Skip to content

ericrisco/rsc-harness / skills/angular

angular

Verified

Use when building, refactoring, or debugging Angular (v20/21+): standalone components, signals, zoneless change detection, @if/@for/@defer control flow, inject() DI, resource()/httpResource(), RxJS interop, NgRx SignalStore, ng CLI. NOT React (that is react), NOT Next.js (that is nextjs), NOT a TypeScript language question (that is typescript).

FileKindSize
SKILL.mdskill md13.5 KB
evals/README.mdmarkdown72 B
evals/cases.yamlconfig2.0 KB
references/migration.mdmarkdown4.0 KB
references/signals-rxjs.mdmarkdown4.0 KB
scripts/verify.shexecutablescript4.2 KB

scripts/verify.sh

View on GitHub
#!/usr/bin/env bash
#
# verify.sh — Angular modern-baseline copy-banlist (heuristic lint, NOT a compiler).
#
# USAGE
#   bash scripts/verify.sh [PATH ...]
#   Run from your Angular project root. With no args it scans ./src (falling back
#   to the current dir). Pass explicit paths to scope it to just-edited files:
#     bash scripts/verify.sh src/app/users
#
# WHAT IT DOES
#   Greps Angular .ts/.html sources for legacy patterns this skill bans, so the
#   agent can self-correct toward standalone + signals + built-in control flow:
#     - @NgModule in new code
#     - legacy structural directives  *ngIf / *ngFor / *ngSwitch
#     - decorator I/O  @Input() / @Output()
#     - @for blocks missing a `track` expression
#     - constructor-based DI (constructor(private x: X)) where inject() is the rule
#   Each hit prints file:line. It is a best-effort heuristic, not a parser, so it
#   may have false positives/negatives — treat it as a hint.
#
# GUARANTEES
#   - Read-only: never writes, fixes, installs, or hits the network.
#   - Exits 0 on an empty/clean target (no sources, or no hits) — no false failure.
#   - Exits 1 only when at least one banned pattern is found, so it can gate a loop.
#   - Portable to stock macOS bash 3.2 (no mapfile, no associative arrays).

set -u

if [ -t 1 ] && command -v tput >/dev/null 2>&1; then
  RED="$(tput setaf 1)"; GREEN="$(tput setaf 2)"; YELLOW="$(tput setaf 3)"; RESET="$(tput sgr0)"
else
  RED=""; GREEN=""; YELLOW=""; RESET=""
fi

hits=0
ok() { printf '%s\n' "${GREEN}ok${RESET}  $1"; }

# --- resolve scan roots -----------------------------------------------------
roots=""
if [ "$#" -gt 0 ]; then
  roots="$*"
elif [ -d ./src ]; then
  roots="./src"
else
  roots="."
fi

# Collect candidate Angular source files (.ts/.html), skipping vendor/build dirs
# and *.spec.ts / *.d.ts. Newline-delimited list; empty if nothing matches.
files="$(
  find $roots \
    \( -name node_modules -o -name dist -o -name .angular -o -name .git -o -name coverage \) -prune -o \
    -type f \( -name '*.ts' -o -name '*.html' \) \
    ! -name '*.spec.ts' ! -name '*.d.ts' -print 2>/dev/null
)"

if [ -z "$files" ]; then
  printf '%s\n' "${YELLOW}skip${RESET} no Angular .ts/.html sources under: $roots"
  exit 0
fi

# Grep a pattern across all files, reporting each match as "file:line: text".
# $1 = ERE pattern, $2 = human label. Counts hits into the global $hits.
scan() {
  pattern="$1"; label="$2"
  out="$(printf '%s\n' "$files" | while IFS= read -r f; do
    [ -n "$f" ] || continue
    grep -nE "$pattern" "$f" 2>/dev/null | sed "s|^|$f:|"
  done)"
  if [ -n "$out" ]; then
    printf '%s\n' "$out" | while IFS= read -r m; do
      [ -n "$m" ] && printf '%s\n' "${RED}HIT${RESET} $label  $m"
    done
    n="$(printf '%s\n' "$out" | grep -c . )"
    hits=$((hits + n))
  else
    ok "no $label"
  fi
}

# @for openers that do NOT contain `track` on the same line — track is required.
scan_for_track() {
  out="$(printf '%s\n' "$files" | while IFS= read -r f; do
    [ -n "$f" ] || continue
    grep -nE '@for[[:space:]]*\(' "$f" 2>/dev/null | grep -v 'track' | sed "s|^|$f:|"
  done)"
  if [ -n "$out" ]; then
    printf '%s\n' "$out" | while IFS= read -r m; do
      [ -n "$m" ] && printf '%s\n' "${RED}HIT${RESET} @for without track (track is required)  $m"
    done
    n="$(printf '%s\n' "$out" | grep -c . )"
    hits=$((hits + n))
  else
    ok "no @for without track"
  fi
}

printf '=== Angular banlist (%s files under %s) ===\n' "$(printf '%s\n' "$files" | grep -c .)" "$roots"

# 1. NgModule in new code.
scan '@NgModule' '@NgModule (use standalone components)'

# 2. Legacy structural directives.
scan '\*ng(If|For|Switch)\b' 'legacy *ngIf/*ngFor/*ngSwitch (use @if/@for/@switch)'

# 3. Decorator I/O.
scan '@(Input|Output)\(' '@Input()/@Output() decorator (use input()/output())'

# 4. @for blocks missing the required `track` expression.
scan_for_track

# 5. Constructor-based DI.
scan 'constructor[[:space:]]*\([^)]*(private|public|protected|readonly)[[:space:]]+[A-Za-z_]+[[:space:]]*:' 'constructor DI (use inject())'

printf '\n'
if [ "$hits" -gt 0 ]; then
  printf '%sFAIL%s %d banned-pattern hit(s) — migrate toward standalone + signals.\n' "$RED" "$RESET" "$hits"
  exit 1
fi
printf '%sPASS%s clean — no banned legacy Angular patterns found.\n' "$GREEN" "$RESET"
exit 0
brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).Stars: 319kUpdated Claude CodeCodexVerifiedInstall
brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.Stars: 196kUpdated Claude CodeCodexVerifiedInstall
frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.Stars: 196kUpdated Claude CodeCodexVerifiedInstall
mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).Stars: 196kUpdated Claude CodeCodexVerifiedInstall