writing-skills is a skill from the Summer skill library: a guide your AI agent reads when the task matches, so it builds the good version on the first try. Create, edit, and verify agent skills — format, structure, testing with subagents, and best practices.
When your agent uses it
- Creating new skills, editing existing skills, or verifying skills work before deployment
- Reviewing a SKILL.md for format, structure, and trigger quality, or testing whether it fires with a subagent
Install
summer setup installs every skill for your agent. To add only this one:
claude-code for your agent, such as codex or cursor. See Skills for every option.
The skill
Overview
Writing skills IS Test-Driven Development applied to process documentation. Personal skills live in agent-specific directories (~/.claude/skills for Claude Code, ~/.agents/skills/ for Codex)
You write test cases (pressure scenarios with subagents), watch them fail (baseline behavior), write the skill (documentation), watch tests pass (agents comply), and refactor (close loopholes).
Core principle: If you didn’t watch an agent fail without the skill, you don’t know if the skill teaches the right thing.
REQUIRED BACKGROUND: This skill adapts the RED-GREEN-REFACTOR cycle to documentation. The cycle: write the test first and watch it FAIL for the reason you expect (red), make the smallest change that passes it (green), then clean up without changing behaviour (refactor). A test you never saw fail proves nothing.
Official guidance: For Anthropic’s official skill authoring best practices, see https://platform.claude.com/docs/en/agents-and-tools/agent-skills/best-practices. That document provides additional patterns and guidelines that complement the TDD-focused approach in this skill.
What is a Skill?
A skill is a reference guide for proven techniques, patterns, or tools. Skills help future Claude instances find and apply effective approaches. Skills are: Reusable techniques, patterns, tools, reference guides Skills are NOT: Narratives about how you solved a problem onceTDD Mapping for Skills
The entire skill creation process follows RED-GREEN-REFACTOR.
When to Create a Skill
Create when:- Technique wasn’t intuitively obvious to you
- You’d reference this again across projects
- Pattern applies broadly (not project-specific)
- Others would benefit
- One-off solutions
- Standard practices well-documented elsewhere
- Project-specific conventions (put in CLAUDE.md)
- Mechanical constraints (if it’s enforceable with regex/validation, automate it—save documentation for judgment calls)
Skill Types
Technique
Concrete method with steps to follow (condition-based-waiting, root-cause-tracing)Pattern
Way of thinking about problems (flatten-with-flags, test-invariants)Reference
API docs, syntax guides, tool documentation (office docs)Directory Structure
- Heavy reference (100+ lines) - API docs, comprehensive syntax
- Reusable tools - Scripts, utilities, templates
- Principles and concepts
- Code patterns (< 50 lines)
- Everything else
SKILL.md Structure
Frontmatter (YAML):- Two required fields:
nameanddescription(see agentskills.io/specification for all supported fields) - Max 1024 characters total
name: Use letters, numbers, and hyphens only (no parentheses, special chars)description: Third-person, describes ONLY when to use (NOT what it does)- Start with “Use when…” to focus on triggering conditions
- Include specific symptoms, situations, and contexts
- NEVER summarize the skill’s process or workflow (see CSO section for why)
- Keep under 500 characters if possible
Claude Search Optimization (CSO)
Critical for discovery: Future Claude needs to FIND your skill1. Rich Description Field
Purpose: Claude reads description to decide which skills to load for a given task. Make it answer: “Should I read this skill right now?” Format: Start with “Use when…” to focus on triggering conditions CRITICAL: Description = When to Use, NOT What the Skill Does The description should ONLY describe triggering conditions. Do NOT summarize the skill’s process or workflow in the description. Why this matters: Testing revealed that when a description summarizes the skill’s workflow, Claude may follow the description instead of reading the full skill content. A description saying “code review between tasks” caused Claude to do ONE review, even though the skill’s flowchart clearly showed TWO reviews (spec compliance then code quality). When the description was changed to just “Use when executing implementation plans with independent tasks” (no workflow summary), Claude correctly read the flowchart and followed the two-stage review process. The trap: Descriptions that summarize workflow create a shortcut Claude will take. The skill body becomes documentation Claude skips.- Use concrete triggers, symptoms, and situations that signal this skill applies
- Describe the problem (race conditions, inconsistent behavior) not language-specific symptoms (setTimeout, sleep)
- Keep triggers technology-agnostic unless the skill itself is technology-specific
- If skill is technology-specific, make that explicit in the trigger
- Write in third person (injected into system prompt)
- NEVER summarize the skill’s process or workflow
2. Keyword Coverage
Use words Claude would search for:- Error messages: “Hook timed out”, “ENOTEMPTY”, “race condition”
- Symptoms: “flaky”, “hanging”, “zombie”, “pollution”
- Synonyms: “timeout/hang/freeze”, “cleanup/teardown/afterEach”
- Tools: Actual commands, library names, file types
3. Descriptive Naming
Use active voice, verb-first:- Good:
creating-skillsnotskill-creation - Good:
condition-based-waitingnotasync-test-helpers
4. Token Efficiency (Critical)
Problem: getting-started and frequently-referenced skills load into EVERY conversation. Every token counts. Target word counts:- getting-started workflows: <150 words each
- Frequently-loaded skills: <200 words total
- Other skills: <500 words (still be concise)
- Don’t repeat what’s in cross-referenced skills
- Don’t explain what’s obvious from command
- Don’t include multiple examples of same pattern
- Good:
condition-based-waiting>async-test-helpers - Good:
using-skillsnotskill-usage - Good:
flatten-with-flags>data-structure-refactoring - Good:
root-cause-tracing>debugging-techniques
creating-skills,testing-skills,debugging-with-logs- Active, describes the action you’re taking
4. Cross-Referencing Other Skills
When writing documentation that references other skills: Use skill name only, with explicit requirement markers:- Good:
**REQUIRED SUB-SKILL:** Use verification-before-completion - Good:
**REQUIRED BACKGROUND:** You MUST understand investigating-bugs - Bad:
See library/skills/debug(unclear if required) - Bad:
@library/skills/debug/SKILL.md(force-loads, burns context)
registry/generated/skills-registry.json (generated from library/skills/); summer skills list prints it. A REQUIRED SUB-SKILL pointing at a skill that was never shipped is worse than no cross-reference: the reader stops and looks for something that does not exist.
Why no @ links: @ syntax force-loads files immediately and spends context before you need them.
Flowchart Usage
- Non-obvious decision points
- Process loops where you might stop too early
- “When to use A vs B” decisions
- Reference material → Tables, lists
- Code examples → Markdown blocks
- Linear instructions → Numbered lists
- Labels without semantic meaning (step1, helper2)
Code Examples
One excellent example beats many mediocre ones Choose most relevant language:- Testing techniques → TypeScript/JavaScript
- System debugging → Shell/Python
- Data processing → Python
- Complete and runnable
- Well-commented explaining WHY
- From real scenario
- Shows pattern clearly
- Ready to adapt (not generic template)
- Implement in 5+ languages
- Create fill-in-the-blank templates
- Write contrived examples
File Organization
Self-Contained Skill
Skill with Reusable Tool
Skill with Heavy Reference
The Iron Law (Same as TDD)
- Not for “simple additions”
- Not for “just adding a section”
- Not for “documentation updates”
- Don’t keep untested changes as “reference”
- Don’t “adapt” while running tests
- Delete means delete
Testing All Skill Types
Different skill types need different test approaches:Discipline-Enforcing Skills (rules/requirements)
Examples: TDD, verification-before-completion, designing-before-coding Test with:- Academic questions: Do they understand the rules?
- Pressure scenarios: Do they comply under stress?
- Multiple pressures combined: time + sunk cost + exhaustion
- Identify rationalizations and add explicit counters
Technique Skills (how-to guides)
Examples: condition-based-waiting, root-cause-tracing, defensive-programming Test with:- Application scenarios: Can they apply the technique correctly?
- Variation scenarios: Do they handle edge cases?
- Missing information tests: Do instructions have gaps?
Pattern Skills (mental models)
Examples: reducing-complexity, information-hiding concepts Test with:- Recognition scenarios: Do they recognize when pattern applies?
- Application scenarios: Can they use the mental model?
- Counter-examples: Do they know when NOT to apply?
Reference Skills (documentation/APIs)
Examples: API documentation, command references, library guides Test with:- Retrieval scenarios: Can they find the right information?
- Application scenarios: Can they use what they found correctly?
- Gap testing: Are common use cases covered?
Common Rationalizations for Skipping Testing
All of these mean: Test before deploying. No exceptions.
Bulletproofing Skills Against Rationalization
Skills that enforce discipline (like TDD) need to resist rationalization. Agents are smart and will find loopholes when under pressure. Why this works: explicit authority (“MUST”, “NEVER”), commitment (announce the skill before acting), and closing each loophole by name are what make a discipline skill hold under pressure; vague encouragement does not.Close Every Loophole Explicitly
Don’t just state the rule - forbid specific workarounds: <Bad>Address “Spirit vs Letter” Arguments
Add foundational principle early:Build Rationalization Table
Capture rationalizations from baseline testing (see Testing section below). Every excuse agents make goes in the table:Create Red Flags List
Make it easy for agents to self-check when rationalizing:Update CSO for Violation Symptoms
Add to description: symptoms of when you’re ABOUT to violate the rule:RED-GREEN-REFACTOR for Skills
Follow the TDD cycle:RED: Write Failing Test (Baseline)
Run pressure scenario with subagent WITHOUT the skill. Document exact behavior:- What choices did they make?
- What rationalizations did they use (verbatim)?
- Which pressures triggered violations?
GREEN: Write Minimal Skill
Write skill that addresses those specific rationalizations. Don’t add extra content for hypothetical cases. Run same scenarios WITH skill. Agent should now comply.REFACTOR: Close Loopholes
Agent found new rationalization? Add explicit counter. Re-test until bulletproof. Testing methodology: Seetesting-skills-with-subagents.md in this directory for the complete testing methodology:
- How to write pressure scenarios
- Pressure types (time, sunk cost, authority, exhaustion)
- Plugging holes systematically
- Meta-testing techniques
Anti-Patterns
Bad: Narrative Example
“In session 2025-10-03, we found empty projectDir caused…” Why bad: Too specific, not reusableBad: Multi-Language Dilution
example-js.js, example-py.py, example-go.go Why bad: Mediocre quality, maintenance burdenBad: Code in Flowcharts
Bad: Generic Labels
helper1, helper2, step3, pattern4 Why bad: Labels should have semantic meaningSTOP: Before Moving to Next Skill
After writing ANY skill, you MUST STOP and complete the deployment process. Do NOT:- Create multiple skills in batch without testing each
- Move to next skill before current one is verified
- Skip testing because “batching is more efficient”
Skill Creation Checklist (TDD Adapted)
IMPORTANT: Use TodoWrite to create todos for EACH checklist item below. RED Phase - Write Failing Test:- Create pressure scenarios (3+ combined pressures for discipline skills)
- Run scenarios WITHOUT skill - document baseline behavior verbatim
- Identify patterns in rationalizations/failures
- Name uses only letters, numbers, hyphens (no parentheses/special chars)
- YAML frontmatter with required
nameanddescriptionfields (max 1024 chars; see spec) - Description starts with “Use when…” and includes specific triggers/symptoms
- Description written in third person
- Keywords throughout for search (errors, symptoms, tools)
- Clear overview with core principle
- Address specific baseline failures identified in RED
- Code inline OR link to separate file
- One excellent example (not multi-language)
- Run scenarios WITH skill - verify agents now comply
- Identify NEW rationalizations from testing
- Add explicit counters (if discipline skill)
- Build rationalization table from all test iterations
- Create red flags list
- Re-test until bulletproof
- Small flowchart only if decision non-obvious
- Quick reference table
- Common mistakes section
- No narrative storytelling
- Supporting files only for tools or heavy reference
- Commit skill to git and push to your fork (if configured)
- Consider contributing back via PR (if broadly useful)
Discovery Workflow
How future Claude finds your skill:- Encounters problem (“tests are flaky”)
- Finds SKILL (description matches)
- Scans overview (is this relevant?)
- Reads patterns (quick reference table)
- Loads example (only when implementing)
The Bottom Line
Creating skills IS TDD for process documentation. Same Iron Law: No skill without failing test first. Same cycle: RED (baseline) → GREEN (write skill) → REFACTOR (close loopholes). Same benefits: Better quality, fewer surprises, bulletproof results. If you follow TDD for code, follow it for skills. It’s the same discipline applied to documentation.Files in this skill
Related skills
debug: Disciplined bug, crash and error loop: script errors, console, debugger, hypothesis, fix, verify.
Source:
library/skills/writing-skills/SKILL.md, rendered from summer-engine@4.3.0 on npm.
