all-for-claudecode 2.13.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 +12 -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 +38 -0
  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 +51 -76
  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 +75 -158
  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 +38 -87
  64. package/skills/setup/conflict-detection.md +33 -0
  65. package/skills/spec/SKILL.md +1 -5
  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
@@ -12,159 +12,111 @@ model: sonnet
12
12
 
13
13
  # /afc:init — Project Initial Setup
14
14
 
15
- > Creates project-local configuration files for the all-for-claudecode plugin.
16
- > Analyzes the project structure and generates config, rules, and profile.
17
- > This is a **project-local** operation — it only creates files under `.claude/`.
18
- > For global `~/.claude/CLAUDE.md` setup, use `/afc:setup` instead.
15
+ > Creates project-local configuration files (`.claude/afc.config.md`, `.claude/rules/afc-project.md`, `.claude/afc/project-profile.md`).
16
+ > **Project-local only** never touches `~/.claude/CLAUDE.md`. For global routing setup use `/afc:setup`.
19
17
 
20
- ## Important
21
-
22
- This skill is a **prompt-only skill** — there is NO `afc-init.sh` script.
23
- All steps below are instructions for the LLM to execute directly using its allowed tools (Read, Write, Bash, Glob).
24
- Do NOT attempt to run a shell script for this skill.
18
+ ## Project State (auto-loaded)
19
+ !`ls .claude/afc.config.md .claude/rules/afc-project.md .claude/selfish.config.md .claude/.selfish-* 2>/dev/null | head -20 || echo "[no existing afc files]"`
25
20
 
26
21
  ## Arguments
27
22
 
28
- - `$ARGUMENTS` — (optional) Additional context or hints for project analysis
23
+ - `$ARGUMENTS` — (optional) additional context or hints for project analysis
29
24
 
30
25
  ## Execution Steps
31
26
 
32
- ### 1. Legacy Migration Check
33
-
34
- Before anything else, detect and migrate v1.x (selfish-pipeline) artifacts:
35
-
36
- **A. Config file migration**
37
- - If `.claude/selfish.config.md` exists AND `.claude/afc.config.md` does NOT exist:
38
- - Rename: `mv .claude/selfish.config.md .claude/afc.config.md`
39
- - Print: `Migrated: selfish.config.md → afc.config.md`
40
- - If both exist: print warning, keep `afc.config.md`, skip migration
27
+ ### 1. Legacy Migration (v1.x → v2.x)
41
28
 
42
- **B. State file migration**
43
- - Glob `.claude/.selfish-*` — if any found:
44
- - Rename each: `.selfish-{x}` → `.afc-{x}`
45
- - Print: `Migrated: {count} state files (.selfish-* → .afc-*)`
29
+ Detect and migrate `selfish-pipeline` artifacts in one pass:
46
30
 
47
- **C. Artifact directory migration**
48
- - If `.claude/selfish/` exists AND `.claude/afc/` does NOT exist:
49
- - Rename: `mv .claude/selfish .claude/afc`
50
- - Print: `Migrated: .claude/selfish/.claude/afc/`
31
+ - `.claude/selfish.config.md` exists, `afc.config.md` does not → rename to `afc.config.md`
32
+ - `.claude/.selfish-*` files found rename each to `.afc-{x}`
33
+ - `.claude/selfish/` exists, `.claude/afc/` does not → rename to `.claude/afc/`
34
+ - `git tag -l 'selfish/*'`rename known patterns to `afc/` equivalent, delete the rest
51
35
 
52
- **D. Git tag cleanup**
53
- - Check `git tag -l 'selfish/*'`
54
- - If any found:
55
- - Known patterns (`selfish/pre-*`, `selfish/phase-*`): rename to `afc/` equivalent (`git tag afc/... selfish/... && git tag -d selfish/...`)
56
- - All remaining `selfish/*`: delete (`git tag -d`)
57
- - Print: `Migrated: {renamed} renamed, {deleted} deleted`
36
+ Print a single migration summary line. If nothing to migrate, skip silently.
58
37
 
59
38
  ### 2. Check for Existing Config
60
39
 
61
- If `.claude/afc.config.md` already exists:
62
- - Ask user: "Config file already exists. Do you want to overwrite it?"
40
+ If `.claude/afc.config.md` already exists and this is NOT a migration:
41
+ - Ask user: "Config file already exists. Overwrite?"
63
42
  - If declined: **abort**
64
43
 
65
44
  ### 3. Analyze Project Structure
66
45
 
