create-shhs 1.0.0 → 1.1.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/INSTALLATION-GUIDE.md +424 -0
- package/README.md +16 -8
- package/UPDATE-GUIDE.md +500 -0
- package/bin/install.js +20 -0
- package/bin/update.js +396 -0
- package/package.json +8 -6
- package/template/.ai/.shhs-version +1 -0
- package/template/.ai/agents/architecture-reviewer.md +92 -0
- package/template/.ai/agents/fitness-enforcer.md +408 -0
- package/template/.ai/agents/knowledge-curator.md +242 -0
- package/template/.ai/architecture/governance/.gitkeep +7 -0
- package/template/.ai/architecture/governance/fitness/README.md +410 -0
- package/template/.ai/architecture/governance/fitness/config.json +48 -0
- package/template/.ai/architecture/governance/fitness/exemptions.json +20 -0
- package/template/.ai/architecture/governance/fitness/rules.json +102 -0
- package/template/.ai/governance/constitution.md +260 -0
- package/template/.ai/governance/definition-of-done.md +481 -0
- package/template/.ai/knowledge/knowledge-base.md +210 -0
- package/template/.ai/reports/fitness-results.json +201 -0
- package/template/.ai/skills/context7/skill.md +458 -0
- package/template/.ai/skills/playwright/skill.md +565 -0
- package/template/.ai/skills/tdd/skill.md +416 -0
- package/template/CLAUDE.md +51 -13
|
@@ -0,0 +1,416 @@
|
|
|
1
|
+
# Skill: Test-Driven Development (TDD)
|
|
2
|
+
|
|
3
|
+
**ID:** `tdd`
|
|
4
|
+
**Version:** 1.0.0
|
|
5
|
+
**Status:** MANDATORY
|
|
6
|
+
**Authority:** Constitution Article II
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## When to Apply
|
|
11
|
+
|
|
12
|
+
This skill is MANDATORY for ALL feature development.
|
|
13
|
+
|
|
14
|
+
No exceptions. If you believe TDD is impractical, the feature is incorrectly scoped.
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## The Cycle
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
RED → GREEN → REFACTOR
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Every feature must go through this cycle at least once.
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Phase 1: RED
|
|
29
|
+
|
|
30
|
+
### Objective
|
|
31
|
+
|
|
32
|
+
Write a failing test that specifies the desired behavior.
|
|
33
|
+
|
|
34
|
+
### Steps
|
|
35
|
+
|
|
36
|
+
1. **Create test file**
|
|
37
|
+
- Convention: `[module].test.ts` or `[module].spec.ts`
|
|
38
|
+
- Location: Mirror source structure (e.g., `src/services/user.service.ts` → `src/services/user.service.test.ts`)
|
|
39
|
+
|
|
40
|
+
2. **Write the test**
|
|
41
|
+
```typescript
|
|
42
|
+
describe('UserService', () => {
|
|
43
|
+
it('should create a new user with valid email', async () => {
|
|
44
|
+
const userService = new UserService();
|
|
45
|
+
const user = await userService.createUser({
|
|
46
|
+
email: 'test@example.com',
|
|
47
|
+
name: 'Test User'
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
expect(user).toBeDefined();
|
|
51
|
+
expect(user.email).toBe('test@example.com');
|
|
52
|
+
expect(user.id).toBeTruthy();
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
3. **Run the test**
|
|
58
|
+
```bash
|
|
59
|
+
npm test -- user.service.test.ts
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
4. **Verify it fails for the right reason**
|
|
63
|
+
- ✅ Good failure: "UserService is not defined"
|
|
64
|
+
- ✅ Good failure: "createUser is not a function"
|
|
65
|
+
- ❌ Bad failure: "SyntaxError: unexpected token"
|
|
66
|
+
- ❌ Bad failure: "Cannot import module" (setup issue, not test failure)
|
|
67
|
+
|
|
68
|
+
### Validation Checklist
|
|
69
|
+
|
|
70
|
+
- [ ] Test file created
|
|
71
|
+
- [ ] Test executes (even if it fails)
|
|
72
|
+
- [ ] Failure message clearly indicates missing functionality
|
|
73
|
+
- [ ] No syntax errors or import issues
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## Phase 2: GREEN
|
|
78
|
+
|
|
79
|
+
### Objective
|
|
80
|
+
|
|
81
|
+
Write the MINIMUM code to make the test pass.
|
|
82
|
+
|
|
83
|
+
### Steps
|
|
84
|
+
|
|
85
|
+
1. **Create implementation file** (if it doesn't exist)
|
|
86
|
+
```typescript
|
|
87
|
+
// src/services/user.service.ts
|
|
88
|
+
export class UserService {
|
|
89
|
+
async createUser(data: { email: string; name: string }) {
|
|
90
|
+
// MINIMAL implementation
|
|
91
|
+
return {
|
|
92
|
+
id: '1',
|
|
93
|
+
email: data.email,
|
|
94
|
+
name: data.name
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
2. **Run the test again**
|
|
101
|
+
```bash
|
|
102
|
+
npm test -- user.service.test.ts
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
3. **Verify it passes**
|
|
106
|
+
- ✅ All assertions pass
|
|
107
|
+
- ✅ No warnings or errors
|
|
108
|
+
|
|
109
|
+
### Anti-Patterns to Avoid
|
|
110
|
+
|
|
111
|
+
❌ **Over-engineering during GREEN phase**
|
|
112
|
+
```typescript
|
|
113
|
+
// BAD: Adding features not required by test
|
|
114
|
+
async createUser(data: UserInput) {
|
|
115
|
+
await this.validateEmail(data.email); // Not tested yet!
|
|
116
|
+
await this.checkDuplicates(data.email); // Not tested yet!
|
|
117
|
+
return this.repository.save(data); // Not tested yet!
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
✅ **Correct GREEN phase**
|
|
122
|
+
```typescript
|
|
123
|
+
// GOOD: Minimal code to pass current test
|
|
124
|
+
async createUser(data: { email: string; name: string }) {
|
|
125
|
+
return {
|
|
126
|
+
id: crypto.randomUUID(),
|
|
127
|
+
email: data.email,
|
|
128
|
+
name: data.name
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Validation Checklist
|
|
134
|
+
|
|
135
|
+
- [ ] Test passes
|
|
136
|
+
- [ ] No additional functionality beyond what test requires
|
|
137
|
+
- [ ] No refactoring done yet (save for next phase)
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## Phase 3: REFACTOR
|
|
142
|
+
|
|
143
|
+
### Objective
|
|
144
|
+
|
|
145
|
+
Improve code structure WITHOUT changing behavior.
|
|
146
|
+
|
|
147
|
+
### Steps
|
|
148
|
+
|
|
149
|
+
1. **Identify code smells**
|
|
150
|
+
- Duplication
|
|
151
|
+
- Long functions
|
|
152
|
+
- Unclear variable names
|
|
153
|
+
- Hard-coded values
|
|
154
|
+
- Poor separation of concerns
|
|
155
|
+
|
|
156
|
+
2. **Refactor incrementally**
|
|
157
|
+
```typescript
|
|
158
|
+
// Before refactoring
|
|
159
|
+
async createUser(data: { email: string; name: string }) {
|
|
160
|
+
return {
|
|
161
|
+
id: crypto.randomUUID(),
|
|
162
|
+
email: data.email,
|
|
163
|
+
name: data.name
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// After refactoring
|
|
168
|
+
async createUser(data: CreateUserInput): Promise<User> {
|
|
169
|
+
const id = this.generateId();
|
|
170
|
+
return this.buildUserObject(id, data);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
private generateId(): string {
|
|
174
|
+
return crypto.randomUUID();
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
private buildUserObject(id: string, data: CreateUserInput): User {
|
|
178
|
+
return { id, ...data };
|
|
179
|
+
}
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
3. **Run tests after EACH refactoring**
|
|
183
|
+
```bash
|
|
184
|
+
npm test
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
4. **Verify tests still pass**
|
|
188
|
+
- ✅ All tests green
|
|
189
|
+
- ✅ No new warnings
|
|
190
|
+
- ✅ Code is cleaner
|
|
191
|
+
|
|
192
|
+
### Refactoring Patterns
|
|
193
|
+
|
|
194
|
+
| Smell | Refactoring |
|
|
195
|
+
|-------|-------------|
|
|
196
|
+
| Duplicated code | Extract method |
|
|
197
|
+
| Long function | Split into smaller functions |
|
|
198
|
+
| Magic numbers | Extract to named constants |
|
|
199
|
+
| Unclear names | Rename variable/function |
|
|
200
|
+
| God class | Extract class |
|
|
201
|
+
|
|
202
|
+
### Validation Checklist
|
|
203
|
+
|
|
204
|
+
- [ ] Code is clearer than before
|
|
205
|
+
- [ ] All tests still pass
|
|
206
|
+
- [ ] No new functionality added
|
|
207
|
+
- [ ] Committed separately from GREEN phase
|
|
208
|
+
|
|
209
|
+
---
|
|
210
|
+
|
|
211
|
+
## Iteration
|
|
212
|
+
|
|
213
|
+
After REFACTOR, return to RED to add the next increment of functionality.
|
|
214
|
+
|
|
215
|
+
**Example Iteration:**
|
|
216
|
+
1. RED: Test user email validation
|
|
217
|
+
2. GREEN: Add email regex check
|
|
218
|
+
3. REFACTOR: Extract validation to separate validator class
|
|
219
|
+
4. RED: Test duplicate email detection
|
|
220
|
+
5. GREEN: Add database query for existing email
|
|
221
|
+
6. REFACTOR: Extract database logic to repository
|
|
222
|
+
7. Continue...
|
|
223
|
+
|
|
224
|
+
---
|
|
225
|
+
|
|
226
|
+
## Integration with SHHS
|
|
227
|
+
|
|
228
|
+
### Pipeline Position
|
|
229
|
+
|
|
230
|
+
TDD occurs during **Developer Agent** phase.
|
|
231
|
+
|
|
232
|
+
```
|
|
233
|
+
Architect defines contract
|
|
234
|
+
↓
|
|
235
|
+
Developer applies TDD skill ← YOU ARE HERE
|
|
236
|
+
↓
|
|
237
|
+
Static Reviewer validates structure
|
|
238
|
+
↓
|
|
239
|
+
QA Validator runs tests
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
### Validation by Static Reviewer
|
|
243
|
+
|
|
244
|
+
Static Reviewer MUST verify git history shows test files modified BEFORE implementation files.
|
|
245
|
+
|
|
246
|
+
```bash
|
|
247
|
+
# Validation command
|
|
248
|
+
git log --oneline --name-status | grep -E "(test|spec)\."
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
Expected pattern:
|
|
252
|
+
```
|
|
253
|
+
M src/services/user.service.test.ts (commit 1 - RED)
|
|
254
|
+
M src/services/user.service.ts (commit 2 - GREEN)
|
|
255
|
+
M src/services/user.service.ts (commit 3 - REFACTOR)
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
---
|
|
259
|
+
|
|
260
|
+
## Common Mistakes
|
|
261
|
+
|
|
262
|
+
### Mistake 1: Writing Implementation First
|
|
263
|
+
|
|
264
|
+
❌ **Wrong:**
|
|
265
|
+
```
|
|
266
|
+
1. Write UserService.createUser()
|
|
267
|
+
2. Write test for createUser()
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
✅ **Correct:**
|
|
271
|
+
```
|
|
272
|
+
1. Write test for createUser() (RED)
|
|
273
|
+
2. Watch it fail
|
|
274
|
+
3. Write UserService.createUser() (GREEN)
|
|
275
|
+
4. Watch it pass
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
### Mistake 2: Testing Implementation Details
|
|
279
|
+
|
|
280
|
+
❌ **Wrong:**
|
|
281
|
+
```typescript
|
|
282
|
+
it('should call database.insert with correct params', () => {
|
|
283
|
+
const spy = jest.spyOn(database, 'insert');
|
|
284
|
+
userService.createUser(data);
|
|
285
|
+
expect(spy).toHaveBeenCalledWith('users', data);
|
|
286
|
+
});
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
✅ **Correct:**
|
|
290
|
+
```typescript
|
|
291
|
+
it('should persist user to database', async () => {
|
|
292
|
+
const user = await userService.createUser(data);
|
|
293
|
+
const saved = await database.findById(user.id);
|
|
294
|
+
expect(saved).toEqual(user);
|
|
295
|
+
});
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
### Mistake 3: Skipping Refactor
|
|
299
|
+
|
|
300
|
+
❌ **Wrong:**
|
|
301
|
+
```
|
|
302
|
+
RED → GREEN → RED → GREEN → RED → GREEN (refactor never happens)
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
✅ **Correct:**
|
|
306
|
+
```
|
|
307
|
+
RED → GREEN → REFACTOR → RED → GREEN → REFACTOR
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
### Mistake 4: Refactoring During GREEN
|
|
311
|
+
|
|
312
|
+
❌ **Wrong:**
|
|
313
|
+
```typescript
|
|
314
|
+
// Making test pass AND refactoring simultaneously
|
|
315
|
+
async createUser(data: CreateUserInput): Promise<User> {
|
|
316
|
+
await this.validator.validate(data); // Refactoring during GREEN!
|
|
317
|
+
return this.repository.save(data);
|
|
318
|
+
}
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
✅ **Correct:**
|
|
322
|
+
```typescript
|
|
323
|
+
// GREEN: Minimal code
|
|
324
|
+
async createUser(data: CreateUserInput): Promise<User> {
|
|
325
|
+
return { id: crypto.randomUUID(), ...data };
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
// REFACTOR: Improve later
|
|
329
|
+
async createUser(data: CreateUserInput): Promise<User> {
|
|
330
|
+
const id = this.idGenerator.generate();
|
|
331
|
+
return this.userFactory.create(id, data);
|
|
332
|
+
}
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
---
|
|
336
|
+
|
|
337
|
+
## Validation Criteria
|
|
338
|
+
|
|
339
|
+
Before considering TDD complete for a feature:
|
|
340
|
+
|
|
341
|
+
- [ ] At least one full RED → GREEN → REFACTOR cycle completed
|
|
342
|
+
- [ ] Test coverage ≥ 80% for new code
|
|
343
|
+
- [ ] Git history shows test commits before implementation commits
|
|
344
|
+
- [ ] All tests pass
|
|
345
|
+
- [ ] Code is refactored (no "I'll clean it up later")
|
|
346
|
+
|
|
347
|
+
---
|
|
348
|
+
|
|
349
|
+
## Tools
|
|
350
|
+
|
|
351
|
+
### Test Runners
|
|
352
|
+
|
|
353
|
+
- **Jest:** Node.js (recommended)
|
|
354
|
+
- **Vitest:** Vite projects
|
|
355
|
+
- **Mocha + Chai:** Alternative for Node.js
|
|
356
|
+
|
|
357
|
+
### Coverage Tools
|
|
358
|
+
|
|
359
|
+
```bash
|
|
360
|
+
# Jest
|
|
361
|
+
npm test -- --coverage
|
|
362
|
+
|
|
363
|
+
# Vitest
|
|
364
|
+
npm test -- --coverage
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
### Watch Mode
|
|
368
|
+
|
|
369
|
+
```bash
|
|
370
|
+
# Jest
|
|
371
|
+
npm test -- --watch
|
|
372
|
+
|
|
373
|
+
# Vitest
|
|
374
|
+
npm test -- --watch
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
Run tests continuously during development.
|
|
378
|
+
|
|
379
|
+
---
|
|
380
|
+
|
|
381
|
+
## Anti-TDD Patterns (Forbidden)
|
|
382
|
+
|
|
383
|
+
1. **Test-After Development (TAD)**
|
|
384
|
+
- Writing implementation first, tests second
|
|
385
|
+
- Violates RED-first principle
|
|
386
|
+
|
|
387
|
+
2. **Test-Last Development (TLD)**
|
|
388
|
+
- Writing all features, then writing all tests
|
|
389
|
+
- Loses feedback loop benefit
|
|
390
|
+
|
|
391
|
+
3. **Test-Never Development (TND)**
|
|
392
|
+
- "Tests slow me down"
|
|
393
|
+
- Rejected by Constitution
|
|
394
|
+
|
|
395
|
+
---
|
|
396
|
+
|
|
397
|
+
## Exemptions
|
|
398
|
+
|
|
399
|
+
NONE. Constitution Article II declares TDD non-negotiable.
|
|
400
|
+
|
|
401
|
+
If TDD feels impractical:
|
|
402
|
+
1. Feature is too large (break it down)
|
|
403
|
+
2. Feature is poorly defined (return to Architect for clarification)
|
|
404
|
+
3. Technical constraints exist (Knowledge Curator must validate)
|
|
405
|
+
|
|
406
|
+
---
|
|
407
|
+
|
|
408
|
+
## References
|
|
409
|
+
|
|
410
|
+
- Constitution Article II (TDD mandate)
|
|
411
|
+
- Martin Fowler: "Refactoring: Improving the Design of Existing Code"
|
|
412
|
+
- Kent Beck: "Test-Driven Development: By Example"
|
|
413
|
+
|
|
414
|
+
---
|
|
415
|
+
|
|
416
|
+
**END OF TDD SKILL**
|
package/template/CLAUDE.md
CHANGED
|
@@ -14,38 +14,51 @@ This project uses a multi-agent AI governance workflow called the **Self-Healing
|
|
|
14
14
|
| Static Reviewer | `.ai/agents/static-reviewer.md` | Validates structural compliance |
|
|
15
15
|
| QA Validator | `.ai/agents/qa.md` | Validates measurable test results |
|
|
16
16
|
| Debt Observer | `.ai/agents/debt-observer.md` | Detects structural debt and proposes refactors |
|
|
17
|
+
| Architecture Reviewer | `.ai/agents/architecture-reviewer.md` | Independent governance review for long-term scalability risks |
|
|
18
|
+
| Knowledge Curator | `.ai/agents/knowledge-curator.md` | Validates technical feasibility via live documentation queries (Context7) |
|
|
19
|
+
| Fitness Enforcer | `.ai/agents/fitness-enforcer.md` | Enforces architectural fitness functions, blocks violations |
|
|
17
20
|
|
|
18
21
|
## Mandatory Execution Order
|
|
19
22
|
|
|
20
23
|
Every feature MUST follow this pipeline. No step may be skipped.
|
|
21
24
|
|
|
22
25
|
```
|
|
26
|
+
0. Knowledge Curator validates technical feasibility
|
|
27
|
+
|
|
|
28
|
+
v
|
|
23
29
|
1. Architect defines contract
|
|
24
30
|
|
|
|
25
31
|
v
|
|
26
|
-
2. Developer implements
|
|
32
|
+
2. Developer implements (using TDD skill)
|
|
27
33
|
|
|
|
28
34
|
v
|
|
29
35
|
3. Static Reviewer validates structure
|
|
30
36
|
|
|
|
31
37
|
v
|
|
32
|
-
4.
|
|
38
|
+
4. Fitness Enforcer validates architectural rules
|
|
33
39
|
|
|
|
34
40
|
v
|
|
35
|
-
5.
|
|
41
|
+
5. QA Validator validates behavior
|
|
42
|
+
|
|
|
43
|
+
v
|
|
44
|
+
6. Domain Architect approves
|
|
36
45
|
```
|
|
37
46
|
|
|
38
47
|
### Step Details
|
|
39
48
|
|
|
49
|
+
0. **Knowledge Curator validates feasibility** — Before any architectural decision, the Knowledge Curator queries live documentation (Context7) to verify technical claims. Produces validation report. Output: APPROVED, REJECTED, or CONDITIONAL.
|
|
50
|
+
|
|
40
51
|
1. **Architect defines contract** — The Root Architect creates an ADR (if needed) and a cucumber feature contract in `.ai/features/`. No implementation begins without a contract.
|
|
41
52
|
|
|
42
|
-
2. **Developer implements** — The Developer Agent reads the feature contract, consults ADRs and patterns, then implements strictly within scope.
|
|
53
|
+
2. **Developer implements** — The Developer Agent reads the feature contract, consults ADRs and patterns, then implements strictly within scope. MUST follow TDD skill (RED → GREEN → REFACTOR). MUST write Playwright E2E tests for critical flows.
|
|
43
54
|
|
|
44
55
|
3. **Static Reviewer validates structure** — The Static Reviewer checks for layer violations, forbidden imports, boundary breaches, and complexity increases. Output: PASS or FAIL.
|
|
45
56
|
|
|
46
|
-
4. **
|
|
57
|
+
4. **Fitness Enforcer validates architectural rules** — Runs automated fitness functions (cross-domain access, dependency limits, module centrality, complexity). Output: PASS or FAIL.
|
|
47
58
|
|
|
48
|
-
5. **
|
|
59
|
+
5. **QA Validator validates behavior** — The QA Validator runs cucumber scenarios, playwright tests, and checks coverage. Output: PASS or FAIL.
|
|
60
|
+
|
|
61
|
+
6. **Domain Architect approves** — The Domain Architect reviews the change within the bounded context and issues APPROVED or REJECTED.
|
|
49
62
|
|
|
50
63
|
## Agent Loading Rule
|
|
51
64
|
|
|
@@ -56,20 +69,45 @@ Every feature MUST follow this pipeline. No step may be skipped.
|
|
|
56
69
|
| Path | Purpose |
|
|
57
70
|
|------|---------|
|
|
58
71
|
| `ARCHITECTURE.md` | System architecture and bounded contexts |
|
|
72
|
+
| `.ai/governance/constitution.md` | Immutable governance rules (TDD, E2E, Knowledge Curator) |
|
|
73
|
+
| `.ai/governance/definition-of-done.md` | Merge gate conditions (mandatory) |
|
|
59
74
|
| `.ai/ADR/` | Architectural Decision Records |
|
|
60
75
|
| `.ai/contracts/` | Public interface definitions |
|
|
61
76
|
| `.ai/features/` | Cucumber feature contracts |
|
|
62
77
|
| `.ai/memory/patterns.md` | Approved architectural patterns |
|
|
63
78
|
| `.ai/memory/anti-patterns.md` | Known anti-patterns to avoid |
|
|
79
|
+
| `.ai/knowledge/knowledge-base.md` | Verified technical constraints (Context7 cache) |
|
|
80
|
+
| `.ai/knowledge/validation-reports/` | Knowledge Curator validation reports |
|
|
64
81
|
| `.ai/reports/` | Review and analysis reports |
|
|
65
82
|
| `.ai/debt/` | Technical debt reports |
|
|
83
|
+
| `.ai/architecture/governance/` | Architecture review reports and governance audits |
|
|
84
|
+
| `.ai/architecture/governance/fitness/` | Fitness function rules and configuration |
|
|
85
|
+
| `.ai/skills/` | Mandatory workflows (TDD, Playwright, Context7) |
|
|
86
|
+
|
|
87
|
+
## Periodic Governance Review
|
|
88
|
+
|
|
89
|
+
The **Architecture Reviewer** operates outside the standard feature pipeline. It should be invoked:
|
|
90
|
+
|
|
91
|
+
- After every milestone
|
|
92
|
+
- Before major feature additions
|
|
93
|
+
- When technical debt reports accumulate
|
|
94
|
+
- When team velocity decreases
|
|
95
|
+
- On request from any stakeholder
|
|
96
|
+
|
|
97
|
+
The Architecture Reviewer produces governance reports in `.ai/architecture/governance/` and may propose corrective ADRs.
|
|
66
98
|
|
|
67
99
|
## Rules for All Agents
|
|
68
100
|
|
|
69
|
-
1.
|
|
70
|
-
2.
|
|
71
|
-
3.
|
|
72
|
-
4.
|
|
73
|
-
5. Consult `
|
|
74
|
-
6.
|
|
75
|
-
7.
|
|
101
|
+
1. **Supremacy Hierarchy:** Constitution > ADR > Patterns > Code. When conflict arises, higher level wins.
|
|
102
|
+
2. Never act outside your defined role
|
|
103
|
+
3. Always reference ADR decisions when making structural choices
|
|
104
|
+
4. Never introduce cross-domain dependencies without an ADR
|
|
105
|
+
5. Consult `patterns.md` before implementing any solution
|
|
106
|
+
6. Consult `anti-patterns.md` to avoid known mistakes
|
|
107
|
+
7. All architectural changes require an ADR — no exceptions
|
|
108
|
+
8. Feature work requires a contract — no exceptions
|
|
109
|
+
9. **TDD is mandatory** (Constitution Article II) — RED → GREEN → REFACTOR, no bypass
|
|
110
|
+
10. **E2E tests mandatory for critical flows** (Constitution Article III) — Playwright required
|
|
111
|
+
11. **Knowledge Curator gate mandatory** (Constitution Article IV) — No architectural decision without technical validation
|
|
112
|
+
12. **Skills are mandatory procedures** (Constitution Article V) — Not guidelines, enforceable workflows
|
|
113
|
+
13. **Definition of Done is enforced** (Constitution Article VI) — All 6 gates must pass, no merge otherwise
|