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,386 @@
|
|
|
1
|
+
# Artifact Templates for Generation
|
|
2
|
+
|
|
3
|
+
## CLAUDE.md Full Template
|
|
4
|
+
```markdown
|
|
5
|
+
# Project: {name}
|
|
6
|
+
{one-line description}
|
|
7
|
+
|
|
8
|
+
## Tech Stack
|
|
9
|
+
- **Backend:** {language} {version} + {framework} {version} ({api_style})
|
|
10
|
+
- **Frontend:** {framework} {version} + {meta_framework} {version} ({rendering_mode})
|
|
11
|
+
- **Database:** {database_type} + {orm} ({migration_tool})
|
|
12
|
+
- **Cache:** {cache_system}
|
|
13
|
+
- **Queue:** {queue_system}
|
|
14
|
+
- **Infra:** {containerization} + {orchestration} + {cloud_provider}
|
|
15
|
+
- **CI/CD:** {platform} ({config_file})
|
|
16
|
+
|
|
17
|
+
## Quick Commands
|
|
18
|
+
- Install: `{install_command}`
|
|
19
|
+
- Build: `{build_command}`
|
|
20
|
+
- Dev: `{dev_command}`
|
|
21
|
+
- Test all: `{test_command}`
|
|
22
|
+
- Test single: `{single_test_command}`
|
|
23
|
+
- Lint: `{lint_command}`
|
|
24
|
+
- Format: `{format_command}`
|
|
25
|
+
- Type check: `{type_check_command}`
|
|
26
|
+
- Migrate: `{migration_command}`
|
|
27
|
+
|
|
28
|
+
## Architecture
|
|
29
|
+
- Type: {monolith | modular | microservices}
|
|
30
|
+
- Pattern: {MVC | Clean | DDD | Hexagonal | Feature-based}
|
|
31
|
+
- Data flow: {request → middleware → controller → service → repository → DB}
|
|
32
|
+
- Auth: {mechanism} via {library}
|
|
33
|
+
|
|
34
|
+
## Code Style
|
|
35
|
+
- {ONLY rules differing from linter config}
|
|
36
|
+
- Import order: {if custom}
|
|
37
|
+
- Error pattern: {convention}
|
|
38
|
+
|
|
39
|
+
## Git Conventions
|
|
40
|
+
- Branch: `{pattern}`
|
|
41
|
+
- Commit: `{format}`
|
|
42
|
+
- PR: `{requirements}`
|
|
43
|
+
|
|
44
|
+
## Key Paths
|
|
45
|
+
- Entry points: `{path}`
|
|
46
|
+
- API routes: `{path}`
|
|
47
|
+
- Services: `{path}`
|
|
48
|
+
- Models: `{path}`
|
|
49
|
+
- Migrations: `{path}`
|
|
50
|
+
- Shared/common: `{path}`
|
|
51
|
+
- Types: `{path}`
|
|
52
|
+
- Frontend components: `{path}`
|
|
53
|
+
- Tests: `{path}` (unit), `{path}` (e2e)
|
|
54
|
+
- Generated (DO NOT EDIT): `{path}`
|
|
55
|
+
|
|
56
|
+
## Gotchas
|
|
57
|
+
- {non-obvious thing with file:line ref}
|
|
58
|
+
|
|
59
|
+
## Testing
|
|
60
|
+
- Unit: `{framework}` — `{command}` — pattern: `{naming}`
|
|
61
|
+
- E2E: `{framework}` — `{command}`
|
|
62
|
+
- Coverage: `{command}`
|
|
63
|
+
|
|
64
|
+
@.claude/rules/domain-terms.md
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Rule File Templates
|
|
68
|
+
|
|
69
|
+
### domain-terms.md
|
|
70
|
+
```yaml
|
|
71
|
+
---
|
|
72
|
+
paths: ["**/*"]
|
|
73
|
+
---
|
|
74
|
+
# Domain Terms
|
|
75
|
+
- {Term}: {Definition as used in THIS codebase}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### api.md
|
|
79
|
+
```yaml
|
|
80
|
+
---
|
|
81
|
+
paths: ["src/api/**/*", "src/routes/**/*"]
|
|
82
|
+
---
|
|
83
|
+
# API Rules
|
|
84
|
+
- Endpoint naming: {pattern}
|
|
85
|
+
- Request validation: {library} — {pattern}
|
|
86
|
+
- Response format: {format}
|
|
87
|
+
- Error format: {format}
|
|
88
|
+
- Auth: {how to protect endpoints}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### testing.md
|
|
92
|
+
```yaml
|
|
93
|
+
---
|
|
94
|
+
paths: ["**/*.test.*", "**/*.spec.*", "tests/**/*"]
|
|
95
|
+
---
|
|
96
|
+
# Testing Rules
|
|
97
|
+
- File naming: {pattern}
|
|
98
|
+
- Test naming: {convention}
|
|
99
|
+
- Mocks: {library and pattern}
|
|
100
|
+
- Integration vs unit: {boundary}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### frontend.md
|
|
104
|
+
```yaml
|
|
105
|
+
---
|
|
106
|
+
paths: ["src/components/**/*", "src/pages/**/*", "app/**/*"]
|
|
107
|
+
---
|
|
108
|
+
# Frontend Rules
|
|
109
|
+
- Component pattern: {hooks | Composition API | class-based}
|
|
110
|
+
- Styling: {approach}
|
|
111
|
+
- State: {when global vs local}
|
|
112
|
+
- Data fetching: {pattern}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### database.md
|
|
116
|
+
```yaml
|
|
117
|
+
---
|
|
118
|
+
paths: ["src/db/**/*", "migrations/**/*", "src/models/**/*"]
|
|
119
|
+
---
|
|
120
|
+
# Database Rules
|
|
121
|
+
- Migration naming: {convention}
|
|
122
|
+
- Query pattern: {repository | active record | query builder}
|
|
123
|
+
- ORM: {orm_name} — always use parameterized queries
|
|
124
|
+
- Transactions: {how to wrap multi-step operations}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### security.md
|
|
128
|
+
```yaml
|
|
129
|
+
---
|
|
130
|
+
paths: ["src/auth/**/*", "src/api/**/*"]
|
|
131
|
+
---
|
|
132
|
+
# Security Rules
|
|
133
|
+
- Validate ALL inputs with {library}
|
|
134
|
+
- Never log PII
|
|
135
|
+
- Parameterized queries only via {orm}
|
|
136
|
+
- Auth on every non-public endpoint
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### infrastructure.md
|
|
140
|
+
```yaml
|
|
141
|
+
---
|
|
142
|
+
paths: ["Dockerfile*", "docker-compose*", "terraform/**/*", ".github/workflows/**/*", "k8s/**/*"]
|
|
143
|
+
---
|
|
144
|
+
# Infrastructure Rules
|
|
145
|
+
- Docker: {base image policy, multi-stage build pattern}
|
|
146
|
+
- CI: {what must pass before merge}
|
|
147
|
+
- Env vars: {naming convention}
|
|
148
|
+
- Secrets: {management approach}
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## Nested CLAUDE.md Template (per module)
|
|
152
|
+
```markdown
|
|
153
|
+
# {Module Name}
|
|
154
|
+
{one-line purpose}
|
|
155
|
+
|
|
156
|
+
## Commands
|
|
157
|
+
- Test: `{module_test_cmd}`
|
|
158
|
+
- Build: `{module_build_cmd}`
|
|
159
|
+
|
|
160
|
+
## Patterns
|
|
161
|
+
- {module-specific patterns only}
|
|
162
|
+
|
|
163
|
+
## Dependencies
|
|
164
|
+
- Depends on: {internal modules}
|
|
165
|
+
- Depended on by: {internal modules}
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## Profile Templates
|
|
169
|
+
|
|
170
|
+
### backend.md
|
|
171
|
+
```markdown
|
|
172
|
+
# Backend Developer Profile
|
|
173
|
+
Focus: API development, database, business logic
|
|
174
|
+
Agents: @debugger, @api-builder, @tester
|
|
175
|
+
Commands: Run API `{api_start_cmd}`, Test `{backend_test_cmd}`, Migrate `{migration_cmd}`
|
|
176
|
+
Load: .claude/rules/api.md, .claude/rules/database.md
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
### frontend.md
|
|
180
|
+
```markdown
|
|
181
|
+
# Frontend Developer Profile
|
|
182
|
+
Focus: UI components, styling, user experience
|
|
183
|
+
Agents: @frontend, @tester
|
|
184
|
+
Commands: Dev `{frontend_dev_cmd}`, Test `{frontend_test_cmd}`, Storybook `{storybook_cmd}`
|
|
185
|
+
Load: .claude/rules/frontend.md
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### devops.md
|
|
189
|
+
```markdown
|
|
190
|
+
# DevOps Profile
|
|
191
|
+
Focus: Infrastructure, CI/CD, deployment
|
|
192
|
+
Agents: @infra
|
|
193
|
+
Commands: Deploy `{deploy_cmd}`, Logs `{log_cmd}`, Status `{status_cmd}`
|
|
194
|
+
Load: .claude/rules/infrastructure.md
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
## Settings.json Template
|
|
198
|
+
```json
|
|
199
|
+
{
|
|
200
|
+
"permissions": {
|
|
201
|
+
"allow": [
|
|
202
|
+
"Bash({pkg_mgr} test *)", "Bash({pkg_mgr} run *)",
|
|
203
|
+
"Bash({build_cmd})", "Bash({lint_cmd})",
|
|
204
|
+
"Bash(git status)", "Bash(git diff *)", "Bash(git log *)"
|
|
205
|
+
],
|
|
206
|
+
"deny": [
|
|
207
|
+
"Bash(rm -rf /)", "Bash(sudo *)",
|
|
208
|
+
"Bash(git push --force *)", "Bash(git reset --hard)"
|
|
209
|
+
]
|
|
210
|
+
},
|
|
211
|
+
"hooks": {
|
|
212
|
+
"SessionStart": [{"matcher": "startup|resume|compact", "hooks": [{"type": "command", "command": "node .claude/hooks/session-start.js"}]}],
|
|
213
|
+
"PreToolUse": [
|
|
214
|
+
{"matcher": "Edit|Write", "hooks": [{"type": "command", "command": "node .claude/hooks/protect-files.js"}]},
|
|
215
|
+
{"matcher": "Bash", "hooks": [{"type": "command", "command": "node .claude/hooks/validate-bash.js"}]}
|
|
216
|
+
],
|
|
217
|
+
"PostToolUse": [{"matcher": "Edit|Write", "hooks": [{"type": "command", "command": "node .claude/hooks/post-edit-format.js"}]}],
|
|
218
|
+
"Notification": [{"matcher": "permission_prompt", "hooks": [{"type": "command", "command": "node .claude/hooks/notify-approval.js"}]}],
|
|
219
|
+
"Stop": [{"hooks": [{"type": "prompt", "prompt": "Check if task is complete. Tests pass, no lint errors, no type errors. Return {\"ok\": true} or {\"ok\": false, \"reason\": \"what's missing\"}", "model": "haiku"}]}]
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
## Hook Script Templates (Cross-Platform Node.js)
|
|
225
|
+
|
|
226
|
+
All hooks use Node.js for cross-platform compatibility (Windows, macOS, Linux). No bash or jq dependency required.
|
|
227
|
+
|
|
228
|
+
### protect-files.js
|
|
229
|
+
```javascript
|
|
230
|
+
#!/usr/bin/env node
|
|
231
|
+
// Pre-tool hook: block edits to protected files
|
|
232
|
+
let input = '';
|
|
233
|
+
process.stdin.setEncoding('utf-8');
|
|
234
|
+
process.stdin.on('data', chunk => { input += chunk; });
|
|
235
|
+
process.stdin.on('end', () => {
|
|
236
|
+
try {
|
|
237
|
+
const data = JSON.parse(input);
|
|
238
|
+
const file = (data.tool_input && data.tool_input.file_path) || '';
|
|
239
|
+
if (!file) process.exit(0);
|
|
240
|
+
const PROTECTED = ['.env', '.env.local', 'package-lock.json', 'yarn.lock', 'pnpm-lock.yaml', '.github/workflows/'];
|
|
241
|
+
for (const p of PROTECTED) {
|
|
242
|
+
if (file.includes(p)) { process.stderr.write(`BLOCKED: ${file} is protected.\n`); process.exit(2); }
|
|
243
|
+
}
|
|
244
|
+
} catch {}
|
|
245
|
+
process.exit(0);
|
|
246
|
+
});
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
### post-edit-format.js
|
|
250
|
+
```javascript
|
|
251
|
+
#!/usr/bin/env node
|
|
252
|
+
// Post-tool hook: auto-format edited files
|
|
253
|
+
const { execSync } = require('child_process');
|
|
254
|
+
const fs = require('fs');
|
|
255
|
+
const path = require('path');
|
|
256
|
+
let input = '';
|
|
257
|
+
process.stdin.setEncoding('utf-8');
|
|
258
|
+
process.stdin.on('data', chunk => { input += chunk; });
|
|
259
|
+
process.stdin.on('end', () => {
|
|
260
|
+
try {
|
|
261
|
+
const data = JSON.parse(input);
|
|
262
|
+
const file = (data.tool_input && data.tool_input.file_path) || '';
|
|
263
|
+
if (!file || !fs.existsSync(file)) process.exit(0);
|
|
264
|
+
const ext = path.extname(file).toLowerCase();
|
|
265
|
+
const formatters = {
|
|
266
|
+
'.ts': 'npx prettier --write', '.tsx': 'npx prettier --write',
|
|
267
|
+
'.js': 'npx prettier --write', '.jsx': 'npx prettier --write',
|
|
268
|
+
'.json': 'npx prettier --write', '.css': 'npx prettier --write',
|
|
269
|
+
'.py': 'black', '.go': 'gofmt -w', '.rs': 'rustfmt',
|
|
270
|
+
};
|
|
271
|
+
const formatter = formatters[ext];
|
|
272
|
+
if (formatter) { try { execSync(`${formatter} "${file}"`, { stdio: 'ignore', timeout: 10000 }); } catch {} }
|
|
273
|
+
} catch {}
|
|
274
|
+
process.exit(0);
|
|
275
|
+
});
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
### validate-bash.js
|
|
279
|
+
```javascript
|
|
280
|
+
#!/usr/bin/env node
|
|
281
|
+
// Pre-tool hook: block dangerous bash commands
|
|
282
|
+
let input = '';
|
|
283
|
+
process.stdin.setEncoding('utf-8');
|
|
284
|
+
process.stdin.on('data', chunk => { input += chunk; });
|
|
285
|
+
process.stdin.on('end', () => {
|
|
286
|
+
try {
|
|
287
|
+
const data = JSON.parse(input);
|
|
288
|
+
const cmd = (data.tool_input && data.tool_input.command) || '';
|
|
289
|
+
if (!cmd) process.exit(0);
|
|
290
|
+
const DANGEROUS = ['rm -rf /', ':(){ :|:& };:', '> /dev/sda', 'mkfs', 'dd if=', 'curl.*| bash'];
|
|
291
|
+
for (const p of DANGEROUS) {
|
|
292
|
+
if (cmd.includes(p)) { process.stderr.write('BLOCKED: Dangerous command.\n'); process.exit(2); }
|
|
293
|
+
}
|
|
294
|
+
} catch {}
|
|
295
|
+
process.exit(0);
|
|
296
|
+
});
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
### session-start.js
|
|
300
|
+
```javascript
|
|
301
|
+
#!/usr/bin/env node
|
|
302
|
+
// Re-inject critical context on session start
|
|
303
|
+
const fs = require('fs');
|
|
304
|
+
const path = require('path');
|
|
305
|
+
console.log('PROJECT: {package_manager} | Test: {test_cmd} | Lint: {lint_cmd} | Build: {build_cmd}');
|
|
306
|
+
const tasksDir = path.join(process.cwd(), '.claude', 'tasks');
|
|
307
|
+
if (fs.existsSync(tasksDir)) {
|
|
308
|
+
for (const file of fs.readdirSync(tasksDir).filter(f => f.endsWith('.md'))) {
|
|
309
|
+
const content = fs.readFileSync(path.join(tasksDir, file), 'utf-8');
|
|
310
|
+
if (/status:\s*(DEVELOPING|DEV_TESTING)/.test(content)) {
|
|
311
|
+
const title = (content.match(/^title:\s*(.+)$/m) || [])[1];
|
|
312
|
+
if (title) console.log(`ACTIVE TASK: ${title.trim()}`);
|
|
313
|
+
break;
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
### notify-approval.js
|
|
320
|
+
```javascript
|
|
321
|
+
#!/usr/bin/env node
|
|
322
|
+
// Cross-platform OS notification when Claude needs user approval
|
|
323
|
+
const { execSync } = require('child_process');
|
|
324
|
+
const MSG = 'Claude Code needs your approval';
|
|
325
|
+
function tryExec(cmd) { try { execSync(cmd, { stdio: 'ignore', timeout: 5000 }); } catch {} }
|
|
326
|
+
if (process.platform === 'darwin') {
|
|
327
|
+
tryExec(`osascript -e 'display notification "${MSG}" with title "Claude Code"'`);
|
|
328
|
+
} else if (process.platform === 'win32') {
|
|
329
|
+
tryExec(`powershell.exe -NoProfile -Command "Add-Type -A System.Windows.Forms; [System.Windows.Forms.MessageBox]::Show('${MSG}','Claude Code')"`);
|
|
330
|
+
} else {
|
|
331
|
+
tryExec(`notify-send "Claude Code" "${MSG}"`);
|
|
332
|
+
}
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
## Auto-Progress Hook (add to settings.json hooks)
|
|
336
|
+
Track file changes for active task:
|
|
337
|
+
```json
|
|
338
|
+
{
|
|
339
|
+
"PostToolUse": [
|
|
340
|
+
{
|
|
341
|
+
"matcher": "Edit|Write",
|
|
342
|
+
"hooks": [
|
|
343
|
+
{"type": "command", "command": "node .claude/hooks/track-file-changes.js"}
|
|
344
|
+
]
|
|
345
|
+
}
|
|
346
|
+
]
|
|
347
|
+
}
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
### track-file-changes.js
|
|
351
|
+
```javascript
|
|
352
|
+
#!/usr/bin/env node
|
|
353
|
+
// Post-tool hook: track file changes for active task
|
|
354
|
+
const fs = require('fs');
|
|
355
|
+
const path = require('path');
|
|
356
|
+
let input = '';
|
|
357
|
+
process.stdin.setEncoding('utf-8');
|
|
358
|
+
process.stdin.on('data', chunk => { input += chunk; });
|
|
359
|
+
process.stdin.on('end', () => {
|
|
360
|
+
try {
|
|
361
|
+
const data = JSON.parse(input);
|
|
362
|
+
const file = (data.tool_input && data.tool_input.file_path) || '';
|
|
363
|
+
if (!file) process.exit(0);
|
|
364
|
+
const tasksDir = path.join(process.cwd(), '.claude', 'tasks');
|
|
365
|
+
if (!fs.existsSync(tasksDir)) process.exit(0);
|
|
366
|
+
for (const tf of fs.readdirSync(tasksDir).filter(f => f.endsWith('.md'))) {
|
|
367
|
+
const taskPath = path.join(tasksDir, tf);
|
|
368
|
+
const content = fs.readFileSync(taskPath, 'utf-8');
|
|
369
|
+
if (/status:\s*(DEVELOPING|DEV_TESTING)/.test(content)) {
|
|
370
|
+
const logPath = taskPath.replace(/\.md$/, '_changes.log');
|
|
371
|
+
fs.appendFileSync(logPath, `| ${new Date().toISOString().replace(/\.\d{3}Z$/, 'Z')} | file_changed | ${file} |\n`);
|
|
372
|
+
break;
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
} catch {}
|
|
376
|
+
process.exit(0);
|
|
377
|
+
});
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
## Code Template Extraction Instructions
|
|
381
|
+
For each template type (component, endpoint, service, model, test):
|
|
382
|
+
1. Read 3-5 existing files of that type
|
|
383
|
+
2. Identify the common skeleton (imports, structure, exports)
|
|
384
|
+
3. Replace specific names with `{Placeholder}`
|
|
385
|
+
4. Preserve exact: import order, export style, prop pattern, error handling
|
|
386
|
+
5. Include both code skeleton AND test skeleton
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
# Domain-Specific Agent Templates
|
|
2
|
+
|
|
3
|
+
Generate ONLY if codebase has that layer. All agents MUST include: structured output format, HANDOFF block, limitations section, `memory: project` field.
|
|
4
|
+
|
|
5
|
+
## SDLC Role Agents (always generate these 4)
|
|
6
|
+
|
|
7
|
+
### product-owner.md — Always generate
|
|
8
|
+
```yaml
|
|
9
|
+
---
|
|
10
|
+
name: product-owner
|
|
11
|
+
description: Business analysis, acceptance criteria, and business sign-off gate for {project_name}.
|
|
12
|
+
tools: Read, Grep, Glob
|
|
13
|
+
disallowedTools: Edit, Write, Bash
|
|
14
|
+
model: opus
|
|
15
|
+
permissionMode: plan
|
|
16
|
+
maxTurns: 20
|
|
17
|
+
effort: high
|
|
18
|
+
memory: project
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
Product Owner for {project_name}. You bridge business requirements and technical implementation.
|
|
22
|
+
|
|
23
|
+
Responsibilities:
|
|
24
|
+
1. Write acceptance criteria in GIVEN/WHEN/THEN format
|
|
25
|
+
2. Validate requirements against implementation
|
|
26
|
+
3. Approve/reject at business sign-off gate (Phase 10)
|
|
27
|
+
4. Flag scope creep immediately
|
|
28
|
+
|
|
29
|
+
Output: acceptance criteria table, sign-off decision, HANDOFF block.
|
|
30
|
+
|
|
31
|
+
Limitations:
|
|
32
|
+
- DO NOT modify code — read-only
|
|
33
|
+
- DO NOT make technical decisions — defer to @architect or @team-lead
|
|
34
|
+
- DO NOT approve without verifying ALL acceptance criteria
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### team-lead.md — Always generate
|
|
38
|
+
```yaml
|
|
39
|
+
---
|
|
40
|
+
name: team-lead
|
|
41
|
+
description: Coordinates workflow, assigns tasks, resolves blockers, and provides tech sign-off for {project_name}.
|
|
42
|
+
tools: Read, Write, Edit, Grep, Glob, Bash
|
|
43
|
+
model: opus
|
|
44
|
+
maxTurns: 50
|
|
45
|
+
effort: high
|
|
46
|
+
memory: project
|
|
47
|
+
skills: task-tracker, progress-report, execution-report
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
Tech Lead for {project_name}. You coordinate all agents and own technical decisions.
|
|
51
|
+
|
|
52
|
+
Agent assignment: backend -> @api-builder, frontend -> @frontend, fullstack -> parallel, infra -> @infra, investigation -> @explorer, bugs -> @debugger, review -> @reviewer + @security, architecture -> @architect, QA -> @qa-lead + @tester.
|
|
53
|
+
|
|
54
|
+
Loop management: track iteration counts in task records. Escalate at max.
|
|
55
|
+
|
|
56
|
+
Limitations:
|
|
57
|
+
- DO NOT write application code — delegate to dev agents
|
|
58
|
+
- DO NOT approve your own changes — use @reviewer
|
|
59
|
+
- DO NOT skip QA or security review
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### architect.md — Always generate
|
|
63
|
+
```yaml
|
|
64
|
+
---
|
|
65
|
+
name: architect
|
|
66
|
+
description: Architecture design and review for {project_name}. Phase 3 (Architecture Review) and design-review.
|
|
67
|
+
tools: Read, Grep, Glob, Bash
|
|
68
|
+
disallowedTools: Edit, Write
|
|
69
|
+
model: opus
|
|
70
|
+
permissionMode: plan
|
|
71
|
+
maxTurns: 25
|
|
72
|
+
effort: high
|
|
73
|
+
memory: project
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
Architect for {project_name}. Architecture: {architecture_type}, {api_style}, {deployment_topology}.
|
|
77
|
+
|
|
78
|
+
Method: map current state -> analyze impact -> design with alternatives -> evaluate trade-offs -> recommend -> document with Mermaid diagrams.
|
|
79
|
+
|
|
80
|
+
Output: design options table, recommendation, Mermaid diagram, decision record, HANDOFF block.
|
|
81
|
+
|
|
82
|
+
Limitations:
|
|
83
|
+
- DO NOT write implementation code — design documents only
|
|
84
|
+
- DO NOT modify source files — strictly read-only
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### qa-lead.md — Always generate
|
|
88
|
+
```yaml
|
|
89
|
+
---
|
|
90
|
+
name: qa-lead
|
|
91
|
+
description: QA planning, test strategy, and QA sign-off gate for {project_name}.
|
|
92
|
+
tools: Read, Grep, Glob, Bash
|
|
93
|
+
disallowedTools: Edit, Write
|
|
94
|
+
model: sonnet
|
|
95
|
+
permissionMode: plan
|
|
96
|
+
maxTurns: 25
|
|
97
|
+
effort: high
|
|
98
|
+
memory: project
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
QA Lead for {project_name}. Test framework: {test_framework}, commands: `{test_cmd}`.
|
|
102
|
+
|
|
103
|
+
Method: create scenario matrix -> verify automated coverage -> identify gaps -> triage bugs (P0-P4) -> sign-off decision.
|
|
104
|
+
|
|
105
|
+
Bug severity: P0/P1 block sign-off, P2 QA decides, P3/P4 conditional approve.
|
|
106
|
+
|
|
107
|
+
Output: QA test plan table, bug reports, sign-off decision, HANDOFF block.
|
|
108
|
+
|
|
109
|
+
Limitations:
|
|
110
|
+
- DO NOT fix bugs — report to @debugger via @team-lead
|
|
111
|
+
- DO NOT modify code — strictly read-only
|
|
112
|
+
- DO NOT approve if P0/P1 bugs open
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Dev Role Agents (generate based on codebase layers)
|
|
116
|
+
|
|
117
|
+
### frontend.md — Generate if TECH_MANIFEST.frontend.exists
|
|
118
|
+
```yaml
|
|
119
|
+
---
|
|
120
|
+
name: frontend
|
|
121
|
+
description: Frontend specialist for {project_name}. Builds UI using {framework} {version}.
|
|
122
|
+
tools: Read, Edit, Write, Bash, Grep, Glob
|
|
123
|
+
model: sonnet
|
|
124
|
+
maxTurns: 30
|
|
125
|
+
effort: high
|
|
126
|
+
memory: project
|
|
127
|
+
isolation: worktree
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
{framework} specialist. Tech: {framework} {version}, {meta_framework}, {state_mgmt}, {styling}, {ui_library}, {test_framework}.
|
|
131
|
+
|
|
132
|
+
Components in `{component_dir}`: {naming_pattern}, {prop_pattern}, {styling_approach}.
|
|
133
|
+
Pages in `{pages_dir}`: {routing_pattern}, {data_loading_pattern}.
|
|
134
|
+
Tests in `{test_dir}`: `{test_command}`.
|
|
135
|
+
|
|
136
|
+
Method: find similar existing -> copy exact pattern -> implement -> accessibility check -> add tests -> verify build.
|
|
137
|
+
|
|
138
|
+
Output: implementation summary, files list, HANDOFF block.
|
|
139
|
+
|
|
140
|
+
Limitations:
|
|
141
|
+
- DO NOT modify backend code — @api-builder's domain
|
|
142
|
+
- DO NOT modify CI/CD — @infra's domain
|
|
143
|
+
- DO NOT skip accessibility
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### api-builder.md — Generate if backend has API routes
|
|
147
|
+
```yaml
|
|
148
|
+
---
|
|
149
|
+
name: api-builder
|
|
150
|
+
description: API endpoint specialist for {project_name}. Creates {api_style} endpoints using {framework}.
|
|
151
|
+
tools: Read, Edit, Write, Bash, Grep, Glob
|
|
152
|
+
model: sonnet
|
|
153
|
+
maxTurns: 30
|
|
154
|
+
effort: high
|
|
155
|
+
memory: project
|
|
156
|
+
isolation: worktree
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
API specialist. Routes: `{routes_dir}`, Handlers: `{handlers_dir}`, Services: `{services_dir}`, Schemas: `{schemas_dir}`.
|
|
160
|
+
|
|
161
|
+
Patterns: {route_definition}, {validation_pattern}, {response_format}, {error_format}, {auth_pattern}.
|
|
162
|
+
|
|
163
|
+
Method: find similar endpoint -> copy pattern -> route -> validation -> handler -> service -> tests -> verify.
|
|
164
|
+
DB: {orm} in `{models_dir}`, migrations: `{migration_cmd}`.
|
|
165
|
+
|
|
166
|
+
Output: endpoint summary, files list, HANDOFF block.
|
|
167
|
+
|
|
168
|
+
Limitations:
|
|
169
|
+
- DO NOT modify frontend code — @frontend's domain
|
|
170
|
+
- DO NOT modify CI/CD — @infra's domain
|
|
171
|
+
- DO NOT skip input validation
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### infra.md — Generate if Docker/k8s/Terraform/CI present
|
|
175
|
+
```yaml
|
|
176
|
+
---
|
|
177
|
+
name: infra
|
|
178
|
+
description: Infrastructure and DevOps specialist for {project_name}. Manages Docker, CI/CD, deployment.
|
|
179
|
+
tools: Read, Edit, Write, Bash, Grep, Glob
|
|
180
|
+
disallowedTools: NotebookEdit
|
|
181
|
+
model: sonnet
|
|
182
|
+
maxTurns: 30
|
|
183
|
+
effort: high
|
|
184
|
+
memory: project
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
Infra specialist. Docker: `{dockerfile}`, Compose: `{compose_file}`.
|
|
188
|
+
CI: {platform} at `{ci_config}`. Cloud: {provider}. IaC: `{iac_dir}`.
|
|
189
|
+
|
|
190
|
+
Always modify IaC files, never manual changes. Test locally before pushing.
|
|
191
|
+
|
|
192
|
+
Output: infrastructure changes, new env vars, rollback plan, HANDOFF block.
|
|
193
|
+
|
|
194
|
+
Limitations:
|
|
195
|
+
- DO NOT modify application source code — infrastructure files only
|
|
196
|
+
- DO NOT hardcode secrets
|
|
197
|
+
- Scope: Dockerfile*, docker-compose*, .github/workflows/**, k8s/**, terraform/**
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
## Additional agents to generate based on codebase:
|
|
201
|
+
- **data-engineer.md** — if data pipelines/ETL detected
|
|
202
|
+
- **ml-engineer.md** — if ML models/training detected
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: impact-analysis
|
|
3
|
+
description: Analyze the blast radius of a proposed change. Use before making significant code changes.
|
|
4
|
+
user-invocable: true
|
|
5
|
+
context: fork
|
|
6
|
+
allowed-tools: Read, Grep, Glob, Bash, Agent
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Impact Analysis: $ARGUMENTS
|
|
10
|
+
|
|
11
|
+
Run @explorer and @security in parallel.
|
|
12
|
+
|
|
13
|
+
**@explorer:** Files directly affected, modules with transitive dependencies, existing test coverage, related pending changes.
|
|
14
|
+
|
|
15
|
+
**@security:** Auth/authz code touched? User input handling? DB queries? PII? File uploads?
|
|
16
|
+
|
|
17
|
+
**Output:** Files affected (file:line refs), blast radius, test coverage %, security flags, risk level (LOW/MEDIUM/HIGH/CRITICAL), Mermaid diagram.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: metrics
|
|
3
|
+
description: Calculate aggregate task metrics — velocity, quality, cycle-time, agent performance. Use when asking about team performance or bottlenecks.
|
|
4
|
+
user-invocable: true
|
|
5
|
+
context: fork
|
|
6
|
+
allowed-tools: Read, Grep, Glob, Bash
|
|
7
|
+
argument-hint: "[velocity|quality|cycle-time|agents|blockers|all] [--period 7d|30d|90d]"
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Metrics: $ARGUMENTS
|
|
11
|
+
|
|
12
|
+
Read all `.claude/tasks/*.md` and calculate:
|
|
13
|
+
|
|
14
|
+
- **velocity** — tasks/week, throughput trend, WIP count
|
|
15
|
+
- **quality** — test pass rate, coverage trend, bug escape rate, deploy success rate, rollback frequency
|
|
16
|
+
- **cycle-time** — avg per phase, bottleneck detection, time in BLOCKED, review iteration count
|
|
17
|
+
- **agents** — tasks handled, avg duration, success rate, rework rate per agent
|
|
18
|
+
- **blockers** — total in period, avg resolution time, most common categories
|
|
19
|
+
- **all** — everything above combined
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: progress-report
|
|
3
|
+
description: Generate progress reports for different stakeholders. Use when someone asks for status updates, reports, or summaries.
|
|
4
|
+
user-invocable: true
|
|
5
|
+
context: fork
|
|
6
|
+
allowed-tools: Read, Grep, Glob, Bash
|
|
7
|
+
argument-hint: "[dev|qa|business|management|executive] [task-id|all]"
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Progress Report: $ARGUMENTS
|
|
11
|
+
|
|
12
|
+
Read task files from `.claude/tasks/` and generate audience-appropriate report.
|
|
13
|
+
|
|
14
|
+
## dev — Developer Report
|
|
15
|
+
What's done (file:line refs), what's in progress, what's next, test results, coverage, build/lint status, agent activity, open questions, commands to run.
|
|
16
|
+
|
|
17
|
+
## qa — QA Report
|
|
18
|
+
Change summary (plain language), backend/frontend/DB changes with what to test, automated test results, manual testing needed (step-by-step), regression risks, known limitations, environment setup.
|
|
19
|
+
|
|
20
|
+
## business — Business Report
|
|
21
|
+
One paragraph summary, acceptance criteria status table (VERIFIED/IN_PROGRESS/NOT_MET), progress bar per phase, estimated completion, risks in business terms, impact when delivered, decisions needed.
|
|
22
|
+
|
|
23
|
+
## management — Management Report
|
|
24
|
+
Portfolio table (all tasks with phase/status/%/ETA), health indicators (on track/at risk/overdue), blocker summary, this week's completions, key decisions needed, 30-day metrics.
|
|
25
|
+
|
|
26
|
+
## executive — Executive Summary
|
|
27
|
+
Status light (green/yellow/red), key metrics table with trends (tasks completed, cycle time, quality, deploy success, blocked), highlights, risks, needs attention.
|