test-strategy

Generates a test strategy document for a project or module. Analyzes existing coverage, identifies gaps, prioritizes what to test, and recommends test types (unit, integration, e2e) per module. Use before add-tests for informed testing decisions.

23 stars

Best use case

test-strategy is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Generates a test strategy document for a project or module. Analyzes existing coverage, identifies gaps, prioritizes what to test, and recommends test types (unit, integration, e2e) per module. Use before add-tests for informed testing decisions.

Teams using test-strategy should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/test-strategy/SKILL.md --create-dirs "https://raw.githubusercontent.com/christophacham/agent-skills-library/main/skills/testing/test-strategy/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/test-strategy/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How test-strategy Compares

Feature / Agenttest-strategyStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Generates a test strategy document for a project or module. Analyzes existing coverage, identifies gaps, prioritizes what to test, and recommends test types (unit, integration, e2e) per module. Use before add-tests for informed testing decisions.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Skill: Test Strategy

## What This Skill Does

Creates a **test strategy document** that answers: what should we test, how, and in what priority? Analyzes the codebase to produce a structured testing plan rather than ad-hoc test writing.

## When to Use

- Before starting a testing initiative
- When the user says "we need better test coverage"
- As input for `add-tests` (which tests to generate first)
- When onboarding a project with poor test coverage

## Execution Model

- **Phase 1**: primary agent analyzes codebase structure, existing tests, and coverage.
- **Phase 2**: primary spawns `doc-explorer` to write the strategy document to `docs/test-strategy.md`.

## Workflow

### Step 1: Inventory Existing Tests

Map what tests exist:

```bash
# Count test files vs source files
find . -name "*.test.*" -o -name "*.spec.*" -o -name "test_*" | wc -l
find . -name "*.ts" -o -name "*.py" -o -name "*.go" | grep -v test | grep -v node_modules | wc -l
```

For each module, check if a corresponding test file exists.

### Step 2: Categorize Modules by Risk

Assess each module's testing priority:

| Risk Factor | Weight |
|-------------|--------|
| Handles user input / external data | High |
| Has complex business logic | High |
| Manages state / data persistence | High |
| Has many dependents (widely imported) | Medium |
| Performs I/O (file, network, DB) | Medium |
| Is pure utility / helper | Low |

### Step 3: Identify Coverage Gaps

For each module:

- Does it have any tests? (binary check)
- Do tests cover happy path? Error cases? Edge cases?
- Are integration points tested?

### Step 4: Recommend Test Types

Per module, recommend the appropriate test types:

| Module Type | Recommended Tests |
|-------------|------------------|
| Business logic | Unit tests with edge cases |
| API endpoints | Integration tests |
| UI components | Component/snapshot tests |
| Data layer | Integration tests with test DB |
| Utilities | Unit tests |
| CLI | Integration tests |

### Step 5: Generate Strategy Document

Write to `docs/test-strategy.md`:

```markdown
# Test Strategy

## Current State
- Source files: N
- Test files: N
- Coverage ratio: N%

## Priority Matrix
| Module | Risk | Current Coverage | Recommended Tests | Priority |
|--------|------|-----------------|-------------------|----------|

## Testing Approach
### Unit Tests
### Integration Tests
### E2E Tests

## Recommended Order
1. <highest priority module>
2. <next>

## Test Infrastructure Needs
- Fixtures needed
- Mocks needed
- CI integration
```

## Rules

1. **Analysis, not implementation**: this skill produces a strategy document. It does not write tests (use `add-tests` for that).
2. **Risk-based prioritization**: not all code needs the same level of testing. Focus on high-risk, high-impact areas.
3. **Be pragmatic**: 80% coverage of critical paths beats 100% coverage of trivial code.
4. **Respect existing patterns**: recommend test types and tools that align with the project's existing test infrastructure.
5. **No built-in explore agent**: do NOT use the built-in `explore` subagent type.

Related Skills

webapp-testing

23
from christophacham/agent-skills-library

Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browse...

web3-testing

23
from christophacham/agent-skills-library

Test smart contracts comprehensively using Hardhat and Foundry with unit tests, integration tests, and mainnet forking. Use when testing Solidity contracts, setting up blockchain test suites, or va...

vue-testing-best-practices

23
from christophacham/agent-skills-library

Use for Vue.js testing. Covers Vitest, Vue Test Utils, component testing, mocking, testing patterns, and Playwright for E2E testing.

screen-reader-testing

23
from christophacham/agent-skills-library

Test web applications with screen readers including VoiceOver, NVDA, and JAWS. Use when validating screen reader compatibility, debugging accessibility issues, or ensuring assistive technology supp...

unit-testing-test-generate

23
from christophacham/agent-skills-library

Generate comprehensive, maintainable unit tests across languages with strong coverage and edge case focus.

test-fixing

23
from christophacham/agent-skills-library

Run tests and systematically fix all failing tests using smart error grouping. Use when user asks to fix failing tests, mentions test failures, runs test suite and failures occur, or requests to ma...

tdd:test-driven-development

23
from christophacham/agent-skills-library

Use when implementing any feature or bugfix, before writing implementation code - write the test first, watch it fail, write minimal code to pass; ensures tests actually verify behavior by requiring failure first

test-automator

23
from christophacham/agent-skills-library

Master AI-powered test automation with modern frameworks, self-healing tests, and comprehensive quality engineering. Build scalable testing strategies with advanced CI/CD integration.

perf-theory-tester

23
from christophacham/agent-skills-library

Use when running controlled perf experiments to validate hypotheses.

pentest-commands

23
from christophacham/agent-skills-library

This skill should be used when the user asks to "run pentest commands", "scan with nmap", "use metasploit exploits", "crack passwords with hydra or john", "scan web vulnerabilities ...

pentest-checklist

23
from christophacham/agent-skills-library

This skill should be used when the user asks to "plan a penetration test", "create a security assessment checklist", "prepare for penetration testing", "define pentest scope", "foll...

ab-test-setup

23
from christophacham/agent-skills-library

Structured guide for setting up A/B tests with mandatory gates for hypothesis, metrics, and execution readiness.