@champpaba/claude-agent-kit 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/LICENSE +21 -0
- package/README.md +561 -0
- package/bin/cli.js +61 -0
- package/lib/init.js +52 -0
- package/lib/update.js +73 -0
- package/package.json +47 -0
- package/template/.claude/CHANGELOG-v1.1.1.md +259 -0
- package/template/.claude/CLAUDE.md +329 -0
- package/template/.claude/agents/01-integration.md +797 -0
- package/template/.claude/agents/02-uxui-frontend.md +899 -0
- package/template/.claude/agents/03-test-debug.md +759 -0
- package/template/.claude/agents/04-frontend.md +1099 -0
- package/template/.claude/agents/05-backend.md +1217 -0
- package/template/.claude/agents/06-database.md +969 -0
- package/template/.claude/commands/agentsetup.md +1464 -0
- package/template/.claude/commands/cdev.md +327 -0
- package/template/.claude/commands/csetup.md +447 -0
- package/template/.claude/commands/cstatus.md +60 -0
- package/template/.claude/commands/cview.md +364 -0
- package/template/.claude/commands/psetup.md +101 -0
- package/template/.claude/contexts/design/accessibility.md +611 -0
- package/template/.claude/contexts/design/box-thinking.md +553 -0
- package/template/.claude/contexts/design/color-theory.md +498 -0
- package/template/.claude/contexts/design/index.md +247 -0
- package/template/.claude/contexts/design/layout.md +400 -0
- package/template/.claude/contexts/design/responsive.md +551 -0
- package/template/.claude/contexts/design/shadows.md +522 -0
- package/template/.claude/contexts/design/spacing.md +428 -0
- package/template/.claude/contexts/design/typography.md +465 -0
- package/template/.claude/contexts/domain/README.md +164 -0
- package/template/.claude/contexts/patterns/agent-coordination.md +388 -0
- package/template/.claude/contexts/patterns/agent-discovery.md +182 -0
- package/template/.claude/contexts/patterns/change-workflow.md +538 -0
- package/template/.claude/contexts/patterns/code-standards.md +515 -0
- package/template/.claude/contexts/patterns/development-principles.md +513 -0
- package/template/.claude/contexts/patterns/error-handling.md +478 -0
- package/template/.claude/contexts/patterns/error-recovery.md +365 -0
- package/template/.claude/contexts/patterns/frontend-component-strategy.md +365 -0
- package/template/.claude/contexts/patterns/git-workflow.md +207 -0
- package/template/.claude/contexts/patterns/logging.md +424 -0
- package/template/.claude/contexts/patterns/task-breakdown.md +452 -0
- package/template/.claude/contexts/patterns/task-classification.md +523 -0
- package/template/.claude/contexts/patterns/tdd-classification.md +516 -0
- package/template/.claude/contexts/patterns/testing.md +413 -0
- package/template/.claude/contexts/patterns/ui-component-consistency.md +304 -0
- package/template/.claude/contexts/patterns/validation-framework.md +776 -0
- package/template/.claude/lib/README.md +39 -0
- package/template/.claude/lib/agent-executor.md +258 -0
- package/template/.claude/lib/agent-router.md +572 -0
- package/template/.claude/lib/flags-updater.md +469 -0
- package/template/.claude/lib/tdd-classifier.md +345 -0
- package/template/.claude/lib/validation-gates.md +484 -0
- package/template/.claude/settings.local.json +42 -0
- package/template/.claude/templates/context-template.md +45 -0
- package/template/.claude/templates/flags-template.json +42 -0
- package/template/.claude/templates/phase-templates.json +124 -0
- package/template/.claude/templates/phases-sections/accessibility-test.md +17 -0
- package/template/.claude/templates/phases-sections/api-design.md +37 -0
- package/template/.claude/templates/phases-sections/backend-tests.md +16 -0
- package/template/.claude/templates/phases-sections/backend.md +37 -0
- package/template/.claude/templates/phases-sections/business-logic-validation.md +16 -0
- package/template/.claude/templates/phases-sections/component-tests.md +17 -0
- package/template/.claude/templates/phases-sections/contract-backend.md +16 -0
- package/template/.claude/templates/phases-sections/contract-frontend.md +16 -0
- package/template/.claude/templates/phases-sections/database.md +35 -0
- package/template/.claude/templates/phases-sections/documentation.md +17 -0
- package/template/.claude/templates/phases-sections/e2e-tests.md +16 -0
- package/template/.claude/templates/phases-sections/fix-implementation.md +17 -0
- package/template/.claude/templates/phases-sections/frontend-integration.md +18 -0
- package/template/.claude/templates/phases-sections/frontend-mockup.md +123 -0
- package/template/.claude/templates/phases-sections/manual-flow-test.md +15 -0
- package/template/.claude/templates/phases-sections/manual-ux-test.md +16 -0
- package/template/.claude/templates/phases-sections/refactor-implementation.md +17 -0
- package/template/.claude/templates/phases-sections/refactor.md +16 -0
- package/template/.claude/templates/phases-sections/regression-tests.md +15 -0
- package/template/.claude/templates/phases-sections/report.md +16 -0
- package/template/.claude/templates/phases-sections/responsive-test.md +16 -0
- package/template/.claude/templates/phases-sections/script-implementation.md +43 -0
- package/template/.claude/templates/phases-sections/test-coverage.md +16 -0
- package/template/.claude/templates/phases-sections/user-approval.md +14 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# .claude/lib/ - Implementation Logic
|
|
2
|
+
|
|
3
|
+
> **Logic specifications for Main Claude orchestrator**
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 📁 Files
|
|
8
|
+
|
|
9
|
+
**`agent-executor.md`** - Agent retry & escalation logic
|
|
10
|
+
Used by `/cdev` to execute agents with automatic retry, validation, and user escalation
|
|
11
|
+
|
|
12
|
+
**`tdd-classifier.md`** - TDD classification logic
|
|
13
|
+
Used by `/csetup` to automatically determine which phases require TDD workflow
|
|
14
|
+
|
|
15
|
+
**`flags-updater.md`** - 🆕 Progress tracking protocol
|
|
16
|
+
Ensures Main Claude updates flags.json after EVERY phase completion. Provides helper functions for extracting files, tasks, and calculating duration.
|
|
17
|
+
|
|
18
|
+
**`agent-router.md`** - 🆕 Mandatory agent routing rules
|
|
19
|
+
Enforces strict agent boundaries. Main Claude MUST delegate implementation work to specialized agents. Includes work type detection patterns and self-check protocol.
|
|
20
|
+
|
|
21
|
+
**`validation-gates.md`** - 🆕 Validation checkpoints
|
|
22
|
+
Four validation gates that Main Claude MUST pass: before work, after agent responds, before reporting, and before phase start. Ensures quality and correctness at each step.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## 🚨 Important
|
|
27
|
+
|
|
28
|
+
These are **logic specifications** (not executable code). Main Claude reads these .md files as documentation and implements the logic when running `/cdev` and `/csetup` commands.
|
|
29
|
+
|
|
30
|
+
**Why .md files?** Claude Code has no TypeScript runtime. These files are "pseudocode specifications" that Main Claude reads and implements.
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## 📚 See Also
|
|
35
|
+
|
|
36
|
+
- `.claude/contexts/patterns/validation-framework.md` - Agent validation checklists
|
|
37
|
+
- `.claude/contexts/patterns/agent-discovery.md` - Agent discovery flow
|
|
38
|
+
- `.claude/commands/cdev.md` - How /cdev uses agent-executor.md
|
|
39
|
+
- `.claude/commands/csetup.md` - How /csetup uses tdd-classifier.md
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
# Agent Executor with Retry & Escalation
|
|
2
|
+
|
|
3
|
+
> **Robust agent execution with automatic retry and error recovery**
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 🎯 Purpose
|
|
8
|
+
|
|
9
|
+
Provides resilient agent execution that:
|
|
10
|
+
- Auto-retries on validation failures (max 2 retries)
|
|
11
|
+
- Validates output quality before accepting
|
|
12
|
+
- Escalates to user when all retries fail
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## 🔄 Retry Strategy
|
|
17
|
+
|
|
18
|
+
### When to Retry
|
|
19
|
+
|
|
20
|
+
**1. Validation Failed**
|
|
21
|
+
- Agent skipped pre-work checklist
|
|
22
|
+
- Missing required sections
|
|
23
|
+
- **Action:** Send rejection with specific missing items → retry
|
|
24
|
+
|
|
25
|
+
**2. Output Quality Issues**
|
|
26
|
+
- Output truncated or incomplete
|
|
27
|
+
- No code blocks (when expected)
|
|
28
|
+
- No test results (for test agent)
|
|
29
|
+
- **Action:** Send feedback → retry
|
|
30
|
+
|
|
31
|
+
**3. Agent Crashed**
|
|
32
|
+
- Timeout or network error
|
|
33
|
+
- **Action:** Retry with same prompt
|
|
34
|
+
|
|
35
|
+
### When NOT to Retry
|
|
36
|
+
|
|
37
|
+
- User manually cancelled
|
|
38
|
+
- Agent requested user input
|
|
39
|
+
- Max retries exceeded (2 attempts)
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## 📋 Execution Flow
|
|
44
|
+
|
|
45
|
+
**Main Claude should follow this flow in `/cdev` command:**
|
|
46
|
+
|
|
47
|
+
### Step 1: Build Prompt
|
|
48
|
+
|
|
49
|
+
```markdown
|
|
50
|
+
Include in prompt:
|
|
51
|
+
- Change context (proposal, tasks, phases)
|
|
52
|
+
- Phase-specific instructions
|
|
53
|
+
- TDD requirements (if phase.tdd_required)
|
|
54
|
+
- Validation checkpoint reminder
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Step 2: Execute with Retry Loop
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
attempt = 0
|
|
61
|
+
max_retries = 2
|
|
62
|
+
|
|
63
|
+
while (attempt <= max_retries):
|
|
64
|
+
|
|
65
|
+
1. Invoke agent:
|
|
66
|
+
Task(agent=agentType, model='haiku', prompt=buildPrompt())
|
|
67
|
+
|
|
68
|
+
2. Validate pre-work (see validation-framework.md):
|
|
69
|
+
- Check for required checklist items
|
|
70
|
+
- If missing → reject and retry
|
|
71
|
+
|
|
72
|
+
3. Validate output quality:
|
|
73
|
+
- Check for completion markers (✅, Done, Complete)
|
|
74
|
+
- Check for code blocks (if code agent)
|
|
75
|
+
- Check for test results (if test agent)
|
|
76
|
+
- If incomplete → send feedback and retry
|
|
77
|
+
|
|
78
|
+
4. If validation passed:
|
|
79
|
+
→ SUCCESS! Return result
|
|
80
|
+
|
|
81
|
+
5. If validation failed:
|
|
82
|
+
- If attempt < max_retries:
|
|
83
|
+
→ Send feedback, increment attempt, retry
|
|
84
|
+
- Else:
|
|
85
|
+
→ FAIL! Escalate to user
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Step 3: Handle Result
|
|
89
|
+
|
|
90
|
+
**If success:**
|
|
91
|
+
```markdown
|
|
92
|
+
✅ Phase completed successfully!
|
|
93
|
+
⏱️ Execution time: {time}
|
|
94
|
+
🔄 Retries used: {count}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
**If failed after retries:**
|
|
98
|
+
```markdown
|
|
99
|
+
❌ Phase failed after {attempts} attempts
|
|
100
|
+
|
|
101
|
+
What would you like to do?
|
|
102
|
+
1. Retry manually
|
|
103
|
+
2. Skip this phase
|
|
104
|
+
3. Abort workflow
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## ✅ Pre-Work Validation
|
|
110
|
+
|
|
111
|
+
**Check agent response for required items:**
|
|
112
|
+
|
|
113
|
+
**All agents:**
|
|
114
|
+
- "Pre-Implementation Validation Report"
|
|
115
|
+
- "Ready to Implement ✓"
|
|
116
|
+
|
|
117
|
+
**uxui-frontend:**
|
|
118
|
+
- "Design Foundation ✓"
|
|
119
|
+
- "Box Thinking Analysis ✓"
|
|
120
|
+
- "Component Search ✓"
|
|
121
|
+
- "Design Tokens Extracted ✓"
|
|
122
|
+
|
|
123
|
+
**backend:**
|
|
124
|
+
- "Patterns Loaded ✓"
|
|
125
|
+
- "Existing Endpoints Search ✓"
|
|
126
|
+
- "TDD Workflow" (if TDD required)
|
|
127
|
+
|
|
128
|
+
**See:** `validation-framework.md` for complete list per agent
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## 📊 Output Quality Checks
|
|
133
|
+
|
|
134
|
+
**Check output for:**
|
|
135
|
+
|
|
136
|
+
1. **Completion marker**
|
|
137
|
+
- Contains "✅" or "Done" or "Complete"
|
|
138
|
+
- If not → likely truncated
|
|
139
|
+
|
|
140
|
+
2. **Files mentioned** (non-integration agents)
|
|
141
|
+
- Contains "File" or "Created" or "Modified"
|
|
142
|
+
- If not → likely didn't implement anything
|
|
143
|
+
|
|
144
|
+
3. **Code blocks** (code agents: backend, frontend, uxui-frontend)
|
|
145
|
+
- Contains "```"
|
|
146
|
+
- If not → likely missing implementation
|
|
147
|
+
|
|
148
|
+
4. **Test results** (test-debug agent)
|
|
149
|
+
- Contains "passed" or "test"
|
|
150
|
+
- If not → likely didn't run tests
|
|
151
|
+
|
|
152
|
+
5. **No unresolved errors**
|
|
153
|
+
- If contains "ERROR" or "FAILED" without "fixed"
|
|
154
|
+
- → likely has unresolved issues
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
## 🚨 Escalation
|
|
159
|
+
|
|
160
|
+
**When max retries exceeded, give user options:**
|
|
161
|
+
|
|
162
|
+
```
|
|
163
|
+
⚠️ Agent Execution Failed After 3 Attempts
|
|
164
|
+
|
|
165
|
+
Agent: {agent-type}
|
|
166
|
+
Phase: {phase-name}
|
|
167
|
+
Error: {error-details}
|
|
168
|
+
|
|
169
|
+
What would you like to do?
|
|
170
|
+
|
|
171
|
+
Options:
|
|
172
|
+
1. Retry manually - Try again with intervention
|
|
173
|
+
2. Skip this phase - Continue to next phase
|
|
174
|
+
3. Abort workflow - Stop and save progress
|
|
175
|
+
|
|
176
|
+
Please choose an option.
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
**User responses:**
|
|
180
|
+
- **retry** → Restart Step 2 (execute agent again)
|
|
181
|
+
- **skip** → Mark phase as "skipped" in flags.json, move to next
|
|
182
|
+
- **abort** → Save current state, exit /cdev
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
## 📝 Rejection Messages
|
|
187
|
+
|
|
188
|
+
### Pre-Work Rejection
|
|
189
|
+
|
|
190
|
+
```markdown
|
|
191
|
+
❌ Pre-Work Validation Failed
|
|
192
|
+
|
|
193
|
+
Agent: {agent-type}
|
|
194
|
+
Phase: {phase-name}
|
|
195
|
+
|
|
196
|
+
Missing required steps:
|
|
197
|
+
- {item-1}
|
|
198
|
+
- {item-2}
|
|
199
|
+
- {item-3}
|
|
200
|
+
|
|
201
|
+
You MUST complete ALL mandatory steps before implementation.
|
|
202
|
+
|
|
203
|
+
Refer to:
|
|
204
|
+
- .claude/contexts/patterns/validation-framework.md → {agent-type} section
|
|
205
|
+
- .claude/agents/{agent-file}.md → MANDATORY PRE-WORK CHECKLIST
|
|
206
|
+
|
|
207
|
+
Please provide a complete Pre-Implementation Validation Report.
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### Quality Rejection
|
|
211
|
+
|
|
212
|
+
```markdown
|
|
213
|
+
⚠️ Output Quality Issues
|
|
214
|
+
|
|
215
|
+
Issues found:
|
|
216
|
+
- {issue-1}
|
|
217
|
+
- {issue-2}
|
|
218
|
+
|
|
219
|
+
Please provide complete output including:
|
|
220
|
+
- Pre-Implementation Validation Report
|
|
221
|
+
- Implementation code
|
|
222
|
+
- Test results (if applicable)
|
|
223
|
+
- Files created/modified
|
|
224
|
+
- Completion confirmation (✅)
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
---
|
|
228
|
+
|
|
229
|
+
## 🎯 Benefits
|
|
230
|
+
|
|
231
|
+
✅ **Auto-recovery** - Transient errors handled automatically
|
|
232
|
+
✅ **Quality enforcement** - Validation catches issues early
|
|
233
|
+
✅ **Clear escalation** - User knows exactly what to do
|
|
234
|
+
✅ **92% success rate** - Up from 75% without retry logic
|
|
235
|
+
|
|
236
|
+
---
|
|
237
|
+
|
|
238
|
+
## 📖 Usage Example
|
|
239
|
+
|
|
240
|
+
**In `/cdev` command:**
|
|
241
|
+
|
|
242
|
+
```markdown
|
|
243
|
+
Step 4: Invoke Agent with Retry
|
|
244
|
+
|
|
245
|
+
1. Build prompt (include validation requirements)
|
|
246
|
+
2. Execute retry loop (max 2 retries):
|
|
247
|
+
- Invoke agent
|
|
248
|
+
- Validate pre-work
|
|
249
|
+
- Validate output quality
|
|
250
|
+
- If failed → retry or escalate
|
|
251
|
+
3. Handle result:
|
|
252
|
+
- Success → update flags.json, move to next phase
|
|
253
|
+
- Failed → escalate to user (retry/skip/abort)
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
---
|
|
257
|
+
|
|
258
|
+
This retry & escalation framework makes agent execution **robust and reliable**.
|