@torka/claude-workflows 0.6.3 → 0.7.1

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.
@@ -37,8 +37,12 @@ Before any operations, verify the environment is safe:
37
37
 
38
38
  8. **Build worktree inventory**: Run `git worktree list --porcelain` to detect all worktrees.
39
39
  - Parse the output to build a map: `{ branch_name -> worktree_path }`
40
- - **For each worktree path, verify it exists on the filesystem**
41
- - **If a path doesn't exist (stale entry), run `git worktree prune` to clean it up before continuing**
40
+ - **For each worktree path:**
41
+ a) Verify the directory exists on the filesystem
42
+ b) If it exists, verify git metadata is valid: `git -C <path> rev-parse --git-dir 2>/dev/null`
43
+ c) If directory exists but git command fails, this is a **stale worktree** (metadata broken but directory remains)
44
+ - **If any paths don't exist OR have invalid git metadata, run `git worktree prune` to clean up before continuing**
45
+ - After pruning, re-run `git worktree list --porcelain` to get the updated inventory
42
46
  - Identify which worktree is the main worktree vs linked worktrees
43
47
  - For each branch, record if it's checked out in a worktree and where
44
48
 
@@ -132,6 +136,8 @@ Store the WIP branches list for use in subsequent phases. Also maintain a separa
132
136
 
133
137
  ## Phase 3: Cleanup Merged Branches
134
138
 
139
+ **Note on GitHub auto-delete:** Many repositories have "Automatically delete head branches" enabled in GitHub settings. When enabled, merged/squash-merged PR branches are automatically deleted from the remote. The workflow handles this gracefully - if remote deletion fails because the branch is already gone, it continues normally.
140
+
135
141
  For all branches identified as merged (via regular merge OR squash merge):
136
142
 
137
143
  ### Step 1: Categorize merged branches by worktree status
@@ -190,8 +196,14 @@ Options:
190
196
  - WARN: "Worktree at '<path>' has uncommitted changes that will be LOST"
191
197
  - Ask for explicit confirmation: "Proceed anyway?" / "Skip this worktree"
192
198
  - If skip, move to next branch
193
- 3. Remove worktree: `git worktree remove <worktree-path>`
194
- 4. If removal fails (locked, etc.), inform user and skip
199
+ 3. Remove worktree: `git worktree remove --force <worktree-path>`
200
+ - The `--force` flag is needed because worktrees often contain untracked build artifacts (.next, node_modules, coverage, etc.)
201
+ - This is safe here because we already: (a) confirmed the branch is merged/squash-merged, (b) warned about uncommitted changes if any
202
+ 4. If removal still fails (locked, etc.):
203
+ a) Run `git worktree prune` to clean up stale metadata
204
+ b) If directory still exists, inform user: "Leftover directory at '<path>' needs manual removal: `rm -rf '<path>'`"
205
+ c) **Do NOT attempt `rm -rf` directly** - this may be blocked by safety hooks in some environments
206
+ d) Continue with branch deletion if possible
195
207
  5. Proceed to delete branch (now safe)
196
208
 
197
209
  **If option 2 (Skip):**
@@ -207,7 +219,10 @@ Options:
207
219
 
208
220
  For each branch now eligible for deletion:
