Write skill

From earchibald/vsc-superpowers · View interactive version

Write skill is an AI agent skill from the GitHub repository earchibald/vsc-superpowers. Use when creating new skills, editing existing skills, or verifying skills work before deployment

How to use this skill

Skill file

Skill: writing-skills


name: writing-skills

description: Use when creating new skills, editing existing skills, or verifying skills work before deployment


Writing Skills

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 Copilot CLI)

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: You MUST understand superpowers:test-driven-development before using this skill. That skill defines the fundamental RED-GREEN-REFACTOR cycle. This skill adapts TDD to documentation.

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 once

When to Create a Skill

Create when:

Don't create for:

SKILL.md Structure

Frontmatter (YAML):

---
name: Skill-Name-With-Hyphens
description: Use when [specific triggering conditions and symptoms]
---

Only two fields: name and description (max 1024 chars total)

Content:

Claude Search Optimization (CSO)

Critical for discovery: Future Claude needs to FIND your skill

Description = When to Use, NOT What the Skill Does

CRITICAL: Description should ONLY describe triggering conditions. Do NOT summarize the skill's workflow.

# ❌ BAD: Summarizes workflow - Claude may follow this instead of reading skill
description: Use when executing plans - dispatches subagent per task with code review between tasks

# ✅ GOOD: Just triggering conditions, no workflow summary
description: Use when executing implementation plans with independent tasks in the current session

Keyword Coverage

Use words Claude would search for:

Descriptive Naming

Use active voice, verb-first:

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:

Testing All Skill Types

Discipline-Enforcing Skills (rules/requirements)

Examples: TDD, verification-before-completion, designing-before-coding

Test with:

Success criteria: Agent follows rule under maximum pressure

Technique Skills (how-to guides)

Examples: condition-based-waiting, root-cause-tracing

Test with:

Success criteria: Agent successfully applies technique to new scenario

Pattern Skills (mental models)

Examples: reducing-complexity, information-hiding concepts

Test with:

Success criteria: Agent correctly identifies when/how to apply pattern

Reference Skills (documentation/APIs)

Examples: API documentation, command references

Test with:

Success criteria: Agent finds and correctly applies reference information

Bulletproofing Skills Against Rationalization

Skills that enforce discipline need to resist rationalization.

Close Every Loophole Explicitly

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:

**Violating the letter of the rules is violating the spirit of the rules.**

Build Rationalization Table

Capture rationalizations from testing:

| Excuse | Reality |
|--------|---------|
| "Too simple to test" | Simple code breaks. Test takes 30 seconds. |

Create Red Flags List

## Red Flags - STOP and Start Over

- Code before test
- "I already manually tested it"
- "This is different because..."

**All of these mean: Delete code. Start over with TDD.**

RED-GREEN-REFACTOR for Skills

RED: Write Failing Test (Baseline)

Run pressure scenario with subagent WITHOUT the skill. Document exact behavior:

GREEN: Write Minimal Skill

Write skill that addresses those specific rationalizations. Don't add extra content.

Run same scenarios WITH skill. Agent should now comply.

REFACTOR: Close Loopholes

Agent 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 other agents. 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 = agents can't use skill. Test BEFORE deploying. |

All of these mean: Test before deploying. No exceptions.

File Organization

Self-Contained Skill

skill-name/
  SKILL.md    # Everything inline

Skill with Reusable Tool

skill-name/
  SKILL.md    # Overview + patterns
  example.ts  # Working helpers to adapt

Skill with Heavy Reference

skill-name/
  SKILL.md       # Overview + workflows
  reference.md   # 600+ lines API reference
  scripts/       # Executable tools

Skill Creation Checklist

RED Phase - Write Failing Test:

GREEN Phase - Write Minimal Skill:

REFACTOR Phase - Close Loopholes:

Quality Checks:

Deployment:

Discovery Workflow

How future Claude finds your skill:

  1. Encounters problem ("tests are flaky")
  2. Finds SKILL (description matches)
  3. Scans overview (is this relevant?)
  4. Reads patterns (quick reference table)
  5. Loads example (only when implementing)

Optimize for this flow - put searchable terms early and often.

Anti-Patterns

❌ Narrative Example

"In session 2025-10-03, we found empty projectDir caused..."

Why bad: Too specific, not reusable

❌ Multi-Language Dilution

example-js.js, example-py.py, example-go.go

Why bad: Mediocre quality, maintenance burden

❌ Generic Labels

helper1, helper2, step3, pattern4

Why bad: Labels should have semantic meaning

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).

If you follow TDD for code, follow it for skills. It's the same discipline applied to documentation.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.