all-for-claudecode 2.12.0 → 2.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/.claude-plugin/marketplace.json +24 -5
  2. package/.claude-plugin/plugin.json +15 -4
  3. package/README.md +14 -0
  4. package/agents/afc-appsec-expert.md +19 -26
  5. package/agents/afc-architect.md +9 -2
  6. package/agents/afc-backend-expert.md +16 -4
  7. package/agents/afc-design-expert.md +17 -7
  8. package/agents/afc-impl-worker.md +7 -1
  9. package/agents/afc-infra-expert.md +16 -6
  10. package/agents/afc-legal-expert.md +16 -18
  11. package/agents/afc-marketing-expert.md +15 -5
  12. package/agents/afc-pm-expert.md +16 -5
  13. package/agents/afc-pr-analyst.md +1 -1
  14. package/agents/afc-security.md +7 -2
  15. package/agents/afc-tech-advisor.md +18 -30
  16. package/docs/agent-authoring-guide.md +144 -0
  17. package/docs/context-management-harness.md +293 -0
  18. package/docs/orchestration-modes.md +228 -0
  19. package/docs/skill-authoring-guide.md +153 -0
  20. package/hooks/hooks.json +27 -2
  21. package/package.json +4 -3
  22. package/schemas/hooks.schema.json +1 -1
  23. package/schemas/marketplace.schema.json +6 -1
  24. package/schemas/plugin.schema.json +0 -4
  25. package/scripts/afc-pipeline-manage.sh +1 -0
  26. package/scripts/afc-post-compact.sh +54 -0
  27. package/scripts/afc-spec-guard.sh +7 -7
  28. package/scripts/afc-stop-failure.sh +46 -0
  29. package/scripts/afc-sync-cache.sh +8 -2
  30. package/scripts/afc-tdd-guard.sh +7 -5
  31. package/scripts/afc-user-prompt-submit.sh +43 -1
  32. package/scripts/pre-compact-checkpoint.sh +10 -0
  33. package/scripts/session-start-context.sh +10 -0
  34. package/skills/architect/SKILL.md +1 -9
  35. package/skills/auto/SKILL.md +228 -910
  36. package/skills/auto/skill-advisor.md +306 -0
  37. package/skills/checkpoint/SKILL.md +7 -1
  38. package/skills/clarify/SKILL.md +3 -2
  39. package/skills/consult/SKILL.md +30 -123
  40. package/skills/consult/peer-mode.md +61 -0
  41. package/skills/debug/SKILL.md +3 -21
  42. package/skills/ideate/SKILL.md +1 -77
  43. package/skills/ideate/brief-template.md +73 -0
  44. package/skills/implement/SKILL.md +68 -260
  45. package/skills/init/SKILL.md +79 -129
  46. package/skills/init/reference.md +55 -0
  47. package/skills/issue/SKILL.md +191 -0
  48. package/skills/launch/SKILL.md +5 -0
  49. package/skills/learner/SKILL.md +1 -25
  50. package/skills/learner/suggestion-format.md +49 -0
  51. package/skills/plan/SKILL.md +1 -5
  52. package/skills/pr-comment/SKILL.md +38 -51
  53. package/skills/principles/SKILL.md +3 -7
  54. package/skills/qa/SKILL.md +3 -14
  55. package/skills/release-notes/SKILL.md +6 -5
  56. package/skills/resolve/SKILL.md +162 -0
  57. package/skills/resolve/graphql.md +48 -0
  58. package/skills/resume/SKILL.md +10 -5
  59. package/skills/review/SKILL.md +56 -202
  60. package/skills/review/perspectives.md +118 -0
  61. package/skills/security/SKILL.md +4 -22
  62. package/skills/security/cross-boundary-verification.md +22 -0
  63. package/skills/setup/SKILL.md +40 -87
  64. package/skills/setup/conflict-detection.md +33 -0
  65. package/skills/spec/SKILL.md +6 -9
  66. package/skills/tasks/SKILL.md +47 -70
  67. package/skills/test/SKILL.md +4 -16
  68. package/skills/triage/SKILL.md +38 -85
  69. package/skills/triage/coupling-detection.md +13 -0
  70. package/skills/triage/pr-analysis-prompt.md +46 -0
  71. package/skills/validate/SKILL.md +24 -62
  72. package/skills/validate/validation-categories.md +39 -0
@@ -29,12 +29,12 @@ model: sonnet
29
29
 
30
30
  ## Config Load
31
31
 
32
- **Always** read `.claude/afc.config.md` first (read manually if not auto-loaded above) — needed for CI Commands (YAML).
32
+ **Always** read `.claude/afc.config.md` first — needed for CI Commands (YAML).
33
33
  Architecture, Code Style, and Project Context are auto-loaded via `.claude/rules/afc-project.md`.
