all-for-claudecode 2.3.0 → 2.5.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 (36) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/README.md +41 -1
  4. package/agents/afc-appsec-expert.md +132 -0
  5. package/agents/afc-backend-expert.md +107 -0
  6. package/agents/afc-design-expert.md +109 -0
  7. package/agents/afc-impl-worker.md +2 -0
  8. package/agents/afc-infra-expert.md +109 -0
  9. package/agents/afc-legal-expert.md +127 -0
  10. package/agents/afc-marketing-expert.md +109 -0
  11. package/agents/afc-pm-expert.md +108 -0
  12. package/agents/afc-pr-analyst.md +57 -0
  13. package/agents/afc-security.md +5 -0
  14. package/agents/afc-tech-advisor.md +159 -0
  15. package/commands/auto.md +2 -1
  16. package/commands/consult.md +160 -0
  17. package/commands/implement.md +19 -11
  18. package/commands/init.md +45 -15
  19. package/commands/pr-comment.md +181 -0
  20. package/commands/release-notes.md +219 -0
  21. package/commands/triage.md +222 -0
  22. package/docs/domain-adapters/ecommerce.md +47 -0
  23. package/docs/domain-adapters/fintech.md +45 -0
  24. package/docs/domain-adapters/healthcare.md +57 -0
  25. package/docs/expert-protocol.md +148 -0
  26. package/hooks/hooks.json +10 -0
  27. package/package.json +2 -2
  28. package/scripts/afc-blast-radius.sh +41 -119
  29. package/scripts/afc-consistency-check.sh +1 -1
  30. package/scripts/afc-pipeline-manage.sh +1 -0
  31. package/scripts/afc-spec-guard.sh +78 -0
  32. package/scripts/afc-state.sh +23 -1
  33. package/scripts/afc-subagent-context.sh +1 -1
  34. package/scripts/afc-triage.sh +131 -0
  35. package/scripts/afc-user-prompt-submit.sh +35 -4
  36. package/templates/project-profile.template.md +43 -0