67
- Analyze the project and auto-infer configuration. Use `$ARGUMENTS` as additional context if provided.
68
-
69
- **Step 1. Package Manager / Script Detection**
70
- - Read `package.json` extract CI-related commands from `scripts` field
71
- - Determine package manager from lockfile:
72
-
73
- | Lockfile | Package Manager |
74
- |----------|----------------|
75
- | `pnpm-lock.yaml` | pnpm |
76
- | `yarn.lock` | yarn |
77
- | `bun.lockb` or `bun.lock` | bun |
78
- | `package-lock.json` | npm |
79
-
80
- - If no lockfile: check `packageManager` field in `package.json`
81
- - Non-JS projects: check `pyproject.toml` (Python), `Cargo.toml` (Rust), `go.mod` (Go)
82
-
83
- > These detection rules are starting-point heuristics, not definitive. If a project uses a tool not listed here, the model should still detect it from context (e.g., `bun.lockb` for Bun, `deno.lock` for Deno). Always confirm the detected setup with the user before proceeding.
84
-
85
- **Step 2. Framework Detection**
86
- - Determine from `package.json` dependencies/devDependencies:
87
-
88
- | Dependency | Framework |
89
- |-----------|-----------|
90
- | `next` | Next.js (App Router if `app/` dir exists, else Pages Router) |
91
- | `nuxt` | Nuxt |
92
- | `@sveltejs/kit` | SvelteKit |
93
- | `@remix-run/react` | Remix |
94
- | `astro` | Astro |
95
- | `@angular/core` | Angular |
96
- | `vite` (alone) | Vite SPA |
97
- | `hono` | Hono |
98
- | `fastify` | Fastify |
99
- | `express` | Express |
100
-
101
- - Non-JS: `pyproject.toml` → Django/FastAPI/Flask, `Cargo.toml` → Rust project, `go.mod` → Go project
102
- - Presence of `tsconfig.json` → TypeScript indicator
103
-
104
- > This list covers common frameworks but is not exhaustive. For unlisted frameworks, infer from package.json dependencies, project structure, and configuration files. Present the detection result to the user for confirmation.
105
-
106
- **Step 3. Architecture Detection**
107
- - Analyze directory structure:
108
- - FSD: If the project's src/ directory contains a combination of FSD-characteristic directories (`features/`, `entities/`, `shared/`, `widgets/`, `pages/`, `processes/`, `app/`), assess whether the project follows FSD principles. Variant FSD structures (e.g., using `processes/` instead of `pages/`) should also be detected. Confirm with the user if the detection is uncertain.
109
- - `src/domain/`, `src/application/`, `src/infrastructure/` → Clean Architecture
110
- - `src/modules/` → Modular
111
- - Other → Layered
112
- - `paths` in `tsconfig.json` → extract path alias
113
-
114
- **Step 4. State / Styling / Testing / DB Detection**
115
- - State management: `zustand`, `@reduxjs/toolkit`, `@tanstack/react-query`, `swr`, `pinia`, `jotai`, `recoil`
116
- - Styling: `tailwindcss`, `styled-components`, `@emotion/react`, `sass`, CSS Modules (check for `*.module.css`)
117
- - Testing: `jest`, `vitest`, `playwright`, `@testing-library/*`, `cypress`
118
- - Linter: `.eslintrc*` / `eslint.config.*` / `biome.json` / `biome.jsonc`
119
- - DB/ORM: `prisma` (check `prisma/schema.prisma`), `drizzle-orm`, `typeorm`, `@prisma/client`
120
-
121
- **Step 5. Code Style Detection**
122
- - Check linter config → identify key rules
123
- - `strict` in `tsconfig.json` → strict mode
124
- - Read 2-3 existing code samples to verify naming patterns
46
+ Use `$ARGUMENTS` as additional context. Detection heuristics are in [`reference.md`](./reference.md) — consult it for package manager, framework, architecture, and tool detection tables.
47
+
48
+ 1. Read `package.json` extract CI scripts, detect package manager from lockfile
49
+ 2. Detect framework from `package.json` deps
50
+ 3. Detect architecture from directory structure + `tsconfig.json` paths
51
+ 4. Detect state/styling/testing/linter/DB tools
52
+ 5. Read 2–3 code samples to verify naming patterns
53
+
54
+ > Detection is best-effort. Present results to user for confirmation before writing files.
125
55
 
126
56
  ### 4. Generate Config File
127
57
 
128
- Generate `.claude/afc.config.md` in **free-form markdown** format:
58
+ Write `.claude/afc.config.md` based on template at `${CLAUDE_SKILL_DIR}/../../templates/afc.config.template.md`:
129
59
 
