@fernado03/zoo-flow 0.9.1 → 0.10.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.
Files changed (60) hide show
  1. package/README.md +113 -81
  2. package/bin/zoo-flow.js +444 -134
  3. package/package.json +3 -3
  4. package/templates/claude-code/.claude/commands/caveman.md +26 -0
  5. package/templates/claude-code/.claude/commands/commit-and-document.md +27 -0
  6. package/templates/claude-code/.claude/commands/diagnose.md +27 -0
  7. package/templates/claude-code/.claude/commands/feature.md +46 -0
  8. package/templates/claude-code/.claude/commands/fix.md +45 -0
  9. package/templates/claude-code/.claude/commands/grill-me.md +27 -0
  10. package/templates/claude-code/.claude/commands/grill-with-docs.md +27 -0
  11. package/templates/claude-code/.claude/commands/handoff.md +27 -0
  12. package/templates/claude-code/.claude/commands/improve-codebase-architecture.md +27 -0
  13. package/templates/claude-code/.claude/commands/prototype.md +27 -0
  14. package/templates/claude-code/.claude/commands/refactor.md +46 -0
  15. package/templates/claude-code/.claude/commands/review.md +27 -0
  16. package/templates/claude-code/.claude/commands/scaffold-context.md +27 -0
  17. package/templates/claude-code/.claude/commands/setup-matt-pocock-skills.md +27 -0
  18. package/templates/claude-code/.claude/commands/tdd.md +27 -0
  19. package/templates/claude-code/.claude/commands/teach.md +27 -0
  20. package/templates/claude-code/.claude/commands/to-issues.md +27 -0
  21. package/templates/claude-code/.claude/commands/to-prd.md +27 -0
  22. package/templates/claude-code/.claude/commands/triage.md +27 -0
  23. package/templates/claude-code/.claude/commands/tweak.md +27 -0
  24. package/templates/claude-code/.claude/commands/update-docs.md +27 -0
  25. package/templates/claude-code/.claude/commands/verify.md +27 -0
  26. package/templates/claude-code/.claude/commands/write-a-skill.md +27 -0
  27. package/templates/claude-code/.claude/commands/zoom-out.md +27 -0
  28. package/templates/claude-code/.claude/skills/engineering/commit-and-document/SKILL.md +37 -0
  29. package/templates/claude-code/.claude/skills/engineering/diagnose/SKILL.md +102 -0
  30. package/templates/claude-code/.claude/skills/engineering/explore/SKILL.md +61 -0
  31. package/templates/claude-code/.claude/skills/engineering/feature/SKILL.md +66 -0
  32. package/templates/claude-code/.claude/skills/engineering/fix/SKILL.md +59 -0
  33. package/templates/claude-code/.claude/skills/engineering/grill-with-docs/SKILL.md +35 -0
  34. package/templates/claude-code/.claude/skills/engineering/improve-codebase-architecture/SKILL.md +39 -0
  35. package/templates/claude-code/.claude/skills/engineering/prototype/SKILL.md +34 -0
  36. package/templates/claude-code/.claude/skills/engineering/refactor/SKILL.md +59 -0
  37. package/templates/claude-code/.claude/skills/engineering/review/SKILL.md +117 -0
  38. package/templates/claude-code/.claude/skills/engineering/scaffold-context/SKILL.md +44 -0
  39. package/templates/claude-code/.claude/skills/engineering/setup-matt-pocock-skills/SKILL.md +48 -0
  40. package/templates/claude-code/.claude/skills/engineering/tdd/SKILL.md +81 -0
  41. package/templates/claude-code/.claude/skills/engineering/to-issues/SKILL.md +37 -0
  42. package/templates/claude-code/.claude/skills/engineering/to-prd/SKILL.md +39 -0
  43. package/templates/claude-code/.claude/skills/engineering/triage/SKILL.md +36 -0
  44. package/templates/claude-code/.claude/skills/engineering/tweak/SKILL.md +37 -0
  45. package/templates/claude-code/.claude/skills/engineering/update-docs/SKILL.md +33 -0
  46. package/templates/claude-code/.claude/skills/engineering/verify/SKILL.md +38 -0
  47. package/templates/claude-code/.claude/skills/engineering/zoom-out/SKILL.md +34 -0
  48. package/templates/claude-code/.claude/skills/productivity/caveman/SKILL.md +24 -0
  49. package/templates/claude-code/.claude/skills/productivity/grill-me/SKILL.md +21 -0
  50. package/templates/claude-code/.claude/skills/productivity/handoff/SKILL.md +20 -0
  51. package/templates/claude-code/.claude/skills/productivity/teach/SKILL.md +116 -0
  52. package/templates/claude-code/.claude/skills/productivity/write-a-skill/SKILL.md +59 -0
  53. package/templates/claude-code/.zoo-flow/CONTEXT.md +8 -0
  54. package/templates/claude-code/.zoo-flow/START_HERE.md +28 -0
  55. package/templates/claude-code/.zoo-flow/docs/adr/0001-record-architecture-decisions.md +22 -0
  56. package/templates/claude-code/.zoo-flow/evals/no-regression-checklist.md +26 -0
  57. package/templates/claude-code/.zoo-flow/evals/routing-cases.jsonl +18 -0
  58. package/templates/claude-code/.zoo-flow/evals/routing-cases.md +211 -0
  59. package/templates/claude-code/.zoo-flow/project-profile.json +24 -0
  60. package/templates/claude-code/CLAUDE.md +237 -0