@@ -0,0 +1,160 @@
1
+ ---
2
+ name: afc:consult
3
+ description: "Expert consultation — get advice from backend, infra, PM, design, marketing, legal, security, or tech advisor specialists"
4
+ argument-hint: "[domain?] \"[question]\" [brief|deep]"
5
+ model: sonnet
6
+ ---
7
+
8
+ # /afc:consult — Expert Consultation
9
+
10
+ > Consult a domain expert for advice tailored to your project.
11
+ > Each expert has persistent memory — they remember your project's decisions across sessions.
12
+ > Pipeline-independent: works anytime, no active pipeline required.
13
+
14
+ ## Arguments
15
+
16
+ - `$ARGUMENTS` — (optional) Format: `[domain] "[question]" [brief|deep]`
17
+ - `domain` — one of: `backend`, `infra`, `pm`, `design`, `marketing`, `legal`, `security`, `advisor` (optional, auto-detected if omitted)
18
+ - `question` — the consultation question (optional, enters exploratory mode if omitted)
19
+ - `brief|deep` — depth hint (optional, default: `auto`)
20
+
21
+ ## Execution Steps
22
+
23
+ ### 1. Parse Arguments
24
+
25
+ Extract from `$ARGUMENTS`:
26
+ - **domain**: first word if it matches a known domain name
27
+ - **question**: remaining text after domain (if any), with quotes stripped
28
+ - **depth**: last word if it matches `brief` or `deep`
29
+
30
+ If `$ARGUMENTS` is empty → go to Step 2 (domain selection).
31
+
32
+ ### 2. Domain Detection
33
+
34
+ **A. Explicit domain provided** → use it directly.
35
+
36
+ **B. No domain, but question provided** → keyword matching:
37
+
38
+ | Domain | Keywords |
39
+ |--------|----------|
40
+ | backend | API, database, schema, query, server, auth, JWT, REST, GraphQL, ORM, migration, endpoint, middleware, validation, session, cookie, token |
41
+ | infra | deploy, Docker, CI/CD, cloud, monitoring, k8s, pipeline, Kubernetes, terraform, AWS, GCP, Azure, nginx, SSL, DNS, CDN, container, scaling |
42
+ | pm | feature, user story, priority, roadmap, PRD, MVP, backlog, metric, KPI, retention, churn, persona, requirement, scope |
43
+ | design | UI, UX, accessibility, component, layout, color, animation, responsive, wireframe, prototype, typography, spacing, contrast, WCAG |
44
+ | marketing | SEO, analytics, content, growth, conversion, funnel, GA4, acquisition, retention, landing page, Open Graph, meta tag, social media |
45
+ | legal | GDPR, CCPA, privacy, cookie, consent, license, GPL, MIT, compliance, terms of service, data protection, PII, HIPAA, regulation, policy |
46
+ | security | XSS, CSRF, injection, OWASP, vulnerability, attack, exploit, encryption, secret, credential, CORS, CSP, rate limit, brute force, penetration |
47
+ | advisor | library, framework, stack, tool, package, which to use, alternative, compare, choose, select, recommend, what exists, ecosystem, best option, switch to |
48
+
49
+ Match rules:
50
+ - Case-insensitive keyword matching against the question
51
+ - If multiple domains match: pick the one with the most keyword hits
52
+ - If tie: pick the first domain in the table order above
53
+
54
+ **C. No domain, no question, or no keyword match** → ask user:
55
+
56
+ Use AskUserQuestion:
57
+ ```
58
+ "Which expert would you like to consult?"
59
+ Options:
60
+ 1. Backend — API design, database, authentication, server architecture
61
+ 2. Infra — deployment, CI/CD, cloud, monitoring, scaling
62
+ 3. PM — product strategy, prioritization, user stories, metrics
63
+ 4. Design — UI/UX, accessibility, components, user flows
64
+ 5. Marketing — SEO, analytics, growth, content strategy
65
+ 6. Legal — GDPR, privacy, licenses, compliance, terms of service
66
+ 7. Security — application security, OWASP, threat modeling, secure coding
67
+ 8. Advisor — technology/library/framework selection, ecosystem navigation, stack decisions
68
+ ```
69
+
70
+ ### 3. Construct Expert Prompt
71
+
72
+ Build the prompt for the expert agent:
73
+
74
+ ```
75
+ You are being consulted via /afc:consult.
76
+
77
+ ## Question
78
+ {question or "No specific question — enter exploratory diagnostic mode. Ask the user probing questions to uncover what they need help with."}
79
+
80
+ ## Depth
81
+ {brief|deep|auto}
82
+
83
+ ## Instructions
84
+ 1. Follow your Session Start Protocol (read project profile, domain adapter, memory, pipeline state)
85
+ 2. Follow the Communication Rules from expert-protocol.md
86
+ 3. Provide your consultation following the Progressive Disclosure format
87
+ 4. Update your MEMORY.md with any confirmed decisions or new project insights
88
+ ```
89
+
90
+ ### 4. Delegate to Expert Agent
91
+
92
+ Invoke the expert agent via Task(). Map the detected domain to the corresponding agent:
93
+
94
+ | Domain | subagent_type |
95
+ |--------|---------------|
96
+ | backend | `afc:afc-backend-expert` |
97
+ | infra | `afc:afc-infra-expert` |
98
+ | pm | `afc:afc-pm-expert` |
99
+ | design | `afc:afc-design-expert` |
100
+ | marketing | `afc:afc-marketing-expert` |
101
+ | legal | `afc:afc-legal-expert` |
102
+ | security | `afc:afc-appsec-expert` |
103
+ | advisor | `afc:afc-tech-advisor` |
104
+
105
+ Example for each domain:
106
+ ```
107
+ Task("backend consultation", subagent_type: "afc:afc-backend-expert", prompt: "...")
108
+ Task("infra consultation", subagent_type: "afc:afc-infra-expert", prompt: "...")
109
+ Task("pm consultation", subagent_type: "afc:afc-pm-expert", prompt: "...")
110
+ Task("design consultation", subagent_type: "afc:afc-design-expert", prompt: "...")
111
+ Task("marketing consultation", subagent_type: "afc:afc-marketing-expert", prompt: "...")
112
+ Task("legal consultation", subagent_type: "afc:afc-legal-expert", prompt: "...")
113
+ Task("security consultation", subagent_type: "afc:afc-appsec-expert", prompt: "...")
114
+ Task("advisor consultation", subagent_type: "afc:afc-tech-advisor", prompt: "...")
115
+ ```
116
+
117
+ The agent runs in foreground (never `run_in_background`).
118
+
119
+ ### 5. Relay Response
120
+
121
+ Return the agent's response to the user as-is. Do not summarize or filter the expert's output.
122
+
123
+ ### 6. Follow-up Prompt
124
+
125
+ After relaying the response, suggest:
126
+
127
+ ```
128
+ Follow-up options:
129
+ - Ask a deeper question on this topic
130
+ - Consult another expert: /afc:consult {other-domain}
131
+ - If a recommendation involves code changes: /afc:auto or /afc:implement
132
+ ```
133
+
134
+ ## Examples
135
+
136
+ ```bash
137
+ # Specific domain + question
138
+ /afc:consult backend "Should I use JWT or session cookies for auth?"
139
+
140
+ # Auto-detect domain from question
141
+ /afc:consult "My API is slow when loading the dashboard"
142
+
143
+ # Exploratory mode (Socratic diagnostic)
144
+ /afc:consult backend
145
+
146
+ # With depth hint
147
+ /afc:consult infra "How should I set up CI/CD?" deep
148
+
149
+ # No arguments (domain selection prompt)
150
+ /afc:consult
151
+ ```
152
+
153
+ ## Notes
154
+
155
+ - **Limited write scope**: Expert agents can create/update project profiles and their own memory files, but should not modify your application code.
156
+ - **Persistent memory**: Each expert remembers your project's decisions across sessions (stored in `.claude/agent-memory/afc-{domain}-expert/MEMORY.md`).
157
+ - **Project profile**: Shared context at `.claude/afc/project-profile.md` — auto-created on first consultation, review and adjust as needed.
158
+ - **Domain adapters**: Industry-specific guardrails (fintech, ecommerce, healthcare) auto-loaded based on project profile.
159
+ - **Pipeline-independent**: Works anytime, no active pipeline required. If a pipeline is active, experts consider the current phase context.
160
+ - **Cross-referral**: Experts may suggest consulting another domain expert when a question crosses boundaries.
@@ -59,7 +59,11 @@ This enables Stop Gate and CI Gate hooks during standalone implementation. Relea
59
59
  3. **Recent changes**: run `git log --oneline -20` to understand what changed recently (context for implementation)
