| name | writing-skills |
| description | Use when creating new skills, editing existing skills, or verifying skills work before deployment |
| metadata | {"user-invocable":true,"disable-model-invocation":true} |
Writing Skills
Overview
Writing skills IS Test-Driven Development applied to process documentation.
You write test cases (scenarios), watch them fail (baseline behavior), write the skill (documentation), watch tests pass (compliance), and refactor (close loopholes).
Core principle: If you didn't watch someone fail without the skill, you don't know if the skill teaches the right thing.
REQUIRED BACKGROUND: You MUST understand /test-driven-development before using this command. That command defines the fundamental RED-GREEN-REFACTOR cycle. This command adapts TDD to documentation.
What is a Skill?
A skill is a reference guide for proven techniques, patterns, or tools. Skills help future instances find and apply effective approaches.
Skills are: Reusable techniques, patterns, tools, reference guides
Skills are NOT: Narratives about how you solved a problem once
TDD Mapping for Skills
| TDD Concept | Skill Creation |
|---|
| Test case | Pressure scenario |
| Production code | Skill document |
| Test fails (RED) | Violation without skill (baseline) |
| Test passes (GREEN) | Compliance with skill present |
| Refactor | Close loopholes while maintaining compliance |
| Write test first | Run baseline scenario BEFORE writing skill |
| Watch it fail | Document exact rationalizations used |
| Minimal code | Write skill addressing those specific violations |
| Watch it pass | Verify compliance now |
| Refactor cycle | Find new rationalizations → plug → re-verify |
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
Don't create for:
- One-off solutions
- Standard practices well-documented elsewhere
- Project-specific conventions (put in custom instructions)
- 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
Directory Structure
.bob/commands/
skill-name.md # Main reference (required)
Bob commands are single markdown files with YAML frontmatter.
Command File Structure
Frontmatter (YAML):
- Two required fields:
name and description
- 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
- Keep under 500 characters if possible
---
name: skill-name-with-hyphens
description: Use when [specific triggering conditions and symptoms]
---
# Skill Name
## Overview
What is this? Core principle in 1-2 sentences.
## When to Use
Bullet list with SYMPTOMS and use cases
When NOT to use
## Core Pattern (for techniques/patterns)
Before/after code comparison
## Quick Reference
Table or bullets for scanning common operations
## Implementation
Inline code for simple patterns
## Common Mistakes
What goes wrong + fixes
## Real-World Impact (optional)
Concrete results
Description Best Practices
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: When a description summarizes workflow, users may follow the description instead of reading the full skill content. A description saying "code review between tasks" caused following ONE review, even though the skill 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), the full skill was correctly read and followed.
The trap: Descriptions that summarize workflow create a shortcut that gets taken. The skill body becomes documentation that gets skipped.
description: Use when executing plans - dispatches subagent per task with code review between tasks
description: Use for TDD - write test first, watch it fail, write minimal code, refactor
description: Use when executing implementation plans with independent tasks in the current session
description: Use when implementing any feature or bugfix, before writing implementation code
Content:
- 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
- Write in third person
- NEVER summarize the skill's process or workflow
The Iron Law (Same as TDD)
NO SKILL WITHOUT A FAILING TEST FIRST
This applies to NEW skills AND EDITS to existing skills.
Write skill before testing? Delete it. Start over.
Edit skill without testing? Same violation.
No exceptions:
- 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
Bulletproofing Skills Against Rationalization
Skills that enforce discipline (like TDD) need to resist rationalization.
Close Every Loophole Explicitly
Don't just state the rule - forbid specific workarounds:
Bad:
Write code before test? Delete it.
Good:
Write code before test? Delete it. Start over.
**No exceptions:**
- Don't keep it as "reference"
- Don't "adapt" it while writing tests
- Don't look at it
- Delete means delete
Address "Spirit vs Letter" Arguments
Add foundational principle early:
**Violating the letter of the rules is violating the spirit of the rules.**
This cuts off entire class of "I'm following the spirit" rationalizations.
Build Rationalization Table
Capture rationalizations from baseline testing. Every excuse goes in the table:
| Excuse | Reality |
|--------|---------|
| "Too simple to test" | Simple code breaks. Test takes 30 seconds. |
| "I'll test after" | Tests passing immediately prove nothing. |
| "Tests after achieve same goals" | Tests-after = "what does this do?" Tests-first = "what should this do?" |
Create Red Flags List
Make it easy to self-check when rationalizing:
## Red Flags - STOP and Start Over
- Code before test
- "I already manually tested it"
- "Tests after achieve the same purpose"
- "It's about spirit not ritual"
- "This is different because..."
**All of these mean: Delete code. Start over with TDD.**
RED-GREEN-REFACTOR for Skills
Follow the TDD cycle:
RED: Write Failing Test (Baseline)
Run pressure scenario WITHOUT the skill. Document exact behavior:
- What choices were made?
- What rationalizations were used (verbatim)?
- Which pressures triggered violations?
This is "watch the test fail" - you must see what happens naturally before writing the skill.
GREEN: Write Minimal Skill
Write skill that addresses those specific rationalizations. Don't add extra content for hypothetical cases.
Run same scenarios WITH skill. Should now comply.
REFACTOR: Close Loopholes
Found new rationalization? Add explicit counter. Re-test until bulletproof.
Common Rationalizations for Skipping Testing
| Excuse | Reality |
|---|
| "Skill is obviously clear" | Clear to you ≠ clear to others. Test it. |
| "It's just a reference" | References can have gaps, unclear sections. Test retrieval. |
| "Testing is overkill" | Untested skills have issues. Always. 15 min testing saves hours. |
| "I'll test if problems emerge" | Problems = can't use skill. Test BEFORE deploying. |
| "Too tedious to test" | Testing is less tedious than debugging bad skill in production. |
| "I'm confident it's good" | Overconfidence guarantees issues. Test anyway. |
All of these mean: Test before deploying. No exceptions.
Skill Creation Checklist (TDD Adapted)
RED Phase - Write Failing Test:
GREEN Phase - Write Minimal Skill:
REFACTOR Phase - Close Loopholes:
Quality Checks:
Deployment:
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.