130
- 1. **CI Commands** section: YAML code block with `ci`, `gate`, `test` keys (fixed format, scripts parse these)
131
- 2. **Architecture** section: describe detected architecture style, layers, import rules, path aliases in free-form prose/lists
132
- 3. **Code Style** section: describe detected language, strictness, naming conventions, lint rules in free-form prose/lists
133
- 4. **Project Context** section: describe framework, state management, styling, testing, DB/ORM, risks, and any other relevant project characteristics in free-form prose/lists
60
+ 1. **CI Commands** YAML block with `ci`, `gate`, `test` keys (scripts parse this; format is fixed)
61
+ 2. **Architecture** detected pattern, layers, import rules, path aliases (free-form prose)
62
+ 3. **Code Style** language, strictness, naming, lint rules (free-form prose)
63
+ 4. **Project Context** framework, state, styling, testing, DB, risks (free-form prose)
134
64
 
135
- Reference `${CLAUDE_SKILL_DIR}/../../templates/afc.config.template.md` for the section structure.
136
- Write sections as natural descriptions — **no YAML code blocks** except for CI Commands.
137
- For items that cannot be inferred: note `TODO: Adjust for your project` inline.
138
- Save to `.claude/afc.config.md`.
65
+ No YAML blocks except CI Commands. Use `TODO: Adjust for your project` for unresolved items.
139
66
 
140
67
  ### 4.5. Generate Project Rules File
141
68
 
142
- Generate `.claude/rules/afc-project.md` a concise summary of project rules that Claude Code auto-loads for all conversations and sub-agents.
143
-
144
- 1. Create `.claude/rules/` directory if it does not exist
145
- 2. If `.claude/rules/afc-project.md` already exists:
146
- - If it contains `<!-- afc:auto-generated` marker: overwrite silently (auto-generated file, safe to regenerate)
147
- - If it does NOT contain the marker: ask user "Project rules file exists (user-managed). Overwrite with auto-generated version?" — skip if declined
148
- 3. Reference `${CLAUDE_SKILL_DIR}/../../templates/afc-project.template.md` for section structure
149
- 4. Fill in from the analysis performed in Step 3:
150
- - **Architecture**: pattern, key layers, import rules, path alias — concise bullet points
151
- - **Code Style**: language, naming conventions, lint rules — concise bullet points
152
- - **Project Context**: framework, state management, styling, testing, DB/ORM — concise bullet points
153
- 5. Include `<!-- afc:auto-generated — do not edit manually; regenerate with /afc:init -->` as the first line
154
- 6. Keep total length **under 30 lines** (excluding the marker comment) — rules only, no explanations
155
- 7. Save to `.claude/rules/afc-project.md`
156
- 8. Print: `Project rules: .claude/rules/afc-project.md (auto-loaded by Claude Code)`
69
+ Write `.claude/rules/afc-project.md` (auto-loaded by Claude Code for all sub-agents):
70
+
71
+ 1. Create `.claude/rules/` if not present
72
+ 2. If file exists with `<!-- afc:auto-generated` marker → overwrite silently
73
+ 3. If file exists without marker ask user before overwriting
74
+ 4. Use template `${CLAUDE_SKILL_DIR}/../../templates/afc-project.template.md`
75
+ 5. First line: `<!-- afc:auto-generated do not edit manually; regenerate with /afc:init -->`
76
+ 6. Max 30 lines (excluding marker) bullets only, no explanations
157
77
 
158
78
  ### 4.6. Generate Project Profile
159
79
 
160
- Generate `.claude/afc/project-profile.md` for expert consultation agents:
80
+ Write `.claude/afc/project-profile.md` for expert consultation agents:
81
+
82
+ 1. Create `.claude/afc/` if not present
83
+ 2. If file already exists → skip (do not overwrite)
84
+ 3. Fill Stack/Architecture/Domain from Step 3 analysis; leave Team/Scale/Constraints as placeholders
85
+ 4. Use template `${CLAUDE_SKILL_DIR}/../../templates/project-profile.template.md`
86
+
87
+ ### 4.7. Update CLAUDE.md with Compact Instructions
88
+
89
+ Append a `# Compact instructions` section to the project's `CLAUDE.md` (create if not present):
90
+
91
+ 1. Check if `CLAUDE.md` already contains `# Compact instructions` → if yes, skip silently
92
+ 2. Append the following block to `CLAUDE.md`:
93
+
94
+ ```markdown
95
+ # Compact instructions
96
+ When compacting, always preserve:
97
+ - Active pipeline feature name and current phase
98
+ - File Change Map from plan.md (file paths + task assignments)
99
+ - All unresolved ESCALATE items with their options
100
+ - context.md contents (spec summary + plan decisions + advisor results)
101
+ - Changed files list and CI/test pass/fail status
102
+ - Current task progress (completed/total)
103
+ ```
104
+
105
+ This ensures auto-compact retains critical pipeline state.
106
+
107
+ ### 4.8. Recommend Context Window Configuration
108
+
109
+ If the project CLAUDE.md does not already contain auto-compact configuration guidance, append:
110
+
111
+ ```markdown
112
+ # Context window configuration (recommended)
113
+ # Add to .claude/settings.json or .claude/settings.local.json:
114
+ # { "env": { "CLAUDE_CODE_AUTO_COMPACT_WINDOW": "500000" } }
115
+ # This treats the window as 500k for compaction — the remaining 500k is reserve headroom.
116
+ # Combined with the compact instructions above, this gives you full control over when compaction happens.
117
+ ```
161
118
 
