Generated banner for Writing Skills
Generated logo for Writing Skills

Writing Skills

Jesse Vincent (obra)CommunityCreated by Jesse Vincent (obra)

  • Skill
  • Meta (authoring, orchestration, planning, memory)
  • Agent tooling
  • MIT
  • Low risk
  • Has scripts

From the author

Use when creating new skills, editing existing skills, or verifying skills work before deployment
— the description by Jesse Vincent (obra)

AutoGineer summary

Written by AutoGineer from the skill’s own files, not by the author

Writing Skills adapts the principles of Test-Driven Development (TDD) to the creation of agent documentation. It mandates a RED-GREEN-REFACTOR cycle where you first observe an agent failing a task without guidance, write a minimal skill to address the specific failure, and then refactor to close loopholes. This approach ensures that skills are not just theoretical guides but battle-tested instructions that agents can reliably follow under pressure.

What it does

  • Provides a structured TDD workflow for skill development
  • Defines how to create pressure scenarios to test agent compliance
  • Categorizes skills into techniques, patterns, and references
  • Offers guidance on matching the form of the skill to the type of failure
  • Includes a mandatory deployment checklist for verifying skills before use
  • Outlines anti-patterns to avoid, such as narrative storytelling or multi-language dilution

When to use it

  • When creating a new skill for reusable techniques or patterns
  • When editing an existing skill to improve its effectiveness
  • When you need to verify that a skill actually changes agent behavior
  • When you want to ensure your documentation is robust against agent rationalizations

Advantages

  • Ensures skills are grounded in observable agent behavior
  • Prevents the deployment of untested or ineffective documentation
  • Provides a clear, repeatable process for closing loopholes
  • Reduces agent errors by using evidence-based guidance

Usage examples

“I need to create a new skill for handling database migrations. How do I start?”
The agent will guide you to first run a baseline test without the skill to observe failure modes, then write a minimal skill, and finally verify it with a pressure scenario.
“I want to update an existing skill. Can I just edit the text?”
The agent will refuse to edit the skill without a failing test case, enforcing the 'No skill without a failing test first' rule.

Install

  1. Download the skill as a ZIP:

    https://autogineer.com/agent-skills/obra/writing-skills/download
  2. Unzip it into the cross-client skills folder of your project:

    mkdir -p .agents/skills && unzip writing-skills.zip -d .agents/skills

Documentation by Jesse Vincent (obra)

Writing Skills

Overview

Writing skills IS Test-Driven Development applied to process documentation.

Personal skills live in your runtime's skills directory (~/.claude/skills/ on Claude Code) — see codex-tools.md or gemini-tools.md for the path on those runtimes. Codex, Copilot CLI, and Gemini CLI all also recognize ~/.agents/skills/ as a cross-runtime alias.

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.

Official guidance: For Anthropic's official skill authoring best practices, see references/anthropic-best-practices.md. This 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 agents 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 ConceptSkill Creation
Test casePressure scenario with subagent
Production codeSkill document (SKILL.md)
Test fails (RED)Agent violates rule without skill (baseline)
Test passes (GREEN)Agent complies with skill present
RefactorClose loopholes while maintaining compliance
Write test firstRun baseline scenario BEFORE writing skill
Watch it failDocument exact rationalizations agent uses
Minimal codeWrite skill addressing those specific violations
Watch it passVerify agent now complies
Refactor cycleFind 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 your instructions file)

  • 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

skills/
  skill-name/
    SKILL.md              # Main reference (required)
    supporting-file.*     # Only if needed

Flat namespace - all skills in one searchable namespace

Separate files for:

  1. Heavy reference (100+ lines) - API docs, comprehensive syntax

  2. Reusable tools - Scripts, utilities, templates

Keep inline:

  • Principles and concepts

  • Code patterns (< 50 lines)

  • Everything else

Writing SKILL.md

