claude-agent-skills 1.3.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/README.md +65 -0
- package/bundled-skills/ask-matt/SKILL.md +61 -0
- package/bundled-skills/brainstorming/SKILL.md +159 -0
- package/bundled-skills/brainstorming/scripts/frame-template.html +213 -0
- package/bundled-skills/brainstorming/scripts/helper.js +167 -0
- package/bundled-skills/brainstorming/scripts/server.cjs +723 -0
- package/bundled-skills/brainstorming/scripts/start-server.sh +209 -0
- package/bundled-skills/brainstorming/scripts/stop-server.sh +120 -0
- package/bundled-skills/brainstorming/spec-document-reviewer-prompt.md +49 -0
- package/bundled-skills/brainstorming/visual-companion.md +298 -0
- package/bundled-skills/cavecrew/README.md +41 -0
- package/bundled-skills/cavecrew/SKILL.md +82 -0
- package/bundled-skills/caveman/README.md +48 -0
- package/bundled-skills/caveman/SKILL.md +78 -0
- package/bundled-skills/caveman-commit/README.md +44 -0
- package/bundled-skills/caveman-commit/SKILL.md +65 -0
- package/bundled-skills/caveman-compress/README.md +163 -0
- package/bundled-skills/caveman-compress/SECURITY.md +31 -0
- package/bundled-skills/caveman-compress/SKILL.md +111 -0
- package/bundled-skills/caveman-compress/scripts/__init__.py +9 -0
- package/bundled-skills/caveman-compress/scripts/__main__.py +3 -0
- package/bundled-skills/caveman-compress/scripts/benchmark.py +80 -0
- package/bundled-skills/caveman-compress/scripts/cli.py +85 -0
- package/bundled-skills/caveman-compress/scripts/compress.py +342 -0
- package/bundled-skills/caveman-compress/scripts/detect.py +121 -0
- package/bundled-skills/caveman-compress/scripts/validate.py +213 -0
- package/bundled-skills/caveman-help/README.md +38 -0
- package/bundled-skills/caveman-help/SKILL.md +63 -0
- package/bundled-skills/caveman-review/README.md +33 -0
- package/bundled-skills/caveman-review/SKILL.md +55 -0
- package/bundled-skills/caveman-stats/README.md +30 -0
- package/bundled-skills/caveman-stats/SKILL.md +10 -0
- package/bundled-skills/codebase-design/DEEPENING.md +37 -0
- package/bundled-skills/codebase-design/DESIGN-IT-TWICE.md +44 -0
- package/bundled-skills/codebase-design/SKILL.md +114 -0
- package/bundled-skills/council/SKILL.md +77 -0
- package/bundled-skills/diagnosing-bugs/SKILL.md +134 -0
- package/bundled-skills/diagnosing-bugs/scripts/hitl-loop.template.sh +41 -0
- package/bundled-skills/dispatching-parallel-agents/SKILL.md +185 -0
- package/bundled-skills/domain-modeling/ADR-FORMAT.md +47 -0
- package/bundled-skills/domain-modeling/CONTEXT-FORMAT.md +60 -0
- package/bundled-skills/domain-modeling/SKILL.md +74 -0
- package/bundled-skills/edit-article/SKILL.md +15 -0
- package/bundled-skills/executing-plans/SKILL.md +70 -0
- package/bundled-skills/finishing-a-development-branch/SKILL.md +241 -0
- package/bundled-skills/git-guardrails-claude-code/SKILL.md +95 -0
- package/bundled-skills/git-guardrails-claude-code/scripts/block-dangerous-git.sh +25 -0
- package/bundled-skills/grill-me/SKILL.md +7 -0
- package/bundled-skills/grill-with-docs/SKILL.md +7 -0
- package/bundled-skills/grilling/SKILL.md +10 -0
- package/bundled-skills/handoff/SKILL.md +16 -0
- package/bundled-skills/i-am-dumb/SKILL.md +57 -0
- package/bundled-skills/implement/SKILL.md +15 -0
- package/bundled-skills/improve-codebase-architecture/HTML-REPORT.md +123 -0
- package/bundled-skills/improve-codebase-architecture/SKILL.md +66 -0
- package/bundled-skills/migrate-to-shoehorn/SKILL.md +118 -0
- package/bundled-skills/obsidian-vault/SKILL.md +59 -0
- package/bundled-skills/ponytail/SKILL.md +117 -0
- package/bundled-skills/ponytail-audit/SKILL.md +50 -0
- package/bundled-skills/ponytail-debt/SKILL.md +59 -0
- package/bundled-skills/ponytail-gain/SKILL.md +51 -0
- package/bundled-skills/ponytail-help/SKILL.md +43 -0
- package/bundled-skills/ponytail-review/SKILL.md +51 -0
- package/bundled-skills/prototype/LOGIC.md +79 -0
- package/bundled-skills/prototype/SKILL.md +31 -0
- package/bundled-skills/prototype/UI.md +112 -0
- package/bundled-skills/receiving-code-review/SKILL.md +213 -0
- package/bundled-skills/requesting-code-review/SKILL.md +103 -0
- package/bundled-skills/requesting-code-review/code-reviewer.md +172 -0
- package/bundled-skills/resolving-merge-conflicts/SKILL.md +14 -0
- package/bundled-skills/scaffold-exercises/SKILL.md +106 -0
- package/bundled-skills/setup-matt-pocock-skills/SKILL.md +127 -0
- package/bundled-skills/setup-matt-pocock-skills/domain.md +51 -0
- package/bundled-skills/setup-matt-pocock-skills/issue-tracker-github.md +34 -0
- package/bundled-skills/setup-matt-pocock-skills/issue-tracker-gitlab.md +35 -0
- package/bundled-skills/setup-matt-pocock-skills/issue-tracker-local.md +19 -0
- package/bundled-skills/setup-matt-pocock-skills/triage-labels.md +15 -0
- package/bundled-skills/setup-pre-commit/SKILL.md +91 -0
- package/bundled-skills/subagent-driven-development/SKILL.md +418 -0
- package/bundled-skills/subagent-driven-development/implementer-prompt.md +139 -0
- package/bundled-skills/subagent-driven-development/scripts/review-package +44 -0
- package/bundled-skills/subagent-driven-development/scripts/sdd-workspace +22 -0
- package/bundled-skills/subagent-driven-development/scripts/task-brief +40 -0
- package/bundled-skills/subagent-driven-development/task-reviewer-prompt.md +188 -0
- package/bundled-skills/systematic-debugging/CREATION-LOG.md +119 -0
- package/bundled-skills/systematic-debugging/SKILL.md +296 -0
- package/bundled-skills/systematic-debugging/condition-based-waiting-example.ts +158 -0
- package/bundled-skills/systematic-debugging/condition-based-waiting.md +115 -0
- package/bundled-skills/systematic-debugging/defense-in-depth.md +122 -0
- package/bundled-skills/systematic-debugging/find-polluter.sh +63 -0
- package/bundled-skills/systematic-debugging/root-cause-tracing.md +169 -0
- package/bundled-skills/systematic-debugging/test-academic.md +14 -0
- package/bundled-skills/systematic-debugging/test-pressure-1.md +58 -0
- package/bundled-skills/systematic-debugging/test-pressure-2.md +68 -0
- package/bundled-skills/systematic-debugging/test-pressure-3.md +69 -0
- package/bundled-skills/tdd/SKILL.md +108 -0
- package/bundled-skills/tdd/mocking.md +59 -0
- package/bundled-skills/tdd/refactoring.md +10 -0
- package/bundled-skills/tdd/tests.md +61 -0
- package/bundled-skills/teach/GLOSSARY-FORMAT.md +35 -0
- package/bundled-skills/teach/LEARNING-RECORD-FORMAT.md +46 -0
- package/bundled-skills/teach/MISSION-FORMAT.md +31 -0
- package/bundled-skills/teach/RESOURCES-FORMAT.md +32 -0
- package/bundled-skills/teach/SKILL.md +140 -0
- package/bundled-skills/test-driven-development/SKILL.md +371 -0
- package/bundled-skills/test-driven-development/testing-anti-patterns.md +299 -0
- package/bundled-skills/to-issues/SKILL.md +84 -0
- package/bundled-skills/to-prd/SKILL.md +75 -0
- package/bundled-skills/triage/AGENT-BRIEF.md +207 -0
- package/bundled-skills/triage/OUT-OF-SCOPE.md +105 -0
- package/bundled-skills/triage/SKILL.md +112 -0
- package/bundled-skills/using-git-worktrees/SKILL.md +202 -0
- package/bundled-skills/using-superpowers/SKILL.md +121 -0
- package/bundled-skills/using-superpowers/references/antigravity-tools.md +96 -0
- package/bundled-skills/using-superpowers/references/claude-code-tools.md +50 -0
- package/bundled-skills/using-superpowers/references/codex-tools.md +72 -0
- package/bundled-skills/using-superpowers/references/copilot-tools.md +49 -0
- package/bundled-skills/using-superpowers/references/gemini-tools.md +63 -0
- package/bundled-skills/using-superpowers/references/pi-tools.md +28 -0
- package/bundled-skills/verification-before-completion/SKILL.md +139 -0
- package/bundled-skills/writing-great-skills/GLOSSARY.md +195 -0
- package/bundled-skills/writing-great-skills/SKILL.md +82 -0
- package/bundled-skills/writing-plans/SKILL.md +174 -0
- package/bundled-skills/writing-plans/plan-document-reviewer-prompt.md +49 -0
- package/bundled-skills/writing-skills/SKILL.md +689 -0
- package/bundled-skills/writing-skills/anthropic-best-practices.md +1150 -0
- package/bundled-skills/writing-skills/examples/CLAUDE_MD_TESTING.md +189 -0
- package/bundled-skills/writing-skills/graphviz-conventions.dot +172 -0
- package/bundled-skills/writing-skills/persuasion-principles.md +187 -0
- package/bundled-skills/writing-skills/render-graphs.js +168 -0
- package/bundled-skills/writing-skills/testing-skills-with-subagents.md +384 -0
- package/commands/add.js +97 -0
- package/commands/check.js +54 -0
- package/commands/exportSkills.js +30 -0
- package/commands/hub.js +52 -0
- package/commands/importSkills.js +68 -0
- package/commands/list.js +37 -0
- package/commands/remove.js +59 -0
- package/commands/sync.js +66 -0
- package/commands/update.js +70 -0
- package/index.js +100 -0
- package/lib/banner.js +108 -0
- package/lib/constants.js +10 -0
- package/lib/deps.js +51 -0
- package/lib/hash.js +26 -0
- package/lib/install.js +31 -0
- package/lib/lockfile.js +37 -0
- package/lib/prompts.js +50 -0
- package/lib/scope.js +19 -0
- package/lib/summary.js +108 -0
- package/lib/theme.js +11 -0
- package/package.json +43 -0
- package/skills.json +164 -0
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
# Code Reviewer Prompt Template
|
|
2
|
+
|
|
3
|
+
Use this template when dispatching a code reviewer subagent.
|
|
4
|
+
|
|
5
|
+
**Purpose:** Review completed work against requirements and code quality standards before it cascades into more work.
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
Subagent (general-purpose):
|
|
9
|
+
description: "Review code changes"
|
|
10
|
+
prompt: |
|
|
11
|
+
You are a Senior Code Reviewer with expertise in software architecture,
|
|
12
|
+
design patterns, and best practices. Your job is to review completed work
|
|
13
|
+
against its plan or requirements and identify issues before they cascade.
|
|
14
|
+
|
|
15
|
+
## What Was Implemented
|
|
16
|
+
|
|
17
|
+
[DESCRIPTION]
|
|
18
|
+
|
|
19
|
+
## Requirements / Plan
|
|
20
|
+
|
|
21
|
+
[PLAN_OR_REQUIREMENTS]
|
|
22
|
+
|
|
23
|
+
## Git Range to Review
|
|
24
|
+
|
|
25
|
+
**Base:** [BASE_SHA]
|
|
26
|
+
**Head:** [HEAD_SHA]
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
git diff --stat [BASE_SHA]..[HEAD_SHA]
|
|
30
|
+
git diff [BASE_SHA]..[HEAD_SHA]
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Read-Only Review
|
|
34
|
+
|
|
35
|
+
Your review is read-only on this checkout. Do not mutate the working tree, the index, HEAD, or branch state in any way. Use tools like `git show`, `git diff`, and `git log` to inspect history. If you need a working copy of a different revision, check it out into a separate temporary directory (e.g. `git worktree add /tmp/review-[SHA] [SHA]`) — never move HEAD on this checkout.
|
|
36
|
+
|
|
37
|
+
## What to Check
|
|
38
|
+
|
|
39
|
+
**Plan alignment:**
|
|
40
|
+
- Does the implementation match the plan / requirements?
|
|
41
|
+
- Are deviations justified improvements, or problematic departures?
|
|
42
|
+
- Is all planned functionality present?
|
|
43
|
+
|
|
44
|
+
**Code quality:**
|
|
45
|
+
- Clean separation of concerns?
|
|
46
|
+
- Proper error handling?
|
|
47
|
+
- Type safety where applicable?
|
|
48
|
+
- DRY without premature abstraction?
|
|
49
|
+
- Edge cases handled?
|
|
50
|
+
|
|
51
|
+
**Architecture:**
|
|
52
|
+
- Sound design decisions?
|
|
53
|
+
- Reasonable scalability and performance?
|
|
54
|
+
- Security concerns?
|
|
55
|
+
- Integrates cleanly with surrounding code?
|
|
56
|
+
|
|
57
|
+
**Testing:**
|
|
58
|
+
- Tests verify real behavior, not mocks?
|
|
59
|
+
- Edge cases covered?
|
|
60
|
+
- Integration tests where they matter?
|
|
61
|
+
- All tests passing?
|
|
62
|
+
|
|
63
|
+
**Production readiness:**
|
|
64
|
+
- Migration strategy if schema changed?
|
|
65
|
+
- Backward compatibility considered?
|
|
66
|
+
- Documentation complete?
|
|
67
|
+
- No obvious bugs?
|
|
68
|
+
|
|
69
|
+
## Calibration
|
|
70
|
+
|
|
71
|
+
Categorize issues by actual severity. Not everything is Critical.
|
|
72
|
+
Acknowledge what was done well before listing issues — accurate praise
|
|
73
|
+
helps the implementer trust the rest of the feedback.
|
|
74
|
+
|
|
75
|
+
If you find significant deviations from the plan, flag them specifically
|
|
76
|
+
so the implementer can confirm whether the deviation was intentional.
|
|
77
|
+
If you find issues with the plan itself rather than the implementation,
|
|
78
|
+
say so.
|
|
79
|
+
|
|
80
|
+
## Output Format
|
|
81
|
+
|
|
82
|
+
### Strengths
|
|
83
|
+
[What's well done? Be specific.]
|
|
84
|
+
|
|
85
|
+
### Issues
|
|
86
|
+
|
|
87
|
+
#### Critical (Must Fix)
|
|
88
|
+
[Bugs, security issues, data loss risks, broken functionality]
|
|
89
|
+
|
|
90
|
+
#### Important (Should Fix)
|
|
91
|
+
[Architecture problems, missing features, poor error handling, test gaps]
|
|
92
|
+
|
|
93
|
+
#### Minor (Nice to Have)
|
|
94
|
+
[Code style, optimization opportunities, documentation polish]
|
|
95
|
+
|
|
96
|
+
For each issue:
|
|
97
|
+
- File:line reference
|
|
98
|
+
- What's wrong
|
|
99
|
+
- Why it matters
|
|
100
|
+
- How to fix (if not obvious)
|
|
101
|
+
|
|
102
|
+
### Recommendations
|
|
103
|
+
[Improvements for code quality, architecture, or process]
|
|
104
|
+
|
|
105
|
+
### Assessment
|
|
106
|
+
|
|
107
|
+
**Ready to merge?** [Yes | No | With fixes]
|
|
108
|
+
|
|
109
|
+
**Reasoning:** [1-2 sentence technical assessment]
|
|
110
|
+
|
|
111
|
+
## Critical Rules
|
|
112
|
+
|
|
113
|
+
**DO:**
|
|
114
|
+
- Categorize by actual severity
|
|
115
|
+
- Be specific (file:line, not vague)
|
|
116
|
+
- Explain WHY each issue matters
|
|
117
|
+
- Acknowledge strengths
|
|
118
|
+
- Give a clear verdict
|
|
119
|
+
|
|
120
|
+
**DON'T:**
|
|
121
|
+
- Say "looks good" without checking
|
|
122
|
+
- Mark nitpicks as Critical
|
|
123
|
+
- Give feedback on code you didn't actually read
|
|
124
|
+
- Be vague ("improve error handling")
|
|
125
|
+
- Avoid giving a clear verdict
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
**Placeholders:**
|
|
129
|
+
- `[DESCRIPTION]` — brief summary of what was built
|
|
130
|
+
- `[PLAN_OR_REQUIREMENTS]` — what it should do (plan file path, task text, or requirements)
|
|
131
|
+
- `[BASE_SHA]` — starting commit
|
|
132
|
+
- `[HEAD_SHA]` — ending commit
|
|
133
|
+
|
|
134
|
+
**Reviewer returns:** Strengths, Issues (Critical / Important / Minor), Recommendations, Assessment
|
|
135
|
+
|
|
136
|
+
## Example Output
|
|
137
|
+
|
|
138
|
+
```
|
|
139
|
+
### Strengths
|
|
140
|
+
- Clean database schema with proper migrations (db.ts:15-42)
|
|
141
|
+
- Comprehensive test coverage (18 tests, all edge cases)
|
|
142
|
+
- Good error handling with fallbacks (summarizer.ts:85-92)
|
|
143
|
+
|
|
144
|
+
### Issues
|
|
145
|
+
|
|
146
|
+
#### Important
|
|
147
|
+
1. **Missing help text in CLI wrapper**
|
|
148
|
+
- File: index-conversations:1-31
|
|
149
|
+
- Issue: No --help flag, users won't discover --concurrency
|
|
150
|
+
- Fix: Add --help case with usage examples
|
|
151
|
+
|
|
152
|
+
2. **Date validation missing**
|
|
153
|
+
- File: search.ts:25-27
|
|
154
|
+
- Issue: Invalid dates silently return no results
|
|
155
|
+
- Fix: Validate ISO format, throw error with example
|
|
156
|
+
|
|
157
|
+
#### Minor
|
|
158
|
+
1. **Progress indicators**
|
|
159
|
+
- File: indexer.ts:130
|
|
160
|
+
- Issue: No "X of Y" counter for long operations
|
|
161
|
+
- Impact: Users don't know how long to wait
|
|
162
|
+
|
|
163
|
+
### Recommendations
|
|
164
|
+
- Add progress reporting for user experience
|
|
165
|
+
- Consider config file for excluded projects (portability)
|
|
166
|
+
|
|
167
|
+
### Assessment
|
|
168
|
+
|
|
169
|
+
**Ready to merge: With fixes**
|
|
170
|
+
|
|
171
|
+
**Reasoning:** Core implementation is solid with good architecture and tests. Important issues (help text, date validation) are easily fixed and don't affect core functionality.
|
|
172
|
+
```
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: resolving-merge-conflicts
|
|
3
|
+
description: "Use when you need to resolve an in-progress git merge/rebase conflict."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
1. **See the current state** of the merge/rebase. Check git history, and the conflicting files.
|
|
7
|
+
|
|
8
|
+
2. **Find the primary sources** for each conflict. Understand deeply why each change was made, and what the original intent was. Read the commit messages, check the PRs, check original issues/tickets.
|
|
9
|
+
|
|
10
|
+
3. **Resolve each hunk.** Preserve both intents where possible. Where incompatible, pick the one matching the merge's stated goal and note the trade-off. Do **not** invent new behaviour. Always resolve; never `--abort`.
|
|
11
|
+
|
|
12
|
+
4. Discover the project's **automated checks** and run them — typically typecheck, then tests, then format. Fix anything the merge broke.
|
|
13
|
+
|
|
14
|
+
5. **Finish the merge/rebase.** Stage everything and commit. If rebasing, continue the rebase process until all commits are rebased.
|
|
@@ -0,0 +1,106 @@
|
|
|
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
|
+
Create exercise directory structures that pass `pnpm ai-hero-cli internal lint`, then commit with `git commit`.
|
|
9
|
+
|
|
10
|
+
## Directory naming
|
|
11
|
+
|
|
12
|
+
- **Sections**: `XX-section-name/` inside `exercises/` (e.g., `01-retrieval-skill-building`)
|
|
13
|
+
- **Exercises**: `XX.YY-exercise-name/` inside a section (e.g., `01.03-retrieval-with-bm25`)
|
|
14
|
+
- Section number = `XX`, exercise number = `XX.YY`
|
|
15
|
+
- Names are dash-case (lowercase, hyphens)
|
|
16
|
+
|
|
17
|
+
## Exercise variants
|
|
18
|
+
|
|
19
|
+
Each exercise needs at least one of these subfolders:
|
|
20
|
+
|
|
21
|
+
- `problem/` - student workspace with TODOs
|
|
22
|
+
- `solution/` - reference implementation
|
|
23
|
+
- `explainer/` - conceptual material, no TODOs
|
|
24
|
+
|
|
25
|
+
When stubbing, default to `explainer/` unless the plan specifies otherwise.
|
|
26
|
+
|
|
27
|
+
## Required files
|
|
28
|
+
|
|
29
|
+
Each subfolder (`problem/`, `solution/`, `explainer/`) needs a `readme.md` that:
|
|
30
|
+
|
|
31
|
+
- Is **not empty** (must have real content, even a single title line works)
|
|
32
|
+
- Has no broken links
|
|
33
|
+
|
|
34
|
+
When stubbing, create a minimal readme with a title and a description:
|
|
35
|
+
|
|
36
|
+
```md
|
|
37
|
+
# Exercise Title
|
|
38
|
+
|
|
39
|
+
Description here
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
If the subfolder has code, it also needs a `main.ts` (>1 line). But for stubs, a readme-only exercise is fine.
|
|
43
|
+
|
|
44
|
+
## Workflow
|
|
45
|
+
|
|
46
|
+
1. **Parse the plan** - extract section names, exercise names, and variant types
|
|
47
|
+
2. **Create directories** - `mkdir -p` for each path
|
|
48
|
+
3. **Create stub readmes** - one `readme.md` per variant folder with a title
|
|
49
|
+
4. **Run lint** - `pnpm ai-hero-cli internal lint` to validate
|
|
50
|
+
5. **Fix any errors** - iterate until lint passes
|
|
51
|
+
|
|
52
|
+
## Lint rules summary
|
|
53
|
+
|
|
54
|
+
The linter (`pnpm ai-hero-cli internal lint`) checks:
|
|
55
|
+
|
|
56
|
+
- Each exercise has subfolders (`problem/`, `solution/`, `explainer/`)
|
|
57
|
+
- At least one of `problem/`, `explainer/`, or `explainer.1/` exists
|
|
58
|
+
- `readme.md` exists and is non-empty in the primary subfolder
|
|
59
|
+
- No `.gitkeep` files
|
|
60
|
+
- No `speaker-notes.md` files
|
|
61
|
+
- No broken links in readmes
|
|
62
|
+
- No `pnpm run exercise` commands in readmes
|
|
63
|
+
- `main.ts` required per subfolder unless it's readme-only
|
|
64
|
+
|
|
65
|
+
## Moving/renaming exercises
|
|
66
|
+
|
|
67
|
+
When renumbering or moving exercises:
|
|
68
|
+
|
|
69
|
+
1. Use `git mv` (not `mv`) to rename directories - preserves git history
|
|
70
|
+
2. Update the numeric prefix to maintain order
|
|
71
|
+
3. Re-run lint after moves
|
|
72
|
+
|
|
73
|
+
Example:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
git mv exercises/01-retrieval/01.03-embeddings exercises/01-retrieval/01.04-embeddings
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Example: stubbing from a plan
|
|
80
|
+
|
|
81
|
+
Given a plan like:
|
|
82
|
+
|
|
83
|
+
```
|
|
84
|
+
Section 05: Memory Skill Building
|
|
85
|
+
- 05.01 Introduction to Memory
|
|
86
|
+
- 05.02 Short-term Memory (explainer + problem + solution)
|
|
87
|
+
- 05.03 Long-term Memory
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Create:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
mkdir -p exercises/05-memory-skill-building/05.01-introduction-to-memory/explainer
|
|
94
|
+
mkdir -p exercises/05-memory-skill-building/05.02-short-term-memory/{explainer,problem,solution}
|
|
95
|
+
mkdir -p exercises/05-memory-skill-building/05.03-long-term-memory/explainer
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Then create readme stubs:
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
exercises/05-memory-skill-building/05.01-introduction-to-memory/explainer/readme.md -> "# Introduction to Memory"
|
|
102
|
+
exercises/05-memory-skill-building/05.02-short-term-memory/explainer/readme.md -> "# Short-term Memory"
|
|
103
|
+
exercises/05-memory-skill-building/05.02-short-term-memory/problem/readme.md -> "# Short-term Memory"
|
|
104
|
+
exercises/05-memory-skill-building/05.02-short-term-memory/solution/readme.md -> "# Short-term Memory"
|
|
105
|
+
exercises/05-memory-skill-building/05.03-long-term-memory/explainer/readme.md -> "# Long-term Memory"
|
|
106
|
+
```
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: setup-matt-pocock-skills
|
|
3
|
+
description: Configure this repo for the engineering skills — set up its issue tracker, triage label vocabulary, and domain doc layout. Run once before first use of the other engineering skills.
|
|
4
|
+
disable-model-invocation: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Setup Matt Pocock's Skills
|
|
8
|
+
|
|
9
|
+
Scaffold the per-repo configuration that the engineering skills assume:
|
|
10
|
+
|
|
11
|
+
- **Issue tracker** — where issues live (GitHub by default; local markdown is also supported out of the box)
|
|
12
|
+
- **Triage labels** — the strings used for the five canonical triage roles
|
|
13
|
+
- **Domain docs** — where `CONTEXT.md` and ADRs live, and the consumer rules for reading them
|
|
14
|
+
|
|
15
|
+
This is a prompt-driven skill, not a deterministic script. Explore, present what you found, confirm with the user, then write.
|
|
16
|
+
|
|
17
|
+
## Process
|
|
18
|
+
|
|
19
|
+
### 1. Explore
|
|
20
|
+
|
|
21
|
+
Look at the current repo to understand its starting state. Read whatever exists; don't assume:
|
|
22
|
+
|
|
23
|
+
- `git remote -v` and `.git/config` — is this a GitHub repo? Which one?
|
|
24
|
+
- `AGENTS.md` and `CLAUDE.md` at the repo root — does either exist? Is there already an `## Agent skills` section in either?
|
|
25
|
+
- `CONTEXT.md` and `CONTEXT-MAP.md` at the repo root
|
|
26
|
+
- `docs/adr/` and any `src/*/docs/adr/` directories
|
|
27
|
+
- `docs/agents/` — does this skill's prior output already exist?
|
|
28
|
+
- `.scratch/` — sign that a local-markdown issue tracker convention is already in use
|
|
29
|
+
|
|
30
|
+
### 2. Present findings and ask
|
|
31
|
+
|
|
32
|
+
Summarise what's present and what's missing. Then walk the user through the three decisions **one at a time** — present a section, get the user's answer, then move to the next. Don't dump all three at once.
|
|
33
|
+
|
|
34
|
+
Assume the user does not know what these terms mean. Each section starts with a short explainer (what it is, why these skills need it, what changes if they pick differently). Then show the choices and the default.
|
|
35
|
+
|
|
36
|
+
**Section A — Issue tracker.**
|
|
37
|
+
|
|
38
|
+
> Explainer: The "issue tracker" is where issues live for this repo. Skills like `to-issues`, `triage`, `to-prd`, and `qa` read from and write to it — they need to know whether to call `gh issue create`, write a markdown file under `.scratch/`, or follow some other workflow you describe. Pick the place you actually track work for this repo.
|
|
39
|
+
|
|
40
|
+
Default posture: these skills were designed for GitHub. If a `git remote` points at GitHub, propose that. If a `git remote` points at GitLab (`gitlab.com` or a self-hosted host), propose GitLab. Otherwise (or if the user prefers), offer:
|
|
41
|
+
|
|
42
|
+
- **GitHub** — issues live in the repo's GitHub Issues (uses the `gh` CLI)
|
|
43
|
+
- **GitLab** — issues live in the repo's GitLab Issues (uses the [`glab`](https://gitlab.com/gitlab-org/cli) CLI)
|
|
44
|
+
- **Local markdown** — issues live as files under `.scratch/<feature>/` in this repo (good for solo projects or repos without a remote)
|
|
45
|
+
- **Other** (Jira, Linear, etc.) — ask the user to describe the workflow in one paragraph; the skill will record it as freeform prose
|
|
46
|
+
|
|
47
|
+
If — and only if — the user picked **GitHub** or **GitLab**, ask one follow-up:
|
|
48
|
+
|
|
49
|
+
> Explainer: Open-source repos often receive feature requests as pull requests, not just issues — a PR is an issue with attached code. If you turn this on, `/triage` pulls *external* PRs into the same queue and runs them through the same labels and states as issues (collaborators' in-flight PRs are left alone). Leave it off if PRs aren't a request surface for you.
|
|
50
|
+
|
|
51
|
+
- **PRs as a request surface** — yes / no (default: no). Record the answer in `docs/agents/issue-tracker.md`. For local-markdown and other trackers, skip this question — there are no PRs.
|
|
52
|
+
|
|
53
|
+
**Section B — Triage label vocabulary.**
|
|
54
|
+
|
|
55
|
+
> Explainer: When the `triage` skill processes an incoming issue, it moves it through a state machine — needs evaluation, waiting on reporter, ready for an AFK agent to pick up, ready for a human, or won't fix. To do that, it needs to apply labels (or the equivalent in your issue tracker) that match strings *you've actually configured*. If your repo already uses different label names (e.g. `bug:triage` instead of `needs-triage`), map them here so the skill applies the right ones instead of creating duplicates.
|
|
56
|
+
|
|
57
|
+
The five canonical roles:
|
|
58
|
+
|
|
59
|
+
- `needs-triage` — maintainer needs to evaluate
|
|
60
|
+
- `needs-info` — waiting on reporter
|
|
61
|
+
- `ready-for-agent` — fully specified, AFK-ready (an agent can pick it up with no human context)
|
|
62
|
+
- `ready-for-human` — needs human implementation
|
|
63
|
+
- `wontfix` — will not be actioned
|
|
64
|
+
|
|
65
|
+
Default: each role's string equals its name. Ask the user if they want to override any. If their issue tracker has no existing labels, the defaults are fine.
|
|
66
|
+
|
|
67
|
+
**Section C — Domain docs.**
|
|
68
|
+
|
|
69
|
+
> Explainer: Some skills (`improve-codebase-architecture`, `diagnosing-bugs`, `tdd`) read a `CONTEXT.md` file to learn the project's domain language, and `docs/adr/` for past architectural decisions. They need to know whether the repo has one global context or multiple (e.g. a monorepo with separate frontend/backend contexts) so they look in the right place.
|
|
70
|
+
|
|
71
|
+
Confirm the layout:
|
|
72
|
+
|
|
73
|
+
- **Single-context** — one `CONTEXT.md` + `docs/adr/` at the repo root. Most repos are this.
|
|
74
|
+
- **Multi-context** — `CONTEXT-MAP.md` at the root pointing to per-context `CONTEXT.md` files (typically a monorepo).
|
|
75
|
+
|
|
76
|
+
### 3. Confirm and edit
|
|
77
|
+
|
|
78
|
+
Show the user a draft of:
|
|
79
|
+
|
|
80
|
+
- The `## Agent skills` block to add to whichever of `CLAUDE.md` / `AGENTS.md` is being edited (see step 4 for selection rules)
|
|
81
|
+
- The contents of `docs/agents/issue-tracker.md`, `docs/agents/triage-labels.md`, `docs/agents/domain.md`
|
|
82
|
+
|
|
83
|
+
Let them edit before writing.
|
|
84
|
+
|
|
85
|
+
### 4. Write
|
|
86
|
+
|
|
87
|
+
**Pick the file to edit:**
|
|
88
|
+
|
|
89
|
+
- If `CLAUDE.md` exists, edit it.
|
|
90
|
+
- Else if `AGENTS.md` exists, edit it.
|
|
91
|
+
- If neither exists, ask the user which one to create — don't pick for them.
|
|
92
|
+
|
|
93
|
+
Never create `AGENTS.md` when `CLAUDE.md` already exists (or vice versa) — always edit the one that's already there.
|
|
94
|
+
|
|
95
|
+
If an `## Agent skills` block already exists in the chosen file, update its contents in-place rather than appending a duplicate. Don't overwrite user edits to the surrounding sections.
|
|
96
|
+
|
|
97
|
+
The block:
|
|
98
|
+
|
|
99
|
+
```markdown
|
|
100
|
+
## Agent skills
|
|
101
|
+
|
|
102
|
+
### Issue tracker
|
|
103
|
+
|
|
104
|
+
[one-line summary of where issues are tracked, plus whether external PRs are a triage surface]. See `docs/agents/issue-tracker.md`.
|
|
105
|
+
|
|
106
|
+
### Triage labels
|
|
107
|
+
|
|
108
|
+
[one-line summary of the label vocabulary]. See `docs/agents/triage-labels.md`.
|
|
109
|
+
|
|
110
|
+
### Domain docs
|
|
111
|
+
|
|
112
|
+
[one-line summary of layout — "single-context" or "multi-context"]. See `docs/agents/domain.md`.
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Then write the three docs files using the seed templates in this skill folder as a starting point:
|
|
116
|
+
|
|
117
|
+
- [issue-tracker-github.md](./issue-tracker-github.md) — GitHub issue tracker
|
|
118
|
+
- [issue-tracker-gitlab.md](./issue-tracker-gitlab.md) — GitLab issue tracker
|
|
119
|
+
- [issue-tracker-local.md](./issue-tracker-local.md) — local-markdown issue tracker
|
|
120
|
+
- [triage-labels.md](./triage-labels.md) — label mapping
|
|
121
|
+
- [domain.md](./domain.md) — domain doc consumer rules + layout
|
|
122
|
+
|
|
123
|
+
For "other" issue trackers, write `docs/agents/issue-tracker.md` from scratch using the user's description.
|
|
124
|
+
|
|
125
|
+
### 5. Done
|
|
126
|
+
|
|
127
|
+
Tell the user the setup is complete and which engineering skills will now read from these files. Mention they can edit `docs/agents/*.md` directly later — re-running this skill is only necessary if they want to switch issue trackers or restart from scratch.
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Domain Docs
|
|
2
|
+
|
|
3
|
+
How the engineering skills should consume this repo's domain documentation when exploring the codebase.
|
|
4
|
+
|
|
5
|
+
## Before exploring, read these
|
|
6
|
+
|
|
7
|
+
- **`CONTEXT.md`** at the repo root, or
|
|
8
|
+
- **`CONTEXT-MAP.md`** at the repo root if it exists — it points at one `CONTEXT.md` per context. Read each one relevant to the topic.
|
|
9
|
+
- **`docs/adr/`** — read ADRs that touch the area you're about to work in. In multi-context repos, also check `src/<context>/docs/adr/` for context-scoped decisions.
|
|
10
|
+
|
|
11
|
+
If any of these files don't exist, **proceed silently**. Don't flag their absence; don't suggest creating them upfront. The `/domain-modeling` skill (reached via `/grill-with-docs` and `/improve-codebase-architecture`) creates them lazily when terms or decisions actually get resolved.
|
|
12
|
+
|
|
13
|
+
## File structure
|
|
14
|
+
|
|
15
|
+
Single-context repo (most repos):
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
/
|
|
19
|
+
├── CONTEXT.md
|
|
20
|
+
├── docs/adr/
|
|
21
|
+
│ ├── 0001-event-sourced-orders.md
|
|
22
|
+
│ └── 0002-postgres-for-write-model.md
|
|
23
|
+
└── src/
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Multi-context repo (presence of `CONTEXT-MAP.md` at the root):
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
/
|
|
30
|
+
├── CONTEXT-MAP.md
|
|
31
|
+
├── docs/adr/ ← system-wide decisions
|
|
32
|
+
└── src/
|
|
33
|
+
├── ordering/
|
|
34
|
+
│ ├── CONTEXT.md
|
|
35
|
+
│ └── docs/adr/ ← context-specific decisions
|
|
36
|
+
└── billing/
|
|
37
|
+
├── CONTEXT.md
|
|
38
|
+
└── docs/adr/
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Use the glossary's vocabulary
|
|
42
|
+
|
|
43
|
+
When your output names a domain concept (in an issue title, a refactor proposal, a hypothesis, a test name), use the term as defined in `CONTEXT.md`. Don't drift to synonyms the glossary explicitly avoids.
|
|
44
|
+
|
|
45
|
+
If the concept you need isn't in the glossary yet, that's a signal — either you're inventing language the project doesn't use (reconsider) or there's a real gap (note it for `/domain-modeling`).
|
|
46
|
+
|
|
47
|
+
## Flag ADR conflicts
|
|
48
|
+
|
|
49
|
+
If your output contradicts an existing ADR, surface it explicitly rather than silently overriding:
|
|
50
|
+
|
|
51
|
+
> _Contradicts ADR-0007 (event-sourced orders) — but worth reopening because…_
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Issue tracker: GitHub
|
|
2
|
+
|
|
3
|
+
Issues and PRDs for this repo live as GitHub issues. Use the `gh` CLI for all operations.
|
|
4
|
+
|
|
5
|
+
## Conventions
|
|
6
|
+
|
|
7
|
+
- **Create an issue**: `gh issue create --title "..." --body "..."`. Use a heredoc for multi-line bodies.
|
|
8
|
+
- **Read an issue**: `gh issue view <number> --comments`, filtering comments by `jq` and also fetching labels.
|
|
9
|
+
- **List issues**: `gh issue list --state open --json number,title,body,labels,comments --jq '[.[] | {number, title, body, labels: [.labels[].name], comments: [.comments[].body]}]'` with appropriate `--label` and `--state` filters.
|
|
10
|
+
- **Comment on an issue**: `gh issue comment <number> --body "..."`
|
|
11
|
+
- **Apply / remove labels**: `gh issue edit <number> --add-label "..."` / `--remove-label "..."`
|
|
12
|
+
- **Close**: `gh issue close <number> --comment "..."`
|
|
13
|
+
|
|
14
|
+
Infer the repo from `git remote -v` — `gh` does this automatically when run inside a clone.
|
|
15
|
+
|
|
16
|
+
## Pull requests as a triage surface
|
|
17
|
+
|
|
18
|
+
**PRs as a request surface: no.** _(Set to `yes` if this repo treats external PRs as feature requests; `/triage` reads this flag.)_
|
|
19
|
+
|
|
20
|
+
When set to `yes`, PRs run through the same labels and states as issues, using the `gh pr` equivalents:
|
|
21
|
+
|
|
22
|
+
- **Read a PR**: `gh pr view <number> --comments` and `gh pr diff <number>` for the diff.
|
|
23
|
+
- **List external PRs for triage**: `gh pr list --state open --json number,title,body,labels,author,authorAssociation,comments` then keep only `authorAssociation` of `CONTRIBUTOR`, `FIRST_TIME_CONTRIBUTOR`, or `NONE` (drop `OWNER`/`MEMBER`/`COLLABORATOR`).
|
|
24
|
+
- **Comment / label / close**: `gh pr comment`, `gh pr edit --add-label`/`--remove-label`, `gh pr close`.
|
|
25
|
+
|
|
26
|
+
GitHub shares one number space across issues and PRs, so a bare `#42` may be either — resolve with `gh pr view 42` and fall back to `gh issue view 42`.
|
|
27
|
+
|
|
28
|
+
## When a skill says "publish to the issue tracker"
|
|
29
|
+
|
|
30
|
+
Create a GitHub issue.
|
|
31
|
+
|
|
32
|
+
## When a skill says "fetch the relevant ticket"
|
|
33
|
+
|
|
34
|
+
Run `gh issue view <number> --comments`.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Issue tracker: GitLab
|
|
2
|
+
|
|
3
|
+
Issues and PRDs for this repo live as GitLab issues. Use the [`glab`](https://gitlab.com/gitlab-org/cli) CLI for all operations.
|
|
4
|
+
|
|
5
|
+
## Conventions
|
|
6
|
+
|
|
7
|
+
- **Create an issue**: `glab issue create --title "..." --description "..."`. Use a heredoc for multi-line descriptions. Pass `--description -` to open an editor.
|
|
8
|
+
- **Read an issue**: `glab issue view <number> --comments`. Use `-F json` for machine-readable output.
|
|
9
|
+
- **List issues**: `glab issue list -F json` with appropriate `--label` filters.
|
|
10
|
+
- **Comment on an issue**: `glab issue note <number> --message "..."`. GitLab calls comments "notes".
|
|
11
|
+
- **Apply / remove labels**: `glab issue update <number> --label "..."` / `--unlabel "..."`. Multiple labels can be comma-separated or by repeating the flag.
|
|
12
|
+
- **Close**: `glab issue close <number>`. `glab issue close` does not accept a closing comment, so post the explanation first with `glab issue note <number> --message "..."`, then close.
|
|
13
|
+
- **Merge requests**: GitLab calls PRs "merge requests". Use `glab mr create`, `glab mr view`, `glab mr note`, etc. — the same shape as `gh pr ...` with `mr` in place of `pr` and `note`/`--message` in place of `comment`/`--body`.
|
|
14
|
+
|
|
15
|
+
Infer the repo from `git remote -v` — `glab` does this automatically when run inside a clone.
|
|
16
|
+
|
|
17
|
+
## Merge requests as a triage surface
|
|
18
|
+
|
|
19
|
+
**MRs as a request surface: no.** _(Set to `yes` if this repo treats external merge requests as feature requests; `/triage` reads this flag.)_
|
|
20
|
+
|
|
21
|
+
When set to `yes`, MRs run through the same labels and states as issues, using the `glab mr` equivalents:
|
|
22
|
+
|
|
23
|
+
- **Read an MR**: `glab mr view <number> --comments` and `glab mr diff <number>` for the diff.
|
|
24
|
+
- **List external MRs for triage**: `glab mr list -F json`, then keep only MRs whose author is not a project member/owner (a contributor's MR, not a maintainer's in-flight work).
|
|
25
|
+
- **Comment / label / close**: `glab mr note`, `glab mr update --label`/`--unlabel`, `glab mr close`.
|
|
26
|
+
|
|
27
|
+
Unlike GitHub, GitLab numbers issues and MRs separately, so `#42` is unambiguous once you know which surface the maintainer means.
|
|
28
|
+
|
|
29
|
+
## When a skill says "publish to the issue tracker"
|
|
30
|
+
|
|
31
|
+
Create a GitLab issue.
|
|
32
|
+
|
|
33
|
+
## When a skill says "fetch the relevant ticket"
|
|
34
|
+
|
|
35
|
+
Run `glab issue view <number> --comments`.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Issue tracker: Local Markdown
|
|
2
|
+
|
|
3
|
+
Issues and PRDs for this repo live as markdown files in `.scratch/`.
|
|
4
|
+
|
|
5
|
+
## Conventions
|
|
6
|
+
|
|
7
|
+
- One feature per directory: `.scratch/<feature-slug>/`
|
|
8
|
+
- The PRD is `.scratch/<feature-slug>/PRD.md`
|
|
9
|
+
- Implementation issues are `.scratch/<feature-slug>/issues/<NN>-<slug>.md`, numbered from `01`
|
|
10
|
+
- Triage state is recorded as a `Status:` line near the top of each issue file (see `triage-labels.md` for the role strings)
|
|
11
|
+
- Comments and conversation history append to the bottom of the file under a `## Comments` heading
|
|
12
|
+
|
|
13
|
+
## When a skill says "publish to the issue tracker"
|
|
14
|
+
|
|
15
|
+
Create a new file under `.scratch/<feature-slug>/` (creating the directory if needed).
|
|
16
|
+
|
|
17
|
+
## When a skill says "fetch the relevant ticket"
|
|
18
|
+
|
|
19
|
+
Read the file at the referenced path. The user will normally pass the path or the issue number directly.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Triage Labels
|
|
2
|
+
|
|
3
|
+
The skills speak in terms of five canonical triage roles. This file maps those roles to the actual label strings used in this repo's issue tracker.
|
|
4
|
+
|
|
5
|
+
| Label in mattpocock/skills | Label in our tracker | Meaning |
|
|
6
|
+
| -------------------------- | -------------------- | ---------------------------------------- |
|
|
7
|
+
| `needs-triage` | `needs-triage` | Maintainer needs to evaluate this issue |
|
|
8
|
+
| `needs-info` | `needs-info` | Waiting on reporter for more information |
|
|
9
|
+
| `ready-for-agent` | `ready-for-agent` | Fully specified, ready for an AFK agent |
|
|
10
|
+
| `ready-for-human` | `ready-for-human` | Requires human implementation |
|
|
11
|
+
| `wontfix` | `wontfix` | Will not be actioned |
|
|
12
|
+
|
|
13
|
+
When a skill mentions a role (e.g. "apply the AFK-ready triage label"), use the corresponding label string from this table.
|
|
14
|
+
|
|
15
|
+
Edit the right-hand column to match whatever vocabulary you actually use.
|
|
@@ -0,0 +1,91 @@
|
|
|
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
|
+
## What This Sets Up
|
|
9
|
+
|
|
10
|
+
- **Husky** pre-commit hook
|
|
11
|
+
- **lint-staged** running Prettier on all staged files
|
|
12
|
+
- **Prettier** config (if missing)
|
|
13
|
+
- **typecheck** and **test** scripts in the pre-commit hook
|
|
14
|
+
|
|
15
|
+
## Steps
|
|
16
|
+
|
|
17
|
+
### 1. Detect package manager
|
|
18
|
+
|
|
19
|
+
Check for `package-lock.json` (npm), `pnpm-lock.yaml` (pnpm), `yarn.lock` (yarn), `bun.lockb` (bun). Use whichever is present. Default to npm if unclear.
|
|
20
|
+
|
|
21
|
+
### 2. Install dependencies
|
|
22
|
+
|
|
23
|
+
Install as devDependencies:
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
husky lint-staged prettier
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### 3. Initialize Husky
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npx husky init
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
This creates `.husky/` dir and adds `prepare: "husky"` to package.json.
|
|
36
|
+
|
|
37
|
+
### 4. Create `.husky/pre-commit`
|
|
38
|
+
|
|
39
|
+
Write this file (no shebang needed for Husky v9+):
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
npx lint-staged
|
|
43
|
+
npm run typecheck
|
|
44
|
+
npm run test
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
**Adapt**: Replace `npm` with detected package manager. If repo has no `typecheck` or `test` script in package.json, omit those lines and tell the user.
|
|
48
|
+
|
|
49
|
+
### 5. Create `.lintstagedrc`
|
|
50
|
+
|
|
51
|
+
```json
|
|
52
|
+
{
|
|
53
|
+
"*": "prettier --ignore-unknown --write"
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### 6. Create `.prettierrc` (if missing)
|
|
58
|
+
|
|
59
|
+
Only create if no Prettier config exists. Use these defaults:
|
|
60
|
+
|
|
61
|
+
```json
|
|
62
|
+
{
|
|
63
|
+
"useTabs": false,
|
|
64
|
+
"tabWidth": 2,
|
|
65
|
+
"printWidth": 80,
|
|
66
|
+
"singleQuote": false,
|
|
67
|
+
"trailingComma": "es5",
|
|
68
|
+
"semi": true,
|
|
69
|
+
"arrowParens": "always"
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### 7. Verify
|
|
74
|
+
|
|
75
|
+
- [ ] `.husky/pre-commit` exists and is executable
|
|
76
|
+
- [ ] `.lintstagedrc` exists
|
|
77
|
+
- [ ] `prepare` script in package.json is `"husky"`
|
|
78
|
+
- [ ] `prettier` config exists
|
|
79
|
+
- [ ] Run `npx lint-staged` to verify it works
|
|
80
|
+
|
|
81
|
+
### 8. Commit
|
|
82
|
+
|
|
83
|
+
Stage all changed/created files and commit with message: `Add pre-commit hooks (husky + lint-staged + prettier)`
|
|
84
|
+
|
|
85
|
+
This will run through the new pre-commit hooks — a good smoke test that everything works.
|
|
86
|
+
|
|
87
|
+
## Notes
|
|
88
|
+
|
|
89
|
+
- Husky v9+ doesn't need shebangs in hook files
|
|
90
|
+
- `prettier --ignore-unknown` skips files Prettier can't parse (images, etc.)
|
|
91
|
+
- The pre-commit runs lint-staged first (fast, staged-only), then full typecheck and tests
|