cc-dev-template 0.1.46 → 0.1.49
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/bin/install.js +54 -8
- package/package.json +4 -2
- package/src/scripts/env-config.json +5 -0
- package/src/scripts/statusline.js +129 -38
- package/src/skills/creating-agent-skills/SKILL.md +7 -43
- package/src/skills/creating-agent-skills/references/create-step-1-understand.md +42 -0
- package/src/skills/creating-agent-skills/references/create-step-2-design.md +113 -0
- package/src/skills/creating-agent-skills/references/create-step-3-write.md +177 -0
- package/src/skills/creating-agent-skills/references/create-step-4-review.md +63 -0
- package/src/skills/creating-agent-skills/references/create-step-5-install.md +39 -0
- package/src/skills/creating-agent-skills/references/fix-step-1-diagnose.md +83 -0
- package/src/skills/creating-agent-skills/references/fix-step-2-apply.md +90 -0
- package/src/skills/creating-agent-skills/references/fix-step-3-validate.md +52 -0
- package/src/hooks/bash-precheck-hook.json +0 -15
- package/src/hooks/bash-precheck.sh +0 -117
- package/src/skills/creating-agent-skills/references/audit.md +0 -121
- package/src/skills/creating-agent-skills/references/create.md +0 -157
- package/src/skills/creating-agent-skills/references/modify.md +0 -131
- package/src/skills/creating-agent-skills/references/principles.md +0 -345
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
# Step 3: Write the Skill
|
|
2
|
+
|
|
3
|
+
Write the skill files based on the design from step 2. Everything in this file applies while writing.
|
|
4
|
+
|
|
5
|
+
## The Fundamental Rule
|
|
6
|
+
|
|
7
|
+
A skill IS a prompt. When Claude reads SKILL.md, it must know what to DO — not what the skill is about.
|
|
8
|
+
|
|
9
|
+
**The test:** After writing each file, ask: "If Claude reads this right now, does it know what action to take?" If it would understand what the skill is about but not know what to do — rewrite it.
|
|
10
|
+
|
|
11
|
+
## Writing Style
|
|
12
|
+
|
|
13
|
+
### Instructions, Not Documentation
|
|
14
|
+
|
|
15
|
+
Write as instructions. Imperative form.
|
|
16
|
+
|
|
17
|
+
| Wrong | Right |
|
|
18
|
+
|-------|-------|
|
|
19
|
+
| "This skill parses PDF files" | "Parse the PDF file" |
|
|
20
|
+
| "You should validate the input" | "Validate the input" |
|
|
21
|
+
| "The next step involves formatting" | "Format the output" |
|
|
22
|
+
|
|
23
|
+
Never describe what the skill IS. Tell Claude what to DO.
|
|
24
|
+
|
|
25
|
+
### No Meta-Descriptions
|
|
26
|
+
|
|
27
|
+
Remove any of these — they describe, they do not instruct:
|
|
28
|
+
|
|
29
|
+
- "Who this is for:" — Claude does not need audience info
|
|
30
|
+
- "Success looks like:" — describe outcomes through instructions, not meta-sections
|
|
31
|
+
- "The purpose is..." — documentation language
|
|
32
|
+
- "This skill orchestrates..." — describes what the skill IS
|
|
33
|
+
- "Overview" or "Introduction" sections — get to the action
|
|
34
|
+
|
|
35
|
+
### Positive Framing
|
|
36
|
+
|
|
37
|
+
Tell Claude what TO do, not what NOT to do. Negatives require extra processing and can prime the unwanted behavior.
|
|
38
|
+
|
|
39
|
+
| Negative | Positive |
|
|
40
|
+
|----------|----------|
|
|
41
|
+
| "Don't hallucinate facts" | "Only use information from the provided documents" |
|
|
42
|
+
| "Don't be too formal" | "Write in a conversational, friendly tone" |
|
|
43
|
+
| "Avoid long paragraphs" | "Keep paragraphs to 3-4 sentences" |
|
|
44
|
+
| "Don't skip validation" | "Always validate before proceeding" |
|
|
45
|
+
|
|
46
|
+
### Explain WHY, Not Just WHAT
|
|
47
|
+
|
|
48
|
+
Trust Claude's intelligence. Provide goals and constraints rather than exhaustive implementation details.
|
|
49
|
+
|
|
50
|
+
Provide:
|
|
51
|
+
- The goal or purpose of the task
|
|
52
|
+
- Why this matters (business context, use case)
|
|
53
|
+
- Constraints that exist (technical, business)
|
|
54
|
+
- What success looks like
|
|
55
|
+
|
|
56
|
+
Let Claude handle:
|
|
57
|
+
- Edge cases it can reason about
|
|
58
|
+
- Best practices for the domain
|
|
59
|
+
- Reasonable implementation choices
|
|
60
|
+
|
|
61
|
+
Only give step-by-step instructions when the task genuinely requires precision or the domain knowledge is non-obvious.
|
|
62
|
+
|
|
63
|
+
### Public Knowledge vs Tribal Knowledge
|
|
64
|
+
|
|
65
|
+
This is critical. If the agent writing this skill knows how to do something, the agent executing it will know too. Both are Claude.
|
|
66
|
+
|
|
67
|
+
**Public knowledge — state WHAT to do, not HOW:**
|
|
68
|
+
- Standard CLI tools (git, npm, yt-dlp, ffmpeg, curl): "Use yt-dlp to search YouTube" — not the full command with flags
|
|
69
|
+
- Common libraries and frameworks: "Parse the JSON response" — not the exact API call
|
|
70
|
+
- Standard programming patterns: "Validate the input" — not a code block showing validation
|
|
71
|
+
|
|
72
|
+
**Tribal knowledge — include the specifics:**
|
|
73
|
+
- Custom internal CLI tools the project built
|
|
74
|
+
- Project-specific conventions or configurations that are non-obvious
|
|
75
|
+
- Workarounds for known bugs or quirks in the codebase
|
|
76
|
+
- Domain-specific sequences that only an expert would know
|
|
77
|
+
- Exact file paths, schemas, or formats unique to this project
|
|
78
|
+
|
|
79
|
+
The test: if you removed the specific details, would a fresh Claude instance still know how to do it? If yes, remove the details. If no, keep them — that is the skill's value.
|
|
80
|
+
|
|
81
|
+
### Be Clear and Direct
|
|
82
|
+
|
|
83
|
+
No hedging. State exactly what to do.
|
|
84
|
+
|
|
85
|
+
| Vague | Clear |
|
|
86
|
+
|-------|-------|
|
|
87
|
+
| "Maybe consider adding..." | "Add..." |
|
|
88
|
+
| "It might be nice to have..." | "Include..." |
|
|
89
|
+
| "You could potentially..." | "Use..." |
|
|
90
|
+
|
|
91
|
+
### Challenge Every Line
|
|
92
|
+
|
|
93
|
+
The context window is a shared resource. For every piece of content, ask: does this justify its token cost?
|
|
94
|
+
|
|
95
|
+
- If Claude already knows it (common programming knowledge, obvious best practices) — remove it.
|
|
96
|
+
- If it is not needed for the current step — it belongs in a different step file or not at all.
|
|
97
|
+
- Three similar examples are better than ten. Pick the best ones.
|
|
98
|
+
|
|
99
|
+
## Structural Rules
|
|
100
|
+
|
|
101
|
+
### Size Targets
|
|
102
|
+
|
|
103
|
+
| Type | SKILL.md Target |
|
|
104
|
+
|------|-----------------|
|
|
105
|
+
| Router (procedural) | Under 150 lines |
|
|
106
|
+
| Informational | Under 300 lines |
|
|
107
|
+
|
|
108
|
+
If SKILL.md exceeds these, move content to `references/`.
|
|
109
|
+
|
|
110
|
+
### For Procedural Skills: Chained Steps
|
|
111
|
+
|
|
112
|
+
Each step file covers ONE phase of the workflow. Structure each file:
|
|
113
|
+
|
|
114
|
+
1. A clear header naming the step
|
|
115
|
+
2. Immediate actionable instructions — what to do NOW
|
|
116
|
+
3. A chain link at the bottom: "Read `references/[next-step].md`" with an optional condition
|
|
117
|
+
|
|
118
|
+
**Critical rules:**
|
|
119
|
+
- No table of contents across steps
|
|
120
|
+
- No "this is step 3 of 5"
|
|
121
|
+
- No overview of the full workflow
|
|
122
|
+
- Each file is self-contained for what the agent needs RIGHT NOW
|
|
123
|
+
- The agent discovers future steps only by reaching them
|
|
124
|
+
|
|
125
|
+
### For Informational Skills
|
|
126
|
+
|
|
127
|
+
Single SKILL.md file. Use sections and tables to organize knowledge. No chaining needed.
|
|
128
|
+
|
|
129
|
+
Optionally add `references/` for depth that is not always needed — the SKILL.md would say "for more detail on X, read `references/x-details.md`".
|
|
130
|
+
|
|
131
|
+
### SKILL.md Structure for Router Skills
|
|
132
|
+
|
|
133
|
+
```
|
|
134
|
+
---
|
|
135
|
+
name: skill-name
|
|
136
|
+
description: [third person, trigger phrases, WHEN not HOW]
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
# Skill Title
|
|
140
|
+
|
|
141
|
+
## What To Do Now
|
|
142
|
+
|
|
143
|
+
[Immediate action — ask a question, route to a workflow]
|
|
144
|
+
|
|
145
|
+
| Choice | Action |
|
|
146
|
+
|--------|--------|
|
|
147
|
+
| Option A | Read `references/step-1-a.md` |
|
|
148
|
+
| Option B | Read `references/step-1-b.md` |
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
Keep it minimal. Only include context that is needed at EVERY activation.
|
|
152
|
+
|
|
153
|
+
### MCP Tool References
|
|
154
|
+
|
|
155
|
+
When a skill uses MCP tools, use fully qualified names:
|
|
156
|
+
```
|
|
157
|
+
Use the BigQuery:bigquery_schema tool to retrieve table schemas.
|
|
158
|
+
```
|
|
159
|
+
Without the server prefix, Claude may fail to locate the tool.
|
|
160
|
+
|
|
161
|
+
## Anti-Patterns
|
|
162
|
+
|
|
163
|
+
**Option menus instead of defaults:** Provide a recommended default, not a menu of choices. "Use pdfplumber for text extraction" not "You can use pypdf, pdfplumber, PyMuPDF, or pdf2image."
|
|
164
|
+
|
|
165
|
+
**Windows-style paths:** Always use forward slashes: `references/guide.md`, not `references\guide.md`.
|
|
166
|
+
|
|
167
|
+
**Deeply nested indirection:** Sequential chaining is fine (step 1 → step 2 → step 3) because each step is self-contained. What to avoid is layers of indirection where you must read through multiple files to reach the actual instructions: SKILL.md → overview.md → details.md → actual-info.md.
|
|
168
|
+
|
|
169
|
+
## Write the Files
|
|
170
|
+
|
|
171
|
+
With these principles applied, write all the skill files now:
|
|
172
|
+
|
|
173
|
+
1. SKILL.md (router or informational, depending on the design)
|
|
174
|
+
2. For procedural: each step file in `references/`
|
|
175
|
+
3. Any `scripts/` or `templates/` files if the design calls for them
|
|
176
|
+
|
|
177
|
+
Read `references/create-step-4-review.md` when all files are written.
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# Step 4: Review
|
|
2
|
+
|
|
3
|
+
Review every file you wrote before proceeding. Fix issues now — do not proceed with known problems.
|
|
4
|
+
|
|
5
|
+
## Public Knowledge Audit
|
|
6
|
+
|
|
7
|
+
Do this first. Go through every file in the skill and find each:
|
|
8
|
+
- Code block (``` fenced blocks)
|
|
9
|
+
- CLI command or flag sequence
|
|
10
|
+
- API call or library usage example
|
|
11
|
+
- Specific implementation detail
|
|
12
|
+
|
|
13
|
+
For EACH one, ask: **"Would a fresh Claude instance — with no access to the user's original request — know how to do this?"**
|
|
14
|
+
|
|
15
|
+
- If yes: **delete the code block or detail.** Replace with a high-level instruction. Example: replace `yt-dlp "ytsearch5:<query>" --print "%(title)s | %(channel)s | %(duration_string)s | %(webpage_url)s" --no-download` with "Use yt-dlp to search YouTube and display results."
|
|
16
|
+
- If no: **keep it.** This is tribal knowledge — project-specific commands, internal tools, non-obvious configurations. This is the skill's value.
|
|
17
|
+
|
|
18
|
+
The user's original request may have included specific commands and implementation details. That does not mean they belong in the skill. The user provided them for YOUR understanding. The skill is for a future Claude instance that already knows standard tools. Only encode what a fresh instance would NOT know.
|
|
19
|
+
|
|
20
|
+
## Self-Review Checklist
|
|
21
|
+
|
|
22
|
+
Go through each file and verify:
|
|
23
|
+
|
|
24
|
+
### Actionability
|
|
25
|
+
- After reading this file, would Claude know what action to take?
|
|
26
|
+
- Is every section written as instructions, not documentation?
|
|
27
|
+
- Are there any meta-descriptions? ("Who this is for", "Success looks like", "The purpose is...") Remove them.
|
|
28
|
+
|
|
29
|
+
### Progressive Disclosure
|
|
30
|
+
- For procedural skills: does each step file focus on ONE phase?
|
|
31
|
+
- Does each step chain correctly to the next?
|
|
32
|
+
- Is SKILL.md lean? Is heavy content in `references/`?
|
|
33
|
+
- For informational skills: is it a single cohesive file without unnecessary splitting?
|
|
34
|
+
|
|
35
|
+
### Writing Style
|
|
36
|
+
- Imperative form throughout? ("Parse" not "You should parse")
|
|
37
|
+
- Positive framing? ("Use X" not "Don't use Y")
|
|
38
|
+
- No hedging? ("Add" not "Maybe consider adding")
|
|
39
|
+
- Is every line worth its token cost? Remove what Claude already knows.
|
|
40
|
+
|
|
41
|
+
### Structure
|
|
42
|
+
- SKILL.md under size target? (150 lines for router, 300 for informational)
|
|
43
|
+
- Valid YAML frontmatter with `name` and `description`?
|
|
44
|
+
- Name matches the directory name?
|
|
45
|
+
- Description uses third person with quoted trigger phrases?
|
|
46
|
+
- All referenced files exist? (no broken links)
|
|
47
|
+
|
|
48
|
+
## Run Validation
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
node ~/.claude/skills/creating-agent-skills/scripts/validate-skill.js [skill-path]
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Handle results:
|
|
55
|
+
- **Errors:** Fix each one, re-run validation, repeat until passing
|
|
56
|
+
- **Warnings:** Evaluate each — most should be fixed
|
|
57
|
+
- **Info:** Review but these may be acceptable (e.g., step files referenced from other steps rather than SKILL.md)
|
|
58
|
+
|
|
59
|
+
Only proceed when validation passes and self-review is clean.
|
|
60
|
+
|
|
61
|
+
If you found and fixed issues, re-run both the self-review and validation to confirm.
|
|
62
|
+
|
|
63
|
+
Read `references/create-step-5-install.md` when review passes with no remaining issues.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Step 5: Install and Test
|
|
2
|
+
|
|
3
|
+
## Choose Install Location
|
|
4
|
+
|
|
5
|
+
Ask the user where to install:
|
|
6
|
+
|
|
7
|
+
| Level | Path | When to Use |
|
|
8
|
+
|-------|------|-------------|
|
|
9
|
+
| User | `~/.claude/skills/[name]/` | Available across all projects |
|
|
10
|
+
| Project | `.claude/skills/[name]/` | This project only |
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
Copy the skill directory to the target location. Ensure all files are in place — SKILL.md, `references/`, `scripts/`, `templates/` as applicable.
|
|
15
|
+
|
|
16
|
+
## Test
|
|
17
|
+
|
|
18
|
+
Guide the user through testing:
|
|
19
|
+
|
|
20
|
+
1. Start a new Claude Code session (or restart the current one)
|
|
21
|
+
2. Test explicit invocation: type `/skill-name`
|
|
22
|
+
3. Test autonomous activation: say one of the trigger phrases from the description
|
|
23
|
+
4. Verify the skill activates and behaves as expected
|
|
24
|
+
|
|
25
|
+
## If Testing Reveals Issues
|
|
26
|
+
|
|
27
|
+
Iterate. The job is not done until the skill works.
|
|
28
|
+
|
|
29
|
+
- Instructions wrong? Go back to the write step.
|
|
30
|
+
- Structure wrong? Go back to the design step.
|
|
31
|
+
- Domain knowledge missing? Go back to the understand step.
|
|
32
|
+
|
|
33
|
+
## Completion
|
|
34
|
+
|
|
35
|
+
Summarize what was created:
|
|
36
|
+
- Skill name
|
|
37
|
+
- Install location
|
|
38
|
+
- Trigger phrases
|
|
39
|
+
- File structure (list all files)
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# Step 1: Diagnose
|
|
2
|
+
|
|
3
|
+
Find the skill, read everything, and understand what is wrong.
|
|
4
|
+
|
|
5
|
+
## Find the Skill
|
|
6
|
+
|
|
7
|
+
If the user named a specific skill, locate it. Otherwise, discover available skills:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
node ~/.claude/skills/creating-agent-skills/scripts/find-skills.js
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Ask which skill to fix.
|
|
14
|
+
|
|
15
|
+
## Read Everything
|
|
16
|
+
|
|
17
|
+
Read the entire skill — every file:
|
|
18
|
+
- SKILL.md
|
|
19
|
+
- Every file in `references/`
|
|
20
|
+
- Every file in `scripts/`
|
|
21
|
+
- Every file in `templates/` or `assets/`
|
|
22
|
+
|
|
23
|
+
Trace the execution path: if SKILL.md says "read `references/step-1.md`", read that file and follow its chain.
|
|
24
|
+
|
|
25
|
+
Cannot diagnose a skill without reading all its files.
|
|
26
|
+
|
|
27
|
+
## Understand What Is Wrong
|
|
28
|
+
|
|
29
|
+
Ask the user:
|
|
30
|
+
- "What is the skill supposed to do?"
|
|
31
|
+
- "What does it actually do instead?"
|
|
32
|
+
- "Can you show me an example of it failing or behaving incorrectly?"
|
|
33
|
+
|
|
34
|
+
Get specific about expected behavior versus actual behavior.
|
|
35
|
+
|
|
36
|
+
## Diagnose Against Principles
|
|
37
|
+
|
|
38
|
+
Evaluate each file against these criteria:
|
|
39
|
+
|
|
40
|
+
### Actionability
|
|
41
|
+
- After reading this file, would Claude know what to DO?
|
|
42
|
+
- Or does it just describe what the skill is about?
|
|
43
|
+
- Any dead ends where Claude would not know what to do next?
|
|
44
|
+
|
|
45
|
+
### Progressive Disclosure
|
|
46
|
+
- Is SKILL.md lean (under 150 lines for routers, under 300 for informational)?
|
|
47
|
+
- Is heavy content in `references/`, not inline?
|
|
48
|
+
- For procedural skills: is each phase in its own step file, chained to the next?
|
|
49
|
+
- Or is everything crammed into one file?
|
|
50
|
+
|
|
51
|
+
### Routing and Chaining
|
|
52
|
+
- For multi-step skills: does each file hand off clearly to the next?
|
|
53
|
+
- Are there dead ends with no next action?
|
|
54
|
+
- Is the chain condition clear (when to move on)?
|
|
55
|
+
|
|
56
|
+
### Writing Style
|
|
57
|
+
- Second person language? ("You should..." — should be imperative: "Parse...")
|
|
58
|
+
- Negative framing? ("Don't skip..." — should be positive: "Always validate...")
|
|
59
|
+
- Meta-descriptions? ("Who this is for", "Success looks like", "The purpose is...")
|
|
60
|
+
- Hedging? ("Maybe consider..." — should be direct: "Add...")
|
|
61
|
+
- Public knowledge spelled out? (exact CLI flags, standard API calls that Claude already knows — should state WHAT to do, not HOW, unless it is tribal/project-specific knowledge)
|
|
62
|
+
|
|
63
|
+
### Description Quality
|
|
64
|
+
- Third person? ("This skill should be used when...")
|
|
65
|
+
- Quoted trigger phrases?
|
|
66
|
+
- Focuses on WHEN to use, not HOW it works?
|
|
67
|
+
- Under 1024 characters?
|
|
68
|
+
|
|
69
|
+
### Structural
|
|
70
|
+
- Valid YAML frontmatter with `name` and `description`?
|
|
71
|
+
- Name matches directory name?
|
|
72
|
+
- All referenced files exist?
|
|
73
|
+
- Any unreferenced files in `references/` that should be connected?
|
|
74
|
+
|
|
75
|
+
## Summarize Findings
|
|
76
|
+
|
|
77
|
+
Present the diagnosis to the user:
|
|
78
|
+
- List each issue found
|
|
79
|
+
- Which file it is in
|
|
80
|
+
- What principle it violates
|
|
81
|
+
- What the fix would look like
|
|
82
|
+
|
|
83
|
+
Read `references/fix-step-2-apply.md` when diagnosis is complete and findings are summarized.
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# Step 2: Apply Fixes
|
|
2
|
+
|
|
3
|
+
Fix the issues identified in diagnosis. Plan the changes, confirm with the user, then apply.
|
|
4
|
+
|
|
5
|
+
## Plan Changes First
|
|
6
|
+
|
|
7
|
+
Before editing, state:
|
|
8
|
+
- Which files will change and what specifically changes
|
|
9
|
+
- Any new files needed (e.g., splitting a monolithic file into step files)
|
|
10
|
+
- Any files to delete
|
|
11
|
+
|
|
12
|
+
Confirm the plan with the user before making changes.
|
|
13
|
+
|
|
14
|
+
## Writing Principles
|
|
15
|
+
|
|
16
|
+
Apply these while making every change:
|
|
17
|
+
|
|
18
|
+
### Instructions, Not Documentation
|
|
19
|
+
|
|
20
|
+
Write as instructions. Imperative form.
|
|
21
|
+
|
|
22
|
+
| Wrong | Right |
|
|
23
|
+
|-------|-------|
|
|
24
|
+
| "This skill parses PDF files" | "Parse the PDF file" |
|
|
25
|
+
| "You should validate the input" | "Validate the input" |
|
|
26
|
+
| "The next step involves formatting" | "Format the output" |
|
|
27
|
+
|
|
28
|
+
### No Meta-Descriptions
|
|
29
|
+
|
|
30
|
+
Remove any of these:
|
|
31
|
+
- "Who this is for:" — Claude does not need audience info
|
|
32
|
+
- "Success looks like:" — describe outcomes through instructions
|
|
33
|
+
- "The purpose is..." — documentation language
|
|
34
|
+
- "This skill orchestrates..." — describes what the skill IS
|
|
35
|
+
- "Overview" or "Introduction" sections — get to the action
|
|
36
|
+
|
|
37
|
+
### Positive Framing
|
|
38
|
+
|
|
39
|
+
| Negative | Positive |
|
|
40
|
+
|----------|----------|
|
|
41
|
+
| "Don't hallucinate facts" | "Only use information from the provided documents" |
|
|
42
|
+
| "Don't skip validation" | "Always validate before proceeding" |
|
|
43
|
+
| "Avoid long paragraphs" | "Keep paragraphs to 3-4 sentences" |
|
|
44
|
+
|
|
45
|
+
### Explain WHY, Not Just WHAT
|
|
46
|
+
|
|
47
|
+
Provide goals and constraints. Trust Claude's intelligence. Only give step-by-step when the domain genuinely requires precision.
|
|
48
|
+
|
|
49
|
+
### Public Knowledge vs Tribal Knowledge
|
|
50
|
+
|
|
51
|
+
If the agent writing this skill knows how to do something, the agent executing it will know too. Both are Claude.
|
|
52
|
+
|
|
53
|
+
- **Public knowledge** (standard CLI tools, common libraries, standard patterns): state WHAT to do, not HOW. "Use yt-dlp to search YouTube" — not the full command with flags.
|
|
54
|
+
- **Tribal knowledge** (custom internal tools, project-specific conventions, workarounds, non-obvious domain sequences): include the specifics. That is the skill's value.
|
|
55
|
+
|
|
56
|
+
The test: if you removed the specific details, would a fresh Claude instance still know how to do it? If yes, remove them.
|
|
57
|
+
|
|
58
|
+
### Be Clear and Direct
|
|
59
|
+
|
|
60
|
+
No hedging. "Add..." not "Maybe consider adding..."
|
|
61
|
+
|
|
62
|
+
### Challenge Every Line
|
|
63
|
+
|
|
64
|
+
Does this justify its token cost? If Claude already knows it — remove it. If it is not needed for the current step — move or remove it.
|
|
65
|
+
|
|
66
|
+
**The test:** After rewriting each file, ask: "If Claude reads this right now, does it know what action to take?"
|
|
67
|
+
|
|
68
|
+
## Common Fix Patterns
|
|
69
|
+
|
|
70
|
+
**Documentation to instructions:** Rewrite "This skill does X" as "Do X".
|
|
71
|
+
|
|
72
|
+
**Add trigger phrases:** Collect phrases from user, add to description in third person with quotes.
|
|
73
|
+
|
|
74
|
+
**Move content to references:** Identify inline content that should be loaded on-demand. Create reference files, add pointers.
|
|
75
|
+
|
|
76
|
+
**Fix second person:** "You should parse" becomes "Parse". "You can use" becomes "Use".
|
|
77
|
+
|
|
78
|
+
**Fix negative framing:** "Don't skip validation" becomes "Always validate". "Never assume" becomes "Verify explicitly".
|
|
79
|
+
|
|
80
|
+
**Fix progressive disclosure:** Split a monolithic SKILL.md into a lean router + step files in `references/`. Each step file covers one phase and chains to the next.
|
|
81
|
+
|
|
82
|
+
**Fix dead ends:** Ensure every file either chains to the next step or completes the flow with a clear ending.
|
|
83
|
+
|
|
84
|
+
**Fix description:** Rewrite to third person, add quoted trigger phrases, focus on WHEN not HOW.
|
|
85
|
+
|
|
86
|
+
## Apply the Changes
|
|
87
|
+
|
|
88
|
+
Make all planned modifications now.
|
|
89
|
+
|
|
90
|
+
Read `references/fix-step-3-validate.md` when all fixes are applied.
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Step 3: Validate and Test
|
|
2
|
+
|
|
3
|
+
## Public Knowledge Audit
|
|
4
|
+
|
|
5
|
+
Go through every changed file. Find each code block, CLI command, API call, and implementation detail.
|
|
6
|
+
|
|
7
|
+
For each one, ask: **"Would a fresh Claude instance know how to do this without being told?"**
|
|
8
|
+
|
|
9
|
+
- If yes: delete it. Replace with a high-level instruction.
|
|
10
|
+
- If no: keep it — this is tribal knowledge and belongs in the skill.
|
|
11
|
+
|
|
12
|
+
## Self-Review
|
|
13
|
+
|
|
14
|
+
Re-read every changed file. For each one, verify:
|
|
15
|
+
|
|
16
|
+
- Would Claude know what to DO after reading this?
|
|
17
|
+
- Are the specific issues from diagnosis resolved?
|
|
18
|
+
- Did the fixes introduce any new problems?
|
|
19
|
+
- Is the writing style correct? (imperative, positive, direct, no meta-descriptions)
|
|
20
|
+
- For procedural skills: does each step chain correctly to the next?
|
|
21
|
+
|
|
22
|
+
## Run Validation
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
node ~/.claude/skills/creating-agent-skills/scripts/validate-skill.js [skill-path]
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Handle results:
|
|
29
|
+
- **Errors:** Fix each one, re-run, repeat until passing
|
|
30
|
+
- **Warnings:** Evaluate and fix most of them
|
|
31
|
+
- **Info:** Review — may be acceptable (e.g., step files chained from other steps rather than SKILL.md)
|
|
32
|
+
|
|
33
|
+
## Test
|
|
34
|
+
|
|
35
|
+
If the fix affected behavior:
|
|
36
|
+
|
|
37
|
+
1. Reinstall if the skill is deployed (copy updated files to install location)
|
|
38
|
+
2. Start a new Claude Code session
|
|
39
|
+
3. If description changed: test trigger phrases for activation
|
|
40
|
+
4. If instructions changed: invoke the skill and verify it behaves correctly
|
|
41
|
+
5. If structure changed: verify all file references work
|
|
42
|
+
|
|
43
|
+
## If Issues Remain
|
|
44
|
+
|
|
45
|
+
Go back to `references/fix-step-2-apply.md` and address them.
|
|
46
|
+
|
|
47
|
+
## Completion
|
|
48
|
+
|
|
49
|
+
Summarize what was fixed:
|
|
50
|
+
- Which files changed
|
|
51
|
+
- What was wrong and how it was resolved
|
|
52
|
+
- Confirm with the user that the skill now behaves as expected
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
# bash-precheck.sh - PreToolUse hook to wrap Bash commands with output limiting
|
|
3
|
-
#
|
|
4
|
-
# Intercepts Bash commands before execution and wraps them to:
|
|
5
|
-
# 1. Capture output to temp file
|
|
6
|
-
# 2. If output exceeds threshold, save and return truncated version
|
|
7
|
-
#
|
|
8
|
-
# This ACTUALLY prevents large outputs from consuming context.
|
|
9
|
-
# Compatible with bash and zsh on macOS and Linux.
|
|
10
|
-
|
|
11
|
-
set -e
|
|
12
|
-
|
|
13
|
-
# Configuration
|
|
14
|
-
MAX_CHARS=${BASH_OVERFLOW_MAX_CHARS:-20000}
|
|
15
|
-
OVERFLOW_DIR="${HOME}/.claude/bash-overflow"
|
|
16
|
-
|
|
17
|
-
# Read hook input from stdin
|
|
18
|
-
input=$(cat)
|
|
19
|
-
|
|
20
|
-
# Parse tool name and command
|
|
21
|
-
tool_name=$(echo "$input" | jq -r '.tool_name // empty')
|
|
22
|
-
|
|
23
|
-
# Only process Bash tool
|
|
24
|
-
if [[ "$tool_name" != "Bash" ]]; then
|
|
25
|
-
exit 0
|
|
26
|
-
fi
|
|
27
|
-
|
|
28
|
-
# Get the original command
|
|
29
|
-
original_cmd=$(echo "$input" | jq -r '.tool_input.command // empty')
|
|
30
|
-
|
|
31
|
-
# Skip if empty
|
|
32
|
-
if [[ -z "$original_cmd" ]]; then
|
|
33
|
-
exit 0
|
|
34
|
-
fi
|
|
35
|
-
|
|
36
|
-
# Skip commands that are already piped to head/tail or are simple commands
|
|
37
|
-
if [[ "$original_cmd" =~ \|[[:space:]]*(head|tail|wc|grep.*-c) ]]; then
|
|
38
|
-
exit 0
|
|
39
|
-
fi
|
|
40
|
-
|
|
41
|
-
# Skip very short commands (likely simple operations)
|
|
42
|
-
if [[ ${#original_cmd} -lt 10 ]]; then
|
|
43
|
-
exit 0
|
|
44
|
-
fi
|
|
45
|
-
|
|
46
|
-
# Create overflow directory
|
|
47
|
-
mkdir -p "$OVERFLOW_DIR"
|
|
48
|
-
|
|
49
|
-
# Generate unique filename
|
|
50
|
-
timestamp=$(date +%Y%m%d_%H%M%S)
|
|
51
|
-
rand_suffix=$RANDOM
|
|
52
|
-
overflow_file="$OVERFLOW_DIR/bash_output_${timestamp}_${rand_suffix}.txt"
|
|
53
|
-
temp_file="/tmp/claude_bash_${timestamp}_${rand_suffix}.tmp"
|
|
54
|
-
|
|
55
|
-
# Escape the original command for embedding in the wrapper
|
|
56
|
-
# Use base64 to safely embed arbitrary commands
|
|
57
|
-
original_cmd_b64=$(echo "$original_cmd" | base64)
|
|
58
|
-
|
|
59
|
-
# Create wrapper that uses temp file approach (more portable)
|
|
60
|
-
read -r -d '' wrapped_cmd << 'WRAPPER_EOF' || true
|
|
61
|
-
__cmd_b64="BASE64_CMD_HERE"
|
|
62
|
-
__cmd=$(echo "$__cmd_b64" | base64 -d)
|
|
63
|
-
__tmpfile="TEMP_FILE_HERE"
|
|
64
|
-
__overflow="OVERFLOW_FILE_HERE"
|
|
65
|
-
__max=MAX_CHARS_HERE
|
|
66
|
-
|
|
67
|
-
# Run command and capture to temp file
|
|
68
|
-
eval "$__cmd" > "$__tmpfile" 2>&1
|
|
69
|
-
__exit_code=$?
|
|
70
|
-
|
|
71
|
-
# Check size
|
|
72
|
-
__size=$(wc -c < "$__tmpfile" | tr -d ' ')
|
|
73
|
-
|
|
74
|
-
if [ "$__size" -gt "$__max" ]; then
|
|
75
|
-
# Save full output
|
|
76
|
-
cp "$__tmpfile" "$__overflow"
|
|
77
|
-
__lines=$(wc -l < "$__tmpfile" | tr -d ' ')
|
|
78
|
-
__tokens=$((__size / 4))
|
|
79
|
-
|
|
80
|
-
echo "=== OUTPUT TRUNCATED (${__lines} lines, ~${__tokens} tokens) ==="
|
|
81
|
-
echo ""
|
|
82
|
-
echo "--- First 5 lines ---"
|
|
83
|
-
head -n 5 "$__tmpfile"
|
|
84
|
-
echo ""
|
|
85
|
-
echo "--- Last 5 lines ---"
|
|
86
|
-
tail -n 5 "$__tmpfile"
|
|
87
|
-
echo ""
|
|
88
|
-
echo "=== Full output saved to: $__overflow ==="
|
|
89
|
-
echo "Use Grep(pattern, path) or Read(file_path, offset, limit) to explore"
|
|
90
|
-
else
|
|
91
|
-
cat "$__tmpfile"
|
|
92
|
-
fi
|
|
93
|
-
|
|
94
|
-
rm -f "$__tmpfile"
|
|
95
|
-
exit $__exit_code
|
|
96
|
-
WRAPPER_EOF
|
|
97
|
-
|
|
98
|
-
# Substitute placeholders
|
|
99
|
-
wrapped_cmd="${wrapped_cmd//BASE64_CMD_HERE/$original_cmd_b64}"
|
|
100
|
-
wrapped_cmd="${wrapped_cmd//TEMP_FILE_HERE/$temp_file}"
|
|
101
|
-
wrapped_cmd="${wrapped_cmd//OVERFLOW_FILE_HERE/$overflow_file}"
|
|
102
|
-
wrapped_cmd="${wrapped_cmd//MAX_CHARS_HERE/$MAX_CHARS}"
|
|
103
|
-
|
|
104
|
-
# Return the modified command
|
|
105
|
-
cat << EOF
|
|
106
|
-
{
|
|
107
|
-
"hookSpecificOutput": {
|
|
108
|
-
"hookEventName": "PreToolUse",
|
|
109
|
-
"permissionDecision": "allow",
|
|
110
|
-
"updatedInput": {
|
|
111
|
-
"command": $(echo "$wrapped_cmd" | jq -Rs .)
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
EOF
|
|
116
|
-
|
|
117
|
-
exit 0
|