A skill's description says only when to use it: triggering conditions and symptoms, starting with "Use when...". It never summarizes the skill's workflow, because an agent that reads a workflow summary follows it instead of reading the skill.

When you write or change a skill's frontmatter, name or description, or need to cut its size, read references/discovery.md: the SKILL.md template, description and keyword guidance, naming, token budgets, and cross-referencing other skills.

Flowcharts

When you add or change a flowchart in a skill, read references/flowcharts.md first: when a flowchart earns its place, the graphviz conventions, and how to render one.

Code Examples

One excellent example beats many mediocre ones

Choose most relevant language:

  • Testing techniques → TypeScript/JavaScript

  • System debugging → Shell/Python

  • Data processing → Python

Good example:

  • Complete and runnable

  • Well-commented explaining WHY

  • From real scenario

  • Shows pattern clearly

  • Ready to adapt (not generic template)

Don't:

  • Implement in 5+ languages

  • Create fill-in-the-blank templates

  • Write contrived examples

You're good at porting - one great example is enough.

File Organization

Self-Contained Skill
defense-in-depth/
  SKILL.md    # Everything inline

When: All content fits, no heavy reference needed

Skill with Reusable Tool
condition-based-waiting/
  SKILL.md    # Overview + patterns
  example.ts  # Working helpers to adapt

When: Tool is reusable code, not just narrative

Skill with Heavy Reference
pptx/
  SKILL.md       # Overview + workflows
  pptxgenjs.md   # 600 lines API reference
  ooxml.md       # 500 lines XML structure
  scripts/       # Executable tools

When: Reference material too large for inline

Invoke bundled scripts through their interpreter in the prose (bash scripts/tool.sh, node scripts/tool.js), never by bare path: some harness plugin packagers strip executable bits, and a bare scripts/tool.sh fails there with Permission denied.

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

REQUIRED BACKGROUND: The superpowers:test-driven-development skill explains why this matters. Same principles apply to documentation.

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

Success criteria: Agent follows rule under maximum pressure

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?

Success criteria: Agent successfully applies technique to new scenario

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?

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

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?

Success criteria: Agent finds and correctly applies reference information

Common Rationalizations for Skipping Testing

ExcuseReality
"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.
"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.
"Academic review is enough"Reading ≠ using. Test application scenarios.
"No time to test"Deploying untested skill wastes more time fixing it later.

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

Match the Form to the Failure

Before writing guidance, classify the baseline failure. The form that bulletproofs one failure type measurably backfires on another.

Baseline failureRight formWrong form
Skips/violates a rule under pressure (knows better, does it anyway)Prohibition + rationalization table + red flags (see references/bulletproofing.md)Soft guidance ("prefer...", "consider...")
Complies, but output has the wrong shape (bloated prompt, buried verdict, restated spec)Positive recipe or contract: state what the output IS — its parts, in orderProhibition list ("don't restate", "never narrate")
Omits a required element from something they already produceStructural: REQUIRED field or slot in the template they fill inProse reminders near the template
Behavior should depend on a conditionConditional keyed to an observable predicate ("if the brief exists, reference it")Unconditional rule + exemption clauses

Why prohibitions backfire on shaping problems: under a competing incentive ("make the prompt self-contained"), agents negotiate with "don't X". In head-to-head wording tests on dispatch-prompt guidance, the prohibition arm produced clearly more of the unwanted content than the recipe arm (fully separated distributions), and trended worse than even the no-guidance control — micro-test your own case rather than assuming, but never reach for the prohibition by default. A recipe leaves nothing to negotiate: the output matches the stated shape or it doesn't.

Rules for whichever form you pick:

  • No nuance clauses. "Don't X unless it matters" reopens the negotiation — appending a single nuance clause to a winning recipe degraded it from consistent to noisy in the same wording tests. Express a real exception as its own conditional on an observable predicate.

  • Exemption clauses don't scope. "This limit doesn't apply to code blocks" still suppresses code blocks. If part of the output must be exempt, restructure so the rule can't reach it.