162
- 1. Create `.claude/afc/` directory if it does not exist
163
- 2. If `.claude/afc/project-profile.md` already exists: skip (do not overwrite)
164
- 3. If not exists: generate from the detected project information using `${CLAUDE_SKILL_DIR}/../../templates/project-profile.template.md` as the structure
165
- - Fill in Stack, Architecture, and Domain fields from the analysis in Step 3
166
- - Leave Team, Scale, and Constraints as template placeholders for user to fill
167
- 4. Print: `Project profile: .claude/afc/project-profile.md (review and adjust team/scale/domain fields)`
119
+ Note: This is informational only. Do NOT modify settings.json just add as a comment in CLAUDE.md for user awareness.
168
120
 
169
121
  ### 5. Final Output
170
122
 
@@ -173,6 +125,7 @@ all-for-claudecode project init complete
173
125
  ├─ Config: .claude/afc.config.md
174
126
  ├─ Rules: .claude/rules/afc-project.md (auto-loaded)
175
127
  ├─ Profile: .claude/afc/project-profile.md
128
+ ├─ Compact instructions: CLAUDE.md updated
176
129
  ├─ Framework: {detected framework}
177
130
  ├─ Architecture: {detected style}
178
131
  ├─ Package Manager: {detected manager}
@@ -183,8 +136,5 @@ all-for-claudecode project init complete
183
136
 
184
137
  ## Notes
185
138
 
186
- - **Idempotent**: safe to run multiple times. Existing config prompts for overwrite confirmation; auto-generated rules are silently regenerated.
187
- - **Project-local only**: this skill only creates files under `.claude/`. It never touches `~/.claude/CLAUDE.md`. For global routing setup, use `/afc:setup`.
188
- - **Overwrite caution**: If config file already exists, always confirm with user.
189
- - **Inference limits**: Auto-inference is best-effort. User may need to review and adjust.
190
- - **`.claude/` directory**: Created automatically if it does not exist.
139
+ - **Idempotent**: existing auto-generated rules are silently regenerated; config prompts for confirmation.
140
+ - **Inference limits**: Auto-detection is best-effort review and adjust after generation.
@@ -0,0 +1,55 @@
1
+ # /afc:init — Detection Reference
2
+
3
+ ## Package Manager Detection
4
+
5
+ | Lockfile | Package Manager |
6
+ |----------|----------------|
7
+ | `pnpm-lock.yaml` | pnpm |
8
+ | `yarn.lock` | yarn |
9
+ | `bun.lockb` or `bun.lock` | bun |
10
+ | `package-lock.json` | npm |
11
+ | `deno.lock` | deno |
12
+
13
+ Fallback: check `packageManager` field in `package.json`.
14
+ Non-JS: `pyproject.toml` (Python), `Cargo.toml` (Rust), `go.mod` (Go).
15
+
16
+ ## Framework Detection
17
+
18
+ Determine from `package.json` dependencies/devDependencies:
19
+
20
+ | Dependency | Framework |
21
+ |-----------|-----------|
22
+ | `next` | Next.js (App Router if `app/` dir, else Pages Router) |
23
+ | `nuxt` | Nuxt |
24
+ | `@sveltejs/kit` | SvelteKit |
25
+ | `@remix-run/react` | Remix |
26
+ | `astro` | Astro |
27
+ | `@angular/core` | Angular |
28
+ | `vite` (alone) | Vite SPA |
29
+ | `hono` | Hono |
30
+ | `fastify` | Fastify |
31
+ | `express` | Express |
32
+
33
+ Non-JS: `pyproject.toml` → Django/FastAPI/Flask, `Cargo.toml` → Rust, `go.mod` → Go.
34
+ Unlisted: infer from project structure + confirm with user.
35
+
36
+ ## Architecture Detection
37
+
38
+ | Pattern | Signals |
39
+ |---------|---------|
40
+ | FSD | `src/` contains ≥3 of: `features/`, `entities/`, `shared/`, `widgets/`, `pages/`, `app/` |
41
+ | Clean Architecture | `src/domain/`, `src/application/`, `src/infrastructure/` |
42
+ | Modular | `src/modules/` |
43
+ | Layered | Default fallback |
44
+
45
+ Also extract path aliases from `tsconfig.json` `paths`.
46
+
47
+ ## Tool Detection
48
+
49
+ | Tool | Detection Signal |
50
+ |------|-----------------|
51
+ | State: zustand/redux/jotai/recoil/pinia/swr/react-query | `package.json` dep |
52
+ | Styling: tailwindcss/styled-components/@emotion/sass | `package.json` dep; CSS Modules: `*.module.css` |
53
+ | Testing: jest/vitest/playwright/cypress/@testing-library | `package.json` dep |
54
+ | Linter: eslint/biome | `.eslintrc*`, `eslint.config.*`, `biome.json` |
55
+ | DB/ORM: prisma/drizzle-orm/typeorm | `package.json` dep; prisma: check `prisma/schema.prisma` |
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: afc:issue
3
- description: "Analyze GitHub issue and create actionable document — use when the user asks to analyze a GitHub issue, understand an issue, or inspect a specific issue number"
3
+ description: "Analyze GitHub issue and create actionable document — use when the user asks to analyze a GitHub issue, investigate a bug report, understand requirements from an issue, triage incoming requests, or inspect a specific issue number"
4
4
  argument-hint: "<GitHub issue URL, owner/repo#number, #number, or number>"
