Skip to content

Commit a386cf3

Browse files
Perloverclaude
andcommitted
feat(improve-skills): embed skill-writing rules, remove external docs link
Removed external Claude documentation links and embedded comprehensive skill-writing rules directly into the improve-skills command. Added: - Three-Phase Loading Model explanation - Supported/unsupported YAML frontmatter fields - Description patterns for maximum discoverability - Compactness Principle and File Structure Options - Quick Template and Quality Checklist Preserved Agent-OS specific content: - "Include all relevant instructions, details and directives" recommendation - Explicit mention of Agent OS standards files for linking Co-Authored-By: Claude <[email protected]>
1 parent c8a1c3d commit a386cf3

File tree

1 file changed

+185
-19
lines changed

1 file changed

+185
-19
lines changed

profiles/default/commands/improve-skills/improve-skills.md

Lines changed: 185 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
I want you to help me improve the files that make up my Claude Code Skills by rewriting their descriptions so that they can be more readily discovered and used by Claude Code when it works on coding tasks.
22

3-
You can refer to the Claude Code documentation on the Skills feature here: https://docs.claude.com/en/docs/claude-code/skills
4-
53
All of the Skills in our project are located in `.claude/skills/`. Each Skill has its own folder and inside each Skill folder is a file called `SKILL.md`.
64

75
LOOP through each `SKILL.md` file and FOR EACH use the following process to revise its content and improve it:
@@ -18,6 +16,130 @@ Before I proceed with improving your Claude Code Skills, can you confirm that yo
1816
If not, then please specify which Skills I should include or exclude.
1917
```
2018

19+
---
20+
21+
## Skills Writing Reference
22+
23+
Before improving skills, understand these key concepts:
24+
25+
### Critical: Three-Phase Loading Model
26+
27+
```
28+
Phase 1: YAML frontmatter cached for ALL skills
29+
30+
Phase 2: SKILL.md loaded when model decides to use skill
31+
32+
Phase 3: Related files loaded based on links + context
33+
```
34+
35+
**Implications:**
36+
- `description` must contain trigger patterns (Phase 1 decision)
37+
- SKILL.md must be SHORT - loaded before full context known
38+
- Related files can be LONGER - loaded only when needed
39+
- Links must have context descriptions (when to load each file)
40+
41+
### Supported YAML Frontmatter Fields
42+
43+
| Field | Required | Purpose |
44+
|-------|----------|---------|
45+
| `name` | auto | Identifier (lowercase, hyphens, max 64 chars) |
46+
| `description` | **yes** | **Critical for triggering.** Max 1024 chars |
47+
| `when_to_use` | no | Additional trigger guidance |
48+
| `allowed-tools` | no | Restrict available tools |
49+
50+
### Unsupported Fields - REMOVE If Present
51+
52+
These fields are **ignored** by Claude Code:
53+
- `tags` - not supported
54+
- `version` - not supported
55+
- `dependencies` - not supported
56+
57+
### Description Patterns
58+
59+
```yaml
60+
# Standard triggers - list scenarios:
61+
description: "Use when writing database queries, creating migrations, working with Prisma models"
62+
63+
# Mandatory loading (always load):
64+
description: "MANDATORY: Project coding standards. Use for all code in this project"
65+
66+
# Combined with when_to_use:
67+
description: "Database patterns and best practices"
68+
when_to_use: "When working with PostgreSQL, Prisma, or SQL queries"
69+
70+
# File type triggers:
71+
description: "Tailwind CSS patterns. Use when writing .tsx, .vue, .css files with utility classes"
72+
73+
# Comprehensive (recommended for max discoverability):
74+
description: "Write accessible React components. Use when creating .tsx files, implementing ARIA attributes, keyboard navigation, or fixing accessibility issues"
75+
```
76+
77+
### Compactness Principle
78+
79+
**Skills consume context window. Every character matters.**
80+
81+
- Short, clear descriptions with triggers
82+
- Minimal SKILL.md content - only essentials
83+
- **Illustrative examples**: 3-5 lines max (showing concept)
84+
- **Reference patterns**: Can be longer if they provide copy-paste value
85+
- Link to supporting files for details
86+
87+
### File Structure Options
88+
89+
**Minimal:**
90+
```
91+
skill-name/
92+
└── SKILL.md
93+
```
94+
95+
**With Supporting Files:**
96+
```
97+
skill-name/
98+
├── SKILL.md # Overview + links (SHORT)
99+
├── REFERENCE.md # Detailed info
100+
└── EXAMPLES.md # Code examples
101+
```
102+
103+
**Multi-topic (preferred for context efficiency):**
104+
```
105+
skill-name/
106+
├── SKILL.md # Core rules + short illustrative examples
107+
├── EXAMPLES-QUERIES.md # Examples for database queries
108+
├── EXAMPLES-MIGRATIONS.md # Examples for migrations
109+
└── EXAMPLES-MODELS.md # Examples for models
110+
```
111+
112+
### Quick Template
113+
114+
```markdown
115+
---
116+
name: my-skill
117+
description: "Use when [specific trigger situations]"
118+
---
119+
120+
# My Skill
121+
122+
## When to use this skill
123+
124+
- When writing or editing [file types]
125+
- When implementing [features]
126+
- When debugging [issues]
127+
128+
## Purpose
129+
[One sentence]
130+
131+
## Instructions
132+
1. Step one
133+
2. Step two
134+
135+
## Example
136+
\`\`\`code
137+
// 3-5 lines max
138+
\`\`\`
139+
```
140+
141+
---
142+
21143
### Step 2: Analyze what this Skill does
22144

