agentleFS
drafthqdrafthq/draft/skills/testing-strategy/SKILL.md

testing-strategy

Skill40 starsChanged 4 months agoMITView on GitHub

Design test strategies and test plans with coverage targets. Complements /draft:coverage which measures what this skill plans. Auto-loaded by /draft:implement before TDD.

54 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use api-contract-design, react-patterns and 4 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • MohOneXSkill

    api-contract-design

    Designs and reviews API contracts (REST, RPC, GraphQL, library interfaces) for evolvability, backward compatibility, and failure semantics. Use when defining new endpoints/interfaces, versioning an API, reviewing a schema, or deciding how breaking changes propagate to clients.

    Also in 3 projects that use this

  • xenitV1Skill

    react-patterns

    Modern React patterns and principles. Hooks, composition, performance, TypeScript best practices.

    Also in 4 projects that use this

  • AnthropicSkill

    system-design

    Design systems, services, and architectures. Trigger with "design a system for", "how should we architect", "system design for", "what's the right architecture for", or when the user needs help with API design, data modeling, or service boundaries.

    Also in 6 projects that use this

  • MicrosoftSkill

    error-handling

    统一错误处理系统。在添加 API 端点、修改错误处理、添加前端 API 调用、编写错误相关测试时使用。

    Also in 5 projects that use this

  • MicrosoftSkill

    api-design

    Guide for designing and documenting RESTful APIs. Use when asked to design an API, create endpoints, or document an API.

    Also in 9 projects that use this

  • Microsoft AzureSkill

    release-readiness

    Complete ODIN release documentation and validation checks before declaring user-visible work complete, preparing a release, or opening the Release-to-main pull request.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

12 rules. 0 are common, 8 are distinctive, and 4 are very specific to this project.

  • 0

    Common

    Most of the 44 edited versions we read keep these.

  • 8

    Distinctive

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Not considering the testing pyramid for this project's architecture

    line 16
  2. Distinctive:

    Before starting, capture the current git state:

    line 26
  3. Very specific:

    If draft/ doesn't exist, this skill can still run standalone with reduced context.

    line 41
  4. Very specific:

    Read and follow the base procedure in core/shared/draft-context-loading.md.

    line 45
  5. Distinctive:

    Check for existing coverage reports or configuration:

    line 72
  6. Distinctive:

    Error paths: Test failure modes, not just happy paths

    line 131
  7. Distinctive:

    Determinism: No time-dependent, order-dependent, or flaky tests

    line 133
  8. Distinctive:

    Naming: Test names describe the scenario and expected outcome

    line 134
  9. Distinctive:

    Run test discovery to count existing tests per module

    line 140
  10. Very specific:

    How: Test type (unit/integration/E2E), framework, key assertions

    line 169
  11. Very specific:

    MANDATORY: Include YAML frontmatter with git metadata: Follow core/shared/git-report-metadata.md.

    line 174
  12. Distinctive:

    If conflicting test patterns found: Document both patterns, recommend consolidation as a tech-debt item

    line 203

“Common” is measured: kept by at least 6 in 10 of the 44 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Testing Strategy

You are designing a testing strategy and test plan for this project or track.

Red Flags — STOP if you're

  • Writing a strategy without understanding the codebase
  • Setting unrealistic coverage targets (100% is rarely appropriate)
  • Focusing only on unit tests and ignoring integration/E2E
  • Ignoring existing test infrastructure and conventions
  • Not considering the testing pyramid for this project's architecture

A good testing strategy matches the architecture. Not every project needs the same pyramid.


Pre-Check

0. Capture Git Context

Before starting, capture the current git state:

git branch --show-current # Current branch name
git rev-parse --short HEAD # Current commit hash

Store this for the report header. The strategy is scoped to this specific branch/commit.

1. Verify Draft Context

ls draft/ 2>/dev/null

If draft/ doesn't exist, this skill can still run standalone with reduced context.

2. Load Draft Context (if available)

Read and follow the base procedure in core/shared/draft-context-loading.md.

Step 1: Parse Arguments

  • /draft:testing-strategy — Project-wide strategy (default if no active track)
  • /draft:testing-strategy track <id> — Track-scoped strategy
  • /draft:testing-strategy module <name> — Module-scoped strategy

