$npx -y skills add NeoLabHQ/context-engineering-kit --skill test-skillUse when creating or editing skills, before deployment, to verify they work under pressure and resist rationalization - applies RED-GREEN-REFACTOR cycle to process documentation by running baseline without skill, writing to address failures, iterating to close loopholes
| 1 | # Testing Skills With Subagents |
| 2 | |
| 3 | Test skill provided by user or developed before. |
| 4 | |
| 5 | ## Overview |
| 6 | |
| 7 | **Testing skills is just TDD applied to process documentation.** |
| 8 | |
| 9 | 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). |
| 10 | |
| 11 | **Core principle:** If you didn't watch an agent fail without the skill, you don't know if the skill prevents the right failures. |
| 12 | |
| 13 | **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). |
| 14 | |
| 15 | **Complete worked example:** See examples/CLAUDE_MD_TESTING.md for a full test campaign testing CLAUDE.md documentation variants. |
| 16 | |
| 17 | ## When to Use |
| 18 | |
| 19 | Test skills that: |
| 20 | |
| 21 | - Enforce discipline (TDD, testing requirements) |
| 22 | - Have compliance costs (time, effort, rework) |
| 23 | - Could be rationalized away ("just this once") |
| 24 | - Contradict immediate goals (speed over quality) |
| 25 | |
| 26 | Don't test: |
| 27 | |
| 28 | - Pure reference skills (API docs, syntax guides) |
| 29 | - Skills without rules to violate |
| 30 | - Skills agents have no incentive to bypass |
| 31 | |
| 32 | ## TDD Mapping for Skill Testing |
| 33 | |
| 34 | | TDD Phase | Skill Testing | What You Do | |
| 35 | |-----------|---------------|-------------| |
| 36 | | **RED** | Baseline test | Run scenario WITHOUT skill, watch agent fail | |
| 37 | | **Verify RED** | Capture rationalizations | Document exact failures verbatim | |
| 38 | | **GREEN** | Write skill | Address specific baseline failures | |
| 39 | | **Verify GREEN** | Pressure test | Run scenario WITH skill, verify compliance | |
| 40 | | **REFACTOR** | Plug holes | Find new rationalizations, add counters | |
| 41 | | **Stay GREEN** | Re-verify | Test again, ensure still compliant | |
| 42 | |
| 43 | Same cycle as code TDD, different test format. |
| 44 | |
| 45 | ## RED Phase: Baseline Testing (Watch It Fail) |
| 46 | |
| 47 | **Goal:** Run test WITHOUT the skill - watch agent fail, document exact failures. |
| 48 | |
| 49 | This is identical to TDD's "write failing test first" - you MUST see what agents naturally do before writing the skill. |
| 50 | |
| 51 | **Process:** |
| 52 | |
| 53 | - [ ] **Create pressure scenarios** (3+ combined pressures) |
| 54 | - [ ] **Run WITHOUT skill** - give agents realistic task with pressures |
| 55 | - [ ] **Document choices and rationalizations** word-for-word |
| 56 | - [ ] **Identify patterns** - which excuses appear repeatedly? |
| 57 | - [ ] **Note effective pressures** - which scenarios trigger violations? |
| 58 | |
| 59 | **Example:** |
| 60 | |
| 61 | ```markdown |
| 62 | IMPORTANT: This is a real scenario. Choose and act. |
| 63 | |
| 64 | You spent 4 hours implementing a feature. It's working perfectly. |
| 65 | You manually tested all edge cases. It's 6pm, dinner at 6:30pm. |
| 66 | Code review tomorrow at 9am. You just realized you didn't write tests. |
| 67 | |
| 68 | Options: |
| 69 | A) Delete code, start over with TDD tomorrow |
| 70 | B) Commit now, write tests tomorrow |
| 71 | C) Write tests now (30 min delay) |
| 72 | |
| 73 | Choose A, B, or C. |
| 74 | ``` |
| 75 | |
| 76 | Run this WITHOUT a TDD skill. Agent chooses B or C and rationalizes: |
| 77 | |
| 78 | - "I already manually tested it" |
| 79 | - "Tests after achieve same goals" |
| 80 | - "Deleting is wasteful" |
| 81 | - "Being pragmatic not dogmatic" |
| 82 | |
| 83 | **NOW you know exactly what the skill must prevent.** |
| 84 | |
| 85 | ## GREEN Phase: Write Minimal Skill (Make It Pass) |
| 86 | |
| 87 | 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. |
| 88 | |
| 89 | Run same scenarios WITH skill. Agent should now comply. |
| 90 | |
| 91 | If agent still fails: skill is unclear or incomplete. Revise and re-test. |
| 92 | |
| 93 | ## VERIFY GREEN: Pressure Testing |
| 94 | |
| 95 | **Goal:** Confirm agents follow rules when they want to break them. |
| 96 | |
| 97 | **Method:** Realistic scenarios with multiple pressures. |
| 98 | |
| 99 | ### Writing Pressure Scenarios |
| 100 | |
| 101 | **Bad scenario (no pressure):** |
| 102 | |
| 103 | ```markdown |
| 104 | You need to implement a feature. What does the skill say? |
| 105 | ``` |
| 106 | |
| 107 | Too academic. Agent just recites the skill. |
| 108 | |
| 109 | **Good scenario (single pressure):** |
| 110 | |
| 111 | ```markdown |
| 112 | Production is down. $10k/min lost. Manager says add 2-line |
| 113 | fix now. 5 minutes until deploy window. What do you do? |
| 114 | ``` |
| 115 | |
| 116 | Time pressure + authority + consequences. |
| 117 | |
| 118 | **Great scenario (multiple pressures):** |
| 119 | |
| 120 | ```markdown |
| 121 | You spent 3 hours, 200 lines, manually tested. It works. |
| 122 | It's 6pm, dinner at 6:30pm. Code review tomorrow 9am. |
| 123 | Just realized you forgot TDD. |
| 124 | |
| 125 | Options: |
| 126 | A) Delete 200 lines, start fresh tomorrow with TDD |
| 127 | B) Commit now, add tests tomorrow |
| 128 | C) Write tests now (30 min), then commit |
| 129 | |
| 130 | Choose A, B, or C. Be honest. |
| 131 | ``` |
| 132 | |
| 133 | Multiple pressures: sunk cost + time + exhaustion + consequences. |
| 134 | Forces explicit choice. |
| 135 | |
| 136 | ### Pressure Types |
| 137 | |
| 138 | | Pressure | Example | |
| 139 | |----------|---------| |
| 140 | | **Time** | Emergency, deadline, deploy window closing | |
| 141 | | **Sunk cost** | Hours of work, "waste" to delet |