23145
Analyze and read the skill file to understand what it is, what it should be used for, and when it should be used. The specific best practices are described and linked within it. Look to these places to read and understand each skill:
@@ -44,24 +166,57 @@ Example transformations:
44166

45167
The most important element of a skill.md file that impacts its discoverability and trigger-ability by Claude Code is the content we write in the `description` in the skill.md frontmatter.
46168

47-
Rewrite this description using the following guidelines:
169+
**Algorithm for maximum discoverability:**
170+
171+
1. **First sentence:** Clearly state what the skill does
172+
```
173+
"Write Tailwind CSS code and structure front-end UIs using utility classes."
174+
```
48175

49-
- The first sentence should clearly describe what this skill is. For example: "Write Tailwind CSS code and structure front-end UIs using Tailwind CSS utility classes."
50-
- The second sentence and subsequent sentences should clearly and directly describe multiple examples where and when this skill should be used.
51-
- The use case examples can include "When writing or editing [file types]" where [file types] can be a list of file extensions or types of files or components commonly found in software projects.
52-
- The use case examples can also include situations or areas or tools where using this skill should come into play.
53-
- The description text can be long. There is no maximum character or word limit.
54-
- Focus on adding examples where the skill SHOULD be used. Do not include instructions on when NOT to use a skill (our goal is for the Skill to be readily found and used frequently).
176+
2. **Following sentences:** List specific trigger scenarios using these patterns:
177+
- **File types:** "When writing or editing .tsx, .vue, .css files"
178+
- **Situations:** "When creating forms, layouts, or responsive designs"
179+
- **Tools/technologies:** "When using PostCSS, CSS-in-JS, or styled-components"
180+
- **Actions:** "When debugging, optimizing, or refactoring [specific area]"
181+
182+
**Key principle:** Focus ONLY on when to USE the skill.
183+
Never include when NOT to use - this reduces discoverability.
184+
185+
**Longer descriptions are better:** More trigger scenarios = higher discoverability.
186+
Use the full 1024 chars if needed.
187+
188+
**Good vs Bad Examples:**
189+
```yaml
190+
# Bad - too vague, won't trigger:
191+
description: "Helps with database"
192+
193+
# Good - specific triggers:
194+
description: "Use when connecting to PostgreSQL/MySQL, writing queries, or debugging database issues"
195+
196+
# Better - multiple trigger scenarios:
197+
description: "API documentation generator. Use when documenting REST endpoints, creating OpenAPI specs, writing JSDoc comments, or generating SDK documentation"
198+
```
199+
200+
#### 3.3: Remove unsupported fields
201+
202+
Check YAML frontmatter and REMOVE these fields if present:
203+
- `tags`
204+
- `version`
205+
- `dependencies`
206+
207+
These fields are ignored by Claude Code and should be removed.
55208

56209
### Step 4: Insert a section for 'When to use this skill'
57210

58211
At the top of the content of skill.md, below the frontmatter, insert an H2 heading, "When to use this skill" followed by a list of use case examples.
59212

60213
The use case examples can repeat the same one(s) listed in the description and/or expand on them.
61214

215+
**Tip:** This section has no character limit (unlike description's 1024 chars), so you can expand on triggers mentioned in the description and add more specific scenarios.
216+
62217
Example:
63218
```markdown
64-
## When to use this skill:
219+
## When to use this skill
65220
66221
- [Descriptive example A]
67222
- [Descriptive example B]
@@ -71,19 +226,30 @@ Example:
71226

72227
### Step 5: Advise the user on improving their skills further
73228

74-
After revising ALL Skill.md files located in the project's `.claude/skills/` folder, display the following message to the user to advise them on how to improve their Claude Code Skills further:
229+
After revising ALL Skill.md files located in the project's `.claude/skills/` folder, display the following message to the user:
75230

76231
```
77232
All Claude Code Skills have been analyzed and revised!
78233
79-
RECOMMENDATION 👉 Review and revise them further using these tips:
234+
## Quality Checklist
80235
81-
- Make Skills as descriptive as possible
82-
- Use their 'description' frontmatter to tell Claude Code when it should proactively use this skill.
83-
- Include all relevant instructions, details and directives within the content of the Skill.
84-
- You can link to other files (like your Agent OS standards files) using markdown links.
85-
- You can consolidate multiple similar skills into single skills where it makes sense for Claude to find and use them together.
236+
Verify each skill meets these criteria:
86237
87-
For more best practices, refer to the official Claude Code documentation on Skills:
88-
https://docs.claude.com/en/docs/claude-code/skills
238+
- [ ] `description` contains specific trigger patterns
239+
- [ ] Has "When to use this skill" section at top of content
240+
- [ ] No `tags`/`version`/`dependencies` fields (unsupported)
241+
- [ ] SKILL.md is SHORT (loaded early, before full context)
242+
- [ ] Illustrative examples are short (3-5 lines)
243+
- [ ] Links have context descriptions (when to load each file)
244+
- [ ] One skill = one capability (focused scope)
245+
246+
## Additional Recommendations
247+
248+
- **Compactness:** Skills consume context window. Every character matters.
249+
- **Triggering:** Description determines when skill loads - make it as specific as possible.
250+
- **Progressive disclosure:** SKILL.md loads first, supporting files only when needed.
251+
- **Multi-topic skills:** Split examples into separate files by topic for context efficiency.
252+
- **Content completeness:** Include all relevant instructions, details and directives within the content of the Skill.
253+
- You can link to other files (like your Agent OS standards files) using markdown links.
254+
- Consolidate similar skills where it makes sense for Claude to find and use them together.
89255
```

0 commit comments

Comments
 (0)