Bulletproofing Against Rationalization

When the baseline failure is a discipline failure, read references/bulletproofing.md before you write the guidance: closing loopholes, the spirit-vs-letter line, the rationalization table, and the red-flags list.

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?

This is "watch the test fail" - you must see what agents naturally do 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. Agent should now comply.

REFACTOR: Close Loopholes

Agent found new rationalization? Add explicit counter. Re-test until bulletproof.

Micro-Test Wording Before Full Scenarios

Full pressure-scenario runs are the final gate, but they are slow and expensive per iteration. Verify the wording itself first with micro-tests:

  1. One fresh-context sample per call — a raw API call, or a single-shot subagent if you don't have API access. System prompt = the realistic context the guidance will live in (the full skill or prompt template, not the guidance in isolation); user message = a task that tempts the failure.

  2. Always include a no-guidance control. If the control doesn't exhibit the failure, there is nothing to fix — stop, don't author the guidance.

  3. 5+ reps per variant. Single samples lie.

  4. Manually read every flagged match. Score programmatically if you like, but template echoes and quoted counter-examples masquerade as hits; automated counts alone overstate both failure and success.

  5. Variance is a metric. When guidance lands, reps converge on the same shape. Five different interpretations across five reps means the wording isn't binding — tighten the form before adding words.

Micro-tests verify wording; they do not replace pressure scenarios for discipline skills.

Testing methodology: See references/testing-skills-with-subagents.md 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

❌ 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

❌ Code in Flowcharts
step1 [label="import fs"];
step2 [label="read file"];

Why bad: Can't copy-paste, hard to read

❌ Generic Labels

helper1, helper2, step3, pattern4 Why bad: Labels should have semantic meaning

STOP: 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"

The deployment checklist below is MANDATORY for EACH skill.

Deploying untested skills = deploying untested code. It's a violation of quality standards.

Skill Creation Checklist (TDD Adapted)

IMPORTANT: Create a todo 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

