codingbuddy-rules 0.0.0-canary.20251222065027.7844cd5
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/.ai-rules/CHANGELOG.md +117 -0
- package/.ai-rules/README.md +232 -0
- package/.ai-rules/adapters/antigravity.md +195 -0
- package/.ai-rules/adapters/claude-code.md +117 -0
- package/.ai-rules/adapters/codex.md +124 -0
- package/.ai-rules/adapters/cursor.md +128 -0
- package/.ai-rules/adapters/kiro.md +130 -0
- package/.ai-rules/adapters/q.md +126 -0
- package/.ai-rules/agents/README.md +681 -0
- package/.ai-rules/agents/accessibility-specialist.json +514 -0
- package/.ai-rules/agents/architecture-specialist.json +501 -0
- package/.ai-rules/agents/backend-developer.json +494 -0
- package/.ai-rules/agents/code-quality-specialist.json +565 -0
- package/.ai-rules/agents/code-reviewer.json +565 -0
- package/.ai-rules/agents/devops-engineer.json +277 -0
- package/.ai-rules/agents/documentation-specialist.json +543 -0
- package/.ai-rules/agents/frontend-developer.json +402 -0
- package/.ai-rules/agents/performance-specialist.json +528 -0
- package/.ai-rules/agents/security-specialist.json +464 -0
- package/.ai-rules/agents/seo-specialist.json +427 -0
- package/.ai-rules/agents/test-strategy-specialist.json +542 -0
- package/.ai-rules/agents/ui-ux-designer.json +513 -0
- package/.ai-rules/keyword-modes.json +20 -0
- package/.ai-rules/rules/augmented-coding.md +292 -0
- package/.ai-rules/rules/clarification-guide.md +138 -0
- package/.ai-rules/rules/core.md +1030 -0
- package/.ai-rules/rules/project.md +200 -0
- package/.ai-rules/schemas/README.md +66 -0
- package/.ai-rules/schemas/agent.schema.json +258 -0
- package/index.d.ts +4 -0
- package/index.js +8 -0
- package/package.json +32 -0
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
# Augmented Coding Principles
|
|
2
|
+
|
|
3
|
+
Based on Kent Beck's approach: https://tidyfirst.substack.com/p/augmented-coding-beyond-the-vibes
|
|
4
|
+
|
|
5
|
+
## Philosophy: Beyond Vibe Coding
|
|
6
|
+
|
|
7
|
+
### Vibe Coding vs Augmented Coding
|
|
8
|
+
- **Vibe Coding**: Don't care about code, only behavior. Feed errors back to AI hoping for fixes.
|
|
9
|
+
- **Augmented Coding**: Care about code quality, complexity, tests, and coverage. Same value system as hand coding—tidy code that works. You just don't type much of it.
|
|
10
|
+
|
|
11
|
+
**We practice Augmented Coding**: High standards for AI-generated code, same as hand-written code.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## TDD Cycle (Strict Adherence)
|
|
16
|
+
|
|
17
|
+
Follow the **Red → Green → Refactor** cycle religiously:
|
|
18
|
+
|
|
19
|
+
1. **Red**: Write a failing test that defines a small increment of functionality
|
|
20
|
+
2. **Green**: Implement the minimum code needed to make the test pass
|
|
21
|
+
3. **Refactor**: Improve structure only after tests are passing
|
|
22
|
+
|
|
23
|
+
### Core Rules
|
|
24
|
+
- Write one test at a time
|
|
25
|
+
- Make it pass with minimal code
|
|
26
|
+
- Run all tests after each change
|
|
27
|
+
- Never skip the refactor step
|
|
28
|
+
|
|
29
|
+
### TDD Strategy by Code Type
|
|
30
|
+
|
|
31
|
+
#### Core Logic (Test-First TDD)
|
|
32
|
+
Apply strict TDD to:
|
|
33
|
+
- API call functions
|
|
34
|
+
- Data models and hooks
|
|
35
|
+
- Utility functions
|
|
36
|
+
- Custom hooks with business logic
|
|
37
|
+
|
|
38
|
+
**Workflow:**
|
|
39
|
+
1. Write failing test
|
|
40
|
+
- Define expected behavior
|
|
41
|
+
- Cover edge cases
|
|
42
|
+
- Cover error cases
|
|
43
|
+
2. Define types
|
|
44
|
+
3. Implement minimal code
|
|
45
|
+
4. Verify all tests pass
|
|
46
|
+
5. Refactor for clarity
|
|
47
|
+
|
|
48
|
+
#### UI Components (Test-After)
|
|
49
|
+
For visual components, implement first, then test:
|
|
50
|
+
- Feature components
|
|
51
|
+
- Composite widgets
|
|
52
|
+
- Reusable UI components
|
|
53
|
+
|
|
54
|
+
**Workflow:**
|
|
55
|
+
1. Define types
|
|
56
|
+
2. Define constants
|
|
57
|
+
3. Implement component
|
|
58
|
+
4. Write tests
|
|
59
|
+
5. Refactor
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## Tidy First Approach
|
|
64
|
+
|
|
65
|
+
**Core Principle**: Separate structural changes from behavioral changes. Never mix them.
|
|
66
|
+
|
|
67
|
+
### Two Types of Changes
|
|
68
|
+
|
|
69
|
+
#### 1. Structural Changes (Tidy First)
|
|
70
|
+
Code reorganization without changing behavior:
|
|
71
|
+
- Renaming variables/functions/files
|
|
72
|
+
- Extracting methods
|
|
73
|
+
- Moving code between files
|
|
74
|
+
- Reorganizing imports
|
|
75
|
+
- Fixing formatting
|
|
76
|
+
|
|
77
|
+
**Validation**: Run tests before and after—they should all pass.
|
|
78
|
+
|
|
79
|
+
#### 2. Behavioral Changes
|
|
80
|
+
Adding or modifying actual functionality:
|
|
81
|
+
- New features
|
|
82
|
+
- Bug fixes
|
|
83
|
+
- Logic modifications
|
|
84
|
+
- API integrations
|
|
85
|
+
|
|
86
|
+
### Workflow Rule
|
|
87
|
+
When both types of changes are needed:
|
|
88
|
+
1. Make structural changes FIRST
|
|
89
|
+
2. Commit structural changes separately
|
|
90
|
+
3. Then make behavioral changes
|
|
91
|
+
4. Commit behavioral changes separately
|
|
92
|
+
|
|
93
|
+
**Never mix in the same commit.**
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## Commit Discipline
|
|
98
|
+
|
|
99
|
+
### Only Commit When:
|
|
100
|
+
1. ✅ ALL tests are passing
|
|
101
|
+
2. ✅ ALL linter/compiler warnings resolved
|
|
102
|
+
3. ✅ Change represents a single logical unit of work
|
|
103
|
+
4. ✅ Commit message clearly states: structural OR behavioral change
|
|
104
|
+
|
|
105
|
+
### Commit Messages
|
|
106
|
+
- **Structural**: `refactor: extract validation logic to utils`
|
|
107
|
+
- **Behavioral**: `feat: add user registration endpoint`
|
|
108
|
+
|
|
109
|
+
Use small, frequent commits rather than large, infrequent ones.
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## AI Monitoring Checkpoints
|
|
114
|
+
|
|
115
|
+
Watch AI carefully and intervene when you see:
|
|
116
|
+
|
|
117
|
+
### 🚨 Warning Signs (Stop AI Immediately)
|
|
118
|
+
|
|
119
|
+
1. **Unnecessary Loops**: AI generating complex loops when simpler solutions exist
|
|
120
|
+
2. **Unrequested Features**: AI adding functionality you didn't ask for (even if reasonable)
|
|
121
|
+
3. **Test Cheating**: AI disabling, deleting, or skipping tests
|
|
122
|
+
4. **Complexity Accumulation**: Code getting messier instead of cleaner
|
|
123
|
+
5. **Coding Ahead**: AI implementing beyond current test requirements
|
|
124
|
+
|
|
125
|
+
### ✅ Good AI Behavior
|
|
126
|
+
|
|
127
|
+
- Follows your exact instructions
|
|
128
|
+
- Implements only what's needed for current test
|
|
129
|
+
- Maintains or improves code simplicity
|
|
130
|
+
- Respects existing patterns
|
|
131
|
+
- Asks for clarification when uncertain
|
|
132
|
+
|
|
133
|
+
### Intervention Strategy
|
|
134
|
+
|
|
135
|
+
Review intermediate results continuously:
|
|
136
|
+
- Check code after each AI response
|
|
137
|
+
- Verify AI did exactly what you asked
|
|
138
|
+
- Stop and redirect if veering off track
|
|
139
|
+
- Propose specific next steps: "for the next test, add keys in reverse order"
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
## Code Quality Standards
|
|
144
|
+
|
|
145
|
+
### Core Principles (SOLID)
|
|
146
|
+
- **Single Responsibility**: Each function/class has one reason to change
|
|
147
|
+
- **Open/Closed**: Open for extension, closed for modification
|
|
148
|
+
- **Liskov Substitution**: Subtypes must be substitutable for base types
|
|
149
|
+
- **Interface Segregation**: No client should depend on unused interfaces
|
|
150
|
+
- **Dependency Inversion**: Depend on abstractions, not concretions
|
|
151
|
+
|
|
152
|
+
### Quality Metrics
|
|
153
|
+
- **Eliminate Duplication**: DRY (Don't Repeat Yourself) ruthlessly
|
|
154
|
+
- **Express Intent Clearly**: Names and structure reveal purpose
|
|
155
|
+
- **Make Dependencies Explicit**: No hidden coupling
|
|
156
|
+
- **Keep Methods Small**: Single responsibility, 10-20 lines max
|
|
157
|
+
- **Minimize State**: Prefer pure functions, minimize side effects
|
|
158
|
+
- **Simplest Solution**: "What's the simplest thing that could possibly work?"
|
|
159
|
+
|
|
160
|
+
### Testing Standards
|
|
161
|
+
- **Coverage Goal**: 90%+ for all code
|
|
162
|
+
- **Test Structure**: `describe/it` pattern with clear names
|
|
163
|
+
- **No Mocking**: Test real behavior with actual implementations (or MSW for API mocking)
|
|
164
|
+
- **User Perspective**: Use Testing Library, test from user's viewpoint
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
## Refactoring Guidelines
|
|
169
|
+
|
|
170
|
+
### When to Refactor
|
|
171
|
+
- Only in the **Green** phase (all tests passing)
|
|
172
|
+
- After adding new functionality
|
|
173
|
+
- When you see duplication
|
|
174
|
+
- When intent is unclear
|
|
175
|
+
|
|
176
|
+
### How to Refactor
|
|
177
|
+
1. **One change at a time**: Single refactoring operation
|
|
178
|
+
2. **Run tests after each step**: Verify behavior unchanged
|
|
179
|
+
3. **Use named patterns**: Apply established refactoring patterns (Extract Method, Move Field, etc.)
|
|
180
|
+
4. **Prioritize clarity**: Remove duplication, improve naming
|
|
181
|
+
|
|
182
|
+
### Common Refactorings
|
|
183
|
+
- Extract Method/Function
|
|
184
|
+
- Rename Variable/Function
|
|
185
|
+
- Move Method
|
|
186
|
+
- Inline Temporary
|
|
187
|
+
- Replace Magic Number with Constant
|
|
188
|
+
- Extract Interface
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
## Testing Best Practices
|
|
193
|
+
|
|
194
|
+
### Test Naming
|
|
195
|
+
Use descriptive names that explain behavior:
|
|
196
|
+
```typescript
|
|
197
|
+
// ✅ Good
|
|
198
|
+
it('returns error when email format is invalid', () => {})
|
|
199
|
+
it('successfully creates user with valid data', () => {})
|
|
200
|
+
|
|
201
|
+
// ❌ Bad
|
|
202
|
+
it('test1', () => {})
|
|
203
|
+
it('handles input', () => {})
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### Test Organization
|
|
207
|
+
```typescript
|
|
208
|
+
describe('UserRegistration', () => {
|
|
209
|
+
describe('when input is valid', () => {
|
|
210
|
+
it('creates user record', () => {})
|
|
211
|
+
it('sends welcome email', () => {})
|
|
212
|
+
})
|
|
213
|
+
|
|
214
|
+
describe('when input is invalid', () => {
|
|
215
|
+
it('returns validation error', () => {})
|
|
216
|
+
it('does not create user', () => {})
|
|
217
|
+
})
|
|
218
|
+
})
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
### Test Coverage Requirements
|
|
222
|
+
- **Core Logic**: 90%+ coverage required
|
|
223
|
+
- **UI Components**: Focus on user interactions and state changes
|
|
224
|
+
- **Edge Cases**: Always test boundaries and error conditions
|
|
225
|
+
- **Happy Path**: Test successful scenarios first, then failures
|
|
226
|
+
|
|
227
|
+
---
|
|
228
|
+
|
|
229
|
+
## Example Workflow
|
|
230
|
+
|
|
231
|
+
### Building a Feature with TDD
|
|
232
|
+
|
|
233
|
+
#### Step 1: Write First Test (Red)
|
|
234
|
+
```typescript
|
|
235
|
+
describe('useCreateUserMutation', () => {
|
|
236
|
+
it('successfully creates user with valid data', async () => {
|
|
237
|
+
const { result } = renderHook(() => useCreateUserMutation());
|
|
238
|
+
|
|
239
|
+
await act(async () => {
|
|
240
|
+
await result.current.mutate({ email: 'test@example.com', name: 'Test' });
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
expect(result.current.isSuccess).toBe(true);
|
|
244
|
+
});
|
|
245
|
+
});
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
#### Step 2: Minimal Implementation (Green)
|
|
249
|
+
```typescript
|
|
250
|
+
export const useCreateUserMutation = () => {
|
|
251
|
+
return useMutation({
|
|
252
|
+
mutationFn: async (data: CreateUserInput) => {
|
|
253
|
+
const response = await api.post('/users', data);
|
|
254
|
+
return response.data;
|
|
255
|
+
},
|
|
256
|
+
});
|
|
257
|
+
};
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
#### Step 3: Verify Tests Pass
|
|
261
|
+
Run tests → All green ✅
|
|
262
|
+
|
|
263
|
+
#### Step 4: Refactor (If Needed)
|
|
264
|
+
Extract validation, improve error handling, etc.
|
|
265
|
+
|
|
266
|
+
#### Step 5: Commit
|
|
267
|
+
```bash
|
|
268
|
+
git commit -m "feat: add create user mutation hook"
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
#### Step 6: Next Test
|
|
272
|
+
```typescript
|
|
273
|
+
it('returns error when data is invalid', async () => {
|
|
274
|
+
// ... next increment
|
|
275
|
+
});
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
Repeat until feature is complete.
|
|
279
|
+
|
|
280
|
+
---
|
|
281
|
+
|
|
282
|
+
## Integration with Project Rules
|
|
283
|
+
|
|
284
|
+
This file defines **HOW** we write code with AI.
|
|
285
|
+
|
|
286
|
+
See also:
|
|
287
|
+
- `core.md` - PLAN/ACT/EVAL modes and communication rules
|
|
288
|
+
- `project.md` - Tech stack, architecture, and project context
|
|
289
|
+
|
|
290
|
+
---
|
|
291
|
+
|
|
292
|
+
**Remember**: Programming with AI is still programming. Make more consequential decisions per hour, fewer boring decisions. Yak shaving goes away. Focus on architecture, design, and quality—let AI handle the typing.
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
# Clarification Question Guidelines
|
|
2
|
+
|
|
3
|
+
Guidelines for AI to generate contextual clarification questions during PLAN MODE.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## When to Start Clarification Phase
|
|
8
|
+
|
|
9
|
+
Start Clarification Phase when any of the following ambiguities are detected:
|
|
10
|
+
|
|
11
|
+
- **Scope unclear** - Which modules, components, or users are affected?
|
|
12
|
+
- **Priority ambiguous** - What is must-have vs nice-to-have?
|
|
13
|
+
- **Constraints not specified** - Technical or business limitations?
|
|
14
|
+
- **Edge cases undefined** - How to handle errors or exceptions?
|
|
15
|
+
- **Integration points unclear** - Relationship with existing systems?
|
|
16
|
+
|
|
17
|
+
**Skip Clarification Phase when:**
|
|
18
|
+
- Requirements are detailed and unambiguous
|
|
19
|
+
- User provides comprehensive specification document
|
|
20
|
+
- User explicitly requests: "Skip clarification" or "Just create the plan"
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Ambiguity Assessment Checklist
|
|
25
|
+
|
|
26
|
+
Use this checklist to determine if Clarification Phase is needed:
|
|
27
|
+
|
|
28
|
+
| Check | Question | If unclear → Ask about |
|
|
29
|
+
|-------|----------|------------------------|
|
|
30
|
+
| [ ] | Is the **scope** defined? (which files, modules, users) | Scope |
|
|
31
|
+
| [ ] | Are **priorities** clear? (must-have vs nice-to-have) | Priority |
|
|
32
|
+
| [ ] | Are **constraints** known? (tech stack, compatibility) | Constraints |
|
|
33
|
+
| [ ] | Are **edge cases** specified? (errors, empty states) | Expected Behavior |
|
|
34
|
+
| [ ] | Are **non-functional requirements** defined? (performance, security) | Non-functional |
|
|
35
|
+
| [ ] | Is **integration** with existing code clear? | Integration |
|
|
36
|
+
|
|
37
|
+
**Rule:** If 2+ items are unclear → Start Clarification Phase
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## Question Format Rules
|
|
42
|
+
|
|
43
|
+
1. **Single Question** - Ask only ONE question per message
|
|
44
|
+
2. **Progress Indicator** - Show "Question N/M" format (estimate M, adjust as needed)
|
|
45
|
+
3. **Multiple-Choice First** - Provide A/B/C options when possible
|
|
46
|
+
4. **Custom Input** - Always allow user's own input option
|
|
47
|
+
5. **Language** - Follow agent's `communication.language` setting; if not set, detect from user's input language
|
|
48
|
+
|
|
49
|
+
### Question Count Guidelines
|
|
50
|
+
|
|
51
|
+
| Request Complexity | Recommended Questions |
|
|
52
|
+
|--------------------|----------------------|
|
|
53
|
+
| Simple feature | 2-3 questions |
|
|
54
|
+
| Standard feature | 3-5 questions |
|
|
55
|
+
| Complex feature | 5-7 questions |
|
|
56
|
+
|
|
57
|
+
**Best Practice:** Start with estimated count, adjust as conversation progresses. Avoid exceeding 7 questions.
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## Question Categories
|
|
62
|
+
|
|
63
|
+
Use these categories as reference when generating questions. Adapt to specific context.
|
|
64
|
+
|
|
65
|
+
| Category | Focus Areas |
|
|
66
|
+
|----------|-------------|
|
|
67
|
+
| **Scope** | Feature boundary, affected modules, user roles |
|
|
68
|
+
| **Priority** | Core requirements vs optional features, MVP definition |
|
|
69
|
+
| **Constraints** | Technical limits, dependencies, compatibility, deadlines |
|
|
70
|
+
| **Expected Behavior** | Edge cases, error handling, default values |
|
|
71
|
+
| **Non-functional** | Performance, security, accessibility requirements |
|
|
72
|
+
| **Integration** | Existing code relations, data flow, API dependencies |
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## Output Format
|
|
77
|
+
|
|
78
|
+
### During Clarification (English)
|
|
79
|
+
|
|
80
|
+
```markdown
|
|
81
|
+
## Clarification Phase
|
|
82
|
+
|
|
83
|
+
### Question 1/3
|
|
84
|
+
|
|
85
|
+
**[Category] clarification needed:**
|
|
86
|
+
|
|
87
|
+
[Question text adapted to context]
|
|
88
|
+
|
|
89
|
+
- **A)** [Option 1]
|
|
90
|
+
- **B)** [Option 2]
|
|
91
|
+
- **C)** [Option 3]
|
|
92
|
+
|
|
93
|
+
> Select your answer (A/B/C) or share your own input.
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### During Clarification (Korean)
|
|
97
|
+
|
|
98
|
+
```markdown
|
|
99
|
+
## Clarification Phase
|
|
100
|
+
|
|
101
|
+
### 질문 1/3
|
|
102
|
+
|
|
103
|
+
**[카테고리]에 대한 확인이 필요합니다:**
|
|
104
|
+
|
|
105
|
+
[컨텍스트에 맞게 조정된 질문]
|
|
106
|
+
|
|
107
|
+
- **A)** [선택지 1]
|
|
108
|
+
- **B)** [선택지 2]
|
|
109
|
+
- **C)** [선택지 3]
|
|
110
|
+
|
|
111
|
+
> 답변을 선택해주세요 (A/B/C) 또는 다른 의견이 있으시면 말씀해주세요.
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### After All Questions
|
|
115
|
+
|
|
116
|
+
```markdown
|
|
117
|
+
## 수집된 정보 요약
|
|
118
|
+
|
|
119
|
+
| 항목 | 결정 사항 |
|
|
120
|
+
|------|----------|
|
|
121
|
+
| 범위 | [사용자 선택] |
|
|
122
|
+
| 우선순위 | [사용자 선택] |
|
|
123
|
+
| 제약조건 | [사용자 선택] |
|
|
124
|
+
| ... | ... |
|
|
125
|
+
|
|
126
|
+
이 내용이 맞나요? 확인해주시면 PLAN 수립을 시작하겠습니다.
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## Handling Special Cases
|
|
132
|
+
|
|
133
|
+
| Situation | Response |
|
|
134
|
+
|-----------|----------|
|
|
135
|
+
| User answers "I'm not sure" / "잘 모르겠어요" | Present default recommendation with rationale, ask for confirmation |
|
|
136
|
+
| User wants to skip a question | Note that AI will use best judgment, continue to next question |
|
|
137
|
+
| User provides unexpected answer | Acknowledge the input, incorporate into understanding, continue |
|
|
138
|
+
| User asks to skip all questions | Proceed to PLAN creation, note assumptions made |
|