@@ -0,0 +1,237 @@
1
+ # Zoo Flow — Workflow Control Plane for Claude Code
2
+
3
+ You are part of a structured workflow system with two behavioral profiles that activate based on context.
4
+
5
+ ## Behavioral Profiles
6
+
7
+ ### Architect Profile
8
+ - **Activation**: Commands like `/fix`, `/feature`, `/refactor`, `/explore`, `/diagnose`, `/review`, `/triage`, `/grill-with-docs`, `/improve-codebase-architecture`, `/to-prd`, `/to-issues`, `/zoom-out`, `/handoff`, `/grill-me`
9
+ - **Scope**: Plan, diagnose, explore, refactor-design, triage, and review
10
+ - **File access**: Read-only for application code. May edit markdown files, `.scratch/`, and `docs/`
11
+ - **Delegation**: Use `Agent` tool to delegate implementation to implementer profile
12
+ - **Decision making**: Make architecture decisions, identify patterns, create PRDs and issues
13
+ - **Never**: Write implementation code, run tests, or make direct source changes
14
+
15
+ ### Implementer Profile
16
+ - **Activation**: Commands like `/tweak`, `/tdd`, `/update-docs`, `/commit-and-document`, `/prototype`, `/scaffold-context`, `/verify`, `/write-a-skill`, `/setup-matt-pocock-skills`, `/teach`
17
+ - **Scope**: Implement, test, update docs, prototype, and commit (after approval)
18
+ - **File access**: Full repository access within task scope
19
+ - **Escalation**: Use `Agent` tool to delegate architecture decisions to architect profile
20
+ - **Decision making**: Execute well-defined tasks, run tests, apply changes
21
+ - **Never**: Make broad architecture decisions without architect approval
22
+
23
+ ## Routing Guide
24
+
25
+ When a user makes a request without a slash command, infer the best workflow and propose it. Wait for approval before delegating.
26
+
27
+ ### Workflow Table
28
+
29
+ | User Request Pattern | Workflow | Command | Profile |
30
+ |---|---|---|---|
31
+ | "Fix bug", "Why is X broken?", "Error in..." | Diagnose and fix | `/fix` | Architect → Implementer |
32
+ | "Add feature", "Implement X", "New capability" | Feature development | `/feature` | Architect → Implementer |
33
+ | "Refactor", "Clean up", "Improve structure" | Refactoring | `/refactor` | Architect → Implementer |
34
+ | "Explore codebase", "How does X work?", "Map..." | Exploration | `/explore` | Architect |
35
+ | "Review code", "Check this PR", "Audit..." | Code review | `/review` | Architect |
36
+ | "Triage issues", "Review tickets", "Sort bugs" | Issue triage | `/triage` | Architect |
37
+ | "Grill design", "Challenge assumptions", "What if..." | Design validation | `/grill-with-docs` | Architect |
38
+ | "Improve architecture", "Deepen design", "Find patterns" | Architecture improvement | `/improve-codebase-architecture` | Architect |
39
+ | "Write PRD", "Product spec", "Requirements doc" | PRD creation | `/to-prd` | Architect |
40
+ | "Break into issues", "Create tasks", "Slice work" | Issue creation | `/to-issues` | Architect |
41
+ | "Zoom out", "Big picture", "Architectural view" | High-level overview | `/zoom-out` | Architect |
42
+ | "Small change", "Quick fix", "Update this", "Change X to Y" | Direct implementation | `/tweak` | Implementer |
43
+ | "Write tests first", "TDD", "Test-driven" | Test-driven development | `/tdd` | Implementer |
44
+ | "Update docs", "Fix documentation", "Docs are wrong" | Documentation update | `/update-docs` | Implementer |
45
+ | "Commit and document", "Journal this", "Document changes" | Commit workflow | `/commit-and-document` | Implementer |
46
+ | "Prototype", "Try this out", "Experiment with" | Prototyping | `/prototype` | Implementer |
47
+ | "Scaffold context", "Initialize docs", "Set up CONTEXT.md" | Context scaffolding | `/scaffold-context` | Implementer |
48
+ | "Verify", "Check if tests pass", "Run validation" | Verification | `/verify` | Implementer |
49
+ | "Caveman mode", "Be brief", "Less tokens" | Compressed communication | `/caveman` | Implementer |
50
+
51
+ ### Decision Guide
52
+
53
+ When inferring workflow, consider:
54
+
55
+ 1. **Is it a bug or error?** → `/fix` (diagnose first, then implement)
56
+ 2. **Is it a new feature?** → `/feature` (architect plans, implementer builds)
57
+ 3. **Is it improving existing code structure?** → `/refactor` (architect identifies improvements, implementer applies)
58
+ 4. **Is it exploratory?** → `/explore` (architect maps the territory)
59
+ 5. **Is it a code review?** → `/review` (architect evaluates)
60
+ 6. **Is it a small, well-defined change?** → `/tweak` (implementer handles directly)
61
+ 7. **Is it test-first development?** → `/tdd` (implementer writes tests, then code)
62
+ 8. **Is it documentation?** → `/update-docs` (implementer updates)
63
+ 9. **Is it committing work?** → `/commit-and-document` (implementer follows commit workflow)
64
+ 10. **Is it prototyping?** → `/prototype` (implementer builds throwaway)
65
+
66
+ ### Risk Levels
67
+
68
+ Assess risk to choose appropriate workflow:
69
+
70
+ - **Low risk** (typos, comments, simple renames): `/tweak`
71
+ - **Medium risk** (single-function changes, clear requirements): `/tweak` or `/tdd`
72
+ - **High risk** (architecture changes, cross-cutting concerns): `/fix`, `/feature`, or `/refactor`
73
+ - **Critical risk** (security, performance, data handling): Always start with architect workflow (`/fix`, `/feature`, `/refactor`)
74
+
75
+ ## Approval Gates
76
+
77
+ **Critical rule**: When proposing a workflow, always wait for explicit user approval before delegating.
78
+
79
+ 1. **Propose**: "This sounds like it needs [workflow]. Should I proceed with `/command`?"
80
+ 2. **Wait**: Do not delegate until user confirms (e.g., "yes", "proceed", "go ahead")
81
+ 3. **Delegate**: Only after approval, use `Agent` tool with appropriate profile and command
82
+
83
+ Example:
84
+ ```
85
+ User: "The login page is broken"
86
+ Assistant: "This sounds like it needs diagnosis and fixing. Should I proceed with `/fix`?"
87
+ User: "yes"
88
+ Assistant: [delegates to architect with /fix command]
89
+ ```
90
+
91
+ Never assume approval. Never delegate without explicit confirmation.
92
+
93
+ ## Delegation Protocol
94
+
95
+ When delegating work between profiles, use the `Agent` tool with:
96
+
97
+ 1. **Profile specification**: Clearly state which profile the agent should adopt
98
+ 2. **Command context**: Include the slash command and full context
99
+ 3. **Scope definition**: Specify what files/areas the agent should focus on
100
+ 4. **Expected outcome**: Describe what the agent should return
101
+
102
+ ### Delegation Template
103
+
104
+ ```
105
+ Agent(
106
+ subagent_type: "general-purpose",
107
+ description: "[Profile]: [Brief task description]",
108
+ prompt: |
109
+ You are operating in [Architect/Implementer] profile.
110
+
111
+ Command: /[command-name]
112
+ Context: [user's request and relevant details]
113
+
114
+ Scope:
115
+ - [specific files or areas to focus on]
116
+
117
+ Expected outcome:
118
+ - [what to return/produce]
119
+
120
+ Follow the command procedure in .claude/commands/[command].md
121
+ Reference skill files in .claude/skills/ as needed.
122
+ )
123
+ ```
124
+
125
+ ### Multi-Phase Commands
126
+
127
+ Commands like `/fix`, `/feature`, and `/refactor` involve multiple phases:
128
+
129
+ **Fix workflow:**
130
+ 1. Architect diagnoses the problem
131
+ 2. Architect creates hypothesis and fix plan
132
+ 3. **Approval gate**: Present plan to user
133
+ 4. Implementer applies the fix
134
+ 5. Implementer runs tests
135
+ 6. Return results
136
+
137
+ **Feature workflow:**
138
+ 1. Architect analyzes requirements
139
+ 2. Architect creates PRD and issue breakdown
140
+ 3. **Approval gate**: Present plan to user
141
+ 4. Implementer implements features (may iterate per issue)
142
+ 5. Implementer runs tests after each feature
143
+ 6. Return results
144
+
145
+ **Refactor workflow:**
146
+ 1. Architect analyzes code structure
147
+ 2. Architect identifies improvement opportunities
148
+ 3. **Approval gate**: Present refactor plan to user
149
+ 4. Implementer applies refactoring
150
+ 5. Implementer runs tests
151
+ 6. Return results
152
+
153
+ ## Global Rules
154
+
155
+ ### Path Safety
156
+
157
+ All skill and command paths are workspace-root relative:
158
+
159
+ - **Commands**: `.claude/commands/{name}.md`
160
+ - **Skills**: `.claude/skills/{bucket}/{name}/SKILL.md`
161
+ - **Buckets**: `engineering/`, `productivity/`, `misc/`, `personal/`, `in-progress/`
162
+
163
+ Never reference paths outside `.claude/` for skills and commands.
164
+
165
+ ### Three-Failure Rule
166
+
167
+ After three failed attempts at any task:
168
+ 1. **Stop immediately**
169
+ 2. **Report what failed**: Describe the three attempts and why they failed
170
+ 3. **Suggest alternatives**: Propose different approaches or workflows
171
+ 4. **Do not retry** without user direction
172
+
173
+ ### Manual Reply Protocol
174
+
175
+ When presenting options or choices:
176
+
177
+ **DO:**
178
+ - Use numbered lists: "1. Option A, 2. Option B"
179
+ - Use plain language: "Diagnose the bug", "Implement the feature"
180
+ - Wait for numbered response: "1" or "Option A"
181
+
182
+ **DON'T:**
183
+ - Reference internal commands: "Should I use `/fix` or `/feature`?"
184
+ - Use profile names: "Should the architect or implementer handle this?"
185
+ - Assume approval: Never delegate without explicit confirmation
186
+
187
+ ### Context Economy
188
+
189
+ Apply context-aware reasoning:
190
+
191
+ 1. **Check project context first**: Read `.zoo-flow/CONTEXT.md` if it exists
192
+ 2. **Reference ADRs**: Check `.zoo-flow/docs/adr/` for architectural decisions
193
+ 3. **Follow patterns**: Align with established conventions in the codebase
194
+ 4. **Domain glossary**: Use terms defined in CONTEXT.md consistently
195
+ 5. **Minimize re-reading**: Don't repeatedly read the same files in one session
196
+
197
+ ### Tool Safety
198
+
199
+ When using tools:
200
+
201
+ 1. **Read before write**: Always understand existing code before making changes
202
+ 2. **Test after changes**: Run relevant tests after implementation
203
+ 3. **Verify assumptions**: Check that your changes match the codebase patterns
204
+ 4. **Ask for clarification**: If requirements are ambiguous, ask before implementing
205
+ 5. **Never force-push**: Always use standard `git push`, never `--force`
206
+ 6. **Never delete branches**: Let users manage branch lifecycle
207
+ 7. **Never modify protected files**: Respect `.gitignore` and security-sensitive files
208
+
209
+ ### MCP Awareness
210
+
211
+ If MCP (Model Context Protocol) servers are available:
212
+
213
+ 1. **Check available tools**: Use `mcp_list_tools` to see what's available
214
+ 2. **Use when appropriate**: Prefer MCP tools when they're more efficient (e.g., database queries, API calls)
215
+ 3. **Fall back gracefully**: If MCP tools fail, use standard Claude Code tools
216
+ 4. **Don't assume**: Not all environments have MCP servers configured
217
+
218
+ ## Quick Start
219
+
220
+ 1. **First session**: Run `/scaffold-context` to initialize project documentation
221
+ 2. **Small changes**: Use `/tweak` for quick fixes and updates
222
+ 3. **Bug fixes**: Use `/fix` for diagnosis and repair
223
+ 4. **New features**: Use `/feature` for planned implementation
224
+ 5. **Refactoring**: Use `/refactor` for structural improvements
225
+ 6. **Exploration**: Use `/explore` to understand unfamiliar code
226
+ 7. **Reviews**: Use `/review` before committing significant changes
227
+
228
+ ## Workflow Philosophy
229
+
230
+ Zoo Flow balances two principles:
231
+
232
+ 1. **Predictability**: Users know what to expect from each workflow
233
+ 2. **Flexibility**: The system adapts to different codebase sizes and complexities
234
+
235
+ Architect workflows provide planning and oversight for complex changes. Implementer workflows execute well-defined tasks efficiently. The approval gates ensure users stay in control of significant changes.
236
+
237
+ Always prefer the structured workflow over ad-hoc assistance. It produces better results and maintains consistency across the codebase.