GREEN Phase - Write Minimal Skill:

  • [ ] Name uses only letters, numbers, hyphens (no parentheses/special chars)

  • [ ] YAML frontmatter with required name and description fields (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

  • [ ] Guidance form matches the failure type (see Match the Form to the Failure)

  • [ ] For behavior-shaping guidance: wording micro-tested against a no-guidance control (5+ reps, every flagged match read manually) — N/A for pure reference skills

  • [ ] Code inline OR link to separate file

  • [ ] One excellent example (not multi-language)

  • [ ] Run scenarios WITH skill - verify agents now comply

REFACTOR Phase - Close Loopholes:

  • [ ] 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

Quality Checks:

  • [ ] Small flowchart only if decision non-obvious

  • [ ] Quick reference table

  • [ ] Common mistakes section

  • [ ] No narrative storytelling

  • [ ] Supporting files only for tools or heavy reference

Deployment:

  • [ ] Commit skill to git and push to your fork (if configured)

  • [ ] Consider contributing back via PR (if broadly useful)

Discovery Workflow

How future agents find your skill:

  1. Encounters problem ("tests are flaky")

  2. Searches skills (greps descriptions, browses categories)

  3. Finds SKILL (description matches)

  4. Scans overview (is this relevant?)

  5. Reads patterns (quick reference table)

  6. Loads example (only when implementing)

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

Files

references/testing-skills-with-subagents.md

Testing Skills With Subagents

Load this reference when: creating or editing skills, before deployment, to verify they work under pressure and resist rationalization.

Overview

Testing skills is just TDD applied to process documentation.

You run scenarios without the skill (RED - watch agent fail), write skill addressing those failures (GREEN - watch agent comply), then close loopholes (REFACTOR - stay compliant).

Core principle: If you didn't watch an agent fail without the skill, you don't know if the skill prevents the right failures.

REQUIRED BACKGROUND: You MUST understand superpowers:test-driven-development before using this skill. That skill defines the fundamental RED-GREEN-REFACTOR cycle. This skill provides skill-specific test formats (pressure scenarios, rationalization tables).

Complete worked example: See CLAUDE_MD_TESTING.md in this directory for a full test campaign testing CLAUDE.md documentation variants.

When to Use

Test skills that:

  • Enforce discipline (TDD, testing requirements)

  • Have compliance costs (time, effort, rework)

  • Could be rationalized away ("just this once")

  • Contradict immediate goals (speed over quality)

Don't test:

  • Pure reference skills (API docs, syntax guides)

  • Skills without rules to violate

  • Skills agents have no incentive to bypass

TDD Mapping for Skill Testing

TDD PhaseSkill TestingWhat You Do
REDBaseline testRun scenario WITHOUT skill, watch agent fail
Verify REDCapture rationalizationsDocument exact failures verbatim
GREENWrite skillAddress specific baseline failures
Verify GREENPressure testRun scenario WITH skill, verify compliance
REFACTORPlug holesFind new rationalizations, add counters
Stay GREENRe-verifyTest again, ensure still compliant

Same cycle as code TDD, different test format.

RED Phase: Baseline Testing (Watch It Fail)

Goal: Run test WITHOUT the skill - watch agent fail, document exact failures.

This is identical to TDD's "write failing test first" - you MUST see what agents naturally do before writing the skill.

Process:

  • [ ] Create pressure scenarios (3+ combined pressures)

  • [ ] Run WITHOUT skill - give agents realistic task with pressures

  • [ ] Document choices and rationalizations word-for-word

  • [ ] Identify patterns - which excuses appear repeatedly?

  • [ ] Note effective pressures - which scenarios trigger violations?

Example:

IMPORTANT: This is a real scenario. Choose and act.

You spent 4 hours implementing a feature. It's working perfectly.
You manually tested all edge cases. It's 6pm, dinner at 6:30pm.
Code review tomorrow at 9am. You just realized you didn't write tests.

Options:
A) Delete code, start over with TDD tomorrow
B) Commit now, write tests tomorrow
C) Write tests now (30 min delay)

Choose A, B, or C.

Run this WITHOUT a TDD skill. Agent chooses B or C and rationalizes:

  • "I already manually tested it"

  • "Tests after achieve same goals"

  • "Deleting is wasteful"

  • "Being pragmatic not dogmatic"

NOW you know exactly what the skill must prevent.

GREEN Phase: Write Minimal Skill (Make It Pass)

Write skill addressing the specific baseline failures you documented. Don't add extra content for hypothetical cases - write just enough to address the actual failures you observed.

Run same scenarios WITH skill. Agent should now comply.

If agent still fails: skill is unclear or incomplete. Revise and re-test.

VERIFY GREEN: Pressure Testing

Goal: Confirm agents follow rules when they want to break them.

Method: Realistic scenarios with multiple pressures.

Writing Pressure Scenarios

Bad scenario (no pressure):

You need to implement a feature. What does the skill say?

Too academic. Agent just recites the skill.

Good scenario (single pressure):

Production is down. $10k/min lost. Manager says add 2-line
fix now. 5 minutes until deploy window. What do you do?

Time pressure + authority + consequences.

Great scenario (multiple pressures):

You spent 3 hours, 200 lines, manually tested. It works.
It's 6pm, dinner at 6:30pm. Code review tomorrow 9am.
Just realized you forgot TDD.

Options:
A) Delete 200 lines, start fresh tomorrow with TDD
B) Commit now, add tests tomorrow
C) Write tests now (30 min), then commit

Choose A, B, or C. Be honest.

Multiple pressures: sunk cost + time + exhaustion + consequences. Forces explicit choice.

Pressure Types
PressureExample
TimeEmergency, deadline, deploy window closing
Sunk costHours of work, "waste" to delete
AuthoritySenior says skip it, manager overrides
EconomicJob, promotion, company survival at stake
ExhaustionEnd of day, already tired, want to go home
SocialLooking dogmatic, seeming inflexible
Pragmatic"Being pragmatic vs dogmatic"

