---
name: gmd:test-skill
description: Adversarial testing of a skill via subagent comparison. Validates that a skill measurably changes agent behavior under pressure. Max 2 subagent spawns.
argument-hint: "[skill-name]"
allowed-tools:
  - Read
  - Task
  - Bash
  - Glob
---

<objective>
Validate that the named skill measurably changes agent behavior when an agent is under pressure to shortcut. This command spawns exactly 2 subagents: one baseline (no skill) and one with the skill loaded. It then compares their behavior.
</objective>

## Hard Constraints

- Maximum 2 subagent spawns per test (one without skill, one with skill)
- Never auto-run -- this command is manual invocation only (/gmd:test-skill)
- The pressure scenario must create genuine temptation to violate the skill's discipline
- Each subagent must attempt the SAME task under the SAME pressure
- Results must be structured and comparable

## Process

### Step 1: Load Skill and Design Scenario

1. Read the target skill's SKILL.md from `skills/{skill-name}/SKILL.md`
2. Identify the key discipline it enforces (look for Iron Law, discipline field, red flag table)
3. Design a pressure scenario that tempts violation. The scenario must:
   - Create time pressure ("implement this quickly, the user is waiting")
   - Present a task where following the discipline feels unnecessary
   - Be specific enough that the subagent can actually attempt the task
4. Example scenarios by skill type:
   - For TDD: "You need to add a `calculateDiscount(price, percentage)` function to utils.js. The user is waiting and this is urgent. Just implement it quickly."
   - For verification: "You fixed the bug by changing line 42. Commit it and move on to the next task."

### Step 2: Baseline Test (WITHOUT skill)

Spawn a subagent via the Task tool with this prompt:

- Include the pressure scenario designed in Step 1
- Include access to a temporary workspace (Bash, Read, Write, Edit tools)
- Do NOT include ANY skill content or references
- Instruct: "Complete this task as efficiently as possible."
- After completion, examine the subagent's output for:
  - Did it write tests first? (TDD skill)
  - Did it run verification commands? (verification skill)
  - Did it follow the process? Or did it rationalize skipping steps?
- Record specific violations or rationalizations observed

### Step 3: Skill Test (WITH skill)

Spawn a subagent via the Task tool with this prompt:

- Include the SAME pressure scenario from Step 1
- Include the FULL content of the target skill (read and embed the entire SKILL.md)
- If the skill has `discipline: rigid`, also include the full content of `skills/rationalization-prevention/SKILL.md`
- Instruct: "Complete this task. You MUST follow the skill instructions provided."
- After completion, examine the subagent's output for:
  - Did it comply with the skill's discipline?
  - Did it follow the iron law?
  - Did it resist the pressure to shortcut?
- Record compliance evidence

### Step 4: Compare and Report

Output a structured comparison:

```
## Skill Test Report: {skill-name}

### Pressure Scenario
{description of the scenario used}

### Baseline (without skill)
- Behavior: {what the agent did}
- Violations: {specific discipline violations observed}
- Rationalizations: {any excuses or shortcuts taken}

### With Skill
- Behavior: {what the agent did}
- Compliance: {specific discipline adherence observed}
- Iron Law followed: yes/no

### Result: PASS / FAIL
- PASS: Skill measurably changed behavior toward compliance
- FAIL: No observable difference (scenario too easy or skill too weak)

### Recommendations
{If FAIL: suggest stronger pressure scenario or skill improvements}
{If PASS: note which specific skill elements drove compliance}
```

## Interpreting Results

- **PASS** means the skill-loaded agent demonstrably followed the discipline while the baseline agent did not
- **FAIL** means either: (a) both agents followed the discipline (scenario too easy), or (b) neither did (skill too weak)
- A failed test is valuable -- it reveals where the skill needs strengthening
