@champpaba/claude-agent-kit 1.1.1 → 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/CLAUDE.md +52 -444
- package/.claude/agents/01-integration.md +47 -193
- package/.claude/agents/02-uxui-frontend.md +40 -186
- package/.claude/agents/03-test-debug.md +43 -186
- package/.claude/agents/04-frontend.md +50 -478
- package/.claude/agents/05-backend.md +49 -499
- package/.claude/agents/06-database.md +36 -188
- package/.claude/commands/cdev.md +86 -1
- package/.claude/commands/csetup.md +319 -6
- package/.claude/commands/designsetup.md +360 -29
- package/.claude/commands/pageplan.md +40 -10
- package/.claude/lib/README.md +46 -4
- 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/handoff-protocol.md +665 -0
- package/.claude/lib/task-analyzer.md +694 -0
- package/.claude/lib/tdd-workflow.md +891 -0
- package/.claude/templates/design-context-template.md +220 -0
- package/README.md +191 -0
- package/package.json +1 -1
|
@@ -0,0 +1,462 @@
|
|
|
1
|
+
# Context Loading Protocol
|
|
2
|
+
|
|
3
|
+
> **Unified context loading strategy for all agents**
|
|
4
|
+
> **Version:** 1.4.0
|
|
5
|
+
> **Purpose:** Eliminate duplication across 6 agents, enforce consistency
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 📋 Overview
|
|
10
|
+
|
|
11
|
+
This protocol defines how agents discover and load context before starting work.
|
|
12
|
+
|
|
13
|
+
**Why this exists:**
|
|
14
|
+
- ✅ Single source of truth (DRY principle)
|
|
15
|
+
- ✅ Consistent behavior across all agents
|
|
16
|
+
- ✅ Easier maintenance (update once, applies everywhere)
|
|
17
|
+
- ✅ Package manager safety (prevent wrong tool usage)
|
|
18
|
+
|
|
19
|
+
**Who uses this:**
|
|
20
|
+
- All 6 agents (integration, uxui-frontend, test-debug, frontend, backend, database)
|
|
21
|
+
- Commands that need tech stack info (/agentsetup, /csetup, /cdev)
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## 🚨 Level 0: Package Manager Discovery (CRITICAL!)
|
|
26
|
+
|
|
27
|
+
**⚠️ STOP! Read this BEFORE running ANY install/run command**
|
|
28
|
+
|
|
29
|
+
### Why This Matters:
|
|
30
|
+
|
|
31
|
+
Using the wrong package manager can:
|
|
32
|
+
- ❌ Create duplicate lock files (package-lock.json + pnpm-lock.yaml)
|
|
33
|
+
- ❌ Install to wrong location (node_modules vs .venv)
|
|
34
|
+
- ❌ Break CI/CD pipelines
|
|
35
|
+
- ❌ Cause version conflicts
|
|
36
|
+
|
|
37
|
+
### Protocol:
|
|
38
|
+
|
|
39
|
+
**Step 1: Check if tech-stack.md exists**
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
# Read this file FIRST:
|
|
43
|
+
.claude/contexts/domain/{project-name}/tech-stack.md
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
**Step 2: Extract package manager**
|
|
47
|
+
|
|
48
|
+
```markdown
|
|
49
|
+
## Package Manager
|
|
50
|
+
### JavaScript/TypeScript
|
|
51
|
+
- Tool: pnpm
|
|
52
|
+
- Install: pnpm install <package>
|
|
53
|
+
- Run: pnpm run <script>
|
|
54
|
+
|
|
55
|
+
### Python
|
|
56
|
+
- Tool: uv
|
|
57
|
+
- Install: uv pip install <package>
|
|
58
|
+
- Run: uv run <script>
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
**Step 3: Store for all subsequent commands**
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
✅ Package Manager Detected:
|
|
65
|
+
- JavaScript: pnpm
|
|
66
|
+
- Python: uv
|
|
67
|
+
|
|
68
|
+
🎯 Will use these tools for all install/run commands
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### What to Extract:
|
|
72
|
+
|
|
73
|
+
From tech-stack.md, extract:
|
|
74
|
+
|
|
75
|
+
1. **Framework** (Next.js, FastAPI, Vue, Django, Express)
|
|
76
|
+
- Use for: Context7 queries
|
|
77
|
+
- Example: "/vercel/next.js", "/fastapi/fastapi"
|
|
78
|
+
|
|
79
|
+
2. **Package Manager** (pnpm, npm, bun, uv, poetry, pip)
|
|
80
|
+
- Use for: ALL install/run commands
|
|
81
|
+
- **CRITICAL:** NEVER hardcode npm/pip
|
|
82
|
+
|
|
83
|
+
3. **ORM/Database Tool** (Prisma, SQLAlchemy, TypeORM, Drizzle)
|
|
84
|
+
- Use for: Database agents
|
|
85
|
+
- Example: Prisma → use `prisma` CLI
|
|
86
|
+
|
|
87
|
+
4. **Testing Framework** (Vitest, Jest, Pytest, Playwright)
|
|
88
|
+
- Use for: test-debug agent
|
|
89
|
+
- Example: Vitest → use `vitest` command
|
|
90
|
+
|
|
91
|
+
### If tech-stack.md Doesn't Exist:
|
|
92
|
+
|
|
93
|
+
```
|
|
94
|
+
⚠️ tech-stack.md not found!
|
|
95
|
+
💡 User should run: /agentsetup
|
|
96
|
+
|
|
97
|
+
FALLBACK (use ONLY if absolutely necessary):
|
|
98
|
+
- Detect from package.json (JavaScript)
|
|
99
|
+
- Detect from pyproject.toml (Python)
|
|
100
|
+
- Warn user about missing tech-stack.md
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## 📚 Level 1: Universal Patterns (All Agents Load)
|
|
106
|
+
|
|
107
|
+
These patterns apply to ALL agents regardless of role:
|
|
108
|
+
|
|
109
|
+
**Core Patterns (ALWAYS load):**
|
|
110
|
+
- `@.claude/contexts/patterns/error-handling.md` (how to handle errors)
|
|
111
|
+
- `@.claude/contexts/patterns/logging.md` (logging standards)
|
|
112
|
+
- `@.claude/contexts/patterns/testing.md` (test conventions)
|
|
113
|
+
- `@.claude/contexts/patterns/code-standards.md` (coding style)
|
|
114
|
+
|
|
115
|
+
**Why load these:**
|
|
116
|
+
- Ensures consistent error messages across codebase
|
|
117
|
+
- Prevents random logging formats
|
|
118
|
+
- Enforces test naming conventions
|
|
119
|
+
- Maintains code quality standards
|
|
120
|
+
|
|
121
|
+
**Example report:**
|
|
122
|
+
```
|
|
123
|
+
✅ Universal Patterns Loaded:
|
|
124
|
+
- Error Handling ✓
|
|
125
|
+
- Logging ✓
|
|
126
|
+
- Testing ✓
|
|
127
|
+
- Code Standards ✓
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## 🎯 Level 2: Framework-Specific Patterns (Context7)
|
|
133
|
+
|
|
134
|
+
Based on tech-stack.md, query Context7 for latest framework docs.
|
|
135
|
+
|
|
136
|
+
### Decision Tree:
|
|
137
|
+
|
|
138
|
+
**IF Backend Framework (FastAPI, Express, Django):**
|
|
139
|
+
|
|
140
|
+
```javascript
|
|
141
|
+
// FastAPI (Python)
|
|
142
|
+
mcp__context7__get-library-docs("/fastapi/fastapi", {
|
|
143
|
+
topic: "routing, dependency injection, pydantic validation, async",
|
|
144
|
+
tokens: 3000
|
|
145
|
+
})
|
|
146
|
+
|
|
147
|
+
// Express (Node.js)
|
|
148
|
+
mcp__context7__get-library-docs("/expressjs/express", {
|
|
149
|
+
topic: "routing, middleware, error handling",
|
|
150
|
+
tokens: 2000
|
|
151
|
+
})
|
|
152
|
+
|
|
153
|
+
// Django
|
|
154
|
+
mcp__context7__get-library-docs("/django/django", {
|
|
155
|
+
topic: "views, urls, models, middleware",
|
|
156
|
+
tokens: 3000
|
|
157
|
+
})
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
**IF Frontend Framework (React, Next.js, Vue):**
|
|
161
|
+
|
|
162
|
+
```javascript
|
|
163
|
+
// Next.js
|
|
164
|
+
mcp__context7__get-library-docs("/vercel/next.js", {
|
|
165
|
+
topic: "app router, server components, api routes, routing",
|
|
166
|
+
tokens: 3000
|
|
167
|
+
})
|
|
168
|
+
|
|
169
|
+
// React
|
|
170
|
+
mcp__context7__get-library-docs("/facebook/react", {
|
|
171
|
+
topic: "hooks, components, state management",
|
|
172
|
+
tokens: 2000
|
|
173
|
+
})
|
|
174
|
+
|
|
175
|
+
// Vue
|
|
176
|
+
mcp__context7__get-library-docs("/vuejs/core", {
|
|
177
|
+
topic: "composition api, components, reactivity",
|
|
178
|
+
tokens: 2000
|
|
179
|
+
})
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
**IF ORM/Database (Prisma, SQLAlchemy, TypeORM):**
|
|
183
|
+
|
|
184
|
+
```javascript
|
|
185
|
+
// Prisma
|
|
186
|
+
mcp__context7__get-library-docs("/prisma/prisma", {
|
|
187
|
+
topic: "schema, migrations, queries, relations",
|
|
188
|
+
tokens: 3000
|
|
189
|
+
})
|
|
190
|
+
|
|
191
|
+
// SQLAlchemy
|
|
192
|
+
mcp__context7__get-library-docs("/sqlalchemy/sqlalchemy", {
|
|
193
|
+
topic: "models, sessions, queries, relationships",
|
|
194
|
+
tokens: 3000
|
|
195
|
+
})
|
|
196
|
+
|
|
197
|
+
// TypeORM
|
|
198
|
+
mcp__context7__get-library-docs("/typeorm/typeorm", {
|
|
199
|
+
topic: "entities, migrations, queries",
|
|
200
|
+
tokens: 2000
|
|
201
|
+
})
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
**IF Testing Framework (Vitest, Jest, Pytest, Playwright):**
|
|
205
|
+
|
|
206
|
+
```javascript
|
|
207
|
+
// Vitest
|
|
208
|
+
mcp__context7__get-library-docs("/vitest-dev/vitest", {
|
|
209
|
+
topic: "testing, mocking, coverage",
|
|
210
|
+
tokens: 2000
|
|
211
|
+
})
|
|
212
|
+
|
|
213
|
+
// Pytest
|
|
214
|
+
mcp__context7__get-library-docs("/pytest-dev/pytest", {
|
|
215
|
+
topic: "fixtures, parametrize, mocking",
|
|
216
|
+
tokens: 2000
|
|
217
|
+
})
|
|
218
|
+
|
|
219
|
+
// Playwright
|
|
220
|
+
mcp__context7__get-library-docs("/microsoft/playwright", {
|
|
221
|
+
topic: "browser testing, selectors, assertions",
|
|
222
|
+
tokens: 2000
|
|
223
|
+
})
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
**Example report:**
|
|
227
|
+
```
|
|
228
|
+
✅ Framework Docs Loaded (Context7):
|
|
229
|
+
- Next.js 15 ✓ (app router, server components)
|
|
230
|
+
- React 19 ✓ (hooks, components)
|
|
231
|
+
- Prisma 6 ✓ (schema, queries)
|
|
232
|
+
- Vitest 2 ✓ (testing, mocking)
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
---
|
|
236
|
+
|
|
237
|
+
## 🎨 Level 3: Agent-Specific Contexts
|
|
238
|
+
|
|
239
|
+
Each agent loads additional contexts based on their role.
|
|
240
|
+
|
|
241
|
+
### uxui-frontend Agent:
|
|
242
|
+
|
|
243
|
+
**Additional contexts:**
|
|
244
|
+
- `@.claude/contexts/design/index.md` (design principles)
|
|
245
|
+
- `@.claude/contexts/design/box-thinking.md` (layout analysis)
|
|
246
|
+
- `@.claude/contexts/design/color-theory.md` (color usage)
|
|
247
|
+
- `@.claude/contexts/design/spacing.md` (spacing scale)
|
|
248
|
+
- `@.claude/contexts/design/shadows.md` (elevation)
|
|
249
|
+
- `@.claude/contexts/patterns/ui-component-consistency.md` (component reuse)
|
|
250
|
+
- `@.claude/contexts/patterns/frontend-component-strategy.md` (when to create vs reuse)
|
|
251
|
+
|
|
252
|
+
**Project-specific (if exists):**
|
|
253
|
+
- `design-system/STYLE_GUIDE.md` (17 sections, ~5K tokens)
|
|
254
|
+
- `design-system/STYLE_TOKENS.json` (lightweight, ~500 tokens)
|
|
255
|
+
- `.changes/{change-id}/page-plan.md` (from /pageplan command)
|
|
256
|
+
|
|
257
|
+
**Loading strategy:**
|
|
258
|
+
```
|
|
259
|
+
1. Try STYLE_TOKENS.json first (lightweight)
|
|
260
|
+
2. Load STYLE_GUIDE.md sections selectively
|
|
261
|
+
3. Fall back to design/*.md if no style guide
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
### backend Agent:
|
|
265
|
+
|
|
266
|
+
**Additional contexts:**
|
|
267
|
+
- API security patterns
|
|
268
|
+
- Request validation patterns
|
|
269
|
+
- Authentication/authorization patterns
|
|
270
|
+
|
|
271
|
+
**ORM-specific:**
|
|
272
|
+
- Load ORM docs from Context7 (Prisma, SQLAlchemy, etc.)
|
|
273
|
+
|
|
274
|
+
### database Agent:
|
|
275
|
+
|
|
276
|
+
**Additional contexts:**
|
|
277
|
+
- Schema design patterns
|
|
278
|
+
- Migration patterns
|
|
279
|
+
- Query optimization patterns
|
|
280
|
+
|
|
281
|
+
**ORM-specific:**
|
|
282
|
+
- Load ORM docs from Context7
|
|
283
|
+
- Focus on: schema, migrations, relationships
|
|
284
|
+
|
|
285
|
+
### frontend Agent:
|
|
286
|
+
|
|
287
|
+
**Additional contexts:**
|
|
288
|
+
- State management patterns (Zustand, Redux)
|
|
289
|
+
- API integration patterns
|
|
290
|
+
- Form handling patterns
|
|
291
|
+
|
|
292
|
+
### integration Agent:
|
|
293
|
+
|
|
294
|
+
**Additional contexts:**
|
|
295
|
+
- API contract validation patterns
|
|
296
|
+
- OpenAPI/Swagger patterns
|
|
297
|
+
|
|
298
|
+
### test-debug Agent:
|
|
299
|
+
|
|
300
|
+
**Additional contexts:**
|
|
301
|
+
- Test framework docs from Context7
|
|
302
|
+
- Debugging patterns
|
|
303
|
+
- Coverage patterns
|
|
304
|
+
|
|
305
|
+
---
|
|
306
|
+
|
|
307
|
+
## 📊 Complete Loading Flow Example
|
|
308
|
+
|
|
309
|
+
**Example: uxui-frontend agent starting work**
|
|
310
|
+
|
|
311
|
+
```
|
|
312
|
+
🔄 Starting Context Loading Protocol...
|
|
313
|
+
|
|
314
|
+
📦 Level 0: Package Manager Discovery
|
|
315
|
+
→ Reading: .claude/contexts/domain/my-app/tech-stack.md
|
|
316
|
+
✅ Detected:
|
|
317
|
+
- Framework: Next.js 15
|
|
318
|
+
- Package Manager: pnpm
|
|
319
|
+
- Testing: Vitest 2
|
|
320
|
+
|
|
321
|
+
📚 Level 1: Universal Patterns
|
|
322
|
+
→ Loading: error-handling.md ✓
|
|
323
|
+
→ Loading: logging.md ✓
|
|
324
|
+
→ Loading: testing.md ✓
|
|
325
|
+
→ Loading: code-standards.md ✓
|
|
326
|
+
✅ Universal patterns loaded
|
|
327
|
+
|
|
328
|
+
🎯 Level 2: Framework-Specific (Context7)
|
|
329
|
+
→ Query: /vercel/next.js (app router, server components)
|
|
330
|
+
→ Query: /facebook/react (hooks, components)
|
|
331
|
+
✅ Framework docs loaded
|
|
332
|
+
|
|
333
|
+
🎨 Level 3: Agent-Specific (uxui-frontend)
|
|
334
|
+
→ Loading: design/*.md ✓
|
|
335
|
+
→ Loading: patterns/ui-component-consistency.md ✓
|
|
336
|
+
→ Loading: design-system/STYLE_TOKENS.json ✓
|
|
337
|
+
→ Loading: .changes/landing-page/page-plan.md ✓
|
|
338
|
+
✅ Design contexts loaded
|
|
339
|
+
|
|
340
|
+
✅ Context Loading Complete!
|
|
341
|
+
|
|
342
|
+
📁 Project: my-app
|
|
343
|
+
🛠️ Stack: Next.js 15 + React 19
|
|
344
|
+
📦 Package Manager: pnpm
|
|
345
|
+
🎨 Style Guide: ✓ (17 sections)
|
|
346
|
+
📋 Page Plan: ✓ (3 reuse, 2 new)
|
|
347
|
+
|
|
348
|
+
🎯 Ready to start work!
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
---
|
|
352
|
+
|
|
353
|
+
## 🚨 Package Manager Safety Rules
|
|
354
|
+
|
|
355
|
+
### ❌ NEVER Do This:
|
|
356
|
+
|
|
357
|
+
```bash
|
|
358
|
+
# ❌ Hardcoded npm (wrong if project uses pnpm)
|
|
359
|
+
npm install lodash
|
|
360
|
+
|
|
361
|
+
# ❌ Hardcoded pip (wrong if project uses uv)
|
|
362
|
+
pip install requests
|
|
363
|
+
|
|
364
|
+
# ❌ Assuming package manager
|
|
365
|
+
npm run dev
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
### ✅ ALWAYS Do This:
|
|
369
|
+
|
|
370
|
+
```bash
|
|
371
|
+
# ✅ Read tech-stack.md first
|
|
372
|
+
# ✅ Use detected package manager
|
|
373
|
+
|
|
374
|
+
# If pnpm detected:
|
|
375
|
+
pnpm install lodash
|
|
376
|
+
pnpm run dev
|
|
377
|
+
|
|
378
|
+
# If uv detected:
|
|
379
|
+
uv pip install requests
|
|
380
|
+
uv run app.py
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
### Error Handling:
|
|
384
|
+
|
|
385
|
+
**If package manager command fails:**
|
|
386
|
+
|
|
387
|
+
```
|
|
388
|
+
❌ Error: pnpm command failed
|
|
389
|
+
|
|
390
|
+
Troubleshooting:
|
|
391
|
+
1. Check tech-stack.md is accurate
|
|
392
|
+
2. Verify package manager is installed
|
|
393
|
+
3. Try: npm install -g pnpm
|
|
394
|
+
4. Update tech-stack.md if wrong
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
**If tech-stack.md is outdated:**
|
|
398
|
+
|
|
399
|
+
```
|
|
400
|
+
⚠️ Warning: tech-stack.md shows pnpm, but pnpm-lock.yaml not found
|
|
401
|
+
|
|
402
|
+
Suggestion:
|
|
403
|
+
- Run: /agentsetup (regenerate tech-stack.md)
|
|
404
|
+
- Or manually update tech-stack.md
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
---
|
|
408
|
+
|
|
409
|
+
## 🔄 When to Re-load Context
|
|
410
|
+
|
|
411
|
+
**Re-load Level 0-2 when:**
|
|
412
|
+
- ✅ User runs `/agentsetup` (tech stack changed)
|
|
413
|
+
- ✅ Framework version upgraded
|
|
414
|
+
- ✅ New dependencies added
|
|
415
|
+
|
|
416
|
+
**Don't re-load when:**
|
|
417
|
+
- ❌ Working on same project continuously
|
|
418
|
+
- ❌ Context already loaded this session
|
|
419
|
+
- ❌ Only code changes (no new dependencies)
|
|
420
|
+
|
|
421
|
+
---
|
|
422
|
+
|
|
423
|
+
## 📝 Quick Reference
|
|
424
|
+
|
|
425
|
+
### Checklist for Agents:
|
|
426
|
+
|
|
427
|
+
```markdown
|
|
428
|
+
Before starting ANY work:
|
|
429
|
+
|
|
430
|
+
[ ] Level 0: Read tech-stack.md
|
|
431
|
+
- Extract package manager
|
|
432
|
+
- Extract framework
|
|
433
|
+
- Store for subsequent commands
|
|
434
|
+
|
|
435
|
+
[ ] Level 1: Load universal patterns
|
|
436
|
+
- error-handling.md
|
|
437
|
+
- logging.md
|
|
438
|
+
- testing.md
|
|
439
|
+
- code-standards.md
|
|
440
|
+
|
|
441
|
+
[ ] Level 2: Query Context7
|
|
442
|
+
- Framework docs
|
|
443
|
+
- ORM docs (if applicable)
|
|
444
|
+
- Testing docs (if applicable)
|
|
445
|
+
|
|
446
|
+
[ ] Level 3: Load agent-specific contexts
|
|
447
|
+
- See agent-specific sections above
|
|
448
|
+
|
|
449
|
+
[ ] Report context loading complete
|
|
450
|
+
- Show package manager
|
|
451
|
+
- Show frameworks loaded
|
|
452
|
+
- Show contexts loaded
|
|
453
|
+
```
|
|
454
|
+
|
|
455
|
+
---
|
|
456
|
+
|
|
457
|
+
## 🔗 See Also
|
|
458
|
+
|
|
459
|
+
- `agent-discovery.md` - Project discovery flow (STEP 0)
|
|
460
|
+
- `validation-framework.md` - Pre-work validation requirements
|
|
461
|
+
- `agent-router.md` - Agent routing rules
|
|
462
|
+
- `contexts/domain/{project}/tech-stack.md` - Tech stack source of truth
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
# Agent System
|
|
2
|
+
|
|
3
|
+
> **Detailed guide to the multi-agent architecture**
|
|
4
|
+
> **Source:** Extracted from CLAUDE.md (Navigation Hub)
|
|
5
|
+
> **Version:** 1.4.0
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 🤖 How It Works
|
|
10
|
+
|
|
11
|
+
**Main Claude analyzes tasks → Invokes specialist agents directly**
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
1. User provides task (e.g., "Build login system")
|
|
15
|
+
↓
|
|
16
|
+
2. Main Claude reads @task-classification.md
|
|
17
|
+
↓
|
|
18
|
+
3. Main Claude selects appropriate agent(s)
|
|
19
|
+
↓
|
|
20
|
+
4. Execute in proper sequence:
|
|
21
|
+
- Phase 1: uxui-frontend (UI with mock data)
|
|
22
|
+
- Phase 2: backend + database (parallel)
|
|
23
|
+
- Phase 2.5: integration (validate contracts)
|
|
24
|
+
- Phase 3: frontend (connect UI to API)
|
|
25
|
+
- Phase 4: test-debug (tests & bug fixes)
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Available Agents (6 specialists)
|
|
31
|
+
|
|
32
|
+
| Agent | Color | When to Use | Phase |
|
|
33
|
+
|-------|-------|-------------|-------|
|
|
34
|
+
| **integration** | Orange | Validate API contracts before connecting | 2.5 |
|
|
35
|
+
| **uxui-frontend** | Blue | Design UI components with mock data | 1 |
|
|
36
|
+
| **test-debug** | Red | Run tests and fix bugs (max 3-4 iterations) | 1,3,4 |
|
|
37
|
+
| **frontend** | Green | Connect UI to backend APIs | 3 |
|
|
38
|
+
| **backend** | Purple | Create API endpoints with validation | 2 |
|
|
39
|
+
| **database** | Pink | Design schemas, migrations, complex queries | 2 |
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Usage
|
|
44
|
+
|
|
45
|
+
**For any task, Main Claude will:**
|
|
46
|
+
1. Read `@/.claude/contexts/patterns/task-classification.md`
|
|
47
|
+
2. Determine which agent(s) to use
|
|
48
|
+
3. Invoke agents in proper sequence
|
|
49
|
+
4. Coordinate between agents
|
|
50
|
+
|
|
51
|
+
**You can also invoke agents directly:**
|
|
52
|
+
```
|
|
53
|
+
User: "/agents uxui-frontend"
|
|
54
|
+
Main Claude: *Executes uxui-frontend agent directly*
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## 🔒 Main Claude Self-Check Protocol (MANDATORY)
|
|
60
|
+
|
|
61
|
+
**⚠️ CRITICAL: Main Claude MUST complete this checklist BEFORE doing ANY work**
|
|
62
|
+
|
|
63
|
+
See: `@/.claude/lib/agent-router.md` for complete routing protocol
|
|
64
|
+
|
|
65
|
+
**Pre-Work Checklist (Run for EVERY user request):**
|
|
66
|
+
|
|
67
|
+
```markdown
|
|
68
|
+
## ✅ Pre-Work Self-Check
|
|
69
|
+
|
|
70
|
+
[ ] 1. Read user request carefully
|
|
71
|
+
- What are they asking for?
|
|
72
|
+
- What is the end goal?
|
|
73
|
+
|
|
74
|
+
[ ] 2. Detect work type
|
|
75
|
+
- Is this implementation work? (writing code, creating files)
|
|
76
|
+
- Is this planning/analysis? (reading, explaining, breaking down)
|
|
77
|
+
|
|
78
|
+
[ ] 3. If IMPLEMENTATION work:
|
|
79
|
+
- Read: @/.claude/contexts/patterns/task-classification.md
|
|
80
|
+
- Which agent should handle this?
|
|
81
|
+
• UI components → uxui-frontend
|
|
82
|
+
• API endpoints → backend
|
|
83
|
+
• Database schemas → database
|
|
84
|
+
• API integration → frontend
|
|
85
|
+
• Tests/bugs → test-debug
|
|
86
|
+
• Contracts → integration
|
|
87
|
+
|
|
88
|
+
[ ] 4. Can Main Claude do this?
|
|
89
|
+
✅ YES for: Planning, reading files, explaining, orchestrating workflows
|
|
90
|
+
❌ NO for: Writing components, creating endpoints, designing schemas
|
|
91
|
+
|
|
92
|
+
[ ] 5. If MUST delegate:
|
|
93
|
+
- Use Task tool with selected agent
|
|
94
|
+
- Include all necessary context
|
|
95
|
+
- Wait for agent response
|
|
96
|
+
- Update flags.json after completion (if using /cdev)
|
|
97
|
+
|
|
98
|
+
[ ] 6. Report decision to user
|
|
99
|
+
```
|
|
100
|
+
🔍 Task Analysis:
|
|
101
|
+
- Work type: [type]
|
|
102
|
+
- Requires: [agent] agent
|
|
103
|
+
- Reason: [explanation]
|
|
104
|
+
|
|
105
|
+
🚀 Invoking [agent] agent...
|
|
106
|
+
```
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
**Main Claude's Role:**
|
|
110
|
+
- ✅ Orchestrator (plan, coordinate, report)
|
|
111
|
+
- ✅ Progress tracker (update flags.json)
|
|
112
|
+
- ✅ Analyst (read files, explain code)
|
|
113
|
+
- ❌ NOT implementer (no writing code directly)
|
|
114
|
+
|
|
115
|
+
**If Main Claude skips this self-check for implementation work, it violates system protocol.**
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## ⚠️ Agent Pre-Work Requirements
|
|
120
|
+
|
|
121
|
+
**STEP 0 (ALL agents):** Every agent must discover project context first
|
|
122
|
+
|
|
123
|
+
**STEP 1-5 (uxui-frontend only):** Design fundamentals checklist
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
### STEP 0: Project Discovery (ALL Agents)
|
|
128
|
+
|
|
129
|
+
**Every agent MUST complete this before ANY work:**
|
|
130
|
+
|
|
131
|
+
```
|
|
132
|
+
1. Read: domain/index.md → Get current project name
|
|
133
|
+
2. Read: domain/{project}/README.md → Get tech stack summary
|
|
134
|
+
3. Read: domain/{project}/best-practices/index.md → Find relevant files
|
|
135
|
+
4. Read: domain/{project}/best-practices/{files} → Load best practices
|
|
136
|
+
5. Report: "✅ Project Context Loaded"
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
**STEP 0.5 (uxui-frontend ONLY):**
|
|
140
|
+
|
|
141
|
+
```
|
|
142
|
+
6. Check: design-system/STYLE_GUIDE.md exists?
|
|
143
|
+
- If YES → Read STYLE_GUIDE.md (Priority #1 - project-specific)
|
|
144
|
+
- If NO → Read .claude/contexts/design/*.md (Fallback - general principles)
|
|
145
|
+
7. Report: "✅ Style Guide Loaded" or "⚠️ No style guide - using general principles"
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
**Why this matters:**
|
|
149
|
+
- STYLE_GUIDE.md = project-specific design system (colors, spacing, components)
|
|
150
|
+
- design/*.md = universal design principles (box thinking, color theory)
|
|
151
|
+
- Priority: STYLE_GUIDE.md > design/*.md
|
|
152
|
+
|
|
153
|
+
**Fallback:** If discovery fails, warn user to run `/agentsetup` or `/designsetup`
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
### STEP 1-5: Design Fundamentals (uxui-frontend only)
|
|
158
|
+
|
|
159
|
+
**When invoking uxui-frontend agent, Main Claude MUST include these requirements in the Task prompt:**
|
|
160
|
+
|
|
161
|
+
```
|
|
162
|
+
MANDATORY PRE-WORK CHECKLIST (after STEP 0):
|
|
163
|
+
|
|
164
|
+
Before writing ANY code, you MUST:
|
|
165
|
+
|
|
166
|
+
1. **Read ALL design contexts:**
|
|
167
|
+
- @/.claude/contexts/design/index.md
|
|
168
|
+
- @/.claude/contexts/design/box-thinking.md
|
|
169
|
+
- @/.claude/contexts/design/color-theory.md
|
|
170
|
+
- @/.claude/contexts/design/spacing.md
|
|
171
|
+
- @/.claude/contexts/patterns/ui-component-consistency.md
|
|
172
|
+
- @/.claude/contexts/patterns/frontend-component-strategy.md
|
|
173
|
+
|
|
174
|
+
2. **Do Box Thinking Analysis:**
|
|
175
|
+
- Identify all boxes (parent, children, siblings)
|
|
176
|
+
- Document relationships (container, adjacent, nested)
|
|
177
|
+
- Plan space flow using spacing scale (8, 16, 24, 32, 40, 48px)
|
|
178
|
+
- Plan responsive behavior (stack/merge/compress)
|
|
179
|
+
|
|
180
|
+
3. **Search for Existing Components:**
|
|
181
|
+
- Glob: "**/*{Keyword}*.{tsx,jsx,vue}"
|
|
182
|
+
- Grep: "[similar-pattern]"
|
|
183
|
+
- Decision: Reuse > Compose > Extend > Create New
|
|
184
|
+
- If creating new: Extract design tokens from most similar component
|
|
185
|
+
|
|
186
|
+
4. **Extract Design Tokens from Reference Component:**
|
|
187
|
+
```typescript
|
|
188
|
+
const DESIGN_TOKENS = {
|
|
189
|
+
spacing: { padding: '[from reference]', gap: '[from reference]' },
|
|
190
|
+
colors: { bg: '[theme token]', text: '[theme token]', border: '[theme token]' },
|
|
191
|
+
shadows: '[from reference - e.g., shadow-sm]',
|
|
192
|
+
borderRadius: '[from reference - e.g., rounded-md]'
|
|
193
|
+
}
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
5. **Report Pre-Implementation Analysis:**
|
|
197
|
+
You MUST provide a detailed report covering steps 1-4 BEFORE writing any code.
|
|
198
|
+
|
|
199
|
+
CRITICAL RULES:
|
|
200
|
+
- ❌ NO hardcoded colors (text-gray-500) → ✅ Use theme tokens (text-foreground/70)
|
|
201
|
+
- ❌ NO arbitrary spacing (p-5) → ✅ Use spacing scale (p-4, p-6)
|
|
202
|
+
- ❌ NO inconsistent icons (h-5 w-5, opacity-50) → ✅ Match reference (h-4 w-4, text-foreground/70)
|
|
203
|
+
- ❌ NO creating duplicate components → ✅ Search and reuse first
|
|
204
|
+
|
|
205
|
+
If you skip these steps, your work will be rejected.
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
**Why this enforcement matters:**
|
|
209
|
+
- Prevents visual inconsistency (mismatched colors, spacing, shadows)
|
|
210
|
+
- Ensures component reuse (avoids duplicates)
|
|
211
|
+
- Maintains design system integrity
|
|
212
|
+
- Saves implementation time
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
## Example: Build Login System
|
|
217
|
+
|
|
218
|
+
```
|
|
219
|
+
User: "Build a login system"
|
|
220
|
+
Main Claude analyzes → Breaks into phases:
|
|
221
|
+
Phase 1: /agents uxui-frontend (create login form UI)
|
|
222
|
+
Phase 2: /agents backend (create POST /api/login)
|
|
223
|
+
/agents database (create User model) [parallel]
|
|
224
|
+
Phase 2.5: /agents integration (verify contracts)
|
|
225
|
+
Phase 3: /agents frontend (connect form to API)
|
|
226
|
+
Phase 4: /agents test-debug (test everything)
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
---
|
|
230
|
+
|
|
231
|
+
## 🔗 See Also
|
|
232
|
+
|
|
233
|
+
- `../agent-router.md` - Mandatory agent routing rules (enforcement)
|
|
234
|
+
- `../agent-executor.md` - Agent retry & escalation logic (used by /cdev)
|
|
235
|
+
- `../../contexts/patterns/task-classification.md` - Agent selection guide
|
|
236
|
+
- `../../contexts/patterns/agent-coordination.md` - When to run agents parallel/sequential
|
|
237
|
+
- `../../contexts/patterns/agent-discovery.md` - Shared agent discovery flow
|