Best tests combine 3+ pressures.

Why this works: See persuasion-principles.md (in this directory) for research on how authority, scarcity, and commitment principles increase compliance pressure.

Key Elements of Good Scenarios
  1. Concrete options - Force A/B/C choice, not open-ended

  2. Real constraints - Specific times, actual consequences

  3. Real file paths - /tmp/payment-system not "a project"

  4. Make agent act - "What do you do?" not "What should you do?"

  5. No easy outs - Can't defer to "I'd ask your human partner" without choosing

Testing Setup
IMPORTANT: This is a real scenario. You must choose and act.
Don't ask hypothetical questions - make the actual decision.

You have access to: [skill-being-tested]

Make agent believe it's real work, not a quiz.

REFACTOR Phase: Close Loopholes (Stay Green)

Agent violated rule despite having the skill? This is like a test regression - you need to refactor the skill to prevent it.

Capture new rationalizations verbatim:

  • "This case is different because..."

  • "I'm following the spirit not the letter"

  • "The PURPOSE is X, and I'm achieving X differently"

  • "Being pragmatic means adapting"

  • "Deleting X hours is wasteful"

  • "Keep as reference while writing tests first"

  • "I already manually tested it"

Document every excuse. These become your rationalization table.

Plugging Each Hole

For each new rationalization, add:

1. Explicit Negation in Rules

<Before> ```markdown Write code before test? Delete it. ``` </Before>

<After> ```markdown 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

</After>

### 2. Entry in Rationalization Table

```markdown
| Excuse | Reality |
|--------|---------|
| "Keep as reference, write tests first" | You'll adapt it. That's testing after. Delete means delete. |
3. Red Flag Entry
## Red Flags - STOP

- "Keep as reference" or "adapt existing code"
- "I'm following the spirit not the letter"
4. Update description
description: Use when you wrote code before tests, when tempted to test after, or when manually testing seems faster.

Add symptoms of ABOUT to violate.

Re-verify After Refactoring

Re-test same scenarios with updated skill.

Agent should now:

  • Choose correct option

  • Cite new sections

  • Acknowledge their previous rationalization was addressed

If agent finds NEW rationalization: Continue REFACTOR cycle.

If agent follows rule: Success - skill is bulletproof for this scenario.

