claude-code-scanner 1.0.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.
- package/DOCUMENTATION.md +1210 -0
- package/LICENSE +21 -0
- package/README.md +306 -0
- package/bin/cli.js +305 -0
- package/package.json +43 -0
- package/template/.claude/agents/api-builder.md +64 -0
- package/template/.claude/agents/architect.md +92 -0
- package/template/.claude/agents/debugger.md +69 -0
- package/template/.claude/agents/explorer.md +71 -0
- package/template/.claude/agents/frontend.md +61 -0
- package/template/.claude/agents/infra.md +66 -0
- package/template/.claude/agents/product-owner.md +73 -0
- package/template/.claude/agents/qa-lead.md +102 -0
- package/template/.claude/agents/reviewer.md +77 -0
- package/template/.claude/agents/security.md +81 -0
- package/template/.claude/agents/team-lead.md +128 -0
- package/template/.claude/agents/tester.md +72 -0
- package/template/.claude/docs/agent-error-protocol.md +89 -0
- package/template/.claude/docs/best-practices.md +93 -0
- package/template/.claude/docs/commands-template.md +73 -0
- package/template/.claude/docs/conflict-resolution-protocol.md +82 -0
- package/template/.claude/docs/context-budget.md +54 -0
- package/template/.claude/docs/execution-metrics-protocol.md +105 -0
- package/template/.claude/docs/flow-engine.md +475 -0
- package/template/.claude/docs/smithery-setup.md +51 -0
- package/template/.claude/docs/task-record-schema.md +196 -0
- package/template/.claude/hooks/drift-detector.js +143 -0
- package/template/.claude/hooks/execution-report.js +114 -0
- package/template/.claude/hooks/notify-approval.js +30 -0
- package/template/.claude/hooks/post-compact-recovery.js +68 -0
- package/template/.claude/hooks/post-edit-format.js +43 -0
- package/template/.claude/hooks/pre-compact-save.js +94 -0
- package/template/.claude/hooks/protect-files.js +39 -0
- package/template/.claude/hooks/session-start.js +76 -0
- package/template/.claude/hooks/stop-failure-handler.js +77 -0
- package/template/.claude/hooks/tool-failure-tracker.js +54 -0
- package/template/.claude/hooks/track-file-changes.js +34 -0
- package/template/.claude/hooks/validate-bash.js +34 -0
- package/template/.claude/manifest.json +22 -0
- package/template/.claude/profiles/backend.md +34 -0
- package/template/.claude/profiles/devops.md +36 -0
- package/template/.claude/profiles/frontend.md +34 -0
- package/template/.claude/rules/context-budget.md +34 -0
- package/template/.claude/scripts/verify-setup.js +210 -0
- package/template/.claude/settings.json +154 -0
- package/template/.claude/skills/context-check/SKILL.md +112 -0
- package/template/.claude/skills/execution-report/SKILL.md +229 -0
- package/template/.claude/skills/generate-environment/SKILL.md +128 -0
- package/template/.claude/skills/generate-environment/additional-skills.md +276 -0
- package/template/.claude/skills/generate-environment/artifact-templates.md +386 -0
- package/template/.claude/skills/generate-environment/domain-agents.md +202 -0
- package/template/.claude/skills/impact-analysis/SKILL.md +17 -0
- package/template/.claude/skills/metrics/SKILL.md +19 -0
- package/template/.claude/skills/progress-report/SKILL.md +27 -0
- package/template/.claude/skills/rollback/SKILL.md +75 -0
- package/template/.claude/skills/scan-codebase/SKILL.md +59 -0
- package/template/.claude/skills/scan-codebase/deep-scan-instructions.md +101 -0
- package/template/.claude/skills/scan-codebase/tech-markers.md +87 -0
- package/template/.claude/skills/setup-smithery/SKILL.md +38 -0
- package/template/.claude/skills/sync/SKILL.md +239 -0
- package/template/.claude/skills/task-tracker/SKILL.md +40 -0
- package/template/.claude/skills/validate-setup/SKILL.md +30 -0
- package/template/.claude/skills/workflow/SKILL.md +333 -0
- package/template/.claude/templates/README.md +42 -0
- package/template/CLAUDE.md +67 -0
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: execution-report
|
|
3
|
+
description: Generate post-execution analytics report after any prompt, phase, or workflow completion. Tracks token usage, context consumption, agent communication, success scoring, hallucination detection, and regression impact analysis.
|
|
4
|
+
user-invocable: true
|
|
5
|
+
context: fork
|
|
6
|
+
allowed-tools: Read, Grep, Glob, Bash
|
|
7
|
+
argument-hint: "[task-id|last|all] [--phase N] [--verbose]"
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Execution Report: $ARGUMENTS
|
|
11
|
+
|
|
12
|
+
Generate a comprehensive post-execution analytics report. This runs automatically after every phase completion and on session Stop, or manually via `/execution-report`.
|
|
13
|
+
|
|
14
|
+
## Data Collection
|
|
15
|
+
|
|
16
|
+
### Step 1: Gather Execution Metadata
|
|
17
|
+
Read the active task file from `.claude/tasks/TASK-{id}.md` and the changes log `TASK-{id}_changes.log`.
|
|
18
|
+
|
|
19
|
+
Collect:
|
|
20
|
+
- **Session ID:** `${CLAUDE_SESSION_ID}`
|
|
21
|
+
- **Task ID:** from task file frontmatter
|
|
22
|
+
- **Phase(s) completed:** from task timeline
|
|
23
|
+
- **Start/end timestamps:** from timeline entries
|
|
24
|
+
- **Agents invoked:** from handoff log
|
|
25
|
+
|
|
26
|
+
### Step 2: Token & Context Analysis
|
|
27
|
+
Run `/context` or estimate from artifacts:
|
|
28
|
+
|
|
29
|
+
- **Prompt tokens (input):** estimated from files read + conversation history
|
|
30
|
+
- **Completion tokens (output):** estimated from files written + responses
|
|
31
|
+
- **Total tokens:** input + output
|
|
32
|
+
- **Context window usage:** current % of context consumed
|
|
33
|
+
- **Peak context usage:** highest % reached during execution
|
|
34
|
+
- **Compaction events:** count of `/compact` triggers during execution
|
|
35
|
+
- **Context efficiency score:** (useful output tokens / total tokens) * 100
|
|
36
|
+
|
|
37
|
+
### Step 3: Agent Communication Analysis
|
|
38
|
+
Read the Handoff Log from the task record:
|
|
39
|
+
|
|
40
|
+
- **Agents activated:** list with invocation count
|
|
41
|
+
- **Handoff count:** total agent-to-agent transitions
|
|
42
|
+
- **Parallel executions:** count of parallel agent invocations
|
|
43
|
+
- **Loop iterations:** count per loop type (dev-test, review, qa-bug)
|
|
44
|
+
- **Escalations:** count of circuit breaker triggers
|
|
45
|
+
- **Agent efficiency:** per-agent (tasks completed / turns used)
|
|
46
|
+
|
|
47
|
+
| Agent | Invocations | Turns Used | Success | Rework | Efficiency |
|
|
48
|
+
|-------|-------------|------------|---------|--------|------------|
|
|
49
|
+
| @explorer | N | N | N | N | N% |
|
|
50
|
+
| ... | | | | | |
|
|
51
|
+
|
|
52
|
+
### Step 4: Success Scoring
|
|
53
|
+
Calculate a composite success score (0-100):
|
|
54
|
+
|
|
55
|
+
**Completeness Score (0-40 points):**
|
|
56
|
+
- Phase exit criteria all met: +20
|
|
57
|
+
- All acceptance criteria VERIFIED: +10
|
|
58
|
+
- No skipped phases: +5
|
|
59
|
+
- Task status advanced to expected state: +5
|
|
60
|
+
|
|
61
|
+
**Quality Score (0-30 points):**
|
|
62
|
+
- All tests pass: +10
|
|
63
|
+
- Coverage maintained or increased: +5
|
|
64
|
+
- No lint/type errors: +5
|
|
65
|
+
- Code review APPROVED (no critical issues): +5
|
|
66
|
+
- Security review clean: +5
|
|
67
|
+
|
|
68
|
+
**Efficiency Score (0-30 points):**
|
|
69
|
+
- Completed within expected turns: +10
|
|
70
|
+
- No circuit breaker triggers: +5
|
|
71
|
+
- Context stayed under 60%: +5
|
|
72
|
+
- Loops resolved within first attempt: +5
|
|
73
|
+
- No unnecessary agent invocations: +5
|
|
74
|
+
|
|
75
|
+
**Score Interpretation:**
|
|
76
|
+
- 90-100: EXCELLENT — clean execution
|
|
77
|
+
- 70-89: GOOD — minor issues
|
|
78
|
+
- 50-69: FAIR — rework or inefficiency detected
|
|
79
|
+
- 30-49: POOR — significant issues
|
|
80
|
+
- 0-29: FAILED — task incomplete or blocked
|
|
81
|
+
|
|
82
|
+
### Step 5: Hallucination Detection
|
|
83
|
+
Verify all generated artifacts against the actual codebase:
|
|
84
|
+
|
|
85
|
+
**File Reference Check:**
|
|
86
|
+
- Scan all file:line references in agent outputs
|
|
87
|
+
- Verify each referenced file exists at that path
|
|
88
|
+
- Verify line numbers are within file range
|
|
89
|
+
- Flag any references to non-existent files/functions
|
|
90
|
+
|
|
91
|
+
**API/Function Verification:**
|
|
92
|
+
- Check all function names mentioned in generated code exist
|
|
93
|
+
- Verify import paths resolve to real modules
|
|
94
|
+
- Confirm API endpoints referenced actually exist in routes
|
|
95
|
+
- Flag any invented or hallucinated identifiers
|
|
96
|
+
|
|
97
|
+
**Convention Consistency:**
|
|
98
|
+
- Compare generated code patterns against CLAUDE.md conventions
|
|
99
|
+
- Check naming against existing codebase patterns
|
|
100
|
+
- Verify generated test patterns match existing test files
|
|
101
|
+
- Flag any patterns that don't match the project
|
|
102
|
+
|
|
103
|
+
**Hallucination Score (0-3):**
|
|
104
|
+
- 0: CLEAN — all references verified
|
|
105
|
+
- 1: MINOR — cosmetic mismatches (wrong line numbers, outdated paths)
|
|
106
|
+
- 2: MODERATE — referenced non-existent functions or wrong imports
|
|
107
|
+
- 3: SEVERE — generated code based on invented APIs or wrong architecture
|
|
108
|
+
|
|
109
|
+
### Step 6: Regression & Bug Impact Analysis
|
|
110
|
+
Run the test suite and compare against baseline:
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
# Run the project's test command (check package.json scripts, Makefile, or CI config)
|
|
114
|
+
# Examples: npm test, pytest, go test ./..., cargo test
|
|
115
|
+
# Compare test count: before vs after
|
|
116
|
+
# Compare coverage: before vs after
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
**Regression Checks:**
|
|
120
|
+
- **Test suite result:** PASS/FAIL (count passing/failing/skipped)
|
|
121
|
+
- **New test failures:** list of tests that passed before but fail now
|
|
122
|
+
- **Coverage delta:** before% -> after% (flag if decreased)
|
|
123
|
+
- **Lint check:** PASS/FAIL (new lint errors introduced?)
|
|
124
|
+
- **Type check:** PASS/FAIL (new type errors introduced?)
|
|
125
|
+
- **Build check:** PASS/FAIL (build still succeeds?)
|
|
126
|
+
|
|
127
|
+
**Bug Impact Assessment:**
|
|
128
|
+
- Files modified in this execution: list from changes log
|
|
129
|
+
- Existing tests covering those files: list
|
|
130
|
+
- Tests that changed from PASS to FAIL: list (these are regressions)
|
|
131
|
+
- Files modified but lacking test coverage: list (risk areas)
|
|
132
|
+
|
|
133
|
+
**Impact Score (0-3):**
|
|
134
|
+
- 0: CLEAN — no regressions, coverage maintained
|
|
135
|
+
- 1: LOW — coverage decreased slightly but no new failures
|
|
136
|
+
- 2: MEDIUM — new test failures introduced
|
|
137
|
+
- 3: HIGH — build broken or critical regressions
|
|
138
|
+
|
|
139
|
+
## Output: Execution Report
|
|
140
|
+
|
|
141
|
+
Save to `.claude/reports/executions/TASK-{id}_phase-{N}_{timestamp}.md`:
|
|
142
|
+
|
|
143
|
+
```markdown
|
|
144
|
+
# Execution Report: TASK-{id} Phase {N}
|
|
145
|
+
|
|
146
|
+
## Summary
|
|
147
|
+
| Metric | Value |
|
|
148
|
+
|--------|-------|
|
|
149
|
+
| Task | TASK-{id}: {title} |
|
|
150
|
+
| Phase | {N}: {phase_name} |
|
|
151
|
+
| Duration | {elapsed} |
|
|
152
|
+
| Success Score | {score}/100 ({rating}) |
|
|
153
|
+
| Hallucination Score | {0-3} ({level}) |
|
|
154
|
+
| Regression Impact | {0-3} ({level}) |
|
|
155
|
+
|
|
156
|
+
## Token & Context Usage
|
|
157
|
+
| Metric | Value |
|
|
158
|
+
|--------|-------|
|
|
159
|
+
| Estimated Input Tokens | {N} |
|
|
160
|
+
| Estimated Output Tokens | {N} |
|
|
161
|
+
| Total Tokens | {N} |
|
|
162
|
+
| Peak Context Usage | {N}% |
|
|
163
|
+
| Compaction Events | {N} |
|
|
164
|
+
| Context Efficiency | {N}% |
|
|
165
|
+
|
|
166
|
+
## Agent Communication
|
|
167
|
+
| Agent | Invocations | Turns | Success | Rework | Efficiency |
|
|
168
|
+
|-------|-------------|-------|---------|--------|------------|
|
|
169
|
+
| ... | | | | | |
|
|
170
|
+
|
|
171
|
+
**Handoff Count:** {N}
|
|
172
|
+
**Parallel Executions:** {N}
|
|
173
|
+
**Loop Iterations:** dev-test {N}/5, review {N}/3, qa-bug {N}/3
|
|
174
|
+
**Escalations:** {N}
|
|
175
|
+
|
|
176
|
+
## Success Breakdown
|
|
177
|
+
| Category | Score | Detail |
|
|
178
|
+
|----------|-------|--------|
|
|
179
|
+
| Completeness | {N}/40 | {detail} |
|
|
180
|
+
| Quality | {N}/30 | {detail} |
|
|
181
|
+
| Efficiency | {N}/30 | {detail} |
|
|
182
|
+
| **Total** | **{N}/100** | **{rating}** |
|
|
183
|
+
|
|
184
|
+
## Hallucination Check
|
|
185
|
+
| Check | Result | Flags |
|
|
186
|
+
|-------|--------|-------|
|
|
187
|
+
| File references | {N} verified / {N} total | {list of bad refs} |
|
|
188
|
+
| Function/API names | {N} verified / {N} total | {list of invented} |
|
|
189
|
+
| Convention match | {N} consistent / {N} checked | {list of mismatches} |
|
|
190
|
+
| **Score** | **{0-3}** | **{level}** |
|
|
191
|
+
|
|
192
|
+
## Regression & Bug Impact
|
|
193
|
+
| Check | Result |
|
|
194
|
+
|-------|--------|
|
|
195
|
+
| Test suite | {PASS/FAIL} ({passing}/{total}) |
|
|
196
|
+
| New failures | {count} — {list} |
|
|
197
|
+
| Coverage delta | {before}% -> {after}% ({+/-N}%) |
|
|
198
|
+
| Lint check | {PASS/FAIL} |
|
|
199
|
+
| Type check | {PASS/FAIL} |
|
|
200
|
+
| Build check | {PASS/FAIL} |
|
|
201
|
+
| Uncovered modified files | {list} |
|
|
202
|
+
| **Impact Score** | **{0-3}** ({level}) |
|
|
203
|
+
|
|
204
|
+
## Recommendations
|
|
205
|
+
- {Actionable recommendation based on findings}
|
|
206
|
+
- {e.g., "Add tests for src/api/handler.ts — modified but uncovered"}
|
|
207
|
+
- {e.g., "Reduce context usage — 72% peak, consider splitting task"}
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
## Auto-Generation Trigger
|
|
211
|
+
This report is automatically generated:
|
|
212
|
+
1. After each workflow phase completion (appended to task record)
|
|
213
|
+
2. On session Stop (summary report)
|
|
214
|
+
3. On `/execution-report` manual invocation
|
|
215
|
+
4. On workflow completion (final cumulative report)
|
|
216
|
+
|
|
217
|
+
## Cumulative Report (on workflow completion)
|
|
218
|
+
When the full workflow completes (Phase 12), generate a cumulative report at:
|
|
219
|
+
`.claude/reports/executions/TASK-{id}_final.md`
|
|
220
|
+
|
|
221
|
+
Includes:
|
|
222
|
+
- Per-phase scores stacked
|
|
223
|
+
- Total token usage across all phases
|
|
224
|
+
- Agent utilization heatmap
|
|
225
|
+
- Phase bottleneck analysis (which phase took most turns/time)
|
|
226
|
+
- Overall success score (weighted average of phase scores)
|
|
227
|
+
- Full hallucination audit
|
|
228
|
+
- Full regression audit
|
|
229
|
+
- Lessons learned (what should be different next time)
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: generate-environment
|
|
3
|
+
description: Generate complete Claude Code environment from scan results. Use after /scan-codebase completes.
|
|
4
|
+
user-invocable: true
|
|
5
|
+
allowed-tools: Read, Edit, Write, Bash, Grep, Glob
|
|
6
|
+
context: fork
|
|
7
|
+
effort: high
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Generate Environment: $ARGUMENTS
|
|
11
|
+
|
|
12
|
+
## Prerequisite Check
|
|
13
|
+
Before generating, verify `.claude/scan-results.md` exists. If NOT found:
|
|
14
|
+
1. Warn: "scan-results.md not found. Run /scan-codebase first."
|
|
15
|
+
2. STOP — do NOT generate generic templates without scan data.
|
|
16
|
+
3. Exit with instructions to run `/scan-codebase` first.
|
|
17
|
+
|
|
18
|
+
Read `.claude/scan-results.md` (from /scan-codebase). Replace ALL `{placeholders}` with actual values. If a value wasn't found, OMIT that section — never leave placeholders.
|
|
19
|
+
|
|
20
|
+
**Reference files in this skill directory:**
|
|
21
|
+
- `artifact-templates.md` — full CLAUDE.md template, rule templates, settings.json, hook scripts, profiles, code template extraction instructions
|
|
22
|
+
- `additional-skills.md` — all skill SKILL.md templates to generate
|
|
23
|
+
- `domain-agents.md` — frontend, api-builder, infra agent templates
|
|
24
|
+
|
|
25
|
+
## Generate These Files (in order):
|
|
26
|
+
|
|
27
|
+
### 1. Root CLAUDE.md (max 150 lines)
|
|
28
|
+
```
|
|
29
|
+
# Project: {name}
|
|
30
|
+
## Tech Stack (exact versions from scan)
|
|
31
|
+
## Quick Commands (every build/test/lint/dev/migrate command)
|
|
32
|
+
## Architecture (3-5 lines: type, pattern, data flow, auth, API style)
|
|
33
|
+
## Code Style (ONLY rules differing from linter defaults)
|
|
34
|
+
## Git Conventions (branch pattern, commit format, PR requirements)
|
|
35
|
+
## Key Paths (entry points, handlers, services, models, tests, config, generated DO NOT EDIT)
|
|
36
|
+
## Gotchas (non-obvious things with file:line refs)
|
|
37
|
+
## Testing (framework, commands, patterns)
|
|
38
|
+
@.claude/rules/domain-terms.md
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### 2. Nested CLAUDE.md (per module, max 80 lines each)
|
|
42
|
+
Only for monorepo packages or distinct modules.
|
|
43
|
+
|
|
44
|
+
### 3. .claude/rules/ (max 50 lines each, with paths: frontmatter)
|
|
45
|
+
- `domain-terms.md` — business glossary (paths: **/*)
|
|
46
|
+
- `api.md` — endpoint conventions (paths: src/api/**)
|
|
47
|
+
- `testing.md` — test patterns (paths: **/*.test.*, tests/**)
|
|
48
|
+
- `database.md` — migration/query rules (paths: src/db/**, migrations/**)
|
|
49
|
+
- `frontend.md` — component patterns (paths: src/components/**, app/**)
|
|
50
|
+
- `security.md` — input validation, auth, PII rules (paths: src/auth/**, src/api/**)
|
|
51
|
+
- `infrastructure.md` — Docker, CI, IaC rules (paths: Dockerfile*, .github/workflows/**)
|
|
52
|
+
- Generate additional rules ONLY if codebase demands them.
|
|
53
|
+
|
|
54
|
+
### 4. .claude/agents/ (see agents/ directory and domain-agents.md for templates)
|
|
55
|
+
**Always generate (SDLC roles):** team-lead, architect, product-owner, qa-lead
|
|
56
|
+
**Always generate (core):** explorer, reviewer, debugger, tester
|
|
57
|
+
**Generate if layer exists:** frontend, api-builder, infra + domain-specific
|
|
58
|
+
|
|
59
|
+
All agents MUST include:
|
|
60
|
+
- `memory: project` for cross-session persistence
|
|
61
|
+
- `disallowedTools` on read-only agents (Edit, Write, Bash)
|
|
62
|
+
- `permissionMode: plan` on read-only agents
|
|
63
|
+
- `isolation: worktree` on parallel dev agents (frontend, api-builder)
|
|
64
|
+
- Structured output format section
|
|
65
|
+
- HANDOFF block in output format
|
|
66
|
+
- Limitations section with explicit DO NOT rules
|
|
67
|
+
- Model: haiku (fast checks), sonnet (routine), opus (complex reasoning)
|
|
68
|
+
- Set `maxTurns`, `effort`, `tools` per agent
|
|
69
|
+
- Scope `mcpServers:` per agent
|
|
70
|
+
|
|
71
|
+
### 5. .claude/skills/ (see skills/ directory for templates)
|
|
72
|
+
Generate: workflow, onboard, add-feature, add-endpoint, add-component, add-page, fix-bug, review-pr, qa-plan, signoff, deploy, rollback, migrate, task-tracker, progress-report, metrics, standup, impact-analysis, design-review, discover-skills, architecture, execution-report, context-check, sync.
|
|
73
|
+
- Heavy skills: `context: fork`
|
|
74
|
+
- Side-effect skills: `disable-model-invocation: true`
|
|
75
|
+
|
|
76
|
+
### 6. .claude/settings.json
|
|
77
|
+
Permissions (allow trusted commands, deny dangerous), hooks (SessionStart, PreToolUse, PostToolUse, Notification, Stop), env vars.
|
|
78
|
+
|
|
79
|
+
### 7. .claude/settings.local.json (gitignored)
|
|
80
|
+
Machine-specific env vars template.
|
|
81
|
+
|
|
82
|
+
### 8. .claude/hooks/ (cross-platform Node.js scripts)
|
|
83
|
+
- protect-files.js — block edits to .env, lock files, CI configs (PreToolUse)
|
|
84
|
+
- post-edit-format.js — auto-format after edits (PostToolUse)
|
|
85
|
+
- validate-bash.js — block dangerous commands (PreToolUse)
|
|
86
|
+
- session-start.js — re-inject context on startup/resume/compact (SessionStart)
|
|
87
|
+
- track-file-changes.js — log file modifications to task changes log (PostToolUse)
|
|
88
|
+
- notify-approval.js — OS notification when approval needed (Notification)
|
|
89
|
+
- execution-report.js — capture execution snapshot on Stop (Stop)
|
|
90
|
+
- tool-failure-tracker.js — log tool failures for debugging (PostToolUseFailure)
|
|
91
|
+
- stop-failure-handler.js — handle rate limits, auth failures, preserve state (StopFailure)
|
|
92
|
+
- pre-compact-save.js — save critical workflow state before compaction hits (PreCompact)
|
|
93
|
+
- post-compact-recovery.js — re-inject loop state, handoffs, blockers after compaction (PostCompact)
|
|
94
|
+
|
|
95
|
+
### 9. .claude/templates/ (extracted from REAL code, not invented)
|
|
96
|
+
Read 3-5 existing files of each type, extract common skeleton.
|
|
97
|
+
- component.md, api-endpoint.md, service.md, model.md, test.md, hook.md
|
|
98
|
+
- Only generate templates for patterns that actually exist in the codebase.
|
|
99
|
+
|
|
100
|
+
### 10. .claude/profiles/
|
|
101
|
+
- backend.md, frontend.md, devops.md (only those relevant to the project)
|
|
102
|
+
|
|
103
|
+
### 11. .claude/docs/commands.md
|
|
104
|
+
Master command reference: Claude CLI, session commands, /slash skills, @agent mentions, build/test/lint commands, git workflow, Smithery CLI.
|
|
105
|
+
|
|
106
|
+
### 12. .gitignore additions
|
|
107
|
+
```
|
|
108
|
+
.claude/settings.local.json
|
|
109
|
+
.claude/agent-memory-local/
|
|
110
|
+
.claude/tasks/
|
|
111
|
+
.claude/reports/
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Validation After Generation
|
|
115
|
+
- Count CLAUDE.md lines (must be under 150)
|
|
116
|
+
- Validate settings.json with `JSON.parse()` or `node -e`
|
|
117
|
+
- Check hook .js scripts exist
|
|
118
|
+
- Test that build/test/lint commands actually work
|
|
119
|
+
- Verify no placeholder `{...}` values remain
|
|
120
|
+
|
|
121
|
+
## Update Manifest
|
|
122
|
+
After generation, create/update `.claude/manifest.json`:
|
|
123
|
+
- Set `last_sync` and `last_scan` to current ISO timestamp
|
|
124
|
+
- Hash every generated file (agents, skills, hooks, rules, CLAUDE.md)
|
|
125
|
+
- Record tech stack dependency file hashes (package.json, etc.)
|
|
126
|
+
- Record project structure (source dirs, test dirs, config files)
|
|
127
|
+
- Record CLAUDE.md line count and agent count
|
|
128
|
+
This manifest enables `/sync` to detect drift in future sessions.
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
# Additional Skill Templates to Generate
|
|
2
|
+
|
|
3
|
+
## Always Generate
|
|
4
|
+
|
|
5
|
+
### /onboard
|
|
6
|
+
```yaml
|
|
7
|
+
---
|
|
8
|
+
name: onboard
|
|
9
|
+
description: Onboard a new developer. Use when someone is new to the project.
|
|
10
|
+
user-invocable: true
|
|
11
|
+
context: fork
|
|
12
|
+
agent: explorer
|
|
13
|
+
allowed-tools: Read, Grep, Glob, Bash
|
|
14
|
+
argument-hint: "[area or topic to focus on]"
|
|
15
|
+
---
|
|
16
|
+
Walk through: architecture overview, setup verification ({install_cmd}, {build_cmd}, {test_cmd}), domain terms, key concepts, first task guidance.
|
|
17
|
+
Focus on $ARGUMENTS if provided.
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### /add-feature
|
|
21
|
+
```yaml
|
|
22
|
+
---
|
|
23
|
+
name: add-feature
|
|
24
|
+
description: Scaffold a new feature following project patterns.
|
|
25
|
+
user-invocable: true
|
|
26
|
+
allowed-tools: Read, Edit, Write, Bash, Grep, Glob
|
|
27
|
+
argument-hint: "[feature description]"
|
|
28
|
+
---
|
|
29
|
+
1. Find closest existing pattern
|
|
30
|
+
2. Scaffold files in correct directories with naming conventions
|
|
31
|
+
3. Implement with proper error handling and logging
|
|
32
|
+
4. Write tests following existing patterns
|
|
33
|
+
5. Verify: {test_cmd} → {lint_cmd} → {build_cmd}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### /fix-bug
|
|
37
|
+
```yaml
|
|
38
|
+
---
|
|
39
|
+
name: fix-bug
|
|
40
|
+
description: Systematic bug fixing. Use when something is broken.
|
|
41
|
+
user-invocable: true
|
|
42
|
+
allowed-tools: Read, Edit, Write, Bash, Grep, Glob
|
|
43
|
+
argument-hint: "[bug description or error message]"
|
|
44
|
+
---
|
|
45
|
+
1. Reproduce with failing test
|
|
46
|
+
2. Trace code path from entry to failure
|
|
47
|
+
3. Fix root cause (not symptom)
|
|
48
|
+
4. Verify: failing test passes, no regressions
|
|
49
|
+
Run {test_cmd} after fix.
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### /review-pr
|
|
53
|
+
```yaml
|
|
54
|
+
---
|
|
55
|
+
name: review-pr
|
|
56
|
+
description: Review a PR against project standards.
|
|
57
|
+
user-invocable: true
|
|
58
|
+
context: fork
|
|
59
|
+
allowed-tools: Read, Grep, Glob, Bash
|
|
60
|
+
argument-hint: "[PR-number]"
|
|
61
|
+
---
|
|
62
|
+
`gh pr diff $0` — check conventions, tests, security, performance, backward compatibility.
|
|
63
|
+
Output: APPROVE/CHANGES_REQUESTED with file:line comments.
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### /design-review
|
|
67
|
+
```yaml
|
|
68
|
+
---
|
|
69
|
+
name: design-review
|
|
70
|
+
description: Architecture and design review for proposed changes.
|
|
71
|
+
user-invocable: true
|
|
72
|
+
context: fork
|
|
73
|
+
allowed-tools: Read, Grep, Glob, Bash, Agent
|
|
74
|
+
argument-hint: "[change description]"
|
|
75
|
+
---
|
|
76
|
+
@explorer: analyze fit with existing architecture, propose file locations, compare alternatives, flag breaking changes. Output Mermaid diagram.
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### /qa-plan
|
|
80
|
+
```yaml
|
|
81
|
+
---
|
|
82
|
+
name: qa-plan
|
|
83
|
+
description: Generate QA test plan for current changes.
|
|
84
|
+
user-invocable: true
|
|
85
|
+
context: fork
|
|
86
|
+
allowed-tools: Read, Grep, Glob, Bash
|
|
87
|
+
---
|
|
88
|
+
Analyze `git diff {base}...HEAD`. Generate: happy path scenarios, error/edge cases, regression tests, performance checks, cross-browser matrix. Format as checkable table.
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### /signoff
|
|
92
|
+
```yaml
|
|
93
|
+
---
|
|
94
|
+
name: signoff
|
|
95
|
+
description: Generate sign-off request for QA, business, or tech lead.
|
|
96
|
+
user-invocable: true
|
|
97
|
+
allowed-tools: Read, Grep, Glob, Bash
|
|
98
|
+
argument-hint: "[qa|business|tech] [task-id]"
|
|
99
|
+
---
|
|
100
|
+
qa: test results, known issues, recommendation.
|
|
101
|
+
business: acceptance criteria verification, demo URL, impact, rollback plan.
|
|
102
|
+
tech: all prior sign-offs, architecture/security review status, merge strategy.
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### /deploy
|
|
106
|
+
```yaml
|
|
107
|
+
---
|
|
108
|
+
name: deploy
|
|
109
|
+
description: Deploy with pre/post checks.
|
|
110
|
+
user-invocable: true
|
|
111
|
+
disable-model-invocation: true
|
|
112
|
+
allowed-tools: Read, Bash, Grep, Glob
|
|
113
|
+
argument-hint: "[staging|production] [pr-number]"
|
|
114
|
+
---
|
|
115
|
+
Pre-checks → merge PR → deploy → health check → smoke test. Rollback on failure.
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### /standup
|
|
119
|
+
```yaml
|
|
120
|
+
---
|
|
121
|
+
name: standup
|
|
122
|
+
description: Auto-generate daily standup from active task data.
|
|
123
|
+
user-invocable: true
|
|
124
|
+
allowed-tools: Read, Grep, Glob, Bash
|
|
125
|
+
---
|
|
126
|
+
Read .claude/tasks/. Output: yesterday (completed), today (planned), blockers, metrics.
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### /discover-skills
|
|
130
|
+
```yaml
|
|
131
|
+
---
|
|
132
|
+
name: discover-skills
|
|
133
|
+
description: Search Smithery for matching skills and install them.
|
|
134
|
+
user-invocable: true
|
|
135
|
+
disable-model-invocation: true
|
|
136
|
+
allowed-tools: Bash
|
|
137
|
+
---
|
|
138
|
+
`smithery skill search "$ARGUMENTS"` → evaluate match → install → `/context` to verify budget.
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### /architecture
|
|
142
|
+
```yaml
|
|
143
|
+
---
|
|
144
|
+
name: architecture
|
|
145
|
+
description: Generate or explain project architecture.
|
|
146
|
+
user-invocable: true
|
|
147
|
+
context: fork
|
|
148
|
+
agent: explorer
|
|
149
|
+
allowed-tools: Read, Grep, Glob, Bash
|
|
150
|
+
---
|
|
151
|
+
System context, container diagram, component diagram, data flow, key decisions. Mermaid diagrams.
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### /execution-report
|
|
155
|
+
```yaml
|
|
156
|
+
---
|
|
157
|
+
name: execution-report
|
|
158
|
+
description: Generate post-execution analytics report with success scoring, hallucination detection, and regression impact analysis.
|
|
159
|
+
user-invocable: true
|
|
160
|
+
context: fork
|
|
161
|
+
allowed-tools: Read, Grep, Glob, Bash
|
|
162
|
+
argument-hint: "[task-id|last|all] [--phase N] [--verbose]"
|
|
163
|
+
---
|
|
164
|
+
Collect execution metadata, calculate success score (0-100), check for hallucinations (verify file refs, function names, conventions), assess regression impact (test suite, coverage delta), and output scored report to .claude/reports/executions/.
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### /sync
|
|
168
|
+
```yaml
|
|
169
|
+
---
|
|
170
|
+
name: sync
|
|
171
|
+
description: Detect drift between Claude Code environment and actual codebase. Updates CLAUDE.md, agents, skills, rules, hooks when roles change or project evolves.
|
|
172
|
+
user-invocable: true
|
|
173
|
+
context: fork
|
|
174
|
+
allowed-tools: Read, Edit, Write, Bash, Grep, Glob, Agent
|
|
175
|
+
argument-hint: "[--check|--fix|--full-rescan] [--component agents|skills|rules|hooks|claude-md|all]"
|
|
176
|
+
---
|
|
177
|
+
Drift detection across 8 categories: agents, skills, hooks, rules, CLAUDE.md, settings, tech stack, structure.
|
|
178
|
+
--check: report only. --fix: auto-repair. --full-rescan: re-scan + regenerate.
|
|
179
|
+
Updates manifest.json for future drift tracking.
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### /context-check
|
|
183
|
+
```yaml
|
|
184
|
+
---
|
|
185
|
+
name: context-check
|
|
186
|
+
description: Check current context usage and enforce the 60% working budget. Use between workflow phases or when responses feel slow.
|
|
187
|
+
user-invocable: true
|
|
188
|
+
allowed-tools: Read, Bash, Grep, Glob
|
|
189
|
+
argument-hint: "[--compact] [--force]"
|
|
190
|
+
---
|
|
191
|
+
Run /context, evaluate against budget thresholds (GREEN <40%, YELLOW 40-60%, ORANGE 60-75%, RED 75%+).
|
|
192
|
+
If ORANGE+: compact with focus on current task/phase. Log context pressure in task record.
|
|
193
|
+
Auto-invoked between every workflow phase transition.
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### /rollback
|
|
197
|
+
```yaml
|
|
198
|
+
---
|
|
199
|
+
name: rollback
|
|
200
|
+
description: Rollback a failed deployment, revert code changes, or undo a workflow phase.
|
|
201
|
+
user-invocable: true
|
|
202
|
+
disable-model-invocation: true
|
|
203
|
+
allowed-tools: Read, Bash, Grep, Glob
|
|
204
|
+
argument-hint: "[deploy|code|phase] [task-id] [--to-commit SHA]"
|
|
205
|
+
---
|
|
206
|
+
Deploy rollback: revert merge, redeploy, health check.
|
|
207
|
+
Code rollback: revert commits or close PR.
|
|
208
|
+
Phase rollback: undo artifacts from target phase range, reset task status.
|
|
209
|
+
Safety: never force-push, always create revert commit, always run tests after.
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
### /migrate
|
|
213
|
+
```yaml
|
|
214
|
+
---
|
|
215
|
+
name: migrate
|
|
216
|
+
description: Create database migrations.
|
|
217
|
+
user-invocable: true
|
|
218
|
+
disable-model-invocation: true
|
|
219
|
+
allowed-tools: Read, Edit, Write, Bash, Grep, Glob
|
|
220
|
+
argument-hint: "[migration description]"
|
|
221
|
+
---
|
|
222
|
+
Check schema → create migration file → write up/down → test → verify.
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
## Conditional Skills (generate ONLY if codebase has the layer)
|
|
226
|
+
|
|
227
|
+
### /add-endpoint — Generate if backend API exists
|
|
228
|
+
```yaml
|
|
229
|
+
---
|
|
230
|
+
name: add-endpoint
|
|
231
|
+
description: Create new API endpoint following project patterns.
|
|
232
|
+
user-invocable: true
|
|
233
|
+
allowed-tools: Read, Edit, Write, Bash, Grep, Glob
|
|
234
|
+
---
|
|
235
|
+
1. Find closest existing endpoint in `{routes_dir}` — READ it
|
|
236
|
+
2. Create: route in `{routes_dir}`, handler in `{handlers_dir}`, schema in `{schemas_dir}`, service in `{services_dir}`
|
|
237
|
+
3. Add validation using {validation_library}, auth using {auth_pattern}
|
|
238
|
+
4. Write tests in `{api_test_dir}`: happy path, validation errors, auth errors, not found
|
|
239
|
+
5. Verify: {test_cmd} → {lint_cmd} → {type_check_cmd}
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
### /add-component — Generate if frontend exists
|
|
243
|
+
```yaml
|
|
244
|
+
---
|
|
245
|
+
name: add-component
|
|
246
|
+
description: Create new UI component following project patterns.
|
|
247
|
+
user-invocable: true
|
|
248
|
+
allowed-tools: Read, Edit, Write, Bash, Grep, Glob
|
|
249
|
+
---
|
|
250
|
+
1. Find similar component in `{component_dir}` — READ it for exact pattern
|
|
251
|
+
2. Create: component `{ComponentName}.{ext}`, test `{ComponentName}.test.{ext}`, styles if co-located
|
|
252
|
+
3. Follow: {prop_pattern}, {styling_approach}, {export_pattern}
|
|
253
|
+
4. Write tests: render, behavior, props variations
|
|
254
|
+
5. Verify: {frontend_test_cmd} → {frontend_build_cmd}
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
### /add-page — Generate if frontend has routing
|
|
258
|
+
```yaml
|
|
259
|
+
---
|
|
260
|
+
name: add-page
|
|
261
|
+
description: Create new page/route.
|
|
262
|
+
user-invocable: true
|
|
263
|
+
allowed-tools: Read, Edit, Write, Bash, Grep, Glob
|
|
264
|
+
---
|
|
265
|
+
1. Pages in `{pages_dir}` use {file-based | config-based} routing
|
|
266
|
+
2. READ existing page for: data loading pattern, layout, error handling
|
|
267
|
+
3. Create page, set up data loading ({getServerSideProps | loader | useEffect})
|
|
268
|
+
4. Apply layout, add navigation link
|
|
269
|
+
5. Write test, verify with {dev_cmd}
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
### Additional conditional skills:
|
|
273
|
+
- If i18n: `/add-translation` (translation file format + key naming)
|
|
274
|
+
- If GraphQL: `/add-query`, `/add-mutation` (schema + resolver patterns)
|
|
275
|
+
- If Storybook: `/add-story` (story format + decorators)
|
|
276
|
+
- If WebSocket: `/add-channel` (event patterns)
|