Step 2: Analyze Codebase

  1. Identify component types:
    • APIs (REST, GraphQL, gRPC)
    • Data pipelines (ETL, streaming)
    • Frontend (React, Vue, etc.)
    • Infrastructure (Terraform, K8s configs)
    • Libraries/SDKs
    • CLI tools
  2. Discover existing tests:

    find . -name "*test*" -o -name "*spec*" | head -50

    Identify: test frameworks, test directories, existing coverage config, test runners.

  3. Assess current coverage: Check for existing coverage reports or configuration:

    ls coverage/ .nyc_output/ htmlcov/ .coverage 2>/dev/null
  4. Read project context:
    • draft/tech-stack.md — Test frameworks, testing conventions
    • draft/workflow.md — TDD preferences (strict/flexible/none)
    • draft/.ai-context.md — INVARIANTS section (critical paths), module boundaries, concurrency model
    • draft/guardrails.md — Anti-patterns that need test coverage
    • draft/product.md — Critical user flows that demand E2E tests

Step 3: Design Strategy

Testing Pyramid

Tailor to the project architecture:

        ┌─────────┐
        │ E2E │ Few, critical paths only
        ├─────────┤
        │ Integr. │ Service boundaries, DB, APIs
        ├─────────┤
        │ Unit │ Business logic, utilities
        └─────────┘

Adjust the pyramid shape per architecture. A microservices backend may need a wider integration band. A UI-heavy app may need more E2E. A library may be almost entirely unit tests.

Per-Component Strategy

Component TypeUnitIntegrationE2EFocus
API endpointsInput validation, handlersDB queries, authCritical flowsContract testing
Data pipelinesTransform logicSource/sink connectionsFull pipelineData integrity
FrontendComponent rendering, hooksAPI integrationUser journeysVisual regression
InfrastructureConfig validationResource provisioningDeploymentDrift detection
LibrariesPublic API surfaceCross-moduleConsumer scenariosBackward compat
CLI toolsArgument parsing, logicFile I/O, system callsFull workflowsExit codes, output

Coverage Targets

Set realistic targets based on component criticality:

  • Critical paths (from .ai-context.md INVARIANTS): 95%+
  • Business logic: 85-90%
  • Utilities/helpers: 80%
  • Infrastructure/config: 70%
  • Generated code: Exclude from targets
  • Vendor/third-party wrappers: 60%

Test Quality Guidelines

Coverage alone is insufficient. Include guidance on:

  • Assertion density: At least one meaningful assertion per test (not just "doesn't throw")
  • Boundary testing: Edge cases, empty inputs, max values, off-by-one
  • Error paths: Test failure modes, not just happy paths
  • Isolation: Unit tests must not depend on external services, filesystem, or network
  • Determinism: No time-dependent, order-dependent, or flaky tests
  • Naming: Test names describe the scenario and expected outcome

Step 4: Gap Analysis

Compare current state to targets:

  1. Run test discovery to count existing tests per module
  2. Identify modules with zero test coverage
  3. Identify critical paths (from INVARIANTS) without integration tests
  4. Identify user flows (from product.md) without E2E coverage
  5. Identify anti-patterns (from guardrails.md) without regression tests
  6. Prioritize gaps by risk: high-risk untested > low-risk untested

Present as a gap matrix:

ModuleCurrent TestsTargetGapRiskPriority
..................

Step 5: Generate Test Plan

Priority test cases to write, ordered by impact:

  1. Tests for critical invariants (from .ai-context.md)
  2. Tests for anti-patterns (from guardrails.md) — regression prevention
  3. Integration tests for service boundaries
  4. E2E tests for critical user flows (from product.md)
  5. Regression tests for known bugs
  6. Property-based tests for complex business logic (if framework supports it)
  7. Performance tests for latency-sensitive paths

For each priority test, specify:

  • What: Description of the test scenario
  • Why: Which invariant, anti-pattern, or flow it protects
  • How: Test type (unit/integration/E2E), framework, key assertions
  • Where: File path where the test should live

Step 6: Save Output

MANDATORY: Include YAML frontmatter with git metadata. Follow core/shared/git-report-metadata.md.

Include the report header table immediately after frontmatter:

| Field | Value |
|-------|-------|
| **Branch** | `{LOCAL_BRANCH}` → `{REMOTE/BRANCH}` |
| **Commit** | `{SHORT_SHA}` — {COMMIT_MESSAGE} |
| **Generated** | {ISO_TIMESTAMP} |
| **Synced To** | `{FULL_SHA}` |

Save to:

  • Project-wide: draft/testing-strategy.md
  • Track-scoped: draft/tracks/<id>/testing-strategy.md

Cross-Skill Dispatch

  • Auto-loaded by: /draft:implement (before TDD cycle)
  • Suggested by: /draft:decompose (after module definition), /draft:init (after setup)
  • Feeds into: /draft:coverage (measurement against targets set here)
  • References: /draft:bughunt findings as regression test candidates

Error Handling

If no test infrastructure found: Recommend test framework based on tech-stack.md, include setup steps needed before tests can be written If no draft context: Generate generic strategy, suggest running /draft:init for better results If conflicting test patterns found: Document both patterns, recommend consolidation as a tech-debt item

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.