@fernado03/zoo-flow 0.11.0 → 0.11.2
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/README.md +60 -5
- package/bin/zoo-flow.js +2 -4
- package/package.json +45 -55
- package/templates/claude-code/.claude/commands/explore.md +28 -0
- package/templates/claude-code/.claude/skills/in-progress/writing-beats/SKILL.md +32 -0
- package/templates/claude-code/.claude/skills/in-progress/writing-fragments/SKILL.md +45 -0
- package/templates/claude-code/.claude/skills/in-progress/writing-shape/SKILL.md +50 -0
- package/templates/claude-code/.claude/skills/misc/git-guardrails-claude-code/SKILL.md +64 -0
- package/templates/claude-code/.claude/skills/misc/git-guardrails-claude-code/scripts/block-dangerous-git.sh +25 -0
- package/templates/claude-code/.claude/skills/misc/migrate-to-shoehorn/SKILL.md +39 -0
- package/templates/claude-code/.claude/skills/misc/scaffold-exercises/SKILL.md +53 -0
- package/templates/claude-code/.claude/skills/misc/setup-pre-commit/SKILL.md +62 -0
- package/templates/claude-code/.claude/skills/personal/edit-article/SKILL.md +13 -0
- package/templates/claude-code/.claude/skills/personal/obsidian-vault/SKILL.md +39 -0
- package/docs/architecture.md +0 -380
- package/docs/bloat-control.md +0 -49
- package/docs/command-design.md +0 -38
- package/docs/command-flow.md +0 -133
- package/docs/comparison.md +0 -86
- package/docs/context-packs.md +0 -35
- package/docs/dogfood/01-small-library.md +0 -28
- package/docs/dogfood/02-web-app.md +0 -29
- package/docs/dogfood/03-mixed-monorepo.md +0 -29
- package/docs/mode-rules.md +0 -86
- package/docs/npm-publishing.md +0 -79
- package/docs/out-of-scope/mainstream-issue-trackers-only.md +0 -25
- package/docs/out-of-scope/question-limits.md +0 -18
- package/docs/out-of-scope/setup-skill-verify-mode.md +0 -15
- package/docs/overview.md +0 -61
- package/docs/philosophy.md +0 -73
- package/docs/quality-scorecard.md +0 -23
- package/docs/skill-maintenance.md +0 -32
- package/docs/skills-index.md +0 -64
- package/docs/team-mode.md +0 -46
- package/docs/token-budget.md +0 -22
- package/docs/troubleshooting.md +0 -288
- package/examples/demo-transcripts/01-small-tweak.md +0 -37
- package/examples/demo-transcripts/02-unknown-bug-fix.md +0 -37
- package/examples/demo-transcripts/03-new-feature.md +0 -37
- package/examples/demo-transcripts/04-refactor.md +0 -37
- package/examples/demo-transcripts/05-review-and-verify.md +0 -37
- package/examples/feature-flow.md +0 -117
- package/examples/fix-flow.md +0 -139
- package/quality/scorecard.json +0 -88
- package/quality/token-budget.exceptions.json +0 -13
package/README.md
CHANGED
|
@@ -130,9 +130,36 @@ For team usage, see `docs/team-mode.md`.
|
|
|
130
130
|
npx @fernado03/zoo-flow@latest update
|
|
131
131
|
```
|
|
132
132
|
|
|
133
|
-
Backs up your current `.
|
|
134
|
-
|
|
135
|
-
|
|
133
|
+
Backs up your current Zoo Flow files to `.zoo-flow-backup/<timestamp>/`, then replaces them with the latest template. Preview with `--dry-run`.
|
|
134
|
+
|
|
135
|
+
- **Zoo Code**: Backs up `.roomodes` and `.roo/`
|
|
136
|
+
- **Claude Code**: Backs up `CLAUDE.md` and `.claude/`
|
|
137
|
+
|
|
138
|
+
## Scratch working memory
|
|
139
|
+
|
|
140
|
+
Certain skills (like `/review`, `/diagnose`, and `/zoom-out`) use a scratch working memory pattern for deeper analysis. These skills:
|
|
141
|
+
|
|
142
|
+
- Create structured `.scratch/` subdirectories with date and context
|
|
143
|
+
- Write intermediate findings to separate files during multi-pass analysis
|
|
144
|
+
- Read back previous passes before synthesizing final insights
|
|
145
|
+
|
|
146
|
+
**Example structure:**
|
|
147
|
+
```
|
|
148
|
+
.scratch/
|
|
149
|
+
reviews/
|
|
150
|
+
2026-06-14_auth-refactor/
|
|
151
|
+
01_security.md # Security analysis pass
|
|
152
|
+
02_architecture.md # Architecture review pass
|
|
153
|
+
03_synthesis.md # Final insights from both passes
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
This enables:
|
|
157
|
+
- **Cross-angle insights**: Later passes reference earlier findings, catching issues that span multiple perspectives
|
|
158
|
+
- **Persistent reasoning**: Findings aren't lost in context window limits
|
|
159
|
+
- **Audit trail**: You can review the reasoning process, not just final conclusions
|
|
160
|
+
- **Ultracode-level depth**: Achieves thorough analysis within Zoo Flow's single-agent architecture
|
|
161
|
+
|
|
162
|
+
See `templates/full/.roo/rules/07-scratch-working-memory.md` for the protocol details.
|
|
136
163
|
|
|
137
164
|
## Token discipline
|
|
138
165
|
|
|
@@ -213,6 +240,8 @@ For command-addition rules, see [`docs/command-design.md`](docs/command-design.m
|
|
|
213
240
|
|
|
214
241
|
If you would rather copy the template by hand:
|
|
215
242
|
|
|
243
|
+
### Zoo Code
|
|
244
|
+
|
|
216
245
|
```sh
|
|
217
246
|
git clone https://github.com/Fernado03/zoo-flow.git /tmp/zoo-flow
|
|
218
247
|
cp /tmp/zoo-flow/templates/full/.roomodes .
|
|
@@ -227,14 +256,40 @@ grep -qxF "# Zoo Flow — generated config (never committed)" .gitignore 2>/dev/
|
|
|
227
256
|
|
|
228
257
|
Windows uses `git clone ... C:\Temp\zoo-flow` and `Copy-Item` (including `Copy-Item -Recurse` for `.roo\` and `.zoo-flow\`) instead. Add `.roomodes`, `.roo/`, and `.zoo-flow/` to `.gitignore`.
|
|
229
258
|
|
|
259
|
+
### Claude Code
|
|
260
|
+
|
|
261
|
+
```sh
|
|
262
|
+
git clone https://github.com/Fernado03/zoo-flow.git /tmp/zoo-flow
|
|
263
|
+
cp /tmp/zoo-flow/templates/claude-code/CLAUDE.md .
|
|
264
|
+
cp -R /tmp/zoo-flow/templates/claude-code/.claude .
|
|
265
|
+
cp -R /tmp/zoo-flow/templates/claude-code/.zoo-flow .
|
|
266
|
+
touch .gitignore
|
|
267
|
+
grep -qxF "# Zoo Flow — generated config (never committed)" .gitignore 2>/dev/null || {
|
|
268
|
+
printf "\n# Zoo Flow — generated config (never committed)\n" >> .gitignore
|
|
269
|
+
printf ".claude/\n.zoo-flow/\n" >> .gitignore
|
|
270
|
+
}
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
Windows uses the same approach with `Copy-Item` for `.claude\` and `.zoo-flow\`. Add `.claude/` and `.zoo-flow/` to `.gitignore`.
|
|
274
|
+
|
|
230
275
|
## Development
|
|
231
276
|
|
|
232
|
-
Before publishing, run:
|
|
277
|
+
Before publishing, run validation scripts from the package root:
|
|
233
278
|
|
|
234
279
|
```bash
|
|
235
|
-
|
|
280
|
+
# Run all validation checks
|
|
281
|
+
npm run check
|
|
282
|
+
|
|
283
|
+
# Run individual validations
|
|
284
|
+
npm run token-budget
|
|
285
|
+
npm run package-manifest
|
|
286
|
+
npm run golden-transcripts
|
|
287
|
+
npm run project-shapes
|
|
288
|
+
npm run score-quality
|
|
236
289
|
```
|
|
237
290
|
|
|
291
|
+
Note: These validate the template source, not an installed project. To validate an installation, run `npx @fernado03/zoo-flow@latest doctor` inside the target project.
|
|
292
|
+
|
|
238
293
|
## Migration
|
|
239
294
|
|
|
240
295
|
Zoo Flow started as a Roo Flow template and was renamed for Zoo Code.
|
package/bin/zoo-flow.js
CHANGED
|
@@ -61,8 +61,8 @@ const CLAUDE_CODE_GITIGNORE_MARKER = "# Zoo Flow — Claude Code config (never c
|
|
|
61
61
|
const CLAUDE_CODE_GITIGNORE_ENTRIES = [".claude/", ".zoo-flow/"];
|
|
62
62
|
|
|
63
63
|
function detectPlatform(projectRoot) {
|
|
64
|
-
if (pathExists(path.join(projectRoot, "CLAUDE.md"))) return "claude-code";
|
|
65
|
-
if (pathExists(path.join(projectRoot, ".roomodes"))) return "zoo-code";
|
|
64
|
+
if (pathExists(path.join(projectRoot, "CLAUDE.md")) || pathExists(path.join(projectRoot, ".claude"))) return "claude-code";
|
|
65
|
+
if (pathExists(path.join(projectRoot, ".roomodes")) || pathExists(path.join(projectRoot, ".roo"))) return "zoo-code";
|
|
66
66
|
return null;
|
|
67
67
|
}
|
|
68
68
|
|
|
@@ -770,8 +770,6 @@ Next:
|
|
|
770
770
|
3. Try a small request, e.g.:
|
|
771
771
|
change a harmless comment in README
|
|
772
772
|
4. Or use a slash command like /tweak or /fix
|
|
773
|
-
|
|
774
|
-
When workflow choices appear, type the number manually, e.g. 1.
|
|
775
773
|
`);
|
|
776
774
|
}
|
|
777
775
|
}
|
package/package.json
CHANGED
|
@@ -1,55 +1,45 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@fernado03/zoo-flow",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"type": "module",
|
|
6
|
-
"bin": {
|
|
7
|
-
"zoo-flow": "bin/zoo-flow.js"
|
|
8
|
-
},
|
|
9
|
-
"files": [
|
|
10
|
-
"bin",
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"tests"
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
"
|
|
30
|
-
"zoo-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
"check": "
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
"
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
"score-quality": "node scripts/score-quality.js",
|
|
47
|
-
"release:check": "npm run check && npm run token-budget && npm run package-manifest && npm run golden-transcripts && npm run project-shapes && npm run score-quality && npm run pack:check"
|
|
48
|
-
},
|
|
49
|
-
"engines": {
|
|
50
|
-
"node": ">=18"
|
|
51
|
-
},
|
|
52
|
-
"publishConfig": {
|
|
53
|
-
"access": "public"
|
|
54
|
-
}
|
|
55
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@fernado03/zoo-flow",
|
|
3
|
+
"version": "0.11.2",
|
|
4
|
+
"description": "Structured workflow templates for AI coding assistants",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"zoo-flow": "./bin/zoo-flow.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"bin/",
|
|
11
|
+
"templates/",
|
|
12
|
+
"scripts/",
|
|
13
|
+
"tests/"
|
|
14
|
+
],
|
|
15
|
+
"keywords": [
|
|
16
|
+
"ai",
|
|
17
|
+
"coding-assistant",
|
|
18
|
+
"workflow",
|
|
19
|
+
"claude",
|
|
20
|
+
"zoo-code",
|
|
21
|
+
"roo-code"
|
|
22
|
+
],
|
|
23
|
+
"author": "Fernado",
|
|
24
|
+
"license": "MIT",
|
|
25
|
+
"repository": {
|
|
26
|
+
"type": "git",
|
|
27
|
+
"url": "git+https://github.com/Fernado03/zoo-flow.git"
|
|
28
|
+
},
|
|
29
|
+
"bugs": {
|
|
30
|
+
"url": "https://github.com/Fernado03/zoo-flow/issues"
|
|
31
|
+
},
|
|
32
|
+
"homepage": "https://github.com/Fernado03/zoo-flow#readme",
|
|
33
|
+
"scripts": {
|
|
34
|
+
"check": "node scripts/test-doctor.js && node bin/zoo-flow.js doctor --template-only && node scripts/eval-routing.js && node scripts/check-package-links.js",
|
|
35
|
+
"token-budget": "node scripts/token-budget.js",
|
|
36
|
+
"package-manifest": "node scripts/check-package-manifest.js",
|
|
37
|
+
"golden-transcripts": "node scripts/check-golden-transcripts.js",
|
|
38
|
+
"project-shapes": "node scripts/test-project-shapes.js",
|
|
39
|
+
"score-quality": "node scripts/score-quality.js",
|
|
40
|
+
"release:check": "npm run check && npm run token-budget && npm run package-manifest && npm run golden-transcripts && npm run project-shapes && npm run score-quality"
|
|
41
|
+
},
|
|
42
|
+
"engines": {
|
|
43
|
+
"node": ">=18"
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Explore and understand a codebase area"
|
|
3
|
+
argument-hint: "<what to explore>"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Explore — Codebase Understanding
|
|
7
|
+
|
|
8
|
+
This command systematically explores a codebase area to build understanding and create documentation.
|
|
9
|
+
|
|
10
|
+
## Behavioral Context: Architect
|
|
11
|
+
|
|
12
|
+
You are operating in the **Architect profile**:
|
|
13
|
+
- **File access**: Read-only for code, write to `.scratch/` for exploration notes
|
|
14
|
+
- **Scope**: Understand and document code structure
|
|
15
|
+
- **Output**: Exploration report with insights and recommendations
|
|
16
|
+
|
|
17
|
+
## Procedure
|
|
18
|
+
|
|
19
|
+
Read and follow the skill file: `.claude/skills/engineering/explore/SKILL.md`
|
|
20
|
+
|
|
21
|
+
## Expected Outcome
|
|
22
|
+
|
|
23
|
+
- Deep understanding of the explored area
|
|
24
|
+
- Documentation of structure and patterns
|
|
25
|
+
- Recommendations for improvements or next steps
|
|
26
|
+
- Exploration report in `.scratch/`
|
|
27
|
+
|
|
28
|
+
$ARGUMENTS
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: writing-beats
|
|
3
|
+
description: Shape an article as a journey of beats, choose-your-own-adventure style. The user picks a starting beat from the raw material, you write only that beat, then offer options for where to pivot next, beat by beat, until the article reaches a natural end. Use when the user has raw material and wants to assemble it as a narrative rather than an argument.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Writing Beats
|
|
7
|
+
|
|
8
|
+
## Setup
|
|
9
|
+
|
|
10
|
+
1. Use `Read` to read raw markdown fully.
|
|
11
|
+
2. If article output path missing, ask once.
|
|
12
|
+
3. Never edit raw material.
|
|
13
|
+
4. Use `Read` to re-read article before every `Write`.
|
|
14
|
+
|
|
15
|
+
## Loop
|
|
16
|
+
|
|
17
|
+
1. Offer 2–3 starting beats from raw material.
|
|
18
|
+
2. Preview likely next pivots for each.
|
|
19
|
+
3. User picks.
|
|
20
|
+
4. Use `Write` to write only selected beat to article.
|
|
21
|
+
5. Use `Read` to re-read article.
|
|
22
|
+
6. Offer 2–3 next beats from current ending.
|
|
23
|
+
7. Loop until natural end.
|
|
24
|
+
|
|
25
|
+
## Rules
|
|
26
|
+
|
|
27
|
+
- Beat = one move: scene/point/question/aside/twist.
|
|
28
|
+
- Size to need: sentence, paragraph, or short vignette.
|
|
29
|
+
- If needs headings/5 paragraphs, split.
|
|
30
|
+
- Pull/paraphrase/split/merge raw fragments.
|
|
31
|
+
- Leave unused raw material.
|
|
32
|
+
- Rewrite/go back → edit specific beat; preserve rest.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: writing-fragments
|
|
3
|
+
description: Grilling session that mines the user for fragments — heterogeneous nuggets of writing (claims, vignettes, sharp sentences, half-thoughts) — and appends them to a single document as raw material for a future article. Use when the user wants to develop ideas before imposing structure, or mentions "fragments", "ideate", or "raw material" for writing.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Writing Fragments
|
|
7
|
+
|
|
8
|
+
## Setup
|
|
9
|
+
|
|
10
|
+
1. Capture fragments from initial prompt onward.
|
|
11
|
+
2. If output path missing, ask once.
|
|
12
|
+
3. First write: one H1 working title; no metadata/TOC/date.
|
|
13
|
+
4. Use `Read` to re-read file before every `Write`.
|
|
14
|
+
5. Use `Write` to append only unless user requests specific edit.
|
|
15
|
+
|
|
16
|
+
## Fragment forms
|
|
17
|
+
|
|
18
|
+
- Sharp sentence.
|
|
19
|
+
- Claim + one-line reason.
|
|
20
|
+
- Vignette/scenario/analogy/code snippet.
|
|
21
|
+
- Half-thought.
|
|
22
|
+
- Quote/dialogue.
|
|
23
|
+
- Observation cluster.
|
|
24
|
+
- Complaint/confession/punchline.
|
|
25
|
+
|
|
26
|
+
## File format
|
|
27
|
+
|
|
28
|
+
```markdown
|
|
29
|
+
# Working title
|
|
30
|
+
|
|
31
|
+
Fragment one.
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
Fragment two.
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Rules:
|
|
39
|
+
- Separate fragments with `---`.
|
|
40
|
+
- No body headings/tags.
|
|
41
|
+
- Order = capture order.
|
|
42
|
+
- Append silently; mention briefly.
|
|
43
|
+
- Preserve user edits.
|
|
44
|
+
- Support `cut last`, `rewrite`, `merge` immediately.
|
|
45
|
+
- DO NOT impose outline/structure.
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: writing-shape
|
|
3
|
+
description: Take a markdown file of raw material and shape it into an article through a conversational session — drafting candidate openings, growing the piece paragraph by paragraph, arguing about format (lists, tables, callouts, quotes) at each step. Use when the user has a pile of notes, fragments, or a rough draft and wants help turning it into something publishable.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Writing Shape
|
|
7
|
+
|
|
8
|
+
## Setup
|
|
9
|
+
|
|
10
|
+
1. Use `Read` to read raw markdown fully.
|
|
11
|
+
2. Treat raw file read-only.
|
|
12
|
+
3. If article path missing, ask once.
|
|
13
|
+
4. Use `Read` to re-read article before every `Write`.
|
|
14
|
+
|
|
15
|
+
## Loop
|
|
16
|
+
|
|
17
|
+
1. Draft 2–3 openings with different thesis/angle.
|
|
18
|
+
2. User picks or composes hybrid.
|
|
19
|
+
3. Opening defines article path.
|
|
20
|
+
4. Ask what reader needs next.
|
|
21
|
+
5. Pull from raw material.
|
|
22
|
+
6. Argue format: prose/list/table/callout/quote/code.
|
|
23
|
+
7. Use `Write` to append agreed block immediately.
|
|
24
|
+
8. Repeat until article done.
|
|
25
|
+
|
|
26
|
+
## Pressure tests
|
|
27
|
+
|
|
28
|
+
- What does this paragraph do that previous didn't?
|
|
29
|
+
- If cut, what breaks?
|
|
30
|
+
- Prose/list/table/callout? Why?
|
|
31
|
+
- Sentence doing two jobs? Split or pick one.
|
|
32
|
+
- Opening promised X; current draft drifted to Y?
|
|
33
|
+
|
|
34
|
+
## Format rules
|
|
35
|
+
|
|
36
|
+
- Prose carries argument.
|
|
37
|
+
- List only for parallel items.
|
|
38
|
+
- Callout for derailing tips/warnings/asides.
|
|
39
|
+
- Table when same fields repeat 3+ times.
|
|
40
|
+
- Quote when exact wording matters.
|
|
41
|
+
- Code block for multi-line/runnable/illustrative; inline code for single token.
|
|
42
|
+
|
|
43
|
+
## Rules
|
|
44
|
+
|
|
45
|
+
- Mine pile; do not follow as script.
|
|
46
|
+
- Paraphrase/split/merge fragments.
|
|
47
|
+
- If pile lacks needed example/info, ask user or cut section.
|
|
48
|
+
- Preserve user edits.
|
|
49
|
+
- Edit specific paragraph in place when requested.
|
|
50
|
+
- DO NOT publish or add unsolicited frontmatter.
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: git-guardrails-claude-code
|
|
3
|
+
description: Set up Claude Code hooks to block dangerous git commands (push, reset --hard, clean, branch -D, etc.) before they execute. Use when user wants to prevent destructive git operations, add git safety hooks, or block git push/reset in Claude Code.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Setup Git Guardrails
|
|
7
|
+
|
|
8
|
+
Block patterns: `git push`, `git reset --hard`, `git clean -f`, `git clean -fd`, `git branch -D`, `git checkout .`, `git restore .`, `push --force`, `reset --hard`.
|
|
9
|
+
|
|
10
|
+
## Process
|
|
11
|
+
|
|
12
|
+
1. Ask scope: Project `.claude/settings.json` or Global `~/.claude/settings.json`.
|
|
13
|
+
2. Copy `scripts/block-dangerous-git.sh` to `.claude/hooks/block-dangerous-git.sh` in selected scope.
|
|
14
|
+
3. Use `Bash` to run `chmod +x {script}`.
|
|
15
|
+
4. Merge hook into settings; DO NOT overwrite existing settings.
|
|
16
|
+
|
|
17
|
+
Project settings:
|
|
18
|
+
|
|
19
|
+
```json
|
|
20
|
+
{
|
|
21
|
+
"hooks": {
|
|
22
|
+
"PreToolUse": [
|
|
23
|
+
{
|
|
24
|
+
"matcher": "Bash",
|
|
25
|
+
"hooks": [
|
|
26
|
+
{
|
|
27
|
+
"type": "command",
|
|
28
|
+
"command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/block-dangerous-git.sh"
|
|
29
|
+
}
|
|
30
|
+
]
|
|
31
|
+
}
|
|
32
|
+
]
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Global settings:
|
|
38
|
+
|
|
39
|
+
```json
|
|
40
|
+
{
|
|
41
|
+
"hooks": {
|
|
42
|
+
"PreToolUse": [
|
|
43
|
+
{
|
|
44
|
+
"matcher": "Bash",
|
|
45
|
+
"hooks": [
|
|
46
|
+
{
|
|
47
|
+
"type": "command",
|
|
48
|
+
"command": "~/.claude/hooks/block-dangerous-git.sh"
|
|
49
|
+
}
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
5. Ask pattern customisation.
|
|
58
|
+
6. Verify:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
echo '{"tool_input":{"command":"git push origin main"}}' | {path-to-script}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Expected: exit 2 + `BLOCKED` stderr.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
INPUT=$(cat)
|
|
4
|
+
COMMAND=$(echo "$INPUT" | jq -r '.tool_input.command')
|
|
5
|
+
|
|
6
|
+
DANGEROUS_PATTERNS=(
|
|
7
|
+
"git push"
|
|
8
|
+
"git reset --hard"
|
|
9
|
+
"git clean -fd"
|
|
10
|
+
"git clean -f"
|
|
11
|
+
"git branch -D"
|
|
12
|
+
"git checkout \."
|
|
13
|
+
"git restore \."
|
|
14
|
+
"push --force"
|
|
15
|
+
"reset --hard"
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
for pattern in "${DANGEROUS_PATTERNS[@]}"; do
|
|
19
|
+
if echo "$COMMAND" | grep -qE "$pattern"; then
|
|
20
|
+
echo "BLOCKED: '$COMMAND' matches dangerous pattern '$pattern'. The user has prevented you from doing this." >&2
|
|
21
|
+
exit 2
|
|
22
|
+
fi
|
|
23
|
+
done
|
|
24
|
+
|
|
25
|
+
exit 0
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: migrate-to-shoehorn
|
|
3
|
+
description: Migrate test files from `as` type assertions to @total-typescript/shoehorn. Use when user mentions shoehorn, wants to replace `as` in tests, or needs partial test data.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Migrate to Shoehorn
|
|
7
|
+
|
|
8
|
+
RULE: Test code only. Never production.
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
Use `Bash` to run:
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm i @total-typescript/shoehorn
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Mapping
|
|
19
|
+
|
|
20
|
+
- `as Type` → `fromPartial()`.
|
|
21
|
+
- `as unknown as Type` → `fromAny()`.
|
|
22
|
+
- `fromPartial()` = partial data that should type-check.
|
|
23
|
+
- `fromAny()` = intentionally wrong data.
|
|
24
|
+
- `fromExact()` = full object now, partial later.
|
|
25
|
+
|
|
26
|
+
## Workflow
|
|
27
|
+
|
|
28
|
+
1. Ask target test files/use cases if missing.
|
|
29
|
+
2. Use `Bash` to install dependency.
|
|
30
|
+
3. Use `Grep` to find assertions:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
grep -r " as [A-Z]" --include="*.test.ts" --include="*.spec.ts"
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
4. Use `Edit` to replace `as Type` with `fromPartial()`.
|
|
37
|
+
5. Use `Edit` to replace `as unknown as Type` with `fromAny()`.
|
|
38
|
+
6. Use `Edit` to add imports.
|
|
39
|
+
7. Use `Bash` to run type check.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: scaffold-exercises
|
|
3
|
+
description: Create exercise directory structures with sections, problems, solutions, and explainers that pass linting. Use when user wants to scaffold exercises, create exercise stubs, or set up a new course section.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Scaffold Exercises
|
|
7
|
+
|
|
8
|
+
Goal: create exercise dirs passing `pnpm ai-hero-cli internal lint`, then commit.
|
|
9
|
+
|
|
10
|
+
## Naming
|
|
11
|
+
|
|
12
|
+
- Sections: `exercises/XX-section-name/`.
|
|
13
|
+
- Exercises: `XX.YY-exercise-name/` inside section.
|
|
14
|
+
- Lowercase dash-case.
|
|
15
|
+
|
|
16
|
+
## Variants
|
|
17
|
+
|
|
18
|
+
Each exercise needs ≥1: `problem/`, `solution/`, `explainer/`. Default stub: `explainer/` unless plan says otherwise.
|
|
19
|
+
|
|
20
|
+
## Required files
|
|
21
|
+
|
|
22
|
+
- Each variant folder: non-empty `readme.md`.
|
|
23
|
+
- Minimal readme:
|
|
24
|
+
|
|
25
|
+
```md
|
|
26
|
+
# Exercise Title
|
|
27
|
+
|
|
28
|
+
Description here
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
- If folder has code, `main.ts` >1 line required.
|
|
32
|
+
- Readme-only stubs allowed.
|
|
33
|
+
|
|
34
|
+
## Workflow
|
|
35
|
+
|
|
36
|
+
1. Parse plan into sections/exercises/variants.
|
|
37
|
+
2. Use `Bash` to `mkdir -p` dirs.
|
|
38
|
+
3. Use `Write` to create readme stubs.
|
|
39
|
+
4. Use `Bash` to run `pnpm ai-hero-cli internal lint`.
|
|
40
|
+
5. Fix until pass.
|
|
41
|
+
6. Use `Bash` to move/rename with `git mv`.
|
|
42
|
+
7. Use `Bash` to commit with `git commit`.
|
|
43
|
+
|
|
44
|
+
## Lint constraints
|
|
45
|
+
|
|
46
|
+
- Exercise has subfolder.
|
|
47
|
+
- At least one of `problem/`, `explainer/`, `explainer.1/` exists.
|
|
48
|
+
- Primary readme exists and non-empty.
|
|
49
|
+
- No `.gitkeep`.
|
|
50
|
+
- No `speaker-notes.md`.
|
|
51
|
+
- No broken links.
|
|
52
|
+
- No `pnpm run exercise` in readmes.
|
|
53
|
+
- `main.ts` required only when code present.
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: setup-pre-commit
|
|
3
|
+
description: Set up Husky pre-commit hooks with lint-staged (Prettier), type checking, and tests in the current repo. Use when user wants to add pre-commit hooks, set up Husky, configure lint-staged, or add commit-time formatting/typechecking/testing.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Setup Pre-Commit Hooks
|
|
7
|
+
|
|
8
|
+
Creates Husky pre-commit, lint-staged Prettier, optional typecheck/test.
|
|
9
|
+
|
|
10
|
+
## Process
|
|
11
|
+
|
|
12
|
+
1. Detect package manager: `package-lock.json`→npm; `pnpm-lock.yaml`→pnpm; `yarn.lock`→yarn; `bun.lockb`→bun; default npm.
|
|
13
|
+
2. Use `Bash` to install dev deps, adapting package manager:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm i -D husky lint-staged prettier
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
3. Use `Bash` to init Husky:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npx husky init
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
4. Use `Write` to write `.husky/pre-commit`, adapting package manager; omit missing scripts and tell user:
|
|
26
|
+
|
|
27
|
+
```text
|
|
28
|
+
npx lint-staged
|
|
29
|
+
npm run typecheck
|
|
30
|
+
npm run test
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
5. Use `Write` to create `.lintstagedrc`:
|
|
34
|
+
|
|
35
|
+
```json
|
|
36
|
+
{
|
|
37
|
+
"*": "prettier --ignore-unknown --write"
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
6. Use `Write` to create `.prettierrc` only if no Prettier config:
|
|
42
|
+
|
|
43
|
+
```json
|
|
44
|
+
{
|
|
45
|
+
"useTabs": false,
|
|
46
|
+
"tabWidth": 2,
|
|
47
|
+
"printWidth": 80,
|
|
48
|
+
"singleQuote": false,
|
|
49
|
+
"trailingComma": "es5",
|
|
50
|
+
"semi": true,
|
|
51
|
+
"arrowParens": "always"
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
7. Verify: executable `.husky/pre-commit`; `.lintstagedrc`; `prepare` script = `husky`; Prettier config; use `Bash` to run `npx lint-staged`.
|
|
56
|
+
8. Use `Bash` to commit:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
git commit -m "Add pre-commit hooks (husky + lint-staged + prettier)"
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
RULE: Wait for explicit user approval before commit if current mode requires HITL.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: edit-article
|
|
3
|
+
description: Edit and improve articles by restructuring sections, improving clarity, and tightening prose. Use when user wants to edit, revise, or improve an article draft.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Edit Article
|
|
7
|
+
|
|
8
|
+
1. Use `Read` to divide article by headings.
|
|
9
|
+
2. Identify main point per section.
|
|
10
|
+
3. Reorder sections/content so dependencies flow first.
|
|
11
|
+
4. Confirm section plan with user.
|
|
12
|
+
5. Use `Edit` to rewrite each section for clarity/coherence/flow.
|
|
13
|
+
6. Max 240 chars per paragraph.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: obsidian-vault
|
|
3
|
+
description: Search, create, and manage notes in the Obsidian vault with wikilinks and index notes. Use when user wants to find, create, or organize notes in Obsidian.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Obsidian Vault
|
|
7
|
+
|
|
8
|
+
## Vault path
|
|
9
|
+
|
|
10
|
+
1. Use `$OBSIDIAN_VAULT_PATH`.
|
|
11
|
+
2. If unset, STOP and ask absolute vault path.
|
|
12
|
+
|
|
13
|
+
## Naming
|
|
14
|
+
|
|
15
|
+
- Index notes aggregate related topics: `Ralph Wiggum Index.md`.
|
|
16
|
+
- Title Case filenames.
|
|
17
|
+
- No folders for org; use wikilinks/index notes.
|
|
18
|
+
|
|
19
|
+
## Linking
|
|
20
|
+
|
|
21
|
+
- Use `[[wikilinks]]`.
|
|
22
|
+
- Add related/dependency links at bottom.
|
|
23
|
+
- Index notes = wikilink lists.
|
|
24
|
+
|
|
25
|
+
## Commands
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
find "/mnt/d/Obsidian Vault/AI Research/" -name "*.md" | grep -i "keyword"
|
|
29
|
+
grep -rl "keyword" "/mnt/d/Obsidian Vault/AI Research/" --include="*.md"
|
|
30
|
+
grep -rl "\\[\\[Note Title\\]\\]" "/mnt/d/Obsidian Vault/AI Research/"
|
|
31
|
+
find "/mnt/d/Obsidian Vault/AI Research/" -name "*Index*"
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Create note
|
|
35
|
+
|
|
36
|
+
1. Title Case filename.
|
|
37
|
+
2. Use `Write` to write one learning unit.
|
|
38
|
+
3. Add related wikilinks at bottom.
|
|
39
|
+
4. If numbered sequence, use hierarchy.
|