@champpaba/claude-agent-kit 1.1.0 → 1.4.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/.claude/CHANGELOG-v1.1.1.md +259 -0
- package/.claude/CLAUDE.md +163 -0
- package/.claude/agents/01-integration.md +651 -0
- package/.claude/agents/02-uxui-frontend.md +809 -0
- package/.claude/agents/03-test-debug.md +616 -0
- package/.claude/agents/04-frontend.md +671 -0
- package/.claude/agents/05-backend.md +767 -0
- package/.claude/agents/06-database.md +817 -0
- package/.claude/commands/agentsetup.md +1464 -0
- package/.claude/commands/cdev.md +412 -0
- package/.claude/commands/csetup.md +760 -0
- package/.claude/commands/cstatus.md +60 -0
- package/.claude/commands/cview.md +364 -0
- package/.claude/commands/designsetup.md +1169 -0
- package/.claude/commands/extract.md +1005 -0
- package/.claude/commands/pageplan.md +357 -0
- package/.claude/commands/psetup.md +101 -0
- package/.claude/contexts/design/accessibility.md +611 -0
- package/.claude/contexts/design/box-thinking.md +566 -0
- package/.claude/contexts/design/color-theory.md +519 -0
- package/.claude/contexts/design/index.md +290 -0
- package/.claude/contexts/design/layout.md +400 -0
- package/.claude/contexts/design/responsive.md +551 -0
- package/.claude/contexts/design/shadows.md +522 -0
- package/.claude/contexts/design/spacing.md +445 -0
- package/.claude/contexts/design/typography.md +465 -0
- package/.claude/contexts/domain/README.md +164 -0
- package/.claude/contexts/patterns/agent-coordination.md +388 -0
- package/.claude/contexts/patterns/agent-discovery.md +182 -0
- package/.claude/contexts/patterns/change-workflow.md +538 -0
- package/.claude/contexts/patterns/code-standards.md +515 -0
- package/.claude/contexts/patterns/development-principles.md +513 -0
- package/.claude/contexts/patterns/error-handling.md +478 -0
- package/.claude/contexts/patterns/error-recovery.md +365 -0
- package/.claude/contexts/patterns/frontend-component-strategy.md +365 -0
- package/.claude/contexts/patterns/git-workflow.md +207 -0
- package/.claude/contexts/patterns/logging.md +424 -0
- package/.claude/contexts/patterns/task-breakdown.md +452 -0
- package/.claude/contexts/patterns/task-classification.md +523 -0
- package/.claude/contexts/patterns/tdd-classification.md +516 -0
- package/.claude/contexts/patterns/testing.md +413 -0
- package/.claude/contexts/patterns/ui-component-consistency.md +304 -0
- package/.claude/contexts/patterns/validation-framework.md +776 -0
- package/.claude/lib/README.md +81 -0
- package/.claude/lib/agent-executor.md +258 -0
- package/.claude/lib/agent-router.md +572 -0
- package/.claude/lib/context-loading-protocol.md +462 -0
- package/.claude/lib/detailed-guides/agent-system.md +237 -0
- package/.claude/lib/detailed-guides/best-practices-system.md +150 -0
- package/.claude/lib/detailed-guides/context-optimization.md +118 -0
- package/.claude/lib/detailed-guides/design-system.md +98 -0
- package/.claude/lib/detailed-guides/page-planning.md +147 -0
- package/.claude/lib/detailed-guides/taskmaster-analysis.md +263 -0
- package/.claude/lib/document-loader.md +353 -0
- package/.claude/lib/flags-updater.md +469 -0
- package/.claude/lib/handoff-protocol.md +665 -0
- package/.claude/lib/task-analyzer.md +694 -0
- package/.claude/lib/tdd-classifier.md +345 -0
- package/.claude/lib/tdd-workflow.md +891 -0
- package/.claude/lib/validation-gates.md +484 -0
- package/.claude/settings.local.json +42 -0
- package/.claude/templates/STYLE_GUIDE.template.md +879 -0
- package/.claude/templates/context-template.md +45 -0
- package/.claude/templates/design-context-template.md +220 -0
- package/.claude/templates/flags-template.json +42 -0
- package/.claude/templates/page-plan-example.md +562 -0
- package/.claude/templates/phase-templates.json +124 -0
- package/.claude/templates/phases-sections/accessibility-test.md +17 -0
- package/.claude/templates/phases-sections/api-design.md +37 -0
- package/.claude/templates/phases-sections/backend-tests.md +16 -0
- package/.claude/templates/phases-sections/backend.md +37 -0
- package/.claude/templates/phases-sections/business-logic-validation.md +16 -0
- package/.claude/templates/phases-sections/component-tests.md +17 -0
- package/.claude/templates/phases-sections/contract-backend.md +16 -0
- package/.claude/templates/phases-sections/contract-frontend.md +16 -0
- package/.claude/templates/phases-sections/database.md +35 -0
- package/.claude/templates/phases-sections/documentation.md +17 -0
- package/.claude/templates/phases-sections/e2e-tests.md +16 -0
- package/.claude/templates/phases-sections/fix-implementation.md +17 -0
- package/.claude/templates/phases-sections/frontend-integration.md +18 -0
- package/.claude/templates/phases-sections/frontend-mockup.md +123 -0
- package/.claude/templates/phases-sections/manual-flow-test.md +15 -0
- package/.claude/templates/phases-sections/manual-ux-test.md +16 -0
- package/.claude/templates/phases-sections/refactor-implementation.md +17 -0
- package/.claude/templates/phases-sections/refactor.md +16 -0
- package/.claude/templates/phases-sections/regression-tests.md +15 -0
- package/.claude/templates/phases-sections/report.md +16 -0
- package/.claude/templates/phases-sections/responsive-test.md +16 -0
- package/.claude/templates/phases-sections/script-implementation.md +43 -0
- package/.claude/templates/phases-sections/test-coverage.md +16 -0
- package/.claude/templates/phases-sections/user-approval.md +14 -0
- package/README.md +191 -0
- package/lib/init.js +1 -1
- package/lib/update.js +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# .claude/lib/ - Implementation Logic
|
|
2
|
+
|
|
3
|
+
> **Logic specifications for Main Claude orchestrator**
|
|
4
|
+
> **Version:** 1.4.0 - Context Optimization & DRY Consolidation
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## 📁 Core Logic Files
|
|
9
|
+
|
|
10
|
+
**`agent-executor.md`** - Agent retry & escalation logic
|
|
11
|
+
Used by `/cdev` to execute agents with automatic retry, validation, and user escalation
|
|
12
|
+
|
|
13
|
+
**`tdd-classifier.md`** - TDD classification logic
|
|
14
|
+
Used by `/csetup` to automatically determine which phases require TDD workflow
|
|
15
|
+
|
|
16
|
+
**`flags-updater.md`** - Progress tracking protocol
|
|
17
|
+
Ensures Main Claude updates flags.json after EVERY phase completion. Provides helper functions for extracting files, tasks, and calculating duration.
|
|
18
|
+
|
|
19
|
+
**`agent-router.md`** - Mandatory agent routing rules
|
|
20
|
+
Enforces strict agent boundaries. Main Claude MUST delegate implementation work to specialized agents. Includes work type detection patterns and self-check protocol.
|
|
21
|
+
|
|
22
|
+
**`validation-gates.md`** - Validation checkpoints
|
|
23
|
+
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.
|
|
24
|
+
|
|
25
|
+
**`task-analyzer.md`** - TaskMaster-style task analysis (v1.3.0)
|
|
26
|
+
Used by `/csetup` to analyze tasks with 6 dimensions: complexity, dependencies, risk, research, subtasks, priority. Generates intelligent phases.md with time buffers and metadata.
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## 📁 Shared Documentation (v1.4.0 - NEW!)
|
|
31
|
+
|
|
32
|
+
**`context-loading-protocol.md`** - Universal context loading strategy
|
|
33
|
+
Consolidated protocol used by ALL agents (STEP 0). Includes package manager discovery, framework detection via Context7, and best practices loading.
|
|
34
|
+
|
|
35
|
+
**`handoff-protocol.md`** - Agent handoff templates
|
|
36
|
+
Standardized handoff formats for agent-to-agent communication. Includes all 15 handoff paths with clear templates.
|
|
37
|
+
|
|
38
|
+
**`tdd-workflow.md`** - TDD workflow examples
|
|
39
|
+
Complete TDD implementation examples (Stripe integration, user auth). Used by frontend, backend, database agents.
|
|
40
|
+
|
|
41
|
+
**`document-loader.md`** - Token-efficient document loading
|
|
42
|
+
Unified pattern for loading design system files. 3-tier strategy: STYLE_TOKENS.json → design-context.md → STYLE_GUIDE.md.
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## 📁 Detailed Guides (v1.4.0 - NEW!)
|
|
47
|
+
|
|
48
|
+
**`detailed-guides/best-practices-system.md`** - How best practices work
|
|
49
|
+
Complete guide to auto-generated best practices via Context7 MCP. Covers `/agentsetup`, 3-level indexing, and agent discovery flow.
|
|
50
|
+
|
|
51
|
+
**`detailed-guides/context-optimization.md`** - Token optimization strategy
|
|
52
|
+
Details the 70% token reduction in design system loading. Explains 3-tier loading, before/after comparisons, and benefits.
|
|
53
|
+
|
|
54
|
+
**`detailed-guides/page-planning.md`** - /pageplan command guide
|
|
55
|
+
Complete guide to page planning system. Covers component reuse, content drafting, asset preparation, and 25% speed improvement.
|
|
56
|
+
|
|
57
|
+
**`detailed-guides/taskmaster-analysis.md`** - 6-dimension task analysis
|
|
58
|
+
Detailed explanation of TaskMaster-style analysis. Covers complexity scoring, dependency detection, risk assessment, research requirements, subtask breakdown, priority ranking.
|
|
59
|
+
|
|
60
|
+
**`detailed-guides/design-system.md`** - Style guide generation
|
|
61
|
+
How `/designsetup` works. Covers 3 smart paths (reference → brownfield → greenfield), 17-section output, and agent discovery.
|
|
62
|
+
|
|
63
|
+
**`detailed-guides/agent-system.md`** - Agent overview & workflow
|
|
64
|
+
Complete agent system guide. Covers 6 specialist agents, Main Claude's role, self-check protocol, and pre-work requirements.
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## 🚨 Important
|
|
69
|
+
|
|
70
|
+
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.
|
|
71
|
+
|
|
72
|
+
**Why .md files?** Claude Code has no TypeScript runtime. These files are "pseudocode specifications" that Main Claude reads and implements.
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## 📚 See Also
|
|
77
|
+
|
|
78
|
+
- `.claude/contexts/patterns/validation-framework.md` - Agent validation checklists
|
|
79
|
+
- `.claude/contexts/patterns/agent-discovery.md` - Agent discovery flow
|
|
80
|
+
- `.claude/commands/cdev.md` - How /cdev uses agent-executor.md
|
|
81
|
+
- `.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**.
|