5
5
  allowed-tools:
6
6
  - Read
@@ -17,6 +17,10 @@ model: sonnet
17
17
  > Analyzes a single GitHub issue (title, body, labels, comments, attached images) and produces a structured analysis document.
18
18
  > Searches the codebase for related files and suggests the appropriate next afc skill (debug, spec, or auto).
19
19
 
20
+ ## Pre-fetch
21
+
22
+ !`gh --version >/dev/null 2>&1 && gh auth status >/dev/null 2>&1 && echo "GH_OK" || echo "GH_UNAVAILABLE"`
23
+
20
24
  ## Arguments
21
25
 
22
26
  - `$ARGUMENTS` — (required) One of:
@@ -28,13 +32,7 @@ model: sonnet
28
32
 
29
33
  ### 1. Prerequisites Check
30
34
 
31
- Verify `gh` CLI is available and authenticated:
32
-
33
- ```bash
34
- gh --version >/dev/null 2>&1 && gh auth status >/dev/null 2>&1
35
- ```
36
-
37
- If either check fails:
35
+ If the pre-fetch returned `GH_UNAVAILABLE`:
38
36
  - Output: `[afc:issue] Error: GitHub CLI (gh) is not installed or not authenticated. Install from https://cli.github.com/ and run 'gh auth login'.`
39
37
  - **Abort immediately.**
40
38
 
@@ -42,17 +40,9 @@ If either check fails:
42
40
 
43
41
  Determine the input format and extract owner, repo, and issue number:
44
42
 
45
- 1. **GitHub URL** (`https://github.com/{owner}/{repo}/issues/{number}`):
46
- - Extract owner, repo, number from URL path segments
47
- - Set `GH_REPO_FLAG="--repo {owner}/{repo}"`
48
-
49
- 2. **Cross-repo** (`{owner}/{repo}#{number}`):
50
- - Split on `#` — left part is `owner/repo`, right part is number
51
- - Set `GH_REPO_FLAG="--repo {owner}/{repo}"`
52
-
53
- 3. **Local number** (`123` or `#123`):
54
- - Strip leading `#` if present
55
- - Set `GH_REPO_FLAG=""` (use current repo from git remote)
43
+ 1. **GitHub URL** (`https://github.com/{owner}/{repo}/issues/{number}`): extract from path, set `GH_REPO_FLAG="--repo {owner}/{repo}"`
44
+ 2. **Cross-repo** (`{owner}/{repo}#{number}`): split on `#`, set `GH_REPO_FLAG="--repo {owner}/{repo}"`
45
+ 3. **Local number** (`123` or `#123`): strip leading `#`, set `GH_REPO_FLAG=""` (use current repo from git remote)
56
46
 
57
47
  ### 3. Collect Issue Data
58
48
 
@@ -60,90 +50,79 @@ Determine the input format and extract owner, repo, and issue number:
60
50
  gh issue view {number} {GH_REPO_FLAG} --json number,title,body,labels,author,comments,createdAt,state,url
61
51
  ```
62
52
 
63
- If the command fails:
64
- - `Issue #{number} not found` → output error and **abort**
65
- - Other errors → output the gh error message and **abort**
53
+ If the command fails → output error and **abort**.
66
54
 
67
- Parse the JSON response and extract:
68
- - `TITLE`, `BODY`, `LABELS`, `AUTHOR`, `COMMENTS`, `CREATED_AT`, `STATE`, `URL`
55
+ Parse and extract: `TITLE`, `BODY`, `LABELS`, `AUTHOR`, `COMMENTS`, `CREATED_AT`, `STATE`, `URL`.
69
56
 