209
221
  - Delete local: `git branch -d <branch>` (use `-D` for squash-merged branches that git doesn't recognize as merged)
210
- - Delete remote (if exists): `git push <remote> --delete <branch>`
222
+ - Delete remote (if tracking branch exists):
223
+ 1. First check if remote branch exists: `git ls-remote --heads <remote> <branch>`
224
+ 2. If output is empty, remote branch is already deleted (likely by GitHub auto-delete) - skip remote deletion
225
+ 3. If remote branch exists: `git push <remote> --delete <branch>`
211
226
 
212
227
  ### Step 6: Clean up orphaned tracking branches
213
228
 
@@ -407,7 +422,7 @@ If the workflow fails at any point, display:
407
422
 
408
423
  ### Worktree Safety Rules
409
424
  - NEVER remove a worktree with uncommitted changes without explicit user confirmation
410
- - NEVER force remove a worktree (`git worktree remove --force`) - always handle uncommitted changes properly
425
+ - `--force` flag for worktree removal IS allowed when: (a) branch is confirmed merged/squash-merged, AND (b) uncommitted changes have been checked and user warned if any exist. The `--force` is needed to handle untracked build artifacts (.next, node_modules, etc.)
411
426
  - ALWAYS check worktree status (`git -C <path> status --porcelain`) before attempting branch deletion
412
427
  - ALWAYS run `git worktree prune` after removing worktrees to clean up stale entries
413
428
  - NEVER attempt to remove the main worktree (git will error, but check anyway)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@torka/claude-workflows",
3
- "version": "0.6.3",
3
+ "version": "0.7.1",
4
4
  "description": "Claude Code workflow helpers: epic automation, git cleanup, agents, and design workflows",
5
5
  "keywords": [
6
6
  "claude-code",
@@ -10,8 +10,9 @@ Only use this template when explicitly requested for non-story tasks (research,
10
10
  ---
11
11
  name: {agent-name}
12
12
  description: {Clear description of when/why to use this agent. Be specific about triggers.}
13
- tools: {Comma-separated list of allowed tools}
14
13
  model: {sonnet|haiku|opus|inherit}
14
+ # Optional: Only use disallowedTools if you need to restrict specific tools
15
+ # disallowedTools: {tools to deny, e.g., Write, Edit for read-only agents}
15
16
  ---
16
17
 
17
18
  # Role & Purpose
@@ -24,11 +25,32 @@ This agent should be used when:
24
25
  - {Trigger condition 1}
25
26
  - {Trigger condition 2}
26
27
 
28
+ ## First Action: MCP Availability Check
29
+
30
+ Before starting work:
31
+ 1. Review task requirements for MCP dependencies
32
+ 2. If critical MCP unavailable:
33
+ - Output: `ESCALATE: Required MCP '{mcp-name}' not available.`
34
+ - HALT and wait for user action
35
+ 3. If optional MCP unavailable: note limitation and proceed
36
+
27
37
  ## Core Responsibilities
28
38
 
29
39
  1. {Primary responsibility}
30
40
  2. {Secondary responsibility}
31
41
 
42
+ ## MCP Usage Patterns (if applicable)
43
+
44
+ ### ShadCN Components
45
+ - ALWAYS call demo/docs first before implementing
46
+ - Verify component API, variants, props
47
+ - Never guess—verify first
48
+
49
+ ### MagicPatterns Designs
50
+ - When link provided, use MCP to fetch code
51
+ - NEVER build from scratch
52
+ - Adapt fetched code for project structure
53
+
32
54
  ## Workflow
33
55
 
34
56
  1. {First step}
@@ -43,6 +65,7 @@ This agent should be used when:
43
65
 
44
66
  - {Limitation 1}
45
67
  - {Limitation 2}
68
+ - MUST escalate if critical MCP is unavailable
46
69
  ```
47
70
 
48
71
  ---
@@ -53,12 +76,14 @@ This agent should be used when:
53
76
  ---
54
77
  name: {name}
55
78
  description: {When to use this agent}
56
- tools: Read, Glob, Grep
57
79
  model: sonnet
80
+ # disallowedTools: Write, Edit # Uncomment for read-only agents
58
81
  ---
59
82
 
60
83
  You are a {role}. Your job is to {primary task}.
61
84
 
85
+ **First Action**: Check MCP availability. If critical MCP missing → ESCALATE and HALT.
86
+
62
87
  When invoked:
63
88
  1. {Step 1}
64
89
  2. {Step 2}
@@ -69,10 +94,12 @@ When invoked:
69
94
 
70
95
  ## Common Non-Story Agent Patterns
71
96
 
72
- | Agent Type | Use Case | Key Tools |
73
- |------------|----------|-----------|
74
- | `explorer` | Codebase research, file discovery | Read, Glob, Grep |
75
- | `documenter` | Documentation-only updates | Read, Write |
97
+ | Agent Type | Use Case | Restrictions |
98
+ |------------|----------|--------------|
99
+ | `explorer` | Codebase research, file discovery | `disallowedTools: Write, Edit` |
100
+ | `documenter` | Documentation-only updates | None (inherits all) |
101
+
102
+ **Note**: Use `disallowedTools` for restrictions instead of explicit `tools` lists. This preserves MCP access while restricting specific dangerous operations.
76
103
 
77
104
  ---
78
105
 
@@ -81,10 +108,16 @@ When invoked:
81
108
  Before saving a non-story agent, verify:
82
109
 
83
110
  1. **Name format**: `{lowercase-alphanumeric-hyphens}`
84
- 2. **Tools list**: Only valid Claude Code tools
111
+ 2. **Tool access**:
112
+ - ✅ Best: No `tools:` field (inherits all including MCPs)
113
+ - ✅ OK: `disallowedTools:` for specific restrictions (e.g., read-only agents)
114
+ - ❌ Avoid: Explicit `tools:` list (blocks MCP access)
85
115
  3. **Model**: `sonnet`, `haiku`, `opus`, or `inherit`
86
116
  4. **Description**: 20-300 characters, specific triggers
87
117
  5. **Content includes**:
88
118
  - Clear activation conditions
119
+ - **MCP Availability Check** as first action
120
+ - Escalation behavior for missing critical MCPs
89
121
  - Defined workflow steps
90
122
  - Expected output format
123
+ - MCP usage patterns if agent may use ShadCN/MagicPatterns
@@ -25,33 +25,15 @@ Create custom Claude Code sub-agents tailored to your project's needs. All agent
25
25
 
26
26
  This skill follows a 5-step interactive process:
27
27
 
28
- 0. **Memory Check** - Check registry for reusable patterns (may skip to step 4)
29
28
  1. **Context Assessment** - Analyze project and task requirements
30
29
  2. **Agent Design** - Determine needed agents and their specialties
31
30
  3. **Community Research** - Reference GitHub repos for patterns and inspiration
32
31
  4. **Agent Creation** - Generate and validate agent specification files
33
- 5. **Deployment & Registry** - Save files, verify, and optionally save to registry
32
+ 5. **Deployment** - Save files and verify installation
34
33
 
35
34
  ---
36
35
 
37
- ## Step 0: Quick Start (Always First)
38
-
39
- **Check for existing patterns before designing from scratch.**
40
-
41
- ### Check Registry & Templates
42
- ```bash
43
- cat .claude/skills/agent-creator/REGISTRY.yaml 2>/dev/null
44
- ls .claude/skills/agent-creator/templates/ 2>/dev/null
45
- ```
46
-
47
- ### If Match Found
48
- - Ask: "I found a pattern for [X]. Reuse it or create fresh?"
49
- - If reuse: Skip to Step 4 with the template
50
- - If fresh: Continue to Step 1
51
-
52
- ### If No Match
53
- - For simple requests ("quick agent for..."): Skip to Step 4
54
- - For complex needs: Continue to Step 1
36
+ ## Step 0: Quick Start
55
37
 
56
38
  ### Consider Built-in Agents First
57
39
  Before creating custom agents, check if built-ins suffice:
@@ -61,6 +43,9 @@ Before creating custom agents, check if built-ins suffice:
61
43
 
62
44
  Only create custom agents when you need project-specific knowledge or custom workflows.
63
45
 
46
+ For simple requests ("quick agent for..."): Skip to Step 4.
47
+ For complex needs: Continue to Step 1.
48
+
64
49
  ---
65
50
 
66
51
  ## Step 1: Context Assessment
@@ -75,7 +60,7 @@ ls -la . && ls -la src/ 2>/dev/null
75
60
  # Check existing agents
76
61
  ls -la .claude/agents/vt-bmad-dev-agents/ 2>/dev/null || echo "No agents directory yet"
77
62
 
78
- # Check existing templates in registry
63
+ # Check existing templates
79
64
  ls -la .claude/skills/agent-creator/templates/ 2>/dev/null || echo "No templates yet"
80
65
  ```
81
66
 
@@ -107,27 +92,31 @@ Based on context, design the agent architecture:
107
92
 
108
93
  All agents below accept a story identifier and invoke `/dev-story`. The specialty provides context.
109
94
 
110
- | Agent Type | Specialty Focus | Key Tools |
111
- |------------|-----------------|-----------|
112
- | `frontend` | UI/React component stories | Read, Glob, Grep, Bash, Edit, Write |
113
- | `backend` | API/server-side stories | Read, Glob, Grep, Bash, Edit, Write |
114
- | `fullstack` | End-to-end feature stories | Read, Glob, Grep, Bash, Edit, Write |
115
- | `tester` | Test-focused stories | Read, Glob, Grep, Bash, Edit, Write |
116
- | `database` | Schema/migration stories | Read, Glob, Grep, Bash, Edit, Write |
117
- | `api-integrator` | External API integration stories | Read, Glob, Grep, Bash, Edit, Write, WebFetch |
95
+ | Agent Type | Specialty Focus | Notes |
96
+ |------------|-----------------|-------|
97
+ | `frontend` | UI/React component stories | May use ShadCN, MagicPatterns MCPs |
98
+ | `backend` | API/server-side stories | May use database MCPs |
99
+ | `fullstack` | End-to-end feature stories | Broad MCP access beneficial |
100
+ | `tester` | Test-focused stories | May use Playwright MCP |
101
+ | `database` | Schema/migration stories | May use database MCPs |
102
+ | `api-integrator` | External API integration stories | May use Context7 MCP for docs |
103
+
104
+ **Note**: Agents inherit all available tools by default (including MCPs). Only use `disallowedTools` when explicit restrictions are needed.
118
105
 
119
106
  ### Non-Story Agent Patterns (Rare - Only When Explicitly Requested)
120
107
 
121
- | Agent Type | Use Case | Key Tools |
122
- |------------|----------|-----------|
123
- | `explorer` | Codebase research, file discovery | Read, Glob, Grep |
124
- | `documenter` | Documentation-only updates | Read, Write |
108
+ | Agent Type | Use Case | Restrictions |
109
+ |------------|----------|--------------|
110
+ | `explorer` | Codebase research, file discovery | `disallowedTools: Write, Edit` |
111
+ | `documenter` | Documentation-only updates | None (inherits all) |
125
112
 
126
113
  ### Design Considerations
127
114
  - **Story-first**: Default to story-based agents that invoke `/dev-story`
128
115
  - **Single responsibility**: Each agent has one specialty focus
129
116
  - **Minimal wrapper**: Agents delegate to `/dev-story` for all implementation
130
117
  - **Model selection**: Use `sonnet` for story agents (complex reasoning needed)
118
+ - **Tool inheritance**: Omit `tools:` field so agents inherit all tools including MCPs
119
+ - **MCP-aware**: Agents should check MCP availability and escalate if critical MCPs are missing
131
120
 
132
121
  ### CHECKPOINT 2
133
122
  Present agent design to user:
@@ -209,9 +198,10 @@ Before presenting to user, validate each agent:
209
198
  - Valid: `frontend`, `api-client`, `db-migrator`
210
199
  - Invalid: `my_agent`, `MyAgent`, `FRONTEND`
211
200
 
212
- 2. **Tools list**: Only valid Claude Code tools
213
- - Valid: Read, Write, Edit, Glob, Grep, Bash, WebFetch, WebSearch, Task, LSP
214
- - Invalid: AskUserQuestion, CustomTool
201
+ 2. **Tool access**: Prefer inheritance over explicit lists
202
+ - ✅ Best: Omit `tools:` field entirely (inherits all including MCPs)
203
+ - ✅ OK: Use `disallowedTools:` to restrict specific dangerous tools
204
+ - ⚠️ Avoid: Explicit `tools:` list (blocks MCP access)
215
205
 
216
206
  3. **Model**: Must be one of: `sonnet`, `haiku`, `opus`, `inherit`
217
207
 
@@ -225,6 +215,13 @@ Before presenting to user, validate each agent:
225
215
  - Content includes "Required Input" section for story identifier
226
216
  - Content includes `/dev-story` invocation instruction
227
217
  - Content does NOT include direct implementation steps (only /dev-story delegation)
218
+ - Content includes MCP availability check guidance
219
+
220
+ 7. **MCP awareness** (for implementation agents):
221
+ - Content includes MCP availability check as first action
222
+ - Content includes escalation behavior for missing critical MCPs
223
+ - If UI-focused: includes ShadCN demo-first pattern
224
+ - If design link expected: includes MagicPatterns handling
228
225
 
229
226
  ### CHECKPOINT 4
230
227
  For each agent, show:
@@ -275,38 +272,105 @@ Present summary:
275
272
  - How to use them
276
273
  - How to clean them up later
277
274
 
278
- **Ask user**: "Would you like to save this pattern to the registry for future reuse?"
275
+ **Confirm completion with user.**
276
+
277
+ ## MCP Integration Guidelines
279
278
 
280
- ### If User Wants to Save Pattern
281
- Update `.claude/skills/agent-creator/REGISTRY.yaml`:
279
+ ### Tool Inheritance (Critical)
280
+
281
+ **DO NOT explicitly list tools in agent frontmatter** unless you need to restrict access.
282
282
 
283
- 1. Add entry to `successful_agents`:
284
283
  ```yaml
285
- - name: {agent-name-without-tmp}
286
- purpose: What task/specialization it handles
287
- tools: [list of tools]
288
- model: model used
289
- created: YYYY-MM-DD
290
- project_context: What project/task it was created for
284
+ # ❌ WRONG - Blocks MCP access
285
+ tools: Read, Glob, Grep, Bash, Edit, Write
286
+
287
+ # CORRECT - Inherits all tools including MCPs
288
+ # (omit the tools field entirely)
289
+
290
+ # ✅ ALSO CORRECT - Restrict specific dangerous tools only
291
+ disallowedTools: Bash
291
292
  ```
292
293
 
293
- 2. Optionally save template file:
294
- ```bash
295
- mkdir -p .claude/skills/agent-creator/templates
296
- cp .claude/agents/vt-bmad-dev-agents/{name}.md .claude/skills/agent-creator/templates/{name}.md
294
+ When `tools:` is omitted, agents inherit all available tools from the main conversation, including any configured MCP tools.
295
+
296
+ ### MCP Availability Check (Required First Step)
297
+
298
+ All agents must check MCP availability before starting work:
299
+
300
+ ```markdown
301
+ ## First Action: MCP Availability Check
302
+
303
+ Before proceeding with implementation:
304
+ 1. Review the story/task requirements for MCP dependencies
305
+ 2. If requirements mention UI components → check for ShadCN MCP
306
+ 3. If requirements include a MagicPatterns link → check for MagicPatterns MCP
307
+ 4. If requirements need external API docs → check for Context7 MCP
308
+
309
+ **If critical MCP is unavailable:**
310
+ - Output: `ESCALATE: Required MCP '{mcp-name}' not available. Please enable it and retry.`
311
+ - Include in handoff: `status: blocked`, `blockers: ["MCP {name} unavailable"]`
312
+ - HALT - Do not attempt workarounds for critical MCPs
313
+
314
+ **If optional MCP is unavailable:**
315
+ - Note the limitation
316
+ - Proceed with fallback approach
317
+ - Document in handoff: `notes: "Built without {mcp} - manual review recommended"`
297
318
  ```
298
319
 
299
- 3. Update `stats.total_agents_created`
320
+ ### ShadCN MCP Pattern
300
321
 
301
- ### If Agent Doesn't Work (Later Feedback)
302
- If user reports issues later, record in `failed_patterns`:
303
- ```yaml
304
- - name: agent-name
305
- reason: Why it failed
306
- lesson: What to do differently
322
+ When implementing UI components with ShadCN MCP available:
323
+
324
+ ```markdown
325
+ ## ShadCN Component Implementation
326
+
327
+ **ALWAYS call demo/docs first before implementing any ShadCN component:**
328
+
329
+ 1. Call the component demo tool to see usage:
330
+ - Review available variants, sizes, and props
331
+ - Note any required imports or dependencies
332
+
333
+ 2. Implement following the exact patterns shown:
334
+ - Use correct import paths
335
+ - Apply proper variant props
336
+ - Follow composition patterns for complex components
337
+
338
+ 3. Never guess component APIs—always verify first
339
+
340
+ Example flow:
341
+ - Need a Button? → Call shadcn demo for Button → See variants (default, destructive, outline, etc.) → Implement with correct props
307
342
  ```
308
343
 
309
- **Confirm completion with user.**
344
+ ### MagicPatterns MCP Pattern
345
+
346
+ When user provides a MagicPatterns link:
347
+
348
+ ```markdown
349
+ ## MagicPatterns Link Handling
350
+
351
+ **NEVER build from scratch when a MagicPatterns link is provided.**
352
+
353
+ 1. Extract the pattern/design ID from the link
354
+ 2. Use MagicPatterns MCP to fetch the generated code
355
+ 3. Adapt the fetched code for the project:
356
+ - Update imports to match project structure
357
+ - Apply project's styling conventions (Tailwind config, CSS variables)
358
+ - Integrate with project's state management if needed
359
+ - Ensure component follows project's file organization
360
+
361
+ 4. The MagicPatterns design represents user's intent—preserve the design, adapt the implementation
362
+ ```
363
+
364
+ ### Background vs Foreground Agent Warning
365
+
366
+ **Critical limitation**: MCP tools are NOT available in background subagents.
367
+
368
+ If your agent needs MCP access:
369
+ - It must run in foreground mode
370
+ - Background tasks that need MCPs will fail silently
371
+ - Consider this when designing agent workflows
372
+
373
+ ---
310
374
 
311
375
  ## Quick Reference
312
376
 
@@ -317,6 +381,8 @@ See the dedicated template files for full examples and minimal templates:
317
381
  - **Non-Story**: `NON-STORY-AGENT-TEMPLATE.md`
318
382
 
319
383
  ### Available Tools Reference
384
+
385
+ **Core Tools** (always available):
320
386
  | Tool | Purpose |
321
387
  |------|---------|
322
388
  | `Read` | Read file contents |
@@ -330,6 +396,16 @@ See the dedicated template files for full examples and minimal templates:
330
396
  | `Task` | Delegate to subagents |
331
397
  | `LSP` | Code intelligence |
332
398
 
399
+ **MCP Tools** (available when configured):
400
+ | MCP | Common Tools | Use Case |
401
+ |-----|--------------|----------|
402
+ | ShadCN | Component demos, installation | UI component implementation |
403
+ | MagicPatterns | Get pattern code | Fetch designed components |
404
+ | Context7 | Query docs | Up-to-date library documentation |
405
+ | Playwright | Browser automation | E2E testing, screenshots |
406
+
407
+ **Remember**: Omit `tools:` field to inherit all available tools including MCPs.
408
+
333
409
  ### Model Selection Guide
334
410
  | Model | Best For | Cost |
335
411
  |-------|----------|------|
@@ -10,7 +10,6 @@
10
10
  ---
11
11
  name: {agent-name}
12
12
  description: {Specialty} story executor. Requires story number or name.
13
- tools: Read, Glob, Grep, Bash, Edit, Write
14
13
  model: {sonnet|haiku|opus|inherit}
15
14
  ---
16
15
 
@@ -24,6 +23,24 @@ You are a {specialty} agent. Your role is to execute user stories with a focus o
24
23
  - Story number: e.g., "3.2", "story-3.2", "S3.2"
25
24
  - Story name: e.g., "user authentication flow"
26
25
 
26
+ ## First Action: MCP Availability Check
27
+
28
+ Before invoking /dev-story, verify required tools are available:
29
+
30
+ 1. **Review story requirements** for MCP dependencies:
31
+ - UI components mentioned? → Need ShadCN MCP
32
+ - MagicPatterns link provided? → Need MagicPatterns MCP
33
+ - External API integration? → Context7 MCP helpful
34
+
35
+ 2. **If critical MCP is unavailable:**
36
+ - Output: `ESCALATE: Required MCP '{mcp-name}' not available. Please enable it and retry.`
37
+ - Set handoff: `status: blocked`, `blockers: ["MCP {name} unavailable"]`
38
+ - HALT immediately
39
+
40
+ 3. **If optional MCP is unavailable:**
41
+ - Note limitation and proceed
42
+ - Document in handoff notes
43
+
27
44
  ## Single Responsibility: Execute /dev-story
28
45
 
29
46
  **Your ONLY job is to invoke /dev-story with the provided story identifier.**
@@ -40,6 +57,21 @@ The /dev-story workflow handles ALL implementation work:
40
57
  - Validating against acceptance criteria
41
58
  - Updating the story file with completion status
42
59
 
60
+ ## MCP Usage Patterns
61
+
62
+ ### ShadCN Components
63
+ When implementing UI components with ShadCN MCP:
64
+ 1. **ALWAYS call demo/docs first** before implementing any component
65
+ 2. Review available variants, sizes, and props
66
+ 3. Implement following the exact patterns shown
67
+ 4. Never guess component APIs—verify first
68
+
69
+ ### MagicPatterns Designs
70
+ When a MagicPatterns link is provided:
71
+ 1. **NEVER build from scratch**—use the MCP to fetch the code
72
+ 2. Adapt fetched code for project structure
73
+ 3. Preserve the design intent, adapt the implementation
74
+
43
75
  ## TDD Requirements
44
76
 
45
77
  These practices are enforced by /dev-story. Include them so the workflow follows TDD:
@@ -59,8 +91,10 @@ This context is passed to /dev-story for implementation guidance.
59
91
  ## Constraints
60
92
 
61
93
  - MUST receive a valid story identifier before proceeding
94
+ - MUST check MCP availability before starting work
62
95
  - MUST NOT implement anything directly - delegate to /dev-story
63
96
  - MUST NOT skip the /dev-story invocation
97
+ - MUST escalate if critical MCP is unavailable
64
98
 
65
99
  ## If /dev-story Fails
66
100
 
@@ -106,7 +140,6 @@ After /dev-story completes, you MUST output this structured handoff:
106
140
  ---
107
141
  name: {name}
108
142
  description: {Specialty} story executor. Requires story number or name.
109
- tools: Read, Glob, Grep, Bash, Edit, Write
110
143
  model: sonnet
111
144
  ---
112
145
 
@@ -114,7 +147,13 @@ You are a {specialty} agent executing stories via /dev-story.
114
147
 
115
148
  **Required Input**: Story number (e.g., "3.2") or story name
116
149
 
117
- **On Launch**: Immediately execute `/dev-story {story-identifier}`
150
+ **First Action**: Check MCP availability. If critical MCP missing → ESCALATE and HALT.
151
+
152
+ **On Launch**: Execute `/dev-story {story-identifier}`
153
+
154
+ **MCP Patterns**:
155
+ - ShadCN: Call demo first, then implement with correct props
156
+ - MagicPatterns: Fetch code via MCP, adapt for project (never build from scratch)
118
157
 
119
158
  All implementation is handled by /dev-story. You provide {specialty} context.
120
159
 
@@ -131,7 +170,6 @@ All implementation is handled by /dev-story. You provide {specialty} context.
131
170
  ---
132
171
  name: frontend
133
172
  description: Frontend/React story executor. Requires story number or name.
134
- tools: Read, Glob, Grep, Bash, Edit, Write
135
173
  model: sonnet
136
174
  ---
137
175
 
@@ -141,13 +179,35 @@ You are a frontend specialist executing stories via /dev-story.
141
179
 
142
180
  **Required Input**: Story number (e.g., "3.2") or story name
143
181
 
144
- **On Launch**: Immediately execute `/dev-story {story-identifier}`
182
+ ## First Action: MCP Availability Check
183
+
184
+ Before starting:
185
+ 1. Check if story involves UI components → verify ShadCN MCP available
186
+ 2. Check if MagicPatterns link provided → verify MagicPatterns MCP available
187
+ 3. If critical MCP missing: `ESCALATE: Required MCP '{name}' not available` → HALT
188
+
189
+ **On Launch**: Execute `/dev-story {story-identifier}`
145
190
 
146
191
  All implementation is handled by /dev-story. Your frontend focus provides context for:
147
192
  - React component patterns
148
193
  - UI/UX considerations
149
194
  - CSS/styling approaches
150
195
 
196
+ ## MCP Usage Patterns
197
+
198
+ ### ShadCN Components
199
+ 1. **ALWAYS call demo first** before implementing any component
200
+ 2. Review variants, sizes, props from the demo output
201
+ 3. Implement with correct imports and props
202
+ 4. Never guess—verify component API first
203
+
204
+ ### MagicPatterns Designs
205
+ When user provides a MagicPatterns link:
206
+ 1. **NEVER build from scratch**
207
+ 2. Use MCP to fetch the generated code
208
+ 3. Adapt for project: update imports, apply project styles
209
+ 4. Preserve design intent
210
+
151
211
  ## TDD Requirements
152
212
 
153
213
  - **Red-Green-Refactor**: Write failing test → make it pass → improve code
@@ -176,7 +236,7 @@ After /dev-story completes, output:
176
236
  tests_run: [count]
177
237
  tests_failed: [count]
178
238
  coverage: [percentage]
179
- blockers: none | [list]
239
+ blockers: none | [list MCP unavailability here if relevant]
180
240
  next_action: proceed | escalate | retry
181
241
  error_summary: null | "[error if any]"
182
242
  === END HANDOFF ===
@@ -189,11 +249,17 @@ After /dev-story completes, output:
189
249
  Before saving a story-based agent, verify:
190
250
 
191
251
  1. **Name format**: `{lowercase-alphanumeric-hyphens}`
192
- 2. **Tools list**: Only valid Claude Code tools
252
+ 2. **Tool access**:
253
+ - ✅ Best: No `tools:` field (inherits all including MCPs)
254
+ - ✅ OK: `disallowedTools:` for specific restrictions
255
+ - ❌ Avoid: Explicit `tools:` list (blocks MCP access)
193
256
  3. **Model**: `sonnet`, `haiku`, `opus`, or `inherit`
194
257
  4. **Description**: Includes "Requires story number or name"
195
258
  5. **Content includes**:
196
259
  - "Required Input" section for story identifier
260
+ - **MCP Availability Check** as first action
197
261
  - `/dev-story` invocation instruction
262
+ - **MCP Usage Patterns** (ShadCN demo-first, MagicPatterns fetch)
263
+ - Escalation behavior for missing critical MCPs
198
264
  - NO direct implementation steps (only delegation)
199
265
  - **Handoff Format section** with `=== AGENT HANDOFF ===` block (required for orchestrator workflows)