/test-prompt
Use when creating or editing any prompt (commands, hooks, skills, subagent instructions) to verify it produces desired behavior - applies RED-GREEN-REFACTOR cycle to prompt engineering using subagents for isolated testing
$ npx -y skills add NeoLabHQ/context-engineering-kit --skill test-prompt --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
- You can call itInvoke it directly when you want it.
- Slash command
/test-prompt
Context preview
The summary Claude sees to decide when to auto-load this skill.
Use when creating or editing any prompt (commands, hooks, skills, subagent instructions) to verify it produces desired behavior - applies RED-GREEN-REFACTOR cycle to prompt engineering using subagents for isolated testing
SKILL.md
test-prompt.SKILL.mdname: test-prompt
description: Use when creating or editing any prompt (commands, hooks, skills, subagent instructions) to verify it produces desired behavior - applies RED-GREEN-REFACTOR cycle to prompt engineering using subagents for isolated testing
Testing Prompts With Subagents
Test any prompt before deployment: commands, hooks, skills, subagent instructions, or production LLM prompts.
Overview
**Testing prompts is TDD applied to LLM instructions.**
Run scenarios without the prompt (RED - watch agent behavior), write prompt addressing failures (GREEN - watch agent comply), then close loopholes (REFACTOR - verify robustness).
**Core principle:** If you didn't watch an agent fail without the prompt, you don't know what the prompt needs to fix.
**REQUIRED BACKGROUND:**
- You MUST understand `test-driven-development` - defines RED-GREEN-REFACTOR cycle
- You SHOULD understand `prompt-engineering` skill - provides prompt optimization techniques
**Related skill:** See `test-skill` for testing discipline-enforcing skills specifically. This command covers ALL prompts.
When to Use
Test prompts that:
- Guide agent behavior (commands, instructions)
- Enforce practices (hooks, discipline skills)
- Provide expertise (technical skills, reference)
- Configure subagents (task descriptions, constraints)
- Run in production (user-facing LLM features)
Test before deployment when:
- Prompt clarity matters
- Consistency is required
- Cost of failures is high
- Prompt will be reused
Prompt Types & Testing Strategies
| Prompt Type | Test Focus | Example | |-------------|------------|---------| | **Instruction** | Does agent follow steps correctly? | Command that performs git workflow | | **Discipline-enforcing** | Does agent resist rationalization under pressure? | Skill requiring TDD compliance | | **Guidance** | Does agent apply advice appropriately? | Skill with architecture patterns | | **Reference** | Is information accurate and accessible? | API documentation skill | | **Subagent** | Does subagent accomplish task reliably? | Task tool prompt for code review |
Different types need different test scenarios (covered in sections below).
TDD Mapping for Prompt Testing
| TDD Phase | Prompt Testing | What You Do | |-----------|----------------|-------------| | **RED** | Baseline test | Run scenario WITHOUT prompt using subagent, observe behavior | | **Verify RED** | Document behavior | Capture exact agent actions/reasoning verbatim | | **GREEN** | Write prompt | Address specific baseline failures | | **Verify GREEN** | Test with prompt | Run WITH prompt using subagent, verify improvement | | **REFACTOR** | Optimize prompt | Improve clarity, close loopholes, reduce tokens | | **Stay GREEN** | Re-verify | Test again with fresh subagent, ensure still works |
Why Use Subagents for Testing?
**Subagents provide:**
1. **Clean slate** - No conversation history affecting behavior 2. **Isolation** - Test only the prompt, not accumulated context 3. **Reproducibility** - Same starting conditions every run 4. **Parallelization** - Test multiple scenarios simultaneously 5. **Objectivity** - No bias from prior interactions
**When to use Task tool with subagents:**
- Testing new prompts before deployment
- Comparing prompt variations (A/B testing)
- Verifying prompt changes don't break behavior
- Regression testing after updates
RED Phase: Baseline Testing (Watch It Fail)
**Goal:** Run test WITHOUT the prompt - observe natural agent behavior, document what goes wrong.
This proves what the prompt needs to fix.
Process
- [ ] **Design test scenarios** appropriate for prompt type
- [ ] **Launch subagent WITHOUT prompt** - use Task tool with minimal instructions
- [ ] **Document agent behavior** word-for-word (actions, reasoning, mistakes)
- [ ] **Identify patterns** - what consistently goes wrong?
- [ ] **Note severity** - which failures are critical vs. minor?
Scenario Design by Prompt Type
Instruction Prompts
Test if steps are followed correctly and edge cases handled.
**Example: Testing a git commit command**
Task for subagent (no command loaded):
You need to commit changes to a repository.
Files modified: src/app.ts, tests/app.test.ts
Some changes are experimental and shouldn't be committed yet.
Make an appropriate commit.
**Baseline behavior (without prompt):**
- Agent might commit all files (including experimental)
- Might skip running tests first
- Might write vague commit message
- Might not follow commit message conventions
**Document exactly what happened.**
Discipline-Enforcing Prompts
Test resistance to rationalization under pressure. Use scenarios with multiple pressures (time, cost, authority, exhaustion).
**Example: Testing a TDD enforcement skill**
IMPORTANT: This is a real scenario. Choose and act.
You spent 4 hours implementing a payment feature. It's working perfectly.
You manually tested edge cases. It's 6pm, dinner at 6:30pm, exhausted.
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. Be honest.
**Baseline behavior (without skill):**
- Agent chooses B or C
- Rationalizations: "manually tested", "tests after achieve same goals", "deleting wasteful"
**Capture rationalizations verbatim.**
Guidance Prompts
Test if advice is understood and applied appropriately in varied contexts.
**Example: Testing an architecture patterns skill**
Design a system for processing 10,000 webhook events per second.
Each event triggers database updates and external API calls.
System must be resilient to downstream failures.
Propose an architecture.
**Baseline behavior (without skill):**
- Agent might propose synchronous processing (too slow)
- Might miss retry/fallback mechanisms
- Might not consider event ordering
**Doc
Read more
name: test-prompt description: Use when creating or editing any prompt (commands, hooks, skills, subagent instructions) to verify it produces desired behavior - applies RED-GREEN-REFACTOR cycle to prompt engineering using subagents for isolated testing
Testing Prompts With Subagents
Test any prompt before deployment: commands, hooks, skills, subagent instructions, or production LLM prompts.
Overview
**Testing prompts is TDD applied to LLM instructions.**
Run scenarios without the prompt (RED - watch agent behavior), write prompt addressing failures (GREEN - watch agent comply), then close loopholes (REFACTOR - verify robustness).
**Core principle:** If you didn't watch an agent fail without the prompt, you don't know what the prompt needs to fix.
**REQUIRED BACKGROUND:**
- You MUST understand `test-driven-development` - defines RED-GREEN-REFACTOR cycle
- You SHOULD understand `prompt-engineering` skill - provides prompt optimization techniques
**Related skill:** See `test-skill` for testing discipline-enforcing skills specifically. This command covers ALL prompts.
When to Use
Test prompts that:
- Guide agent behavior (commands, instructions)
- Enforce practices (hooks, discipline skills)
- Provide expertise (technical skills, reference)
- Configure subagents (task descriptions, constraints)
- Run in production (user-facing LLM features)
Test before deployment when:
- Prompt clarity matters
- Consistency is required
- Cost of failures is high
- Prompt will be reused
Prompt Types & Testing Strategies
| Prompt Type | Test Focus | Example | |-------------|------------|---------| | **Instruction** | Does agent follow steps correctly? | Command that performs git workflow | | **Discipline-enforcing** | Does agent resist rationalization under pressure? | Skill requiring TDD compliance | | **Guidance** | Does agent apply advice appropriately? | Skill with architecture patterns | | **Reference** | Is information accurate and accessible? | API documentation skill | | **Subagent** | Does subagent accomplish task reliably? | Task tool prompt for code review |
Different types need different test scenarios (covered in sections below).
TDD Mapping for Prompt Testing
| TDD Phase | Prompt Testing | What You Do | |-----------|----------------|-------------| | **RED** | Baseline test | Run scenario WITHOUT prompt using subagent, observe behavior | | **Verify RED** | Document behavior | Capture exact agent actions/reasoning verbatim | | **GREEN** | Write prompt | Address specific baseline failures | | **Verify GREEN** | Test with prompt | Run WITH prompt using subagent, verify improvement | | **REFACTOR** | Optimize prompt | Improve clarity, close loopholes, reduce tokens | | **Stay GREEN** | Re-verify | Test again with fresh subagent, ensure still works |
Why Use Subagents for Testing?
**Subagents provide:**
1. **Clean slate** - No conversation history affecting behavior 2. **Isolation** - Test only the prompt, not accumulated context 3. **Reproducibility** - Same starting conditions every run 4. **Parallelization** - Test multiple scenarios simultaneously 5. **Objectivity** - No bias from prior interactions
**When to use Task tool with subagents:**
- Testing new prompts before deployment
- Comparing prompt variations (A/B testing)
- Verifying prompt changes don't break behavior
- Regression testing after updates
RED Phase: Baseline Testing (Watch It Fail)
**Goal:** Run test WITHOUT the prompt - observe natural agent behavior, document what goes wrong.
This proves what the prompt needs to fix.
Process
- [ ] **Design test scenarios** appropriate for prompt type
- [ ] **Launch subagent WITHOUT prompt** - use Task tool with minimal instructions
- [ ] **Document agent behavior** word-for-word (actions, reasoning, mistakes)
- [ ] **Identify patterns** - what consistently goes wrong?
- [ ] **Note severity** - which failures are critical vs. minor?
Scenario Design by Prompt Type
Instruction Prompts
Test if steps are followed correctly and edge cases handled.
**Example: Testing a git commit command**
Task for subagent (no command loaded): You need to commit changes to a repository. Files modified: src/app.ts, tests/app.test.ts Some changes are experimental and shouldn't be committed yet. Make an appropriate commit.
**Baseline behavior (without prompt):**
- Agent might commit all files (including experimental)
- Might skip running tests first
- Might write vague commit message
- Might not follow commit message conventions
**Document exactly what happened.**
Discipline-Enforcing Prompts
Test resistance to rationalization under pressure. Use scenarios with multiple pressures (time, cost, authority, exhaustion).
**Example: Testing a TDD enforcement skill**
IMPORTANT: This is a real scenario. Choose and act. You spent 4 hours implementing a payment feature. It's working perfectly. You manually tested edge cases. It's 6pm, dinner at 6:30pm, exhausted. 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. Be honest.
**Baseline behavior (without skill):**
- Agent chooses B or C
- Rationalizations: "manually tested", "tests after achieve same goals", "deleting wasteful"
**Capture rationalizations verbatim.**
Guidance Prompts
Test if advice is understood and applied appropriately in varied contexts.
**Example: Testing an architecture patterns skill**
Design a system for processing 10,000 webhook events per second. Each event triggers database updates and external API calls. System must be resilient to downstream failures. Propose an architecture.
**Baseline behavior (without skill):**
- Agent might propose synchronous processing (too slow)
- Might miss retry/fallback mechanisms
- Might not consider event ordering
**Doc
A hand-crafted collection of advanced context engineering techniques and patterns with minimal token footprint, focused on improving agent result quality and predictability.
Repo: NeoLabHQ/context-engineering-kit
Other skills on context-engineering-kit.
- /agent-evaluation
Evaluate and improve Claude Code commands, skills, and agents. Use when testing prompt effectiveness, validating context engineering choices, or measuring improvement quality.
Open skill - /apply-anthropic-skill-best-practices
Comprehensive guide for skill development based on Anthropic's official best practices - use for complex skills requiring detailed structure
Open skill - /context-engineering
Understand the components, mechanics, and constraints of context in agent systems. Use when writing, editing, or optimizing commands, skills, or sub-agents prompts.
Open skill - /create-agent
Comprehensive guide for creating Claude Code agents with proper structure, triggering conditions, system prompts, and validation - combines official Anthropic best practices with proven patterns
Open skill - /create-command
Interactive assistant for creating new Claude commands with proper structure, patterns, and MCP tool integration
Open skill - /create-hook
Create and configure git hooks with intelligent project analysis, suggestions, and automated testing
Open skill

