writing-skills

Apply RED-GREEN-REFACTOR cycles to create and test AI skills.

270k|24.1k|Updated Oct 9, 2025
One-click install
npx skills add https://github.com/obra/superpowers --skill writing-skills-obra
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: writing-skills
Source: https://github.com/obra/superpowers/tree/main/skills/writing-skills
Command: npx skills add https://github.com/obra/superpowers --skill writing-skills-obra

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solves? This Skill guides the creation and editing of skills (process documentation) using a Test-Driven Development (TDD) approach. It ensures skills are robust, discoverable, and resist rationalization by agents under pressure, making them truly effective.

Core Features & Use Cases

  • TDD for Documentation: Applies the RED-GREEN-REFACTOR cycle to skill creation, starting with baseline testing (watching agents fail without the skill) and iterating to close loopholes.
  • Claude Search Optimization (CSO): Provides critical guidance on writing rich descriptions, using keywords, and optimizing token efficiency for optimal skill discovery.
  • Bulletproofing Against Rationalization: Teaches how to explicitly negate workarounds, address "spirit vs. letter" arguments, and build rationalization tables to make skills resistant to bypass.
  • Use Case: When developing a new skill for a critical workflow like TDD, this skill ensures you don't just write the rules, but rigorously test them with subagents under pressure, making the skill truly effective and non-negotiable.

Quick Start

Example: Creating a new skill

REQUIRED BACKGROUND: Understand superpowers:test-driven-development

RED Phase - Write Failing Test:

- Create pressure scenarios (3+ combined pressures for discipline skills).

- Run scenarios WITHOUT skill, document agent failures and rationalizations verbatim.

GREEN Phase - Write Minimal Skill:

- Name: Skill-Name-With-Hyphens (letters, numbers, hyphens only).

- YAML frontmatter: name and description only (max 1024 chars total).

- Description: Starts with "Use when...", includes specific triggers/symptoms, third person.

- Address specific baseline failures.

- Run scenarios WITH skill, verify agents now comply.

REFACTOR Phase - Close Loopholes:

- Identify NEW rationalizations from testing.

- Add explicit counters, build rationalization table, create red flags list.

- Re-test until bulletproof.

Claude Search Optimization (CSO) - Description Example:

✅ GOOD: Use when tests have race conditions, timing dependencies, or pass/fail inconsistently - replaces arbitrary timeouts with condition polling for reliable async tests

Frequently Asked Questions about writing-skills

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I apply test-driven development to write better AI skills?

Test-driven development for skills means writing failing test scenarios first (RED phase), then building minimal skill definitions to pass them (GREEN phase), then closing loopholes by identifying and countering rationalizations (REFACTOR phase). This approach ensures skills are bulletproof and resist agent workarounds under pressure.

What makes a skill resistant to rationalization by AI agents?

Rationalization resistance comes from explicit counters to workarounds, rationalization tables that anticipate "spirit vs. letter" arguments, and red flags lists built during REFACTOR cycles. Testing with subagents under combined pressures reveals these loopholes before deployment.

How do I structure a skill for Claude Search Optimization?

Claude Search Optimization requires YAML frontmatter with name and description fields (max 1024 chars), a description starting with "Use when..." plus specific triggers and symptoms in third person, and rich keywords matching search queries. Token efficiency and discoverability improve when descriptions target concrete failure scenarios users face.

What are the required components for a compliant skill definition?

A skill requires: name field with hyphens only (letters, numbers, hyphens), YAML frontmatter with description, structured SKILL.md sections, and concise triggering descriptions. RED-GREEN-REFACTOR cycles and baseline testing against agent failures satisfy technical compliance requirements.

Can I use this approach for skills beyond testing and documentation?

Yes. The RED-GREEN-REFACTOR cycle applies to any skill creation workflow. The approach is domain-agnostic; the metadata example shows TDD application, but the rationalization-bulletproofing method works for any skill where agents might bypass intent under pressure or competing objectives.

What happens if I skip the REFACTOR phase when writing a skill?

Skipping REFACTOR leaves rationalizations unaddressed. Agents will exploit gaps between the skill's stated intent and edge cases not explicitly countered. Testing without REFACTOR cycles produces skills that work in baseline scenarios but fail under pressure, competing priorities, or creative reinterpretation.