60
60
  4. **Smoke test**: run `{config.gate}` before starting implementation:
61
61
  - If it fails → diagnose before implementing (existing code is broken — fix first or report to user)
62
- - If it passes → baseline confirmed, proceed
62
+ - If it passes → continue to baseline test
63
+ 5. **Baseline test** (if `{config.test}` is non-empty): run `{config.test}` before starting implementation:
64
+ - If it fails → report pre-existing test failures to user and ask: "(1) Proceed anyway (tests were already broken) (2) Fix first (3) Abort"
65
+ - If it passes → full baseline confirmed, proceed
66
+ - If `{config.test}` is empty → skip (no test framework configured)
63
67
 
64
68
  ### 1.3. Task List Generation (if tasks.md absent)
65
69
 
@@ -176,11 +180,13 @@ Task("T004: Create AuthService", subagent_type: "afc:afc-impl-worker", isolation
176
180
 
177
181
  **Failure Recovery** (per-task, not per-batch):
178
182
  1. Identify the failed task from the agent's error return
179
- 2. Reset: `TaskUpdate(taskId, status: "pending")`
180
- 3. Track: `TaskUpdate(taskId, metadata: { retryCount: N })`
181
- 4. If retryCount < 3 → re-launch in the next batch round (not immediately wait for current batch to finish)
182
- 5. If retryCount >= 3 → mark as failed, report: `"T{ID} failed after 3 attempts: {last error}"`
183
- 6. Continue with remaining tasks a single failure does not block the entire phase
183
+ 2. Capture the `agentId` from the failed agent's result (returned in Task tool output)
184
+ 3. Reset: `TaskUpdate(taskId, status: "pending")`
185
+ 4. Track: `TaskUpdate(taskId, metadata: { retryCount: N, lastAgentId: agentId })`
186
+ 5. If retryCount < 3 → re-launch with `resume: lastAgentId` in the next batch round. The resumed agent retains full context from the previous attempt (what it tried, what failed, partial progress), enabling more targeted retry instead of starting from scratch.
187
+ - **Worktree caveat**: if the failed worker made no file changes, its worktree is auto-cleaned and `resume` will fail. In this case, fall back to a fresh launch (omit `resume`) for the retry.
188
+ 6. If retryCount >= 3 → mark as failed, report: `"T{ID} failed after 3 attempts: {last error}"`
189
+ 7. Continue with remaining tasks — a single failure does not block the entire phase
184
190
 
185
191
  #### Swarm Mode (6+ [P] tasks)
186
192
 
@@ -243,11 +249,13 @@ Task("Worker 2: T008, T010, T012", subagent_type: "afc:afc-impl-worker", isolati
243
249
  When a worker agent returns an error:
244
250
  1. Identify which tasks the worker was assigned (from the pre-assigned list)
245
251
  2. Check which tasks the worker actually completed (from its result summary)
246
- 3. Reset uncompleted tasks: `TaskUpdate(taskId, status: "pending")`
247
- 4. Track retry count: `TaskUpdate(taskId, metadata: { retryCount: N })`
248
- 5. If retryCount < 3 reassign to next worker batch
249
- 6. If retryCount >= 3 → mark as failed, report: `"T{ID} failed after 3 attempts: {last error}"`
250
- 7. Continue with remaining tasks
252
+ 3. Capture the `agentId` from the failed worker's result
253
+ 4. Reset uncompleted tasks: `TaskUpdate(taskId, status: "pending")`
254
+ 5. Track retry count: `TaskUpdate(taskId, metadata: { retryCount: N, lastAgentId: agentId })`
255
+ 6. If retryCount < 3 → re-launch with `resume: lastAgentId` to preserve context from the previous attempt. The resumed agent retains its full conversation history (files read, changes attempted, errors encountered), enabling targeted retry.
256
+ - **Worktree caveat**: if the failed worker made no file changes, its worktree is auto-cleaned and `resume` will fail. In this case, fall back to a fresh launch (omit `resume`) for the retry.
257
+ 7. If retryCount >= 3 → mark as failed, report: `"T{ID} failed after 3 attempts: {last error}"`
258
+ 8. Continue with remaining tasks
251
259
 
252
260
  > Single task failure does not block the phase. The orchestrator reassigns failed tasks to subsequent batches.
253
261
 
package/commands/init.md CHANGED
@@ -123,6 +123,17 @@ Write sections as natural descriptions — **no YAML code blocks** except for CI
123
123
  For items that cannot be inferred: note `TODO: Adjust for your project` inline.
124
124
  Save to `.claude/afc.config.md`.
125
125
 
126
+ ### 4.5. Generate Project Profile
127
+
128
+ Generate `.claude/afc/project-profile.md` for expert consultation agents:
129
+
130
+ 1. Create `.claude/afc/` directory if it does not exist
131
+ 2. If `.claude/afc/project-profile.md` already exists: skip (do not overwrite)
132
+ 3. If not exists: generate from the detected project information using `${CLAUDE_PLUGIN_ROOT}/templates/project-profile.template.md` as the structure
133
+ - Fill in Stack, Architecture, and Domain fields from the analysis in Step 3
134
+ - Leave Team, Scale, and Constraints as template placeholders for user to fill
135
+ 4. Print: `Project profile: .claude/afc/project-profile.md (review and adjust team/scale/domain fields)`
136
+
126
137
  ### 5. Scan Global CLAUDE.md and Detect Conflicts
127
138
 
128
139
  Read `~/.claude/CLAUDE.md` and analyze in the following order.
@@ -213,21 +224,30 @@ IMPORTANT: For requests matching the afc skill routing table below, always invok
213
224
 
214
225
  ## Skill Routing
215
226
 
216
- | Intent | Skill | Trigger Keywords |
217
- |--------|-------|-----------------|
218
- | Implement/Modify | `afc:implement` | add, modify, refactor, implement |
219
- | Review | `afc:review` | review, check code, check PR |
220
- | Debug | `afc:debug` | bug, error, broken, fix |
221
- | Test | `afc:test` | test, coverage |
222
- | Design | `afc:plan` | design, plan, how to implement |
223
- | Validate | `afc:validate` | consistency, validate, validate artifacts |
224
- | Analyze | `afc:analyze` | analyze, explore, investigate code, root cause |
225
- | Spec | `afc:spec` | spec, specification |
226
- | Tasks | `afc:tasks` | break down tasks, decompose |
227
- | Research | `afc:research` | research, investigate |
228
- | Ideate | `afc:ideate` | idea, brainstorm, what to build, product brief |
229
- | Ambiguous | `afc:clarify` | auto-triggered when requirements are unclear |
230
- | Full auto | `afc:auto` | do it automatically, auto-run |
227
+ Classify the user's intent and route to the matching skill. Use semantic understanding — not keyword matching.
228
+
229
+ | User Intent | Skill | Route When |
230
+ |-------------|-------|------------|
231
+ | Full lifecycle | `afc:auto` | User wants end-to-end feature development, or the request is a non-trivial new feature without an existing plan |
232
+ | Specification | `afc:spec` | User wants to define or write requirements, acceptance criteria, or success conditions |
233
+ | Design/Plan | `afc:plan` | User wants to plan HOW to implement before coding — approach, architecture decisions, design |
234
+ | Implement | `afc:implement` | User wants specific code changes with a clear scope: add feature, refactor, modify. Requires existing plan or precise instructions |
235
+ | Review | `afc:review` | User wants code review, PR review, or quality check on existing/changed code |
236
+ | Debug/Fix | `afc:debug` | User reports a bug, error, or broken behavior and wants diagnosis and fix |
237
+ | Test | `afc:test` | User wants to write tests, improve coverage, or verify behavior |
238
+ | Validate | `afc:validate` | User wants to check consistency or validate existing pipeline artifacts |
239
+ | Analyze | `afc:analyze` | User wants to understand, explore, or audit existing code without modifying it |
240
+ | Research | `afc:research` | User wants deep investigation of external tools, libraries, APIs, or technical concepts |
241
+ | Ideate | `afc:ideate` | User wants to brainstorm ideas, explore possibilities, or draft a product brief |
242
+ | Consult | `afc:consult` | User wants expert advice on a decision: library choice, architecture direction, legal/security/infra guidance |
243
+ | Tasks | `afc:tasks` | User explicitly wants to decompose work into a task breakdown |
244
+ | Ambiguous | `afc:clarify` | User's request is too vague or underspecified to route confidently |
245
+
246
+ ### Routing Rules
247
+
248
+ 1. **Auto vs Implement**: A new feature request without an existing plan routes to `afc:auto`. Only use `afc:implement` when the user has a clear, scoped task or an existing plan/spec.
249
+ 2. **Compound intents**: Route to the primary intent. The pipeline handles sequencing internally.
250
+ 3. **Design-first**: When scope is non-trivial (multiple files, architectural decisions needed), prefer `afc:auto` or `afc:plan` over direct `afc:implement`.
231
251
 
232
252
  User-only (not auto-triggered — inform user on request):
233
253
  - `afc:launch` — inform user when release artifact generation is requested
@@ -237,6 +257,9 @@ User-only (not auto-triggered — inform user on request):
237
257
  - `afc:checkpoint` — inform user when session save is requested
238
258
  - `afc:resume` — inform user when session restore is requested
239
259
  - `afc:principles` — inform user when project principles management is requested
260
+ - `afc:triage` — inform user when parallel PR/issue triage is requested
261
+ - `afc:pr-comment` — inform user when posting PR review comments to GitHub is requested
262
+ - `afc:release-notes` — inform user when generating release notes from git history is requested
240
263
 
241
264
  ## Pipeline
242
265
 
@@ -245,6 +268,13 @@ spec → plan → implement → review → clean
245
268
  ## Override Rules
246
269
 
247
270
  NEVER use executor, deep-executor, debugger, planner, analyst, verifier, test-engineer, code-reviewer, quality-reviewer, style-reviewer, api-reviewer, security-reviewer, performance-reviewer for tasks that an afc skill covers above. ALWAYS invoke the afc skill instead.
271
+
272
+ ## Source Verification
273
+
274
+ When analyzing or making claims about external systems, APIs, SDKs, or third-party tools:
275
+ - Verify against official documentation, NOT project-internal docs
276
+ - Do not hardcode reference data when delegating to sub-agents — instruct them to look up primary sources
277
+ - Cross-verify high-severity findings before reporting
248
278
  </afc-pipeline>
249
279
  <!-- AFC:END -->
250
280
  ```
@@ -0,0 +1,181 @@
1
+ ---
2
+ name: afc:pr-comment
3
+ description: "Post PR review comments to GitHub"
4
+ argument-hint: "<PR number> [--severity critical,warning,info]"
5
+ allowed-tools:
6
+ - Read
7
+ - Bash
8
+ - Glob
9
+ - Grep
10
+ - Task
11
+ model: sonnet
12
+ ---
13
+
14
+ # /afc:pr-comment — Post PR Review to GitHub
15
+
16
+ > Analyzes a PR and posts a structured review comment to GitHub.
17
+ > Reuses existing triage reports when available. Asks for user confirmation before posting.
18
+
19
+ ## Arguments
20
+
21
+ - `$ARGUMENTS` — PR number (required), with optional severity filter
22
+ - `42` — Analyze and post review for PR #42
23
+ - `42 --severity critical,warning` — Only include Critical and Warning findings
24
+ - `42 --severity critical` — Only include Critical findings
25
+
26
+ Parse the arguments:
27
+ 1. Extract the PR number (first numeric argument)
28
+ 2. Extract `--severity` filter if present (comma-separated list of: `critical`, `warning`, `info`)
29
+ 3. If no PR number is found, ask the user: "Which PR number should I review?"
30
+
31
+ ## Execution Steps
32
+
33
+ ### 1. Collect PR Information
34
+
35
+ ```bash
36
+ gh pr view {number} --json number,title,headRefName,author,body,additions,deletions,changedFiles,labels,reviewDecision,state
37
+ ```
38
+
39
+ ```bash
40
+ gh pr diff {number}
41
+ ```
42
+
43
+ Verify the PR exists and is open. If closed/merged, inform the user and ask whether to proceed anyway.
44
+
45
+ ### 2. Check for Existing Triage Report
46
+
47
+ Look for a recent triage report that covers this PR:
48
+
49
+ ```bash
50
+ ls -t .claude/afc/memory/triage/*.md 2>/dev/null | head -5
51
+ ```
52
+
53
+ If a report exists from today, search it for `PR #{number}` analysis. If found, reuse that analysis as the basis for the review instead of re-analyzing from scratch.
54
+
55
+ ### 3. Analyze PR (if no triage data available)
56
+
57
+ If no existing triage report covers this PR, perform a focused review of the diff.
58
+
59
+ Examine the diff from the following perspectives (abbreviated from review.md):
60
+
61
+ #### A. Code Quality
62
+ - Style compliance, naming conventions, unnecessary complexity
63
+
64
+ #### B. Architecture
65
+ - Layer violations, boundary crossings, structural concerns
66
+
67
+ #### C. Security
68
+ - XSS, injection, sensitive data exposure, auth issues
69
+
70
+ #### D. Performance
71
+ - Latency concerns, unnecessary computation, resource leaks
72
+
73
+ #### E. Maintainability
74
+ - Function/file size, naming clarity, readability
75
+
76
+ Classify each finding with a severity:
77
+ - **Critical (C)** — Must fix before merge. Bugs, security vulnerabilities, data loss risks.
78
+ - **Warning (W)** — Should fix. Code quality issues, potential problems, maintainability concerns.
79
+ - **Info (I)** — Nice to have. Suggestions, minor improvements, style preferences.
80
+
81
+ ### 4. Apply Severity Filter
82
+
83
+ If `--severity` was specified, filter findings to only include the specified severity levels.
84
+
85
+ Default (no filter): include all severity levels.
86
+
87
+ ### 5. Generate Review Comment
88
+
89
+ Compose the review comment in this format:
90
+
91
+ ```markdown
92
+ ## AFC Code Review — PR #{number}
93
+
94
+ ### Summary
95
+
96
+ | Severity | Count |
97
+ |----------|-------|
98
+ | Critical | {N} |
99
+ | Warning | {N} |
100
+ | Info | {N} |
101
+
102
+ ### Findings
103
+
104
+ #### C-{N}: {title}
105
+ - **File**: `{path}:{line}`
106
+ - **Issue**: {description}
107
+ - **Suggested fix**: {suggestion}
108
+
109
+ #### W-{N}: {title}
110
+ {same format}
111
+
112
+ #### I-{N}: {title}
113
+ {same format}
114
+
115
+ ### Positives
116
+ - {1-2 things done well}
117
+
118
+ ---
119
+ *Reviewed by [all-for-claudecode](https://github.com/anthropics/claude-code)*
120
+ ```
121
+
122
+ If there are zero findings after filtering, the comment should be:
123
+
124
+ ```markdown
125
+ ## AFC Code Review — PR #{number}
126
+
127
+ No issues found. Code looks good!
128
+
129
+ ---
130
+ *Reviewed by [all-for-claudecode](https://github.com/anthropics/claude-code)*
131
+ ```
132
+
133
+ ### 6. Preview and Confirm
134
+
135
+ Display the full review comment to the user in the console.
136
+
137
+ Then determine the review event type:
138
+ - **Critical findings exist** → `REQUEST_CHANGES`
139
+ - **Only Warning/Info findings** → `COMMENT`
140
+ - **No findings** → `APPROVE`
141
+
142
+ Tell the user:
143
+ ```
144
+ Review event: {APPROVE|COMMENT|REQUEST_CHANGES}
145
+ Findings: Critical {N} / Warning {N} / Info {N}
146
+ ```
147
+
148
+ Ask the user to confirm using AskUserQuestion with these options:
149
+ 1. **Post as-is** — Post the review comment to GitHub
150
+ 2. **Edit first** — Let me modify the comment before posting (user provides edits, then re-confirm)
151
+ 3. **Cancel** — Do not post anything
152
+
153
+ ### 7. Post to GitHub
154
+
155
+ On approval, write the review comment to a temp file and post via `--body-file` (avoids shell escaping issues with markdown):
156
+
157
+ ```bash
158
+ tmp_file=$(mktemp)
159
+ cat > "$tmp_file" << 'REVIEW_EOF'
160
+ {review comment content}
161
+ REVIEW_EOF
162
+ gh pr review {number} --body-file "$tmp_file" --event {COMMENT|REQUEST_CHANGES|APPROVE}
163
+ rm -f "$tmp_file"
164
+ ```
165
+
166
+ ### 8. Final Output
167
+
168
+ ```
169
+ PR review posted
170
+ ├─ PR: #{number} ({title})
171
+ ├─ Event: {APPROVE|COMMENT|REQUEST_CHANGES}
172
+ ├─ Findings: Critical {N} / Warning {N} / Info {N}
173
+ └─ URL: {PR URL from gh pr view}
174
+ ```
175
+
176
+ ## Notes
177
+
178
+ - **User confirmation required**: Never post to GitHub without explicit user approval.
179
+ - **Idempotent**: Running multiple times on the same PR creates additional review comments (GitHub does not deduplicate).
180
+ - **Respects existing reviews**: This command does not dismiss or override other reviewers' reviews.
181
+ - **Rate limits**: Uses a single `gh pr review` call. No rate limit concerns for normal usage.