34
34
 
35
35
  If config file is missing:
36
- 1. Ask the user: "`.claude/afc.config.md` not found. Run `/afc:init` to set up the project?"
37
- 2. If user accepts → run `/afc:init`, then **restart this command** with the original `$ARGUMENTS`
36
+ 1. Ask: "`.claude/afc.config.md` not found. Run `/afc:init`?"
37
+ 2. If user accepts → run `/afc:init`, then **restart** with original `$ARGUMENTS`
38
38
  3. If user declines → **abort**
39
39
 
40
40
  ## Execution Steps
@@ -43,194 +43,68 @@ If config file is missing:
43
43
 
44
44
  1. **Determine scope**:
45
45
  - `$ARGUMENTS` = file path → that file only
46
- - `$ARGUMENTS` = PR number → run `gh pr diff {number}`
46
+ - `$ARGUMENTS` = PR number → `gh pr diff {number}`
47
47
  - `$ARGUMENTS` = "staged" → `git diff --cached`
48
- - Not specified → `git diff HEAD` (all uncommitted changes)
49
- 2. Extract **list of changed files**
50
- 3. Read **full content** of each changed file (not just the diff full context)
51
- 4. **Load spec context** (if available): Check for `.claude/afc/specs/{feature}/context.md` and `.claude/afc/specs/{feature}/spec.md`. If found, load them for SPEC_ALIGNMENT validation in the Critic Loop. If neither exists, SPEC_ALIGNMENT criterion is skipped with note "no spec artifacts available"
52
-
53
- ### 1.5. Reverse Impact Analysis
54
-
55
- Before reviewing, identify **files affected by the changes** (not just the changed files themselves):
56
-
57
- 1. **For each changed file**, find files that depend on it:
58
- - **LSP (preferred)**: `LSP(findReferences)` on exported symbols — tracks type references, function calls, re-exports
59
- - **Grep (fallback)**: `Grep` for `import.*{filename}`, `require.*{filename}`, `source.*{filename}` patterns across the codebase
60
- - LSP and Grep are complementary — use both when LSP is available (LSP catches type-level references Grep misses; Grep catches dynamic patterns LSP misses)
61
-
62
- 2. **Build impact map**:
63
- ```
64
- Impact Map:
65
- ├─ src/auth/login.ts (changed)
66
- │ └─ affected: src/pages/LoginPage.tsx, src/middleware/auth.ts
67
- ├─ scripts/afc-state.sh (changed)
68
- │ └─ affected: scripts/afc-stop-gate.sh, scripts/afc-drift.sh (grep: source.*afc-state)
69
- └─ Total: {N} changed files → {M} affected files
70
- ```
71
-
72
- 3. **Scope decision**:
73
- - Affected files are NOT full review targets (that would explode scope)
74
- - Instead, include them as **cross-reference context** in Step 2 and Step 3.5
75
- - Flag affected files for closer inspection when they have significant coupling to the changed code — consider the nature of the references (type-only imports vs behavioral calls), the criticality of the affected file, and whether the references involve the specific symbols that changed.
76
-
77
- 4. **Limitations** (include in review output):
78
- > ⚠ Dynamic dependencies not covered: runtime dispatch (`obj[method]()`), reflection, cross-language calls, config/env-driven branching. Manual verification recommended for these patterns.
48
+ - Not specified → `git diff HEAD`
49
+ 2. Extract changed file list; read **full content** of each file (not just the diff)
50
+ 3. **Load spec context** (if available): `.claude/afc/specs/{feature}/context.md` and `spec.md`. If neither exists, skip SPEC_ALIGNMENT with note "no spec artifacts available"
51
+ 4. **Build Impact Map** see [Reverse Impact Analysis](perspectives.md#reverse-impact-analysis)
79
52
 
80
53
  ### 2. Parallel Review (scaled by file count)
81
54
 
82
- Assess review complexity holistically — consider total diff size (lines changed), file complexity, diversity of change types, and whether changes are localized to one module or cross-cutting across multiple boundaries.
55
+ Assess complexity holistically: total diff size, file complexity, change diversity, and whether changes are localized or cross-cutting.
83
56
 
84
- **Pre-scan: Call Chain Context** (for Parallel Batch and Review Swarm modes only):
57
+ **Pre-scan for parallel batch / swarm**: Before distributing files, collect cross-boundary context — outbound calls between changed files with function signature + 1-line side-effect summary. Include Impact Map. Provide each agent a `## Cross-File Context` block. Skip pre-scan for Direct mode.
85
58
 
86
- Before distributing files to review agents, collect cross-boundary context:
59
+ | Mode | When to use | How |
60
+ |------|-------------|-----|
61
+ | **Direct** | Small diff, single module, fits in context | Review all files in current context |
62
+ | **Parallel batch** | Multiple files/modules, substantial diff | 2–3 files per agent, single message |
63
+ | **Swarm** | Large-scale, cross-cutting, mixed types | Pre-assigned workers (≤5), single message |
87
64
 
88
- 1. For each changed file, identify **outbound calls** to other changed files (imports + function calls)
89
- 2. For each outbound call target, extract: function signature + 1-line side-effect summary (e.g., "mutates playlist state", "triggers async cascade")
90
- 3. Include the **Impact Map** from Step 1.5 — each agent receives the list of affected (non-changed) files that depend on its assigned files
91
- 4. Include this context in each review agent's prompt:
92
- ```
93
- ## Cross-File Context
94
- This file calls:
95
- - `deleteVideo()` in api/videos.ts → internally auto-advances to next video if current is deleted
96
- - `getNextVideo()` in api/playlist.ts → pops pending keyword queue first, falls back to normal next
97
- Review findings should account for these behaviors.
98
- ```
99
-
100
- For Direct review mode: skip pre-scan — orchestrator already has full context.
101
-
102
- #### Low complexity: Direct review
103
- Appropriate when changes are small in total diff size, confined to a single module or area, and the reviewing model can hold all changed files in context without losing coherence. Review all files directly in the current context (no delegation).
104
-
105
- #### Moderate complexity: Parallel Batch
106
- Appropriate when changes span multiple files or modules, the total diff size is substantial, or different change types (e.g., API, UI, config) benefit from focused review segments. Distribute to parallel review agents (2–3 files per agent) in a **single message**:
107
65
  ```
66
+ // Parallel batch example
108
67
  Task("Review: {file1, file2}", subagent_type: "general-purpose")
109
68
  Task("Review: {file3, file4}", subagent_type: "general-purpose")
110
69
  ```
111
- Read each agent's returned output, then write consolidated review.
112
70
 
113
- #### High complexity: Review Swarm
114
- Appropriate when changes are large-scale, cross-cutting across many modules, involve mixed change types (security-sensitive code, architecture layers, business logic), or individual file groups require deep specialist focus. Create a review task pool and spawn pre-assigned review workers:
71
+ > Note: Unlike implement swarm (prohibits self-claiming due to write conflicts), review workers use orchestrator pre-assignment. This is safe — review is read-only.
115
72
 
116
- > **Note**: Unlike implement swarm (which prohibits self-claiming due to write conflicts), review workers use orchestrator pre-assignment by file group. This is safe because review is read-only — no write race conditions.
117
-
118
- ```
119
- // 1. Group files into batches (2-3 files per worker)
120
- // 2. Spawn N review workers in a single message (N = min(5, file count / 2))
121
- Task("Review Worker 1: src/auth/login.ts, src/auth/session.ts", subagent_type: "general-purpose",
122
- prompt: "Review the following files for quality, security, architecture, performance.
123
- Files: src/auth/login.ts, src/auth/session.ts
124
- Review criteria: {config.code_style}, {config.architecture}, security, performance.
125
- Output findings as: severity (Critical/Warning/Info), file:line, issue, suggested fix.")
126
- Task("Review Worker 2: src/api/routes.ts, src/api/middleware.ts", subagent_type: "general-purpose", ...)
127
- ```
128
73
  Collect all worker outputs, then write consolidated review.
129
74
 
130
75
  ### 2.5. Specialist Agent Delegation (optional, parallel)
131
76
 
132
- When the `afc-architect` and `afc-security` agents are available, delegate perspectives B and C for deeper analysis:
77
+ When `afc-architect` and `afc-security` agents are available, delegate perspectives B and C in a **single message**:
133
78
 
134
79
  ```
135
80
  Task("Architecture Review", subagent_type: "afc:afc-architect",
136
- prompt: "Review changed files for architecture compliance.
137
- Files: {changed file list}
138
- Rules: {config.architecture}
139
- Return findings as: severity, file:line, issue, suggested fix.")
81
+ prompt: "Review changed files for architecture compliance. Files: {list}. Rules: {config.architecture}. Return: severity, file:line, issue, fix.")
140
82
 
141
83
  Task("Security Review", subagent_type: "afc:afc-security",
142
- prompt: "Scan changed files for security vulnerabilities.
143
- Files: {changed file list}
144
- Return findings as: severity, file:line, issue, suggested fix.")
84
+ prompt: "Scan changed files for security vulnerabilities. Files: {list}. Return: severity, file:line, issue, fix.")
145
85
  ```
146
86
 
147
- - Launch both in a **single message** (parallel execution)
148
- - Merge agent findings into the consolidated review (Step 4)
149
- - Agents update their persistent memory automatically (ADR patterns, vulnerability patterns, false positives)
150
- - If agents are unavailable (e.g., standalone mode without plugin): fall back to direct review for B and C
87
+ Merge agent findings into the consolidated review (Step 4). If agents unavailable: fall back to direct review for B and C.
151
88
 
152
89
  ### 3. Perform Review
153
90
 
154
- For each changed file, examine from the following perspectives:
155
-
156
- #### A. Code Quality
157
- - {config.code_style} compliance (any usage, missing types)
158
- - Naming conventions (handleX, isX, UPPER_SNAKE)
159
- - Duplicate code
160
- - Unnecessary complexity
161
-
162
- #### B. {config.architecture} (agent-enhanced when available)
163
- - Layer dependency direction violations (lower→upper imports)
164
- - Segment rules (api/, model/, ui/, lib/)
165
- - Appropriate layer placement
166
- - **Agent bonus**: ADR conflict detection, cross-session pattern recognition
167
-
168
- #### C. Security (agent-enhanced when available)
169
- - XSS vulnerabilities (dangerouslySetInnerHTML, unvalidated user input)
170
- - Sensitive data exposure
171
- - SQL/Command injection
172
- - **Agent bonus**: false positive filtering, known vulnerability pattern matching
173
-
174
- #### D. Performance
175
- - Startup/response latency concerns
176
- - Unnecessary computation or redundant operations
177
- - Resource management (memory, file handles, connections, subprocesses)
178
- - Framework-specific performance patterns (from Project Context)
179
-
180
- #### E. Project Pattern Compliance
181
- - {config.code_style} naming and structure conventions
182
- - {config.architecture} layer rules and boundaries
183
- - Framework-specific idioms and best practices (from Project Context)
184
-
185
- #### F. Reusability
186
- - Duplicate or near-duplicate logic across files
187
- - Opportunities to extract shared utilities or helpers
188
- - DRY principle adherence (same logic repeated in multiple places)
189
- - Appropriate abstraction level (not premature, not missing)
190
-
191
- #### G. Maintainability
192
- - Function/file size — can a developer or LLM understand each unit in isolation?
193
- - Naming clarity — do names reveal intent without requiring surrounding context?
194
- - Self-contained files — minimal cross-file dependencies for comprehension
195
- - Comments where logic is non-obvious (present where needed, absent where redundant)
196
-
197
- #### H. Extensibility
198
- - Can new variants or features be added without modifying existing code?
199
- - Are there clear extension points (configuration, plugin hooks, strategy patterns)?
200
- - Open/Closed principle adherence where applicable
201
- - Future modification cost — would a reasonable feature request require rewriting or only extending?
202
-
203
- ### 3.5. Cross-Boundary Verification (MANDATORY)
204
-
205
- After individual/parallel reviews complete, the **orchestrator** MUST perform a cross-boundary check. This is a required step, not optional — skipping it is a review defect.
206
-
207
- **For High complexity (Review Swarm) reviews**: This is especially critical because individual review agents cannot see cross-file interactions. The orchestrator MUST read callee implementations directly.
91
+ Review each changed file across all 8 perspectives. See [perspectives.md](perspectives.md) for full criteria.
208
92
 
209
- 0. **Impact Map integration**: Use the Impact Map from Step 1.5 to prioritize verification. Affected files with significant coupling to changed symbols (behavioral call references, not just type imports, especially in critical code paths) should be read and checked for breakage — even if no finding was raised against them.
93
+ | Perspective | Focus |
94
+ |-------------|-------|
95
+ | **A. Code Quality** | `{config.code_style}` compliance, naming, duplication, complexity |
96
+ | **B. Architecture** | Layer dependency direction, segment rules, placement (agent-enhanced) |
97
+ | **C. Security** | XSS, sensitive data exposure, injection (agent-enhanced) |
98
+ | **D. Performance** | Latency, redundant computation, resource management |
99
+ | **E. Project Pattern** | `{config.code_style}` + `{config.architecture}` conventions, framework idioms |
100
+ | **F. Reusability** | DRY adherence, extraction opportunities, abstraction level |
101
+ | **G. Maintainability** | Unit comprehensibility, naming clarity, self-contained files |
102
+ | **H. Extensibility** | Extension points, Open/Closed principle, future modification cost |
210
103
 
211
- 1. **Filter**: From all collected findings, select those involving:
212
- - Call order changes (function A now calls B before C)
213
- - Error handling modifications (try/catch scope changes, error propagation changes)
214
- - State mutation changes (new writes to shared state, removed cleanup)
215
-
216
- 2. **Verify**: For each behavioral finding rated Critical or Warning:
217
- - **Read the callee's implementation** (the function/method being called) — this read is mandatory, not optional
218
- - **Skip external dependencies**: If the callee is in `node_modules/`, `vendor/`, or other third-party directories, do NOT read the source (it may be minified/compiled). Instead, verify against the dependency's type definitions or documented API contract. Note: "verified against types/docs, not source"
219
- - Check: does the callee's internal behavior (side effects, state changes, return values) actually conflict with the change?
220
- - If no conflict → downgrade: Critical → Info, Warning → Info (append "verified: no cross-boundary impact")
221
- - If confirmed conflict → keep severity, enrich description with callee behavior details
222
-
223
- 3. **False positive reference** (security-related findings only): For behavioral findings involving security concerns (injection, auth bypass, data exposure), check `afc-security` agent's MEMORY.md (at `.claude/agent-memory/afc-security/MEMORY.md`) `## False Positives` section if the file exists. Known false positive patterns should be noted in findings to avoid recurring false alarms.
224
-
225
- 4. **Output**: Append verification summary before Review Output:
226
- ```
227
- Cross-Boundary Check: {N} behavioral findings verified
228
- ├─ Confirmed: {M} (severity kept)
229
- ├─ Downgraded: {K} (false positive — callee compatible)
230
- └─ Skipped: {J} (no behavioral change)
231
- ```
104
+ ### 3.5. Cross-Boundary Verification (MANDATORY)
232
105
 
233
- This step runs in the orchestrator context (not delegated), as it requires reading code across file boundaries that individual review agents cannot see.
106
+ After reviews complete, the orchestrator MUST verify behavioral findings across file boundaries.
107
+ See [Cross-Boundary Verification](perspectives.md#cross-boundary-verification-mandatory) for the full procedure.
234
108
 
235
109
  ### 4. Review Output
236
110
 
@@ -241,8 +115,8 @@ This step runs in the orchestrator context (not delegated), as it requires readi
241
115
  | Severity | Count | Items |
242
116
  |----------|-------|-------|
243
117
  | Critical | {N} | {summary} |
244
- | Warning | {N} | {summary} |
245
- | Info | {N} | {summary} |
118
+ | Warning | {N} | {summary} |
119
+ | Info | {N} | {summary} |
246
120
 
247
121
  ### Impact Analysis
248
122
  | Changed File | Affected Files | Method |
@@ -258,10 +132,7 @@ This step runs in the orchestrator context (not delegated), as it requires readi
258
132
  - **Issue**: {description}
259
133
  - **Suggested fix**: {code example}
260
134
 
261
- #### W-{N}: {title}
262
- {same format}
263
-
264
- #### I-{N}: {title}
135
+ #### W-{N}: {title} #### I-{N}: {title}
265
136
  {same format}
266
137
 
267
138
  ### Positives
@@ -270,59 +141,42 @@ This step runs in the orchestrator context (not delegated), as it requires readi
270
141
 
271
142
  ### 5. Retrospective Check
272
143
 
273
- If `.claude/afc/memory/retrospectives/` directory exists, load the **most recent 10 files** (sorted by filename descending) and check:
274
- - Were there recurring Critical finding categories in past reviews? Prioritize those perspectives.
275
- - Were there false positives that wasted effort? Reduce sensitivity for those patterns.
144
+ If `.claude/afc/memory/retrospectives/` exists, load the most recent 10 files (sorted descending) and check:
145
+ - Recurring Critical categories from past reviews prioritize those perspectives
146
+ - Past false positives reduce sensitivity for those patterns
276
147
 
277
148
  ### 6. Critic Loop
278
149
 
279
- > **Always** read `${CLAUDE_SKILL_DIR}/../../docs/critic-loop-rules.md` first and follow it.
280
-
281
- Run the critic loop until convergence. Safety cap: 5 passes.
150
+ > **Always** read `docs/critic-loop-rules.md` first and follow it. Safety cap: 5 passes.
282
151
 
283
152
  | Criterion | Validation |
284
153
  |-----------|------------|
285
- | **COMPLETENESS** | Were all changed files reviewed? Are there any missed perspectives (A through H)? |
286
- | **SPEC_ALIGNMENT** | Cross-check implementation against spec.md: (1) every SC (success criterion) is satisfied — provide `{M}/{N} SC verified` count, (2) every acceptance scenario (GWT) has corresponding code path, (3) no spec constraint is violated by the implementation |
287
- | **SIDE_EFFECT_AWARENESS** | For findings involving call order changes, error handling modifications, or state mutation changes: did the reviewer verify the callee's internal behavior? If a Critical finding assumes a side effect without reading the target implementation → auto-downgrade to Info with note "cross-boundary unverified". Provide "{M} of {N} behavioral findings verified" count. |
288
- | **PRECISION** | Are the findings actual issues, not false positives? |
154
+ | **COMPLETENESS** | All changed files reviewed? All perspectives A–H covered? |
155
+ | **SPEC_ALIGNMENT** | Every SC satisfied (`{M}/{N} SC verified`), every GWT scenario has a code path, no spec constraint violated |
156
+ | **SIDE_EFFECT_AWARENESS** | Behavioral findings (call order, error handling, state mutation) verified against callee implementations. Unverified Critical → auto-downgrade to Info with note. Report `{M}/{N} behavioral findings verified` |
157
+ | **PRECISION** | Findings are actual issues, not false positives |
289
158
 
290
- **On FAIL**: auto-fix and continue to next pass.
291
- **On ESCALATE**: pause, present options to user, apply choice, resume.
292
- **On DEFER**: record reason, mark criterion clean, continue.
293
- **On CONVERGE**: `✓ Critic converged ({N} passes, {M} fixes, {E} escalations)`
294
- **On SAFETY CAP**: `⚠ Critic safety cap ({N} passes). Review recommended.`
159
+ **On FAIL**: auto-fix and continue. **On ESCALATE**: pause, present options, resume. **On DEFER**: record, mark clean. **On CONVERGE**: `✓ Critic converged ({N} passes, {M} fixes, {E} escalations)`. **On SAFETY CAP**: `⚠ Critic safety cap ({N} passes). Review recommended.`
295
160
 
296
161
  ### 7. Retrospective Entry (if new pattern found)
297
162
 
298
- If this review reveals a recurring pattern not previously documented in `.claude/afc/memory/retrospectives/`:
163
+ Append to `.claude/afc/memory/retrospectives/{YYYY-MM-DD}.md` only when a pattern is new and actionable:
299
164
 
300
- Append to `.claude/afc/memory/retrospectives/{YYYY-MM-DD}.md`:
301
165
  ```markdown
302
166
  ## Pattern: {category}
303
167
  **What happened**: {concrete description}
304
168
  **Root cause**: {why this keeps occurring}
305
- **Prevention rule**: {actionable rule — usable in future plan/implement phases}
169
+ **Prevention rule**: {actionable rule}
306
170
  **Severity**: Critical | Warning
307
171
  ```
308
172
 
309
- Only write if the pattern is new and actionable. Generic observations are prohibited.
310
-
311
173
  ### 8. Archive Review Report
312
174
 
313
- When running inside a pipeline (.claude/afc/specs/{feature}/ exists), persist the review results:
314
-
315
- 1. Write full review output (Summary table + Detailed Findings + Positives) to `.claude/afc/specs/{feature}/review-report.md`
316
- 2. Include metadata header:
317
- ```markdown
318
- # Review Report: {feature name}
319
- > Date: {YYYY-MM-DD}
320
- > Files reviewed: {count}
321
- > Findings: Critical {N} / Warning {N} / Info {N}
322
- ```
323
- 3. This file survives Clean phase (copied to `.claude/afc/memory/reviews/{feature}-{date}.md` before .claude/afc/specs/ deletion)
175
+ When inside a pipeline (`.claude/afc/specs/{feature}/` exists):
176
+ 1. Write to `.claude/afc/specs/{feature}/review-report.md` with metadata header (date, files reviewed, finding counts)
177
+ 2. This file survives Clean phase (copied to `.claude/afc/memory/reviews/{feature}-{date}.md`)
324
178
 
325
- When running standalone (no active pipeline), skip archiving — display results in console only.
179
+ Standalone run: display results in console only.
326
180
 
327
181
  ### 9. Final Output
328
182
 
@@ -337,7 +191,7 @@ Review complete
337
191
  ## Notes
338
192
 
339
193
  - **Read-only**: do not modify code. Report findings only.
340
- - **Full context**: read the entire file, not just the diff lines, to understand context before reviewing.
194
+ - **Full context**: read the entire file, not just diff lines.
341
195
  - **Avoid false positives**: classify uncertain issues as Info.
342
- - **Respect patterns**: do not flag code simply because it differs from other patterns. Use CLAUDE.md and afc.config.md as the standard.
343
- - **NEVER use `run_in_background: true` on Task calls**: review agents must run in foreground so results are returned before consolidation.
196
+ - **Respect patterns**: flag against `afc.config.md` standards, not personal preference.
197
+ - **NEVER use `run_in_background: true` on Task calls**: review agents must return results before consolidation.
@@ -0,0 +1,118 @@
1
+ # Review Perspectives (A–H)
2
+
3
+ Detailed criteria for each review perspective used by `/afc:review`.
4
+
5
+ ## A. Code Quality
6
+
7
+ - `{config.code_style}` compliance (any usage, missing types)
8
+ - Naming conventions (handleX, isX, UPPER_SNAKE)
9
+ - Duplicate code
10
+ - Unnecessary complexity
11
+
12
+ ## B. Architecture (agent-enhanced when available)
13
+
14
+ - Layer dependency direction violations (lower→upper imports)
15
+ - Segment rules (api/, model/, ui/, lib/)
16
+ - Appropriate layer placement
17
+ - **Agent bonus**: ADR conflict detection, cross-session pattern recognition
18
+
19
+ ## C. Security (agent-enhanced when available)
20
+
21
+ - XSS vulnerabilities (dangerouslySetInnerHTML, unvalidated user input)
22
+ - Sensitive data exposure
23
+ - SQL/Command injection
24
+ - **Agent bonus**: false positive filtering, known vulnerability pattern matching
25
+
26
+ ## D. Performance
27
+
28
+ - Startup/response latency concerns
29
+ - Unnecessary computation or redundant operations
30
+ - Resource management (memory, file handles, connections, subprocesses)
31
+ - Framework-specific performance patterns (from Project Context)
32
+
33
+ ## E. Project Pattern Compliance
34
+
35
+ - `{config.code_style}` naming and structure conventions
36
+ - `{config.architecture}` layer rules and boundaries
37
+ - Framework-specific idioms and best practices (from Project Context)
38
+
39
+ ## F. Reusability
40
+
41
+ - Duplicate or near-duplicate logic across files
42
+ - Opportunities to extract shared utilities or helpers
43
+ - DRY principle adherence (same logic repeated in multiple places)
44
+ - Appropriate abstraction level (not premature, not missing)
45
+
46
+ ## G. Maintainability
47
+
48
+ - Function/file size — can a developer or LLM understand each unit in isolation?
49
+ - Naming clarity — do names reveal intent without requiring surrounding context?
50
+ - Self-contained files — minimal cross-file dependencies for comprehension
51
+ - Comments where logic is non-obvious (present where needed, absent where redundant)
52
+
53
+ ## H. Extensibility
54
+
55
+ - Can new variants or features be added without modifying existing code?
56
+ - Are there clear extension points (configuration, plugin hooks, strategy patterns)?
57
+ - Open/Closed principle adherence where applicable
58
+ - Future modification cost — would a reasonable feature request require rewriting or only extending?
59
+
60
+ ---
61
+
62
+ ## Reverse Impact Analysis
63
+
64
+ Before reviewing, identify **files affected by the changes** (not just the changed files themselves):
65
+
66
+ 1. **For each changed file**, find files that depend on it:
67
+ - **LSP (preferred)**: `LSP(findReferences)` on exported symbols — tracks type references, function calls, re-exports
68
+ - **Grep (fallback)**: `Grep` for `import.*{filename}`, `require.*{filename}`, `source.*{filename}` patterns across the codebase
69
+ - Use both when LSP is available (LSP catches type-level references Grep misses; Grep catches dynamic patterns LSP misses)
70
+
71
+ 2. **Build impact map**:
72
+ ```
73
+ Impact Map:
74
+ ├─ src/auth/login.ts (changed)
75
+ │ └─ affected: src/pages/LoginPage.tsx, src/middleware/auth.ts
76
+ ├─ scripts/afc-state.sh (changed)
77
+ │ └─ affected: scripts/afc-stop-gate.sh, scripts/afc-drift.sh (grep: source.*afc-state)
78
+ └─ Total: {N} changed files → {M} affected files
79
+ ```
80
+
81
+ 3. **Scope decision**: Affected files are NOT full review targets. Include them as cross-reference context during review and Cross-Boundary Verification.
82
+
83
+ 4. **Limitations** (include in review output):
84
+ > ⚠ Dynamic dependencies not covered: runtime dispatch (`obj[method]()`), reflection, cross-language calls, config/env-driven branching. Manual verification recommended for these patterns.
85
+
86
+ ---
87
+
88
+ ## Cross-Boundary Verification (MANDATORY)
89
+
90
+ After individual/parallel reviews complete, the **orchestrator** MUST perform a cross-boundary check. Skipping it is a review defect.
91
+
92
+ **Especially critical for swarm reviews**: individual agents cannot see cross-file interactions.
93
+
94
+ 0. **Impact Map integration**: Use the Impact Map to prioritize verification. Affected files with significant coupling to changed symbols (behavioral call references, not just type imports, especially in critical code paths) should be read and checked for breakage.
95
+
96
+ 1. **Filter**: From all collected findings, select those involving:
97
+ - Call order changes (function A now calls B before C)
98
+ - Error handling modifications (try/catch scope changes, error propagation changes)
99
+ - State mutation changes (new writes to shared state, removed cleanup)
100
+
101
+ 2. **Verify**: For each behavioral finding rated Critical or Warning:
102
+ - **Read the callee's implementation** (mandatory, not optional)
103
+ - **Skip external dependencies**: If callee is in `node_modules/`, `vendor/`, or other third-party directories, verify against type definitions or documented API contract. Note: "verified against types/docs, not source"
104
+ - Check: does the callee's internal behavior (side effects, state changes, return values) conflict with the change?
105
+ - If no conflict → downgrade: Critical → Info, Warning → Info (append "verified: no cross-boundary impact")
106
+ - If confirmed conflict → keep severity, enrich description with callee behavior details
107
+
108
+ 3. **False positive reference** (security findings only): Check `afc-security` agent's MEMORY.md (at `.claude/agent-memory/afc-security/MEMORY.md`) `## False Positives` section if the file exists.
109
+
110
+ 4. **Output**: Append verification summary before Review Output:
111
+ ```
112
+ Cross-Boundary Check: {N} behavioral findings verified
113
+ ├─ Confirmed: {M} (severity kept)
114
+ ├─ Downgraded: {K} (false positive — callee compatible)
115
+ └─ Skipped: {J} (no behavioral change)
116
+ ```
117
+
118
+ This step runs in the orchestrator context (not delegated), as it requires reading code across file boundaries that individual review agents cannot see.
@@ -38,8 +38,9 @@ For dependency audit command: infer from `packageManager` field in `package.json
38
38
  ### 1. Determine Scan Scope
39
39
 
40
40
  - `$ARGUMENTS` = path → that path only
41
- - `$ARGUMENTS` = "full" → entire `src/`
42
- - Not specified → changed files from `git diff --name-only HEAD`
41
+ - `$ARGUMENTS` = "full" → entire codebase
42
+ - Not specified → changed files from:
43
+ !`git diff --name-only HEAD 2>/dev/null || echo "[GIT_DIFF_FAILED]"`
43
44
 
44
45
  ### 2. Agent Teams (when scan complexity warrants it)
45
46
 
@@ -84,26 +85,7 @@ For direct scans (orchestrator only): skip pre-scan — orchestrator has full co
84
85
 
85
86
  ### 2.5. Cross-Boundary Verification
86
87
 
87
- After parallel agent results are collected, the **orchestrator** performs cross-boundary verification on injection/vulnerability findings:
88
-
89
- 1. **Filter**: From all findings, select those involving:
90
- - Injection vulnerabilities (SQL, command, XSS) where input origin is in another agent's scan scope
91
- - Authentication/authorization checks where the guard is in a different directory slice
92
- - Sensitive data exposure where the data source and the exposure point are in different slices
93
-
94
- 2. **Verify**: For each Critical or High finding:
95
- - Read the **upstream code** (where input enters or is sanitized)
96
- - Check: is the input actually sanitized before reaching the flagged consumption point?
97
- - If sanitized → downgrade: Critical → Low, High → Low (append "verified: input sanitized at {location}")
98
- - If NOT sanitized → keep severity, enrich with full data flow path
99
-
100
- 3. **Output**: Append verification summary before Output Results:
101
- ```
102
- Cross-Boundary Check: {N} injection/vulnerability findings verified
103
- ├─ Confirmed: {M} (severity kept — no upstream sanitization)
104
- ├─ Downgraded: {K} (false positive — sanitized upstream)
105
- └─ Skipped: {J} (single-file scope, no cross-boundary flow)
106
- ```
88
+ Read `${CLAUDE_SKILL_DIR}/cross-boundary-verification.md` and apply it after parallel agent results are collected.
107
89
 
108
90
  ### 3. Security Check Items
109
91
 
@@ -0,0 +1,22 @@
1
+ # Cross-Boundary Verification
2
+
3
+ After parallel agent results are collected, the **orchestrator** performs cross-boundary verification on injection/vulnerability findings:
4
+
5
+ 1. **Filter**: From all findings, select those involving:
6
+ - Injection vulnerabilities (SQL, command, XSS) where input origin is in another agent's scan scope
7
+ - Authentication/authorization checks where the guard is in a different directory slice
8
+ - Sensitive data exposure where the data source and the exposure point are in different slices
9
+
10
+ 2. **Verify**: For each Critical or High finding:
11
+ - Read the **upstream code** (where input enters or is sanitized)
12
+ - Check: is the input actually sanitized before reaching the flagged consumption point?
13
+ - If sanitized → downgrade: Critical → Low, High → Low (append "verified: input sanitized at {location}")
14
+ - If NOT sanitized → keep severity, enrich with full data flow path
15
+
16
+ 3. **Output**: Append verification summary before Output Results:
17
+ ```
18
+ Cross-Boundary Check: {N} injection/vulnerability findings verified
19
+ ├─ Confirmed: {M} (severity kept — no upstream sanitization)
20
+ ├─ Downgraded: {K} (false positive — sanitized upstream)
21
+ └─ Skipped: {J} (single-file scope, no cross-boundary flow)
22
+ ```