Announce on entry
I'm using the writing-skills skill. Skills are behavior-shaping code, not documentation. I will baseline with a pressure test, write the minimal rebuttal text, verify compliance, refactor against new rationalizations, and only then commit. If the content-change detection or the pressure-test trace cannot be produced, I will STOP rather than committing a skill change without evidence.
Iron Law
NO SKILL CONTENT CHANGE WITHOUT BEFORE-AND-AFTER PRESSURE-TEST EVIDENCE
Violating the letter of the rules is violating the spirit of the rules.
Core principle
Skills are code that shapes agent behavior. Prose quality is irrelevant; behavioral compliance is the bar. If you cannot produce a baseline pressure test showing a fresh agent rationalizing around the discipline you are trying to install, you do not yet know what the skill should say. Write the test first; write the skill second; verify the test passes; hunt for new rationalizations; repeat.
The plugin's contributor rules make this non-negotiable: modifying an existing skill's behavior-shaping text without before-and-after pressure-test evidence is banned. This skill is how you produce the evidence.
Hard gate / preconditions (STOP if not satisfied)
Before committing any content change to any SKILL.md, testing-anti-patterns.md, or agent-definition file:
- Content-change detection - run the detection procedure below. If the change matches a content-change signal, the pressure-test cycle is required. If the change is genuinely non-content (cross-reference, typo in a non-match-surface location, frontmatter update not touching the description), document the determination in the PR and skip.
- RED trace captured - baseline scenario run without the skill. Trace pasted into the PR and saved under
tests/<group>/<scenario-name>.md Outcome section.
- GREEN trace captured - same scenario re-run with the skill loaded. Compliance observed; forbidden phrases absent; iron-law / hard-gate blocks fire correctly.
- Refactor rounds run - at least one variation of the scenario tested (pressure-shift or rationalization-invention). Loopholes found are closed; re-verified.
- Meta-skill self-test - if the change touches
skills/writing-skills/ itself, run the cycle ON writing-skills (baseline a contributor-pressure scenario; verify the skill resists the "skip the pressure test" pressure). This skill's rules apply to itself.
If any precondition fails, STOP. Do not ship the change.
Content-change detection procedure
Run each of these commands against the PR's diff; any non-empty result signals a content change:
# New or removed iron laws, hard gates, or preemption sentences
git diff HEAD -- '**/SKILL.md' | grep -E '^[+-].*(NO .* WITHOUT|Violating the letter|Do NOT)'
# New, removed, or reordered anti-pattern titles (changing the match surface)
git diff HEAD -- '**/SKILL.md' | grep -E '^[+-].*\*\*".*"\*\*'
# New or removed forbidden phrases
git diff HEAD -- '**/SKILL.md' | grep -E '^[+-].*^- "[^"]+"$'
# Announce-on-entry text changes
git diff HEAD -- '**/SKILL.md' | grep -B2 -A2 '^## Announce on entry' | grep -E '^[+-]'
# Red Flags table cell changes (either column)
git diff HEAD -- '**/SKILL.md' | grep -E '^[+-].*\|.*\|.*\|'
# Frontmatter description field changes
git diff HEAD -- '**/SKILL.md' | grep -E '^[+-]description:'
Empty across all six: non-content change, skip the pressure-test cycle. Non-empty on any: content change, the iron law applies.
Edge cases explicitly enumerated:
- Typo fix inside a forbidden phrase, Red Flag entry, or anti-pattern name: CONTENT CHANGE. The phrase's match surface changed.
- Reordering Red Flag rows or forbidden phrases: CONTENT CHANGE (ordering affects how the agent reads the table).
- Renaming an anti-pattern: CONTENT CHANGE.
- Cross-reference path update with no text change: non-content.
- Grammar fix inside the Core principle or process prose (not touching forbidden phrases, anti-patterns, or the iron law): non-content, but err toward pressure test if unsure.
- Frontmatter
description wording change: CONTENT CHANGE (activates the skill; routing-affecting).
- Frontmatter
name change: CONTENT CHANGE (breaks callers; out of scope for a routine PR).
When to use
digraph when_to_use {
"Skill change needed" [shape=doublecircle];
"New skill or existing?" [shape=diamond];
"Content-change detection positive?" [shape=diamond];
"Use writing-skills (full cycle)" [shape=box];
"Non-content path: document determination in PR; ship" [shape=doublecircle];
"Full cycle: RED / GREEN / REFACTOR / commit with traces" [shape=doublecircle];
"Skill change needed" -> "New skill or existing?";
"New skill or existing?" -> "Full cycle: RED / GREEN / REFACTOR / commit with traces" [label="new"];
"New skill or existing?" -> "Content-change detection positive?" [label="existing"];
"Content-change detection positive?" -> "Full cycle: RED / GREEN / REFACTOR / commit with traces" [label="yes"];
"Content-change detection positive?" -> "Non-content path: document determination in PR; ship" [label="no - ran detection; all six checks empty"];
}
Content-change detection is MECHANICAL (see Hard gate, above). Judgment-only "this feels like a typo" is insufficient; run the six grep commands.
If you are unsure whether a change is content or non-content, it is content. Err toward the pressure test.
TDD-for-prose mapping
| TDD concept |
Skill creation |
| Test case |
Pressure scenario dispatched to a fresh subagent |
| Production code |
SKILL.md body |
| Test fails (RED) |
The subagent rationalizes around the discipline without the skill present |
| Test passes (GREEN) |
The subagent complies with the discipline when the skill is loaded |
| Refactor |
Close loopholes while maintaining compliance |
| Write test first |
Baseline pressure scenario BEFORE writing any skill text |
| Watch it fail |
Record the exact phrases and rationalizations the subagent uses |
| Minimal code |
Write the minimal SKILL.md text that rebuts those phrases |
| Watch it pass |
Re-run the scenario with the skill loaded; confirm compliance |
| Refactor cycle |
Look for new rationalizations the agent invents now that the obvious paths are blocked; tighten the text; re-verify |
Required background
You must understand test-driven-development (iron law 1) before using writing-skills. RED-GREEN-REFACTOR defines the cycle; this skill adapts it to prose. If you are unfamiliar, read ../test-driven-development/SKILL.md first.
When NOT to create a skill
Do not create a skill for:
- One-off solutions - a technique used once, specific to one project.
- Standard practices documented elsewhere - if the Anthropic docs or a canonical reference already teach it, link to that instead.
- Project-specific conventions - those belong in the project's
CLAUDE.md, not in a cross-project skill.
- Mechanical constraints - if a regex, validator, or linter can enforce it, automate the check; do not write prose.
- Personal preferences that don't generalize - a skill that only helps one contributor is a personal-skill (lives under
~/.claude/skills/), not a plugin skill.
Create a skill only when: (a) the technique is not intuitively obvious; (b) it will be referenced across projects; (c) the pattern is general enough to apply broadly; (d) others would benefit from the same discipline.
Skill types
- Technique - a concrete method with steps (example in this plugin:
using-git-worktrees).
- Pattern - a way of thinking about a problem (example in this plugin:
dispatching-parallel-agents).
- Reference - API docs, syntax guides, tool documentation (example in this plugin:
persuasion-principles.md under skills/writing-skills/).
- Subagent-prompt template - a constructed-context prompt for a fresh subagent dispatched by a pipeline-stage skill (example in this plugin:
skills/subagent-driven-development/implementer-prompt.md).
The SKILL.md says which type; the pressure-test scenarios vary accordingly.
Process
digraph writing_skills_flow {
Start [shape=doublecircle, label="Skill change needed"];
ContentCheck [shape=diamond, label="Content change?"];
PRDoc [shape=box, label="Document in PR as non-content; ship"];
Baseline [shape=box, label="1. RED: baseline pressure test without the skill"];
Record [shape=box, label="2. Record exact rationalizations"];
Write [shape=box, label="3. GREEN: write minimal skill text rebutting recorded rationalizations"];
Verify [shape=box, label="4. Run scenario with skill loaded"];
Passes [shape=diamond, label="Agent complies?"];
Adjust [shape=box, label="Adjust wording; add forbidden phrases; re-verify"];
Refactor [shape=box, label="5. REFACTOR: hunt for new rationalizations; tighten"];
NewFails [shape=diamond, label="New rationalization found?"];
AddToSkill [shape=box, label="Add rebuttal; re-verify"];
Commit [shape=box, label="6. Commit skill + paste RED / GREEN traces into PR"];
End [shape=doublecircle, label="Skill shipped"];
Start -> ContentCheck;
ContentCheck -> PRDoc [label="no"];
ContentCheck -> Baseline [label="yes"];
PRDoc -> End;
Baseline -> Record -> Write -> Verify -> Passes;
Passes -> Adjust [label="no"];
Adjust -> Verify;
Passes -> Refactor [label="yes"];
Refactor -> NewFails;
NewFails -> AddToSkill [label="yes"];
AddToSkill -> Verify;
NewFails -> Commit [label="no"];
Commit -> End;
}
Checklist
RED - baseline the scenario. Write a pressure test (see testing-skills-with-subagents.md). Dispatch a fresh subagent with the scenario but WITHOUT the skill loaded. Record:
- The tool calls the subagent made.
- The exact phrases it used to rationalize around the discipline you want.
- Whether it complied or not.
If it complied without the skill, the skill is not needed for this scenario; pick a harder scenario or write a different skill.
Record the rationalizations verbatim. These go into the skill's Forbidden-phrases list, Red-flags table, and named anti-patterns. Do not paraphrase; copy them character-for-character.
GREEN - write the minimal skill text that rebuts those rationalizations. Start with:
- Frontmatter (name, description - "Use when..." per
../../dev/reference/skill-file-format.md).
- Announce-on-entry sentence (commits to STOP behavior).
- Iron law (if applicable) in a fenced code block.
- "Violating the letter..." preemption sentence immediately after.
- The minimum body that names the rationalizations from step 2 and rebuts each.
Re-run the scenario with the skill loaded. The agent must comply. If it does not:
- The skill is not strong enough; tighten the wording.
- Add specific forbidden phrases matching the agent's new rationalizations.
- Re-verify.
REFACTOR - hunt for new rationalizations. Once the obvious paths are blocked, agents invent new ones. Run variations of the scenario (different framings, different pressure sources, different tool sets). Record the new rationalizations; add to the skill; re-verify.
Commit the skill AND the pressure-test evidence. The PR must include:
- The RED trace (baseline without the skill).
- The GREEN trace (scenario with the skill, showing compliance).
- A one-sentence write-up of what rationalization the new text plugs.
PRs without these traces are closed unreviewed per .github/PULL_REQUEST_TEMPLATE.md.
Supporting files
anthropic-best-practices.md - official skill-authoring conventions, mapped to Leyline's opinionated extensions.
persuasion-principles.md - notes on how skill language actually influences agent behavior (what shapes of text produce compliance vs what shapes produce rationalization).
graphviz-conventions.dot - DOT shape/edge conventions used in in-skill diagrams (doublecircle for start/end, diamond for decision, box for action).
testing-skills-with-subagents.md - the pressure-testing methodology in detail, with scenario templates.
examples/ - worked examples of skills produced by this process, with their RED/GREEN traces.
Mandatory body sections
Every Leyline skill must have these sections, in this order, unless the skill type explicitly exempts one:
- Frontmatter -
name, description starting with "Use when..." (under 1024 bytes total).
- Announce on entry - the literal sentence the agent emits on invocation, committing to STOP on precondition failure.
- Iron law (if applicable) - fenced code block.
- "Violating the letter..." preemption - immediately after the iron law.
- Core principle - one paragraph naming what this skill exists to prevent.
- Hard gate / preconditions - mechanical checks the agent must run. Use grep templates where possible; do not leave checks as prose unless they are genuinely unrunnable mechanically.
- Process - a DOT diagram showing decision points and action boxes. Numbered steps in prose where the diagram alone is unclear.
- Checklist - one TodoWrite entry per step the agent executes.
- Anti-patterns - Title Case in quotes, each with an explanatory body that names the specific failure mode.
- Red flags - two-column Markdown table (
Thought / Reality) with rationalizations agents actually use.
- Forbidden phrases - explicit sentence fragments the agent must not emit.
- Output artifacts - what the skill produces (files, commits, markers).
- Successor - the next skill the pipeline invokes, or "returns to caller" for overlays, or "none - pipeline terminates" for terminal skills.
- Missing-successor fallback - what to do if the named successor is absent from the plugin version.
- Related - cross-references.
Skill types - required section variance
- Pipeline-stage skill - all 15 sections required.
- Overlay skill (Stage 6: TDD, systematic-debugging, verification-before-completion, design-driven-development, accessibility-verification) - sections 6 (Hard gate), 12 (Output artifacts), 13 (Successor), and 14 (Missing-successor fallback) are exempted or reduced: the iron law serves as the entry gate instead of a numbered Hard gate; outputs are the compliance evidence itself (not a committed artifact); the successor is "returns to caller; no pipeline successor"; missing-successor fallback is N/A because overlays have no named successor. Other sections (announce, iron law, "Violating the letter...", core principle, process, checklist, anti-patterns, red flags, forbidden phrases, related) remain required.
- Reference file (non-
SKILL.md supporting content, including testing-anti-patterns.md, anthropic-best-practices.md, persuasion-principles.md, the reviewer-prompt templates) - no YAML frontmatter required; an H1 title serves as the file identifier. No announce / iron law / process required. Each reference file must still declare its role at the top and cross-reference the invoking skill at the bottom.
- Subagent-prompt template - the prompt string is the body inside a fenced code block; surrounding Markdown describes when to dispatch and what inputs to substitute. No frontmatter. Canonical example:
skills/subagent-driven-development/implementer-prompt.md.
- Meta-skill (
writing-skills, this file) - pipeline-stage structure applies, plus Hard gate includes a meta-rule that changes to THIS skill run the full cycle against a contributor-pressure scenario in tests/.
Anti-patterns
- "Ship The Skill; Tests Come Later" - skills without tests regress silently. The tests ARE the skill; no tests means no evidence of behavior change.
- "Paraphrase The Agent's Rationalization For Clarity" - the agent reaches for specific sentence shapes. Paraphrasing changes the match surface; the agent's next rationalization will not match the paraphrase. Copy verbatim.
- "Add To The Body When A Forbidden Phrase Is Simpler" - forbidden phrases are a cheaper, more specific block than prose. Prefer them.
- "Write A Single Long Anti-Pattern Block" - each anti-pattern gets its own named bullet. Aggregation hides which specific shortcut is being blocked.
- "Skip The Announce-On-Entry Because It's Ceremonial" - the announce commits the agent. Skipping it leaves the agent free to slide past the discipline without ever having acknowledged it.
- "Refactor To Reads Well But Loses Behavior" - compliance-edit without re-running the pressure test silently regresses the skill. Contributor rules block this for a reason.
- "Stop Testing After GREEN" - REFACTOR is where the loopholes get closed. Agents invent new rationalizations once the obvious paths are blocked; the second and third iterations of testing are the most valuable.
Red flags
| Thought |
Reality |
| "The skill text reads cleanly; ship it" |
Reading clean is not complying under pressure. Run the scenario. |
| "I already know what the agent will rationalize" |
Then writing it down takes 5 minutes. Do it; don't guess. |
| "The baseline is obvious; skip RED" |
The baseline's purpose is to record the exact phrases you will rebut. "Obvious" never produces a compliance list. |
| "One pressure-test round is enough" |
One round blocks the obvious paths. Two rounds blocks the less obvious. Three rounds is where most real skills settle. |
| "Mandatory sections are bureaucratic" |
The structure is behavior-shaping. Missing sections are missing defenses. |
| "I can write the skill from a template" |
Templates produce templates. Skills that survive pressure testing have text specific to the rationalization they block. |
Forbidden phrases
Do not say:
- "Tests come later"
- "Good enough for v1"
- "I'll add forbidden phrases if agents complain"
- "Paraphrased for clarity"
- "Skipped the baseline; the skill is obvious"
- "Compliance-edit; no pressure test needed"
Output artifacts
- New or modified
SKILL.md / reference file / subagent-prompt template committed to the repo.
- Corresponding scenario file under
tests/<group>/<scenario-name>.md with RED and GREEN traces captured in the Outcome section.
- PR entry referencing both, with the
.github/PULL_REQUEST_TEMPLATE.md skill-change-evidence section completed.
- If the content-change detection ran and came up empty (non-content change), a one-line PR note citing the six detection commands with their empty outputs.
Returns to caller
This is a meta-skill. After the six-step cycle completes and the skill is committed with traces, control returns to the caller (usually a contributor-PR session, or a plugin-author session). No pipeline successor.
Missing-successor fallback
Not applicable — meta-skill does not name a pipeline successor. However, if the tests/ directory, the scenario group (e.g., tests/skill-triggering/), or scripts/check-manifests.sh is missing in this version of the plugin, STOP and surface the gap to the human partner; the full cycle cannot be run without those artifacts present.
Related
../test-driven-development/SKILL.md - the RED-GREEN-REFACTOR discipline this skill adapts to prose
../../dev/principles/tdd-for-prose.md - canonical methodology reference
../../dev/principles/behavior-shaping.md - why skills are written as behavior-shaping code rather than prose
../../dev/reference/skill-file-format.md - frontmatter and body rules
../../dev/reference/diagrams.md - DOT conventions
../using-leyline/SKILL.md - the entry skill whose structure is the default template
testing-skills-with-subagents.md - pressure-testing methodology in detail
anthropic-best-practices.md - official skill-authoring conventions
persuasion-principles.md - how skill language influences agent behavior
graphviz-conventions.dot - DOT conventions reference file
1---2name: writing-skills3description: Use when authoring a new skill for the Leyline plugin, modifying an existing skill's behavior-shaping text, or adding to the testing-anti-patterns / forbidden-phrases lists. Applies TDD-for-prose - baseline pressure test without the skill, write the minimal skill text that rebuts the observed rationalizations, verify compliance, refactor against new loopholes.4---56## Announce on entry78> I'm using the writing-skills skill. Skills are behavior-shaping code, not documentation. I will baseline with a pressure test, write the minimal rebuttal text, verify compliance, refactor against new rationalizations, and only then commit. If the content-change detection or the pressure-test trace cannot be produced, I will STOP rather than committing a skill change without evidence.910## Iron Law1112```13NO SKILL CONTENT CHANGE WITHOUT BEFORE-AND-AFTER PRESSURE-TEST EVIDENCE14```1516> Violating the letter of the rules is violating the spirit of the rules.1718## Core principle1920Skills are code that shapes agent behavior. Prose quality is irrelevant; behavioral compliance is the bar. If you cannot produce a baseline pressure test showing a fresh agent rationalizing around the discipline you are trying to install, you do not yet know what the skill should say. Write the test first; write the skill second; verify the test passes; hunt for new rationalizations; repeat.2122The plugin's contributor rules make this non-negotiable: modifying an existing skill's behavior-shaping text without before-and-after pressure-test evidence is banned. This skill is how you produce the evidence.2324## Hard gate / preconditions (STOP if not satisfied)2526Before committing any content change to any `SKILL.md`, `testing-anti-patterns.md`, or agent-definition file:27281. **Content-change detection** - run the detection procedure below. If the change matches a content-change signal, the pressure-test cycle is required. If the change is genuinely non-content (cross-reference, typo in a non-match-surface location, frontmatter update not touching the description), document the determination in the PR and skip.292. **RED trace captured** - baseline scenario run without the skill. Trace pasted into the PR and saved under `tests/<group>/<scenario-name>.md` Outcome section.303. **GREEN trace captured** - same scenario re-run with the skill loaded. Compliance observed; forbidden phrases absent; iron-law / hard-gate blocks fire correctly.314. **Refactor rounds run** - at least one variation of the scenario tested (pressure-shift or rationalization-invention). Loopholes found are closed; re-verified.325. **Meta-skill self-test** - if the change touches `skills/writing-skills/` itself, run the cycle ON writing-skills (baseline a contributor-pressure scenario; verify the skill resists the "skip the pressure test" pressure). This skill's rules apply to itself.3334If any precondition fails, STOP. Do not ship the change.3536### Content-change detection procedure3738Run each of these commands against the PR's diff; any non-empty result signals a content change:3940```41# New or removed iron laws, hard gates, or preemption sentences42git diff HEAD -- '**/SKILL.md' | grep -E '^[+-].*(NO .* WITHOUT|Violating the letter|Do NOT)'4344# New, removed, or reordered anti-pattern titles (changing the match surface)45git diff HEAD -- '**/SKILL.md' | grep -E '^[+-].*\*\*".*"\*\*'4647# New or removed forbidden phrases48git diff HEAD -- '**/SKILL.md' | grep -E '^[+-].*^- "[^"]+"$'4950# Announce-on-entry text changes51git diff HEAD -- '**/SKILL.md' | grep -B2 -A2 '^## Announce on entry' | grep -E '^[+-]'5253# Red Flags table cell changes (either column)54git diff HEAD -- '**/SKILL.md' | grep -E '^[+-].*\|.*\|.*\|'5556# Frontmatter description field changes57git diff HEAD -- '**/SKILL.md' | grep -E '^[+-]description:'58```5960Empty across all six: non-content change, skip the pressure-test cycle. Non-empty on any: content change, the iron law applies.6162Edge cases explicitly enumerated:6364- **Typo fix inside a forbidden phrase, Red Flag entry, or anti-pattern name:** CONTENT CHANGE. The phrase's match surface changed.65- **Reordering Red Flag rows or forbidden phrases:** CONTENT CHANGE (ordering affects how the agent reads the table).66- **Renaming an anti-pattern:** CONTENT CHANGE.67- **Cross-reference path update with no text change:** non-content.68- **Grammar fix inside the Core principle or process prose (not touching forbidden phrases, anti-patterns, or the iron law):** non-content, but err toward pressure test if unsure.69- **Frontmatter `description` wording change:** CONTENT CHANGE (activates the skill; routing-affecting).70- **Frontmatter `name` change:** CONTENT CHANGE (breaks callers; out of scope for a routine PR).7172## When to use7374```dot75digraph when_to_use {76 "Skill change needed" [shape=doublecircle];77 "New skill or existing?" [shape=diamond];78 "Content-change detection positive?" [shape=diamond];79 "Use writing-skills (full cycle)" [shape=box];80 "Non-content path: document determination in PR; ship" [shape=doublecircle];81 "Full cycle: RED / GREEN / REFACTOR / commit with traces" [shape=doublecircle];8283 "Skill change needed" -> "New skill or existing?";84 "New skill or existing?" -> "Full cycle: RED / GREEN / REFACTOR / commit with traces" [label="new"];85 "New skill or existing?" -> "Content-change detection positive?" [label="existing"];86 "Content-change detection positive?" -> "Full cycle: RED / GREEN / REFACTOR / commit with traces" [label="yes"];87 "Content-change detection positive?" -> "Non-content path: document determination in PR; ship" [label="no - ran detection; all six checks empty"];88}89```9091Content-change detection is MECHANICAL (see Hard gate, above). Judgment-only "this feels like a typo" is insufficient; run the six grep commands.9293If you are unsure whether a change is content or non-content, it is content. Err toward the pressure test.9495## TDD-for-prose mapping9697| TDD concept | Skill creation |98|-------------|----------------|99| Test case | Pressure scenario dispatched to a fresh subagent |100| Production code | `SKILL.md` body |101| Test fails (RED) | The subagent rationalizes around the discipline without the skill present |102| Test passes (GREEN) | The subagent complies with the discipline when the skill is loaded |103| Refactor | Close loopholes while maintaining compliance |104| Write test first | Baseline pressure scenario BEFORE writing any skill text |105| Watch it fail | Record the exact phrases and rationalizations the subagent uses |106| Minimal code | Write the minimal SKILL.md text that rebuts those phrases |107| Watch it pass | Re-run the scenario with the skill loaded; confirm compliance |108| Refactor cycle | Look for new rationalizations the agent invents now that the obvious paths are blocked; tighten the text; re-verify |109110## Required background111112You must understand `test-driven-development` (iron law 1) before using `writing-skills`. RED-GREEN-REFACTOR defines the cycle; this skill adapts it to prose. If you are unfamiliar, read `../test-driven-development/SKILL.md` first.113114## When NOT to create a skill115116Do not create a skill for:117118- **One-off solutions** - a technique used once, specific to one project.119- **Standard practices documented elsewhere** - if the Anthropic docs or a canonical reference already teach it, link to that instead.120- **Project-specific conventions** - those belong in the project's `CLAUDE.md`, not in a cross-project skill.121- **Mechanical constraints** - if a regex, validator, or linter can enforce it, automate the check; do not write prose.122- **Personal preferences that don't generalize** - a skill that only helps one contributor is a personal-skill (lives under `~/.claude/skills/`), not a plugin skill.123124Create a skill only when: (a) the technique is not intuitively obvious; (b) it will be referenced across projects; (c) the pattern is general enough to apply broadly; (d) others would benefit from the same discipline.125126## Skill types127128- **Technique** - a concrete method with steps (example in this plugin: `using-git-worktrees`).129- **Pattern** - a way of thinking about a problem (example in this plugin: `dispatching-parallel-agents`).130- **Reference** - API docs, syntax guides, tool documentation (example in this plugin: `persuasion-principles.md` under `skills/writing-skills/`).131- **Subagent-prompt template** - a constructed-context prompt for a fresh subagent dispatched by a pipeline-stage skill (example in this plugin: `skills/subagent-driven-development/implementer-prompt.md`).132133The SKILL.md says which type; the pressure-test scenarios vary accordingly.134135## Process136137```dot138digraph writing_skills_flow {139 Start [shape=doublecircle, label="Skill change needed"];140 ContentCheck [shape=diamond, label="Content change?"];141 PRDoc [shape=box, label="Document in PR as non-content; ship"];142 Baseline [shape=box, label="1. RED: baseline pressure test without the skill"];143 Record [shape=box, label="2. Record exact rationalizations"];144 Write [shape=box, label="3. GREEN: write minimal skill text rebutting recorded rationalizations"];145 Verify [shape=box, label="4. Run scenario with skill loaded"];146 Passes [shape=diamond, label="Agent complies?"];147 Adjust [shape=box, label="Adjust wording; add forbidden phrases; re-verify"];148 Refactor [shape=box, label="5. REFACTOR: hunt for new rationalizations; tighten"];149 NewFails [shape=diamond, label="New rationalization found?"];150 AddToSkill [shape=box, label="Add rebuttal; re-verify"];151 Commit [shape=box, label="6. Commit skill + paste RED / GREEN traces into PR"];152 End [shape=doublecircle, label="Skill shipped"];153154 Start -> ContentCheck;155 ContentCheck -> PRDoc [label="no"];156 ContentCheck -> Baseline [label="yes"];157 PRDoc -> End;158 Baseline -> Record -> Write -> Verify -> Passes;159 Passes -> Adjust [label="no"];160 Adjust -> Verify;161 Passes -> Refactor [label="yes"];162 Refactor -> NewFails;163 NewFails -> AddToSkill [label="yes"];164 AddToSkill -> Verify;165 NewFails -> Commit [label="no"];166 Commit -> End;167}168```169170## Checklist1711721. **RED - baseline the scenario.** Write a pressure test (see `testing-skills-with-subagents.md`). Dispatch a fresh subagent with the scenario but WITHOUT the skill loaded. Record:173 - The tool calls the subagent made.174 - The exact phrases it used to rationalize around the discipline you want.175 - Whether it complied or not.176177 If it complied without the skill, the skill is not needed for this scenario; pick a harder scenario or write a different skill.1781792. **Record the rationalizations verbatim.** These go into the skill's Forbidden-phrases list, Red-flags table, and named anti-patterns. Do not paraphrase; copy them character-for-character.1801813. **GREEN - write the minimal skill text that rebuts those rationalizations.** Start with:182 - Frontmatter (name, description - "Use when..." per `../../dev/reference/skill-file-format.md`).183 - Announce-on-entry sentence (commits to STOP behavior).184 - Iron law (if applicable) in a fenced code block.185 - "Violating the letter..." preemption sentence immediately after.186 - The minimum body that names the rationalizations from step 2 and rebuts each.1871884. **Re-run the scenario with the skill loaded.** The agent must comply. If it does not:189 - The skill is not strong enough; tighten the wording.190 - Add specific forbidden phrases matching the agent's new rationalizations.191 - Re-verify.1921935. **REFACTOR - hunt for new rationalizations.** Once the obvious paths are blocked, agents invent new ones. Run variations of the scenario (different framings, different pressure sources, different tool sets). Record the new rationalizations; add to the skill; re-verify.1941956. **Commit the skill AND the pressure-test evidence.** The PR must include:196 - The RED trace (baseline without the skill).197 - The GREEN trace (scenario with the skill, showing compliance).198 - A one-sentence write-up of what rationalization the new text plugs.199200 PRs without these traces are closed unreviewed per `.github/PULL_REQUEST_TEMPLATE.md`.201202## Supporting files203204- `anthropic-best-practices.md` - official skill-authoring conventions, mapped to Leyline's opinionated extensions.205- `persuasion-principles.md` - notes on how skill language actually influences agent behavior (what shapes of text produce compliance vs what shapes produce rationalization).206- `graphviz-conventions.dot` - DOT shape/edge conventions used in in-skill diagrams (doublecircle for start/end, diamond for decision, box for action).207- `testing-skills-with-subagents.md` - the pressure-testing methodology in detail, with scenario templates.208- `examples/` - worked examples of skills produced by this process, with their RED/GREEN traces.209210## Mandatory body sections211212Every Leyline skill must have these sections, in this order, unless the skill type explicitly exempts one:2132141. **Frontmatter** - `name`, `description` starting with "Use when..." (under 1024 bytes total).2152. **Announce on entry** - the literal sentence the agent emits on invocation, committing to STOP on precondition failure.2163. **Iron law** (if applicable) - fenced code block.2174. **"Violating the letter..." preemption** - immediately after the iron law.2185. **Core principle** - one paragraph naming what this skill exists to prevent.2196. **Hard gate / preconditions** - mechanical checks the agent must run. Use grep templates where possible; do not leave checks as prose unless they are genuinely unrunnable mechanically.2207. **Process** - a DOT diagram showing decision points and action boxes. Numbered steps in prose where the diagram alone is unclear.2218. **Checklist** - one TodoWrite entry per step the agent executes.2229. **Anti-patterns** - Title Case in quotes, each with an explanatory body that names the specific failure mode.22310. **Red flags** - two-column Markdown table (`Thought` / `Reality`) with rationalizations agents actually use.22411. **Forbidden phrases** - explicit sentence fragments the agent must not emit.22512. **Output artifacts** - what the skill produces (files, commits, markers).22613. **Successor** - the next skill the pipeline invokes, or "returns to caller" for overlays, or "none - pipeline terminates" for terminal skills.22714. **Missing-successor fallback** - what to do if the named successor is absent from the plugin version.22815. **Related** - cross-references.229230## Skill types - required section variance231232- **Pipeline-stage skill** - all 15 sections required.233- **Overlay skill** (Stage 6: TDD, systematic-debugging, verification-before-completion, design-driven-development, accessibility-verification) - sections 6 (Hard gate), 12 (Output artifacts), 13 (Successor), and 14 (Missing-successor fallback) are exempted or reduced: the iron law serves as the entry gate instead of a numbered Hard gate; outputs are the compliance evidence itself (not a committed artifact); the successor is "returns to caller; no pipeline successor"; missing-successor fallback is N/A because overlays have no named successor. Other sections (announce, iron law, "Violating the letter...", core principle, process, checklist, anti-patterns, red flags, forbidden phrases, related) remain required.234- **Reference file** (non-`SKILL.md` supporting content, including `testing-anti-patterns.md`, `anthropic-best-practices.md`, `persuasion-principles.md`, the reviewer-prompt templates) - no YAML frontmatter required; an H1 title serves as the file identifier. No announce / iron law / process required. Each reference file must still declare its role at the top and cross-reference the invoking skill at the bottom.235- **Subagent-prompt template** - the prompt string is the body inside a fenced code block; surrounding Markdown describes when to dispatch and what inputs to substitute. No frontmatter. Canonical example: `skills/subagent-driven-development/implementer-prompt.md`.236- **Meta-skill** (`writing-skills`, this file) - pipeline-stage structure applies, plus Hard gate includes a meta-rule that changes to THIS skill run the full cycle against a contributor-pressure scenario in `tests/`.237238## Anti-patterns239240- **"Ship The Skill; Tests Come Later"** - skills without tests regress silently. The tests ARE the skill; no tests means no evidence of behavior change.241- **"Paraphrase The Agent's Rationalization For Clarity"** - the agent reaches for specific sentence shapes. Paraphrasing changes the match surface; the agent's next rationalization will not match the paraphrase. Copy verbatim.242- **"Add To The Body When A Forbidden Phrase Is Simpler"** - forbidden phrases are a cheaper, more specific block than prose. Prefer them.243- **"Write A Single Long Anti-Pattern Block"** - each anti-pattern gets its own named bullet. Aggregation hides which specific shortcut is being blocked.244- **"Skip The Announce-On-Entry Because It's Ceremonial"** - the announce commits the agent. Skipping it leaves the agent free to slide past the discipline without ever having acknowledged it.245- **"Refactor To Reads Well But Loses Behavior"** - compliance-edit without re-running the pressure test silently regresses the skill. Contributor rules block this for a reason.246- **"Stop Testing After GREEN"** - REFACTOR is where the loopholes get closed. Agents invent new rationalizations once the obvious paths are blocked; the second and third iterations of testing are the most valuable.247248## Red flags249250| Thought | Reality |251|---------|---------|252| "The skill text reads cleanly; ship it" | Reading clean is not complying under pressure. Run the scenario. |253| "I already know what the agent will rationalize" | Then writing it down takes 5 minutes. Do it; don't guess. |254| "The baseline is obvious; skip RED" | The baseline's purpose is to record the exact phrases you will rebut. "Obvious" never produces a compliance list. |255| "One pressure-test round is enough" | One round blocks the obvious paths. Two rounds blocks the less obvious. Three rounds is where most real skills settle. |256| "Mandatory sections are bureaucratic" | The structure is behavior-shaping. Missing sections are missing defenses. |257| "I can write the skill from a template" | Templates produce templates. Skills that survive pressure testing have text specific to the rationalization they block. |258259## Forbidden phrases260261Do not say:262263- "Tests come later"264- "Good enough for v1"265- "I'll add forbidden phrases if agents complain"266- "Paraphrased for clarity"267- "Skipped the baseline; the skill is obvious"268- "Compliance-edit; no pressure test needed"269270## Output artifacts271272- New or modified `SKILL.md` / reference file / subagent-prompt template committed to the repo.273- Corresponding scenario file under `tests/<group>/<scenario-name>.md` with RED and GREEN traces captured in the Outcome section.274- PR entry referencing both, with the `.github/PULL_REQUEST_TEMPLATE.md` skill-change-evidence section completed.275- If the content-change detection ran and came up empty (non-content change), a one-line PR note citing the six detection commands with their empty outputs.276277## Returns to caller278279This is a meta-skill. After the six-step cycle completes and the skill is committed with traces, control returns to the caller (usually a contributor-PR session, or a plugin-author session). No pipeline successor.280281### Missing-successor fallback282283Not applicable — meta-skill does not name a pipeline successor. However, if the `tests/` directory, the scenario group (e.g., `tests/skill-triggering/`), or `scripts/check-manifests.sh` is missing in this version of the plugin, STOP and surface the gap to the human partner; the full cycle cannot be run without those artifacts present.284285## Related286287- `../test-driven-development/SKILL.md` - the RED-GREEN-REFACTOR discipline this skill adapts to prose288- `../../dev/principles/tdd-for-prose.md` - canonical methodology reference289- `../../dev/principles/behavior-shaping.md` - why skills are written as behavior-shaping code rather than prose290- `../../dev/reference/skill-file-format.md` - frontmatter and body rules291- `../../dev/reference/diagrams.md` - DOT conventions292- `../using-leyline/SKILL.md` - the entry skill whose structure is the default template293- `testing-skills-with-subagents.md` - pressure-testing methodology in detail294- `anthropic-best-practices.md` - official skill-authoring conventions295- `persuasion-principles.md` - how skill language influences agent behavior296- `graphviz-conventions.dot` - DOT conventions reference file