70
57
  ### 4. Analyze Attached Images
71
58
 
72
- Extract image URLs from the issue body:
73
- - Markdown images: `![alt]({url})`
74
- - HTML images: `<img src="{url}">`
75
- - **Skip** images inside code blocks (` ``` ` fences)
76
-
77
- For each extracted image URL:
78
- 1. Attempt to fetch with WebFetch
79
- 2. If successful: analyze the image content (error messages, UI screenshots, console output, stack traces)
80
- 3. If fetch fails: record `[Image unavailable: {url}]`
59
+ Extract image URLs from the issue body (skip images inside code block fences):
60
+ - Markdown: `![alt]({url})`
61
+ - HTML: `<img src="{url}">`
81
62
 
82
- Tag all image analysis results with `[Image Analysis]` to indicate AI interpretation.
63
+ For each URL: fetch with WebFetch, analyze content (error messages, UI screenshots, console output, stack traces), tag results with `[Image Analysis]`. Record failures as `[Image unavailable: {url}]`.
83
64
 
84
- If no images found: note `No attached media found.`
65
+ If no images: note `No attached media found.`
85
66
 
86
67
  ### 5. Analyze Comments
87
68
 
88
- If comments exist:
89
- - If more than 20 comments: analyze only the **most recent 20** and note `"Analyzed 20 of {N} comments (most recent)"`
90
- - Extract additional context from comments: reproduction steps, error logs, workarounds, maintainer responses, related issue/PR references
69
+ If more than 20 comments: analyze only the **most recent 20** and note `"Analyzed 20 of {N} comments (most recent)"`.
70
+
71
+ Extract: reproduction steps, error logs, workarounds, maintainer responses, related issue/PR references.
91
72
 
92
73
  ### 6. Search Codebase
93
74
 
94
- Extract keywords from the issue title, body, and comments:
75
+ Extract keywords from title, body, and comments:
95
76
  - Error messages (quoted strings, stack trace patterns)
96
- - Function/class/module names
97
- - File paths mentioned
98
- - Technical terms specific to the project
77
+ - Function/class/module names, file paths, project-specific technical terms
99
78
 
100
- For each keyword, search the codebase using Grep and Glob:
101
- - Record matching files with line numbers and relevance reason
102
- - If no matches found: note `No related code found in current codebase.`
79
+ Search with Grep and Glob. Record matching files with line numbers and relevance reason. If no matches: `No related code found in current codebase.`
103
80
 
104
81
  ### 7. Classify Issue
105
82
 
106
- Based on the analysis, classify the issue:
83
+ **Type** choose the strongest matching signal:
107
84
 
108
- | Signal | Classification |
109
- |--------|---------------|
110
- | Error messages, stack traces, reproduction steps, "doesn't work", "broken" | **Bug Report** |
85
+ | Signal | Type |
86
+ |--------|------|
87
+ | Error messages, stack traces, "broken", "doesn't work", reproduction steps | **Bug Report** |
111
88
  | "Add", "support", "new feature", "would be nice", "enhancement" | **Feature Request** |
112
89
  | "How to", "is it possible", "what is", "documentation" | **Question** |
113
90
  | "Improve", "refactor", "better", "optimize", existing feature modification | **Enhancement** |
114
91
 
115
- Assess severity:
116
- - **Critical**: Data loss, security vulnerability, crash, blocks usage
117
- - **High**: Major functionality broken, no workaround
118
- - **Medium**: Functionality issue with workaround, or significant UX problem
119
- - **Low**: Minor issue, cosmetic, or nice-to-have improvement
92
+ **Severity** — based on production impact, not code location:
120
93
 
121
- Estimate scope:
122
- - **Small** (1-2 files): Typo, config change, simple bug fix
123
- - **Medium** (3-5 files): Feature addition, moderate refactor
124
- - **Large** (6+ files): Cross-cutting concern, architectural change
94
+ | Level | Criteria |
95
+ |-------|---------|
96
+ | **Critical** | Data loss, security vulnerability, application crash, or complete feature unavailability with no workaround |
97
+ | **High** | Core functionality broken; workaround exists but is painful or undocumented |
98
+ | **Medium** | Non-critical functionality impacted; reasonable workaround available, or significant UX degradation |
99
+ | **Low** | Cosmetic issue, minor UX friction, or improvement with no functional impact |
125
100
 
126
- ### 8. Determine Next Step
101
+ **Estimated Scope:**
127
102
 
128
- Based on classification:
103
+ | Level | Criteria |
104
+ |-------|---------|
105
+ | **Small** | 1–2 files — typo, config change, isolated bug fix |
106
+ | **Medium** | 3–5 files — feature addition, moderate refactor |
107
+ | **Large** | 6+ files — cross-cutting concern, architectural change |
108
+
109
+ ### 8. Determine Next Step
129
110
 
130
111
  | Type | Suggested Next Step |
131
112
  |------|-------------------|
132
113
  | Bug Report | `/afc:debug "{issue title summary}"` |
133
114
  | Feature Request | `/afc:spec "{feature description}"` or `/afc:auto "{feature description}"` |
134
- | Question | `Reply to issue — provide answer or point to documentation` |
115
+ | Question | Reply to issue — provide answer or point to documentation |
135
116
  | Enhancement | `/afc:spec "{enhancement description}"` |
136
- | Insufficient info | `Reply to issue — request: {specific missing information}` |
117
+ | Insufficient info | Reply to issue — request: {specific missing information} |
137
118
 
138
119
  ### 9. Save Analysis Document
139
120
 
140
- Create directory if needed:
141
121
  ```bash
142
122
  mkdir -p .claude/afc/issues
143
123
  ```
144
124
 
145
- Check for existing analysis:
146
- - If `.claude/afc/issues/{number}-*.md` exists → ask user: "Overwrite existing analysis for issue #{number}?"
125
+ If `.claude/afc/issues/{number}-*.md` exists → ask user: "Overwrite existing analysis for issue #{number}?"
147
126
 
148
127
  Generate slug from title: lowercase, replace non-alphanumeric with `-`, truncate to 40 chars.
149
128
 
@@ -160,24 +139,20 @@ Write to `.claude/afc/issues/{number}-{slug}.md`:
160
139
 
161
140
  ## Summary
162
141
 
163
- {2-4 sentence summary of what the issue is about and what it requires.
164
- Not just a restatement of the title — include context from body, comments, and images.}
142
+ {2-4 sentence summary including context from body, comments, and images not just a restatement of the title.}
165
143
 
166
144
  ## Attached Media Analysis
167
145
 
168
146
  {If images exist:}
169
147
  > [Image Analysis] Below is AI interpretation of attached media.
170
148
 
171
- - **Image 1** ({filename or "screenshot"}): {description of what the image shows — error messages, UI state, console output}
172
- - **Image 2**: ...
149
+ - **Image 1** ({filename or "screenshot"}): {description}
173
150
 
174
151
  {If no images:}
175
152
  No attached media found.
176
153
 
177
154
  ## Codebase Impact
178
155
 
179
- {If related files found:}
180
- - `{path}:{line}` — {why this file is related}
181
156
  - `{path}:{line}` — {why this file is related}
182
157
 
183
158
  {If no related files:}
@@ -209,8 +184,8 @@ Issue analyzed
209
184
 
210
185
  ## Notes
211
186
 
212
- - **Read-only**: This skill does not modify any code. It only creates an analysis document.
213
- - **Image analysis is best-effort**: AI interpretation of screenshots may not be 100% accurate. The `[Image Analysis]` tag makes this explicit.
214
- - **Not part of auto pipeline**: This is a standalone skill invoked manually.
215
- - **Relationship to triage**: `afc:triage` handles bulk PR/issue analysis. `afc:issue` handles deep individual issue analysis. They are complementary.
216
- - **Comment limit**: Max 20 comments analyzed to keep context manageable. Most recent comments are prioritized as they often contain the most relevant information.
187
+ - **Read-only**: Does not modify any code. Only creates an analysis document.
188
+ - **Image analysis is best-effort**: AI interpretation of screenshots may be imprecise `[Image Analysis]` tag makes this explicit.
189
+ - **Not part of auto pipeline**: Standalone skill, invoked manually.
190
+ - **Relationship to triage**: `afc:triage` handles bulk analysis; `afc:issue` handles deep individual analysis.
191
+ - **Comment limit**: Max 20 comments analyzed (most recent prioritized).
@@ -25,6 +25,11 @@ model: sonnet
25
25
  - `"auto"` — auto-detects version from package.json/Cargo.toml/pyproject.toml
26
26
  - Not specified: prompts for version
27
27
 
28
+ ## Git Context (auto-loaded)
29
+
30
+ !`git describe --tags --abbrev=0 2>/dev/null || echo "[NO_TAGS]"`
31
+ !`git log $(git describe --tags --abbrev=0 2>/dev/null || echo "")..HEAD --pretty=format:"%h %s" --no-merges 2>/dev/null || git log --pretty=format:"%h %s" --no-merges`
32
+
28
33
  ## Execution Steps
29
34
 
30
35
  ### 1. Detect Project Context
@@ -73,31 +73,7 @@ For each candidate rule:
73
73
 
74
74
  ### 4. Present Suggestions
75
75
 
76
- Show clustered suggestions to user, most impactful first. Present the most impactful suggestions first. If there are many high-confidence patterns, present them all rather than artificially capping. If most are low-confidence, present fewer. Let relevance and confidence drive the count, not a fixed limit.
77
-
78
- ```markdown
79
- ## Learned Patterns ({N} pending, showing top {M})
80
-
81
- ### 1. [Style] Prefer const over let
82
- - Detected: 3 times across 2 sessions
83
- - Confidence: HIGH
84
- - Proposed rule:
85
- ```
86
- Prefer `const` for variable declarations. Use `let` only when reassignment is required.
87
- ```
88
- - Target: `.claude/rules/afc-learned.md` (universal)
89
- - [Approve] [Edit] [Skip] [Reject permanently]
90
-
91
- ### 2. [Naming] No default exports in React components
92
- - Detected: 2 times (pipeline: auth-feature)
93
- - Confidence: HIGH
94
- - Proposed rule:
95
- ```
96
- In React component files (*.tsx), use named exports only. Avoid default exports.
97
- ```
98
- - Target: `.claude/rules/afc-learned.md` (universal — scope expressed in prose)
99
- - [Approve] [Edit] [Skip] [Reject permanently]
100
- ```
76
+ Show clustered suggestions to user, most impactful first. Let relevance and confidence drive the count, not a fixed limit. See [suggestion-format.md](suggestion-format.md) for the presentation template.
101
77
 
102
78
  Wait for user response on each suggestion.
103
79
 
@@ -0,0 +1,49 @@
1
+ # Suggestion Presentation Format
2
+
3
+ Present each clustered pattern suggestion in this format:
4
+
5
+ ```markdown
6
+ ## Learned Patterns ({N} pending, showing top {M})
7
+
8
+ ### 1. [{Rule type}] {Short title}
9
+ - Detected: {count} times across {sessions} sessions
10
+ - Confidence: {HIGH / MEDIUM / LOW}
11
+ - Proposed rule:
12
+ ```
13
+ {Concise, actionable rule text}
14
+ ```
15
+ - Target: `.claude/rules/afc-learned.md` ({scope: universal / file-type-specific})
16
+ - [Approve] [Edit] [Skip] [Reject permanently]
17
+ ```
18
+
19
+ ## Example
20
+
21
+ ```markdown
22
+ ### 1. [Style] Prefer const over let
23
+ - Detected: 3 times across 2 sessions
24
+ - Confidence: HIGH
25
+ - Proposed rule:
26
+ ```
27
+ Prefer `const` for variable declarations. Use `let` only when reassignment is required.
28
+ ```
29
+ - Target: `.claude/rules/afc-learned.md` (universal)
30
+ - [Approve] [Edit] [Skip] [Reject permanently]
31
+
32
+ ### 2. [Naming] No default exports in React components
33
+ - Detected: 2 times (pipeline: auth-feature)
34
+ - Confidence: HIGH
35
+ - Proposed rule:
36
+ ```
37
+ In React component files (*.tsx), use named exports only. Avoid default exports.
38
+ ```
39
+ - Target: `.claude/rules/afc-learned.md` (universal — scope expressed in prose)
40
+ - [Approve] [Edit] [Skip] [Reject permanently]
41
+ ```
42
+
43
+ ## User Response Handling
44
+
45
+ Wait for user response on each suggestion:
46
+ - **Approve**: promote to rules file
47
+ - **Edit**: user modifies the rule text, then promote
48
+ - **Skip**: remove from queue, do not promote
49
+ - **Reject permanently**: remove from queue + add to suppression list
@@ -139,11 +139,7 @@ Run the critic loop until convergence. Safety cap: 5 passes.
139
139
  4. **Constraint propagation**: every item in spec.md `Constraints` section is addressed in Risk & Mitigation or Implementation Context `Must NOT`. Report: `{M}/{N} constraints propagated`.
140
140
  5. **Acceptance anchor alignment**: Implementation Context `Acceptance Anchors` faithfully reflect spec.md's acceptance scenarios (no omissions, no misinterpretations).
141
141
 
142
- **On FAIL**: auto-fix and continue to next pass.
143
- **On ESCALATE**: pause, present options to user, apply choice, resume.
144
- **On DEFER**: record reason, mark criterion clean, continue.
145
- **On CONVERGE**: `✓ Critic converged ({N} passes, {M} fixes, {E} escalations)`
146
- **On SAFETY CAP**: `⚠ Critic safety cap ({N} passes). Review recommended.`
142
+ Follow verdict handling and output format per `docs/critic-loop-rules.md`.
147
143
 
148
144
  ### 5.5. ADR Recording (optional)
149
145