--- name: angular-cop description: > Pre-merge code review for Angular + TypeScript pull requests. Diffs current branch against a target branch, applies Angular-specific checklists (signals, RxJS, clean architecture, flurryx, TS strict), runs lint + tsc, and emits a tiered report (verbose for juniors, terse for seniors). Auto-loads project AGENTS.md rules. Use when user runs /cop-review, says "pre-merge review", "review before merging", "check my PR against ", or invokes the angular-cop agent. --- # angular-cop Pre-merge review. Compares HEAD vs `origin/`. Angular-aware. Project-aware (reads `AGENTS.md`). Tooling-aware (runs lint + tsc). ## When to Activate - `/cop-review ` slash command - User asks for review before merging a PR - User specifies a target branch and wants a diff review - angular-cop agent is invoked ## Inputs | Arg | Required | Default | Meaning | |---|---|---|---| | `` | yes | โ€” | Target branch (e.g. `main`, `develop`, `release/x`) | | `--level` | no | auto | `junior` (verbose teaching) or `senior` (terse). Auto = senior. | | `--scope` | no | all | Comma list: `signals,rxjs,arch,flurryx,ts,design,ddd,a11y` | | `--no-tools` | no | false | Skip lint + tsc (static review only) | ## Hard Rules 1. **Read-only.** Never patch code. Output report only. 2. **Diff window:** `git merge-base HEAD origin/`..`HEAD`. Never review changes already on target. 3. **Confidence โ‰ฅ 80%.** Skip uncertain findings. Use `โ“ q:` instead of speculative `๐Ÿ”ด bug:`. 4. **Project rules win.** `AGENTS.md` overrides this skill. Re-read on every run; do not cache between sessions. 5. **flurryx ground truth:** load the [[flurryx]] skill before flagging state-management code. Do not invent APIs. 6. **No fluff.** No "great work", no restating what the diff already shows. ## Pipeline ``` 1. Parse args -> target, level, scope 2. git fetch (silent; --quiet) 3. base = git merge-base HEAD / 4. changed = git diff --name-status base..HEAD 5. Load /AGENTS.md (if exists) -> project rules 6. For each changed file: - Skim full file (not just hunk) for context - Apply relevant sub-checklists by extension/role: *.component.ts / *.component.html / *.component.css -> signals.md, rxjs.md, clean-architecture.md, design-system.md, a11y *.facade.ts / *.store.ts -> flurryx.md, clean-architecture.md *.adapter.ts / *.port.ts -> clean-architecture.md *.ts -> typescript-strict.md domain/**/*.ts -> angular-ddd - Apply skill `comment-judge` (REVIEW mode) to every added/changed comment - If --scope includes ddd && domain/ code changed: load [[angular-ddd]] (review-checklist.md) for tactical/strategic DDD checks 7. If !--no-tools: - npm run lint -- --quiet (or eslint --quiet) on changed files - npx tsc --noEmit (full project; abort early on first 50 errors) 8. Aggregate findings -> render via output-format.md ``` ## Severity | Tag | Meaning | Action | |---|---|---| | ๐Ÿ”ด bug | broken behavior, runtime crash, data loss | BLOCK merge | | ๐ŸŸ  sec | security risk (XSS, leaked secret, auth bypass) | BLOCK merge | | ๐ŸŸก risk | works today, fragile tomorrow (leak, race, missing teardown) | Fix before merge | | ๐ŸŸข arch | violates project architecture / layering | Fix before merge | | ๐Ÿ”ต nit | style, naming, micro-optim | Optional | | โ“ q | genuine question | Author decides | Promote to BLOCK if AGENTS.md flags the category as mandatory. ## Sub-pages (read on demand) - [[angular-cop-enforcement]] โ€” BLOCK vs warn severity checklist (load always) - [[angular-cop-enforcement-tooling]] โ€” ESLint flat config + architecture plugins for app repos - [[angular-cop-signals]] โ€” Angular signals, change detection, OnPush, computed, no-method-in-template - [[angular-cop-rxjs]] โ€” RxJS hygiene, takeUntilDestroyed, async pipe, leak patterns - [[angular-cop-clean-architecture]] โ€” facade / use-case / port / adapter / store boundaries - [[angular-cop-flurryx]] โ€” flurryx-specific rules (decorator order, keyed stores, no manual Record updates) - [[angular-cop-typescript-strict]] โ€” no `any`, immutability, narrowing, no `!`, readonly - [[angular-cop-design-system]] โ€” Kourou v0 design-token / color / spacing / typography bypass severity (load for *.html and template-bearing files) - [[angular-ddd]] โ€” DDD tactical patterns (entities, value objects, aggregates, repositories) and strategic design (bounded contexts, ubiquitous language, ACL) for domain-layer code - [[angular-cop-output-format]] โ€” junior vs senior render templates ## AGENTS.md Loading Always: ```bash test -f AGENTS.md && cat AGENTS.md test -f .agent/AGENTS.md && cat .agent/AGENTS.md ``` Parse rule blocks. Where this skill and AGENTS.md disagree, AGENTS.md wins. Cite the AGENTS.md line in the finding: `(AGENTS.md ยง
)`. ## Output Contract Single markdown document, sections in fixed order: 1. **Summary** โ€” target, base SHA, head SHA, files changed, finding counts by severity. 2. **Blockers** (๐Ÿ”ด / ๐ŸŸ  / ๐ŸŸข-when-AGENTS-mandates) โ€” sorted by severity, then file path. 3. **Should-fix** (๐ŸŸก) โ€” same sort. 4. **Optional** (๐Ÿ”ต / โ“) โ€” collapsible. 5. **Tooling** โ€” lint summary, tsc summary, test status if available. 6. **Verdict** โ€” `APPROVE` / `APPROVE-WITH-CHANGES` / `BLOCK`. See [[angular-cop-output-format]] for full templates. ## Boundaries - Does not write code fixes. Suggestions only. - Does not run e2e or unit tests by default (delegate to `e2e-runner` / `tdd-guide`). - Does not approve PRs in GitHub/Azure. Author posts the report manually. - Does not auto-fix lint. Reports counts only. - If no diff (HEAD == base), exit early with "no changes to review".