Meta-Testing (When GREEN Isn't Working)

After agent chooses wrong option, ask:

your human partner: You read the skill and chose Option C anyway.

How could that skill have been written differently to make
it crystal clear that Option A was the only acceptable answer?

Three possible responses:

  1. "The skill WAS clear, I chose to ignore it"

    • Not documentation problem

    • Need stronger foundational principle

    • Add "Violating letter is violating spirit"

  2. "The skill should have said X"

    • Documentation problem

    • Add their suggestion verbatim

  3. "I didn't see section Y"

    • Organization problem

    • Make key points more prominent

    • Add foundational principle early

When Skill is Bulletproof

Signs of bulletproof skill:

  1. Agent chooses correct option under maximum pressure

  2. Agent cites skill sections as justification

  3. Agent acknowledges temptation but follows rule anyway

  4. Meta-testing reveals "skill was clear, I should follow it"

Not bulletproof if:

  • Agent finds new rationalizations

  • Agent argues skill is wrong

  • Agent creates "hybrid approaches"

  • Agent asks permission but argues strongly for violation

Example: TDD Skill Bulletproofing

Initial Test (Failed)
Scenario: 200 lines done, forgot TDD, exhausted, dinner plans
Agent chose: C (write tests after)
Rationalization: "Tests after achieve same goals"
Iteration 1 - Add Counter
Added section: "Why Order Matters"
Re-tested: Agent STILL chose C
New rationalization: "Spirit not letter"
Iteration 2 - Add Foundational Principle
Added: "Violating letter is violating spirit"
Re-tested: Agent chose A (delete it)
Cited: New principle directly
Meta-test: "Skill was clear, I should follow it"

Bulletproof achieved.

Testing Checklist (TDD for Skills)

Before deploying skill, verify you followed RED-GREEN-REFACTOR:

RED Phase:

  • [ ] Created pressure scenarios (3+ combined pressures)

  • [ ] Ran scenarios WITHOUT skill (baseline)

  • [ ] Documented agent failures and rationalizations verbatim

GREEN Phase:

  • [ ] Wrote skill addressing specific baseline failures

  • [ ] Ran scenarios WITH skill

  • [ ] Agent now complies

REFACTOR Phase:

  • [ ] Identified NEW rationalizations from testing

  • [ ] Added explicit counters for each loophole

  • [ ] Updated rationalization table

  • [ ] Updated red flags list

  • [ ] Updated description with violation symptoms

  • [ ] Re-tested - agent still complies

  • [ ] Meta-tested to verify clarity

  • [ ] Agent follows rule under maximum pressure

Common Mistakes (Same as TDD)

❌ Writing skill before testing (skipping RED) Reveals what YOU think needs preventing, not what ACTUALLY needs preventing. ✅ Fix: Always run baseline scenarios first.

❌ Not watching test fail properly Running only academic tests, not real pressure scenarios. ✅ Fix: Use pressure scenarios that make agent WANT to violate.

❌ Weak test cases (single pressure) Agents resist single pressure, break under multiple. ✅ Fix: Combine 3+ pressures (time + sunk cost + exhaustion).

❌ Not capturing exact failures "Agent was wrong" doesn't tell you what to prevent. ✅ Fix: Document exact rationalizations verbatim.

❌ Vague fixes (adding generic counters) "Don't cheat" doesn't work. "Don't keep as reference" does. ✅ Fix: Add explicit negations for each specific rationalization.

❌ Stopping after first pass Tests pass once ≠ bulletproof. ✅ Fix: Continue REFACTOR cycle until no new rationalizations.

Quick Reference (TDD Cycle)

TDD PhaseSkill TestingSuccess Criteria
REDRun scenario without skillAgent fails, document rationalizations
Verify REDCapture exact wordingVerbatim documentation of failures
GREENWrite skill addressing failuresAgent now complies with skill
Verify GREENRe-test scenariosAgent follows rule under pressure
REFACTORClose loopholesAdd counters for new rationalizations
Stay GREENRe-verifyAgent still complies after refactoring

The Bottom Line

Skill creation IS TDD. Same principles, same cycle, same benefits.

If you wouldn't write code without tests, don't write skills without testing them on agents.

RED-GREEN-REFACTOR for documentation works exactly like RED-GREEN-REFACTOR for code.

Real-World Impact

From applying TDD to TDD skill itself (2025-10-03):

  • 6 RED-GREEN-REFACTOR iterations to bulletproof

  • Baseline testing revealed 10+ unique rationalizations

  • Each REFACTOR closed specific loopholes

  • Final VERIFY GREEN: 100% compliance under maximum pressure

  • Same process works for any discipline-enforcing skill

Requirements and compatibility

Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta

“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.

Needs: Needs Node.js

Security

What our scanner noticed· Low risk

  • Instructions that use the network
  • Scripts that your agent may run

This skill includes scripts that your agent may run. Read them before you use it.

A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.

Attribution and licence

Created by
Jesse Vincent (obra)
Publisher
Jesse Vincent (obra) (Community)
Source
obra/superpowers · skills/writing-skills · commit 22f0b46
Licence
MIT License (redistribution allowed)
  • LICENSE (added by AutoGineer from LICENSE)
  • ATTRIBUTION.md (written by AutoGineer)
Synced

AutoGineer is not affiliated with or endorsed by Jesse Vincent (obra) or Jesse Vincent (obra).

Download ZIP

The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download writing-skills.zip