agentic-sdlc-wizard 1.15.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/CHANGELOG.md +343 -0
- package/CLAUDE_CODE_SDLC_WIZARD.md +3470 -0
- package/README.md +199 -0
- package/cli/bin/sdlc-wizard.js +49 -0
- package/cli/init.js +136 -0
- package/cli/templates/hooks/instructions-loaded-check.sh +23 -0
- package/cli/templates/hooks/sdlc-prompt-check.sh +27 -0
- package/cli/templates/hooks/tdd-pretool-check.sh +20 -0
- package/cli/templates/settings.json +35 -0
- package/cli/templates/skills/sdlc/SKILL.md +363 -0
- package/cli/templates/skills/testing/SKILL.md +97 -0
- package/package.json +29 -0
package/README.md
ADDED
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
# Claude Code SDLC Wizard
|
|
2
|
+
|
|
3
|
+
A **self-evolving SDLC enforcement system for AI coding agents**. Makes Claude plan before coding, test before shipping, and ask when uncertain. Measures itself getting better over time.
|
|
4
|
+
|
|
5
|
+
## What This Actually Is
|
|
6
|
+
|
|
7
|
+
Five layers working together:
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
Layer 5: SELF-IMPROVEMENT
|
|
11
|
+
Weekly/monthly workflows detect changes, test them
|
|
12
|
+
statistically, create PRs. Baselines evolve organically.
|
|
13
|
+
|
|
14
|
+
Layer 4: STATISTICAL VALIDATION
|
|
15
|
+
E2E scoring with 95% CI (5 trials, t-distribution).
|
|
16
|
+
SDP normalizes for model quality. CUSUM catches drift.
|
|
17
|
+
|
|
18
|
+
Layer 3: SCORING ENGINE
|
|
19
|
+
7 criteria, 10/11 points. Claude evaluates Claude.
|
|
20
|
+
Before/after wizard A/B comparison in CI.
|
|
21
|
+
|
|
22
|
+
Layer 2: ENFORCEMENT
|
|
23
|
+
Hooks fire every interaction (~100 tokens).
|
|
24
|
+
PreToolUse blocks source edits without tests.
|
|
25
|
+
|
|
26
|
+
Layer 1: PHILOSOPHY
|
|
27
|
+
The wizard document. KISS. TDD. Confidence levels.
|
|
28
|
+
Copy it, run setup, get a bespoke SDLC.
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Why Someone Uses This
|
|
32
|
+
|
|
33
|
+
You want Claude Code to follow engineering discipline automatically:
|
|
34
|
+
- **Plan before coding** (not guess-and-check)
|
|
35
|
+
- **Write tests first** (TDD enforced via hooks)
|
|
36
|
+
- **State confidence** (LOW = ask user, don't guess)
|
|
37
|
+
- **Track work visibly** (TaskCreate)
|
|
38
|
+
- **Self-review before presenting**
|
|
39
|
+
- **Prove it's better** (use native features unless you prove custom wins)
|
|
40
|
+
|
|
41
|
+
The wizard auto-detects your stack (package.json, test framework, deployment targets) and generates bespoke hooks + skills + docs. CI validates the generated assets; cross-stack setup-path E2E is on the [roadmap](ROADMAP.md).
|
|
42
|
+
|
|
43
|
+
## What Makes This Different
|
|
44
|
+
|
|
45
|
+
| Capability | What It Does |
|
|
46
|
+
|---|---|
|
|
47
|
+
| **E2E scoring in CI** | Every PR gets an automated SDLC compliance score (0-10) — measures whether Claude actually planned, tested, and reviewed |
|
|
48
|
+
| **Before/after A/B testing** | Compares wizard changes against a baseline with 95% confidence intervals to prove improvements aren't noise |
|
|
49
|
+
| **SDP normalization** | Separates "the model had a bad day" from "our SDLC broke" by cross-referencing external benchmarks |
|
|
50
|
+
| **CUSUM drift detection** | Catches gradual quality decay over time — borrowed from manufacturing quality control |
|
|
51
|
+
| **Pre-tool TDD hooks** | Claude can't write code without writing tests first — enforced at the hook level, not just guidance |
|
|
52
|
+
| **Self-evolving loop** | Weekly/monthly external research + CI friction signals from self-heal — you approve, the system gets better |
|
|
53
|
+
|
|
54
|
+
## How It Works
|
|
55
|
+
|
|
56
|
+
**Think Iron Man:** Jarvis is nothing without Tony Stark. Tony Stark is still Tony Stark. But together? They make Iron Man. This SDLC is your suit - you build it over time, improve it for your needs, and it makes you both better.
|
|
57
|
+
|
|
58
|
+
**The dream:** Mold an ever-evolving SDLC to your needs. Replace my components with native Claude Code features as they ship — and one day, delete this repo entirely because Claude Code has them all built in. That's the goal.
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
WIZARD FILE (CLAUDE_CODE_SDLC_WIZARD.md)
|
|
62
|
+
- Setup guide, used once
|
|
63
|
+
- Lives on GitHub, fetched when needed
|
|
64
|
+
|
|
|
65
|
+
| generates
|
|
66
|
+
v
|
|
67
|
+
GENERATED FILES (in your repo)
|
|
68
|
+
- .claude/hooks/*.sh
|
|
69
|
+
- .claude/skills/*/SKILL.md
|
|
70
|
+
- .claude/settings.json
|
|
71
|
+
- CLAUDE.md, SDLC.md, TESTING.md, ARCHITECTURE.md
|
|
72
|
+
|
|
|
73
|
+
| validated by
|
|
74
|
+
v
|
|
75
|
+
CI/CD PIPELINE
|
|
76
|
+
- E2E: simulate SDLC task -> score 0-10
|
|
77
|
+
- Before/after: main vs PR wizard
|
|
78
|
+
- Statistical: 5x trials, 95% CI
|
|
79
|
+
- Model-aware: SDP adjusts for external conditions
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Using It
|
|
83
|
+
|
|
84
|
+
**One command (recommended):**
|
|
85
|
+
```bash
|
|
86
|
+
npx agentic-sdlc-wizard init
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Installs hooks, skills, settings, and the wizard doc. Then start Claude Code and tell it "Run the SDLC wizard setup" — it'll scan your project and generate bespoke CLAUDE.md, SDLC.md, TESTING.md, and ARCHITECTURE.md.
|
|
90
|
+
|
|
91
|
+
**From GitHub (no npm needed):**
|
|
92
|
+
```bash
|
|
93
|
+
npx github:BaseInfinity/agentic-ai-sdlc-wizard init
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
**Manual:** Download `CLAUDE_CODE_SDLC_WIZARD.md` to your project and follow setup instructions inside.
|
|
97
|
+
|
|
98
|
+
**Check for updates:** Ask Claude "Check if the SDLC wizard has updates" — it reads [CHANGELOG.md](CHANGELOG.md), shows what's new, and offers to apply changes (opt-in each).
|
|
99
|
+
|
|
100
|
+
## Self-Evolving System
|
|
101
|
+
|
|
102
|
+
| Cadence | Source | Action |
|
|
103
|
+
|---------|--------|--------|
|
|
104
|
+
| Weekly | Claude Code releases | PR with analysis + E2E test |
|
|
105
|
+
| Weekly | Community (Reddit, HN) | Issue digest |
|
|
106
|
+
| Monthly | Deep research, papers | Trend report |
|
|
107
|
+
|
|
108
|
+
Every update: regression tested -> AI reviewed -> human approved.
|
|
109
|
+
|
|
110
|
+
## E2E Scoring
|
|
111
|
+
|
|
112
|
+
Like evaluating scientific method adherence - we measure **process compliance**:
|
|
113
|
+
|
|
114
|
+
| Criterion | Points | Type |
|
|
115
|
+
|-----------|--------|------|
|
|
116
|
+
| TodoWrite/TaskCreate | 1 | Deterministic |
|
|
117
|
+
| Confidence stated | 1 | Deterministic |
|
|
118
|
+
| Plan mode | 2 | AI-judge |
|
|
119
|
+
| TDD RED | 2 | Deterministic |
|
|
120
|
+
| TDD GREEN | 2 | AI-judge |
|
|
121
|
+
| Self-review | 1 | AI-judge |
|
|
122
|
+
| Clean code | 1 | AI-judge |
|
|
123
|
+
|
|
124
|
+
40% deterministic + 60% AI-judged. 5 trials handle variance.
|
|
125
|
+
|
|
126
|
+
## Model-Adjusted Scoring (SDP)
|
|
127
|
+
|
|
128
|
+
| Metric | Meaning |
|
|
129
|
+
|--------|---------|
|
|
130
|
+
| **Raw** | Actual score (Layer 2: SDLC compliance) |
|
|
131
|
+
| **SDP** | Adjusted for model conditions |
|
|
132
|
+
| **Robustness** | How well SDLC holds up vs model changes |
|
|
133
|
+
|
|
134
|
+
- **Robustness < 1.0** = SDLC is resilient (good!)
|
|
135
|
+
- **Robustness > 1.0** = SDLC is sensitive (investigate)
|
|
136
|
+
|
|
137
|
+
## Tests Are The Building Blocks
|
|
138
|
+
|
|
139
|
+
Tests aren't just validation - they're the foundation everything else builds on.
|
|
140
|
+
|
|
141
|
+
- **Tests >= App Code** - Critique tests as hard (or harder) than implementation
|
|
142
|
+
- **Tests prove correctness** - Without them, you're just hoping
|
|
143
|
+
- **Tests enable fearless change** - Refactor confidently
|
|
144
|
+
|
|
145
|
+
## Official Plugin Integration
|
|
146
|
+
|
|
147
|
+
| Plugin | Purpose | Scope |
|
|
148
|
+
|--------|---------|-------|
|
|
149
|
+
| `claude-md-management` | **Required** - CLAUDE.md maintenance | CLAUDE.md only |
|
|
150
|
+
| `claude-code-setup` | Recommends automations | Recommendations |
|
|
151
|
+
| `code-review` | PR review (optional) | PRs only |
|
|
152
|
+
|
|
153
|
+
## Prove It's Better
|
|
154
|
+
|
|
155
|
+
Don't reinvent the wheel. Use native/built-in features UNLESS you prove your custom version is better. If you can't prove it, delete yours.
|
|
156
|
+
|
|
157
|
+
1. Test the native solution — measure quality, speed, reliability
|
|
158
|
+
2. Test your custom solution — same scenario, same metrics
|
|
159
|
+
3. Compare side-by-side
|
|
160
|
+
4. Native >= custom? **Use native. Delete yours.**
|
|
161
|
+
5. Custom > native? **Keep yours. Document WHY.** Re-evaluate when native improves.
|
|
162
|
+
|
|
163
|
+
This applies to everything: native commands vs custom skills, framework utilities vs hand-rolled code, library functions vs custom implementations.
|
|
164
|
+
|
|
165
|
+
## How This Compares
|
|
166
|
+
|
|
167
|
+
This isn't the only Claude Code SDLC tool. Here's an honest comparison:
|
|
168
|
+
|
|
169
|
+
| Aspect | SDLC Wizard | everything-claude-code | claude-sdlc |
|
|
170
|
+
|--------|------------|----------------------|-------------|
|
|
171
|
+
| **Focus** | SDLC enforcement + measurement | Agent performance optimization | Plugin marketplace |
|
|
172
|
+
| **Hooks** | 3 (SDLC, TDD, instructions) | 12+ (dev blocker, prettier, etc.) | Webhook watcher |
|
|
173
|
+
| **Skills** | 2 (/sdlc, /testing) | 80+ domain-specific | 13 slash commands |
|
|
174
|
+
| **Evaluation** | 95% CI, CUSUM, SDP, Tier 1/2 | Configuration testing | skilltest framework |
|
|
175
|
+
| **Self-healing** | CI auto-fix + re-trigger | No | No |
|
|
176
|
+
| **Auto-updates** | Weekly CC + community scan | No | No |
|
|
177
|
+
| **Install** | `npx agentic-sdlc-wizard init` | npm install | npm install |
|
|
178
|
+
| **Philosophy** | Lightweight, prove-it-or-delete | Scale and optimization | Documentation-first |
|
|
179
|
+
|
|
180
|
+
**Our unique strengths:** Statistical rigor (CUSUM + 95% CI), SDP scoring (model quality vs SDLC compliance), self-healing CI, Prove-It A/B pipeline, comprehensive automated test suite, dogfooding enforcement.
|
|
181
|
+
|
|
182
|
+
**Where others are stronger:** everything-claude-code has broader language/framework coverage. claude-sdlc has webhook-driven automation. Both have npm distribution.
|
|
183
|
+
|
|
184
|
+
**The spirit:** Open source — we learn from each other. See [COMPETITIVE_AUDIT.md](COMPETITIVE_AUDIT.md) for details.
|
|
185
|
+
|
|
186
|
+
## Documentation
|
|
187
|
+
|
|
188
|
+
| Document | What It Covers |
|
|
189
|
+
|----------|---------------|
|
|
190
|
+
| [ARCHITECTURE.md](ARCHITECTURE.md) | System design, 5-layer diagram, data flows, file structure |
|
|
191
|
+
| [CI_CD.md](CI_CD.md) | All 5 workflows, E2E scoring, tier system, SDP, integrity checks |
|
|
192
|
+
| [SDLC.md](SDLC.md) | Version tracking, enforcement rules, SDLC configuration |
|
|
193
|
+
| [TESTING.md](TESTING.md) | Testing philosophy, test diamond, TDD approach |
|
|
194
|
+
| [CHANGELOG.md](CHANGELOG.md) | Version history, what changed and when |
|
|
195
|
+
| [CONTRIBUTING.md](CONTRIBUTING.md) | How to contribute, evaluation methodology |
|
|
196
|
+
|
|
197
|
+
## Contributing
|
|
198
|
+
|
|
199
|
+
PRs welcome. See [CONTRIBUTING.md](CONTRIBUTING.md) for evaluation methodology and testing.
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const { version } = require('../../package.json');
|
|
5
|
+
const { init } = require('../init');
|
|
6
|
+
|
|
7
|
+
const args = process.argv.slice(2);
|
|
8
|
+
|
|
9
|
+
const flags = {
|
|
10
|
+
force: args.includes('--force'),
|
|
11
|
+
dryRun: args.includes('--dry-run'),
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const command = args.find((a) => !a.startsWith('--'));
|
|
15
|
+
|
|
16
|
+
if (args.includes('--version') || args.includes('-v')) {
|
|
17
|
+
console.log(version);
|
|
18
|
+
process.exit(0);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (args.includes('--help') || args.includes('-h') || !command) {
|
|
22
|
+
console.log(`
|
|
23
|
+
agentic-sdlc-wizard v${version}
|
|
24
|
+
|
|
25
|
+
Usage:
|
|
26
|
+
sdlc-wizard init [options] Install SDLC wizard into current directory
|
|
27
|
+
|
|
28
|
+
Options:
|
|
29
|
+
--force Overwrite existing files
|
|
30
|
+
--dry-run Preview changes without writing
|
|
31
|
+
--version Show version
|
|
32
|
+
--help Show this help
|
|
33
|
+
`.trim());
|
|
34
|
+
process.exit(0);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (command === 'init') {
|
|
38
|
+
try {
|
|
39
|
+
init(process.cwd(), flags);
|
|
40
|
+
process.exit(0);
|
|
41
|
+
} catch (err) {
|
|
42
|
+
console.error(`Error: ${err.message}`);
|
|
43
|
+
process.exit(1);
|
|
44
|
+
}
|
|
45
|
+
} else {
|
|
46
|
+
console.error(`Unknown command: ${command}`);
|
|
47
|
+
console.error('Run "sdlc-wizard --help" for usage.');
|
|
48
|
+
process.exit(1);
|
|
49
|
+
}
|
package/cli/init.js
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
|
|
6
|
+
const RESET = '\x1b[0m';
|
|
7
|
+
const GREEN = '\x1b[32m';
|
|
8
|
+
const YELLOW = '\x1b[33m';
|
|
9
|
+
const CYAN = '\x1b[36m';
|
|
10
|
+
|
|
11
|
+
const TEMPLATES_DIR = path.join(__dirname, 'templates');
|
|
12
|
+
const WIZARD_DOC = path.join(__dirname, '..', 'CLAUDE_CODE_SDLC_WIZARD.md');
|
|
13
|
+
|
|
14
|
+
const FILES = [
|
|
15
|
+
{ src: 'settings.json', dest: '.claude/settings.json' },
|
|
16
|
+
{ src: 'hooks/sdlc-prompt-check.sh', dest: '.claude/hooks/sdlc-prompt-check.sh', executable: true },
|
|
17
|
+
{ src: 'hooks/tdd-pretool-check.sh', dest: '.claude/hooks/tdd-pretool-check.sh', executable: true },
|
|
18
|
+
{ src: 'hooks/instructions-loaded-check.sh', dest: '.claude/hooks/instructions-loaded-check.sh', executable: true },
|
|
19
|
+
{ src: 'skills/sdlc/SKILL.md', dest: '.claude/skills/sdlc/SKILL.md' },
|
|
20
|
+
{ src: 'skills/testing/SKILL.md', dest: '.claude/skills/testing/SKILL.md' },
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
const GITIGNORE_ENTRIES = ['.claude/plans/', '.claude/settings.local.json'];
|
|
24
|
+
|
|
25
|
+
function planOperations(targetDir, { force }) {
|
|
26
|
+
const ops = [];
|
|
27
|
+
|
|
28
|
+
for (const file of FILES) {
|
|
29
|
+
const destPath = path.join(targetDir, file.dest);
|
|
30
|
+
const exists = fs.existsSync(destPath);
|
|
31
|
+
ops.push({
|
|
32
|
+
src: path.join(TEMPLATES_DIR, file.src),
|
|
33
|
+
dest: destPath,
|
|
34
|
+
relativeDest: file.dest,
|
|
35
|
+
action: exists ? (force ? 'OVERWRITE' : 'SKIP') : 'CREATE',
|
|
36
|
+
executable: file.executable || false,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Wizard doc
|
|
41
|
+
const wizardDest = path.join(targetDir, 'CLAUDE_CODE_SDLC_WIZARD.md');
|
|
42
|
+
const wizardExists = fs.existsSync(wizardDest);
|
|
43
|
+
ops.push({
|
|
44
|
+
src: WIZARD_DOC,
|
|
45
|
+
dest: wizardDest,
|
|
46
|
+
relativeDest: 'CLAUDE_CODE_SDLC_WIZARD.md',
|
|
47
|
+
action: wizardExists ? (force ? 'OVERWRITE' : 'SKIP') : 'CREATE',
|
|
48
|
+
executable: false,
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
return ops;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function ensureDir(filePath) {
|
|
55
|
+
fs.mkdirSync(path.dirname(filePath), { recursive: true });
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function executeOperations(ops) {
|
|
59
|
+
for (const op of ops) {
|
|
60
|
+
if (op.action === 'SKIP') continue;
|
|
61
|
+
ensureDir(op.dest);
|
|
62
|
+
fs.copyFileSync(op.src, op.dest);
|
|
63
|
+
if (op.executable) {
|
|
64
|
+
fs.chmodSync(op.dest, 0o755);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function updateGitignore(targetDir, { dryRun }) {
|
|
70
|
+
const gitignorePath = path.join(targetDir, '.gitignore');
|
|
71
|
+
let content = '';
|
|
72
|
+
if (fs.existsSync(gitignorePath)) {
|
|
73
|
+
content = fs.readFileSync(gitignorePath, 'utf8');
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const toAdd = GITIGNORE_ENTRIES.filter((entry) => !content.includes(entry));
|
|
77
|
+
if (toAdd.length === 0) return [];
|
|
78
|
+
|
|
79
|
+
if (!dryRun) {
|
|
80
|
+
const suffix = (content && !content.endsWith('\n') ? '\n' : '') + toAdd.join('\n') + '\n';
|
|
81
|
+
fs.appendFileSync(gitignorePath, suffix);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return toAdd;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function printOps(ops) {
|
|
88
|
+
for (const op of ops) {
|
|
89
|
+
const color = op.action === 'CREATE' ? GREEN : op.action === 'SKIP' ? YELLOW : CYAN;
|
|
90
|
+
console.log(` ${color}${op.action}${RESET} ${op.relativeDest}`);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function init(targetDir, { force = false, dryRun = false } = {}) {
|
|
95
|
+
const ops = planOperations(targetDir, { force });
|
|
96
|
+
|
|
97
|
+
if (dryRun) {
|
|
98
|
+
console.log('Dry run — no files will be written:\n');
|
|
99
|
+
printOps(ops);
|
|
100
|
+
const gitignoreAdds = updateGitignore(targetDir, { dryRun: true });
|
|
101
|
+
if (gitignoreAdds.length > 0) {
|
|
102
|
+
console.log(` ${GREEN}APPEND${RESET} .gitignore (${gitignoreAdds.join(', ')})`);
|
|
103
|
+
}
|
|
104
|
+
return true;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
console.log('');
|
|
108
|
+
printOps(ops);
|
|
109
|
+
|
|
110
|
+
if (ops.every((o) => o.action === 'SKIP')) {
|
|
111
|
+
console.log('\nAll files already exist. Use --force to overwrite.');
|
|
112
|
+
return true;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
executeOperations(ops);
|
|
116
|
+
|
|
117
|
+
const gitignoreAdds = updateGitignore(targetDir, { dryRun: false });
|
|
118
|
+
if (gitignoreAdds.length > 0) {
|
|
119
|
+
console.log(` ${GREEN}APPEND${RESET} .gitignore (${gitignoreAdds.join(', ')})`);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
console.log(`
|
|
123
|
+
${GREEN}SDLC Wizard installed successfully!${RESET}
|
|
124
|
+
|
|
125
|
+
Next steps:
|
|
126
|
+
1. Start Claude Code in this directory
|
|
127
|
+
2. Tell Claude: "Run the SDLC wizard setup"
|
|
128
|
+
3. Claude will scan your project and create CLAUDE.md, SDLC.md, TESTING.md, ARCHITECTURE.md
|
|
129
|
+
|
|
130
|
+
The wizard doc is at: CLAUDE_CODE_SDLC_WIZARD.md
|
|
131
|
+
`);
|
|
132
|
+
|
|
133
|
+
return true;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
module.exports = { init, planOperations, GITIGNORE_ENTRIES };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# InstructionsLoaded hook - validates SDLC files exist at session start
|
|
3
|
+
# Fires when Claude loads instructions (session start/resume)
|
|
4
|
+
# Available since Claude Code v2.1.69
|
|
5
|
+
# Note: no set -e — this hook must always exit 0 to not block session start
|
|
6
|
+
|
|
7
|
+
PROJECT_DIR="${CLAUDE_PROJECT_DIR:-.}"
|
|
8
|
+
MISSING=""
|
|
9
|
+
|
|
10
|
+
if [ ! -f "$PROJECT_DIR/SDLC.md" ]; then
|
|
11
|
+
MISSING="${MISSING:+${MISSING}, }SDLC.md"
|
|
12
|
+
fi
|
|
13
|
+
|
|
14
|
+
if [ ! -f "$PROJECT_DIR/TESTING.md" ]; then
|
|
15
|
+
MISSING="${MISSING:+${MISSING}, }TESTING.md"
|
|
16
|
+
fi
|
|
17
|
+
|
|
18
|
+
if [ -n "$MISSING" ]; then
|
|
19
|
+
echo "WARNING: Missing SDLC wizard files: ${MISSING}"
|
|
20
|
+
echo "Run the wizard setup to generate them."
|
|
21
|
+
fi
|
|
22
|
+
|
|
23
|
+
exit 0
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Light SDLC hook - baseline reminder every prompt (~100 tokens)
|
|
3
|
+
# Full guidance in skills: .claude/skills/sdlc/ and .claude/skills/testing/
|
|
4
|
+
|
|
5
|
+
cat << 'EOF'
|
|
6
|
+
SDLC BASELINE:
|
|
7
|
+
1. TodoWrite FIRST (plan tasks before coding)
|
|
8
|
+
2. STATE CONFIDENCE: HIGH/MEDIUM/LOW
|
|
9
|
+
3. LOW confidence? ASK USER before proceeding
|
|
10
|
+
4. FAILED 2x? STOP and ASK USER
|
|
11
|
+
5. ALL TESTS MUST PASS BEFORE COMMIT - NO EXCEPTIONS
|
|
12
|
+
|
|
13
|
+
AUTO-INVOKE SKILLS (Claude MUST do this FIRST):
|
|
14
|
+
- implement/fix/refactor/feature/bug/build → Invoke: Skill tool, skill="sdlc"
|
|
15
|
+
- test/TDD/write test (standalone) → Invoke: Skill tool, skill="testing"
|
|
16
|
+
- If BOTH match (e.g., "fix the test") → sdlc takes precedence (includes TDD)
|
|
17
|
+
- DON'T invoke for: questions, explanations, reading/exploring code, simple queries
|
|
18
|
+
- DON'T wait for user to type /sdlc - AUTO-INVOKE based on task type
|
|
19
|
+
|
|
20
|
+
Workflow phases:
|
|
21
|
+
1. Plan Mode (research) → Present approach + confidence
|
|
22
|
+
2. Transition (update docs) → Request /compact
|
|
23
|
+
3. Implementation (TDD after compact)
|
|
24
|
+
4. SELF-REVIEW (/code-review) → BEFORE presenting to user
|
|
25
|
+
|
|
26
|
+
Quick refs: SDLC.md | TESTING.md | *_PLAN.md for feature
|
|
27
|
+
EOF
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# PreToolUse hook - TDD enforcement before editing source files
|
|
3
|
+
# Fires before Write/Edit/MultiEdit tools
|
|
4
|
+
|
|
5
|
+
# Read the tool input (JSON with file_path, content, etc.)
|
|
6
|
+
TOOL_INPUT=$(cat)
|
|
7
|
+
|
|
8
|
+
# Extract the file path being edited (requires jq)
|
|
9
|
+
FILE_PATH=$(echo "$TOOL_INPUT" | jq -r '.tool_input.file_path // empty')
|
|
10
|
+
|
|
11
|
+
# CUSTOMIZE: Change this pattern to match YOUR source directory
|
|
12
|
+
# Examples: "/src/", "/app/", "/lib/", "/packages/", "/server/"
|
|
13
|
+
if [[ "$FILE_PATH" == *"/src/"* ]]; then
|
|
14
|
+
# Output additionalContext that Claude will read
|
|
15
|
+
cat << 'EOF'
|
|
16
|
+
{"hookSpecificOutput": {"hookEventName": "PreToolUse", "additionalContext": "TDD CHECK: Are you writing IMPLEMENTATION before a FAILING TEST? If yes, STOP. Write the test first (TDD RED), then implement (TDD GREEN)."}}
|
|
17
|
+
EOF
|
|
18
|
+
fi
|
|
19
|
+
|
|
20
|
+
# No output = allow the tool to proceed
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"hooks": {
|
|
3
|
+
"UserPromptSubmit": [
|
|
4
|
+
{
|
|
5
|
+
"hooks": [
|
|
6
|
+
{
|
|
7
|
+
"type": "command",
|
|
8
|
+
"command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/sdlc-prompt-check.sh"
|
|
9
|
+
}
|
|
10
|
+
]
|
|
11
|
+
}
|
|
12
|
+
],
|
|
13
|
+
"PreToolUse": [
|
|
14
|
+
{
|
|
15
|
+
"matcher": "Write|Edit|MultiEdit",
|
|
16
|
+
"hooks": [
|
|
17
|
+
{
|
|
18
|
+
"type": "command",
|
|
19
|
+
"command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/tdd-pretool-check.sh"
|
|
20
|
+
}
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
],
|
|
24
|
+
"InstructionsLoaded": [
|
|
25
|
+
{
|
|
26
|
+
"hooks": [
|
|
27
|
+
{
|
|
28
|
+
"type": "command",
|
|
29
|
+
"command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/instructions-loaded-check.sh"
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
]
|
|
34
|
+
}
|
|
35
|
+
}
|