/spec-forge:test-plan-generationfrom spec-forge
Generates professional Test Plan and Test Cases documents following IEEE 829, ISTQB, and Google Testing Blog standards. Activates on requests to write test plans, create test cases, define test strategy, or draft QA documents.
Ships in spec-forge. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
A Test Plan is the master document that defines the scope, approach, resources, and schedule of all testing activities for a software project or feature. As specified by IEEE 829 (Standard for Software and System Test Documentation), a test plan communicates the intent of testing to all stakeholders and provides a framework for organizing, tracking, and evaluating test efforts. It answers fundamental questions: what will be tested, how it will be tested, who will test it, when testing will happen, and what criteria determine whether testing is complete.
Within the software development lifecycle a Test Plan sits downstream of the Software Requirements Specification (SRS) and Technical Design documents. It translates functional and non-functional requirements into concrete, verifiable test cases. A well-constructed Test Plan reduces the risk of undetected defects reaching production, provides measurable quality gates, and serves as the contractual agreement between development, QA, and product teams on what "done" means from a quality perspective.
This skill treats the Test Plan as a living artifact. It is authored once, but it evolves as requirements change, new risks emerge, and test execution reveals areas needing deeper coverage.
Every Test Plan generated by this skill follows a disciplined six-step process. Each step must be completed before moving to the next.
Before writing any test documentation, scan the project to build situational awareness of both the application under test and the existing test infrastructure.
Fast path (preferred): resolve <sf_scripts> (see @../shared/scripts.md) and run python3 "<sf_scripts>/sf-scan.py" --root "<project_root>". Its JSON supplies the tech stack, frameworks, DB/auth signals, test.framework/test.command, source_tree, and the existing-doc inventory in one pass — use those directly. Fall back to the manual scan below (silently) only when python3 is unavailable.
**/*.md, **/package.json, **/pyproject.toml, **/*.test.*, **/*.spec.*, **/__tests__/**, or language-specific test directories to map the landscape.jest.config.*, pytest.ini, vitest.config.*, .github/workflows/*, Makefile, or docker-compose.test.yml. Understanding what test infrastructure already exists prevents duplicated effort and ensures the plan integrates with the team's workflow.Before locating upstream documents or writing any test plan content, the doc-first discipline applies. Read the existing test documentation (test-plan.md, qa.md, testing-strategy.md, README test sections), identify what already covers the strategy, scope, environment, or process, and decide for each section whether to REUSE (reference existing), EXTEND (edit existing in place), or NEW (genuinely missing). The default for any topic that already has coverage in an existing test plan is to extend in place — never to create parallel test-plan-v2.md files, never to append ## Update blocks, never to leave deprecated sections strikethrough'd.
The full discipline, the four rules, the pre-generation checklist, and the anti-patterns to avoid:
@../shared/doc-first.md
You MUST run the pre-generation checklist (the five questions) from doc-first.md before proceeding to Step 2. If an existing test plan already covers any of the topics this generation will discuss, you must:
file:line references)If the project shows signs of doc drift (multiple test-plan-*.md files, contradictory strategies, obvious duplication), warn the user and recommend /spec-forge:analyze or /spec-forge:propagate first.
If a usable existing test plan already covers most of what the user is asking for, the right action is edit it in place, not generate a new file.
The Test Plan must trace every test case back to a requirement. The sf-scan.py inventory from Step 1 already lists upstream docs under document_index (srs/tech-design/prd) with the requirement IDs each declares (declared_ids); use it instead of re-globbing.
document_index (or, as a fallback, glob docs/ for */srs.md, */tech-design.md, */prd.md).FR-XXX-NNN, NFR-XXX-NNN): use python3 "<sf_scripts>/sf-trace.py" ids "<srs.md>" (or the scan's declared_ids) rather than reading them out by hand — these seed the traceability matrix in Step 5.After scanning, infer everything you can from the codebase, the upstream SRS/Tech Design, and any existing test plan — and state those inferences as assumptions the user can correct. Then ask only the questions whose answers materially change the plan and cannot be inferred. Typical areas that genuinely need the user (they are rarely in the code) include:
Proceed to generation once you have enough to fill the core sections — on your inferred defaults (stated explicitly) where the user has not weighed in — rather than blocking on a full questionnaire. Capture any remaining unknowns as open questions in the plan.
Using the answers from Step 3 and the context from Steps 1 and 2, generate the full Test Plan by filling in every applicable section of references/template.md. Follow the writing guidelines and standards described in the sections below. Generate all Mermaid diagrams inline. Assign test case IDs, priorities, and types as you go.
Real DB enforcement gate: After generating all test cases, scan every test case's DB Approach field. Any test case that performs a Create, Read, Update, or Delete operation against the project's own database MUST have DB Approach: Real DB. If you find Mock for a database-touching test case, rewrite it to use TestContainers or a real test database instance. Mocks are only acceptable for external third-party services the project does not control.
After generating the Test Plan, construct the Requirements Traceability Matrix (RTM). Map every SRS requirement ID (both functional and non-functional) to one or more test case IDs. Let the script layer do the coverage math: run
python3 "<sf_scripts>/sf-trace.py" matrix --upstream "<srs.md>" --downstream "<test-plan.md>"
and use its uncovered_upstream (requirements with no test case — the gaps to flag) and orphan_downstream_refs (test references to requirement IDs that do not exist). You decide whether each gap is intentional; the script does the bipartite counting. Fall back to building the matrix by hand if the script is unavailable. The RTM is the primary mechanism for proving that testing is complete and aligned with the specification.
Run the structural gate first — python3 "<sf_scripts>/sf-verify-doc.py" "<test-plan.md>" --strict deterministically checks the title, sections, TC ID format/uniqueness, and leftover placeholders — and fix everything it flags. Then validate the judgement items against references/checklist.md (the parts the script cannot judge). Summarize the checklist results so the user can see what passed and whether any items were intentionally skipped (with justification). (Run the checklist by hand if python3 is unavailable.)
The test strategy follows the well-established test pyramid model, with one critical modification: any test that touches the database must use a real database, not a mock.
Mocking the database hides real bugs:
The only acceptable use of mocks is for external third-party services (payment gateways, email/SMS providers, external APIs) that you don't control and may be unavailable during tests. Your own database, cache, and message queues should always be tested for real.
Tools like TestContainers make real database testing as easy as mocking — they spin up a real database in Docker, run tests, and auto-cleanup. There is no longer a valid excuse to mock the database.
The plan must specify the approximate distribution of tests across these levels (e.g., 60% unit, 25% integration, 10% system/E2E, 5% acceptance) and include a Pyramid Distribution Rationale explaining why this specific split was chosen for this project. A generic distribution is not acceptable — the rationale must reference project-specific factors: "Unit tests are weighted at 70% because the domain logic is heavily algorithmic with minimal external I/O" or "Integration tests are elevated to 40% because this service is primarily a data aggregation layer with little pure logic to unit test." Any distribution that deviates significantly from the standard pyramid must explain what makes this project structurally different.
Test cases use the same TC-<MODULE>-<NNN> convention as the test-cases-generation skill — that skill is the single source of truth for the shared test-case conventions (ID format and the implementation-ready field structure); keep the two identical rather than letting them drift. In brief:
TC-<MODULE>-<NNN>
AUTH, PAY, DASH, NOTIF, CART, SRCH.Examples: TC-AUTH-001, TC-PAY-012, TC-CART-003. Allocate the next free number with python3 "<sf_scripts>/sf-trace.py" next-id --prefix TC --module AUTH --existing "<test-plan.md>" to avoid collisions when extending.
Each test case is an implementation guide for engineers. It must be detailed enough to be translated directly into test code. Each test case must include the following fields:
[action] [condition] [expected outcome] (e.g., "Create user with valid email returns 201 and saves to database").users table with id='uuid-1', role='admin', status='active'; Auth token valid for user uuid-1".name: "John Doe", email: "[email protected]", age: 25. Never use placeholders like [valid name] or [valid email]. Specify exact HTTP method, endpoint, headers, and request body.users WHERE email = '[email protected]' → verify name = 'John Doe', status = 'active'").The Test Plan must address the following test types, allocating appropriate effort to each based on the project's risk profile:
Three primary test methods are applied depending on the test level and objective:
Not all features carry equal risk. The Test Plan applies risk-based prioritization to focus testing effort where it matters most.
Entry criteria define the preconditions that must be met before testing begins. They act as a gate to prevent wasted effort on an untestable build. Typical entry criteria include: code complete for the features in scope, build successfully deployed to the test environment, unit tests passing with minimum coverage thresholds, test data prepared and loaded, and upstream documentation (SRS, Tech Design) reviewed and approved.
Exit criteria define the measurable conditions that must be met before testing is declared complete. They provide an objective, defensible answer to "are we done testing?" Typical exit criteria include: all P0 and P1 test cases executed, overall pass rate at or above 95%, no open Critical or Major defects, requirements traceability matrix showing 100% coverage of in-scope requirements, and performance benchmarks met.
Defects are classified into four severity levels:
Every defect follows a defined lifecycle: New, Assigned, In Progress, Fixed, Verified, and Closed. If verification fails, the defect is Reopened and cycles back through the process. The Test Plan must include a Mermaid state diagram illustrating this lifecycle.
The Requirements Traceability Matrix (RTM) is one of the most critical sections of the Test Plan. It provides a bidirectional mapping between SRS requirements and test cases.
Every test plan must include a dedicated section for data integrity test cases. Per the real-database rule above, these must run against a real DB (a mock cannot catch a constraint violation). Data integrity tests must cover:
deleted_at set) rather than physically removed; verify soft-deleted records are excluded from normal queries.Every feature must have both positive test cases (verifying correct behavior with valid inputs) and negative test cases (verifying proper error handling with invalid, unexpected, or malicious inputs). A ratio of roughly 60% positive to 40% negative is a useful starting guideline for most features.
For any input that has defined ranges or limits, include test cases at the exact boundary, one value below the boundary, and one value above the boundary. This technique catches off-by-one errors and range validation defects that are among the most common bugs in software.
Beyond boundary values, identify and test edge cases specific to the domain: empty inputs, maximum-length strings, concurrent operations, timezone transitions, Unicode characters, null values, and other scenarios that stress the system's assumptions.
This skill relies on two reference files stored alongside it.
references/template.md -- The full Test Plan template following IEEE 829 structure with placeholder text for every section. The generated Test Plan is built by filling in this template.references/checklist.md -- A quality checklist organized into four categories (Completeness, Quality, Consistency, Format). The checklist is used during Step 6 to validate the finished document.Always read both files before generating a Test Plan so that any updates to the template or checklist are picked up automatically.
The finished Test Plan is written to:
docs/<feature-name>/test-plan.md
where <feature-name> is a lowercase, hyphen-separated slug derived from the feature name (for example, docs/user-authentication/test-plan.md or docs/payment-processing/test-plan.md). If the docs/<feature-name>/ directory does not exist, create it. If a file with the same name already exists, confirm with the user before overwriting.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
spec-forge@tercel-claude-plugins is listed by tercel/tercel-claude-plugins — review the source before installing
npx claudepluginhub tercel/tercel-claude-plugins --plugin spec-forge11 skills in this plugin
/analyzeAnalyze a collection of documents to build a knowledge map, identify themes, find gaps, duplicates, conflicts, and staleness, then produce an organized analysis with improvement recommendations. Designed for document ecosystems (cross-repo docs, research collections, mixed-format doc repos) where the challenge is understanding the landscape, not auditing against code.
/auditAudit existing project documentation for quality, completeness, consistency, and code alignment. Scans docs against the actual codebase to find stale references, missing coverage, internal contradictions, and quality issues. Generates a structured findings report with severity levels and actionable fix recommendations. Works on any project with a docs/ directory.
/decomposeLightweight project decomposition skill. Analyzes project scope through a brief interview and determines whether the project should be treated as a single feature or split into multiple sub-features. For multi-split projects, generates a project manifest listing sub-features, dependencies, and execution order.
/ideaUse when exploring a new idea before writing formal specifications. Guides users through iterative discovery, research, and critical analysis to crystallize vague ideas into validated requirement drafts. Includes anti-pseudo-requirement checks, competitive research, demand evidence gathering, and "What if we don't build this?" analysis. Supports pause/resume across sessions, stores ideas in the project's ideas/ directory, and graduates validated ideas into the spec-forge auto chain ([idea] → [decompose] → [prd] → srs → tech-design → review).
/prd-generationGenerates professional Product Requirements Documents (PRDs) following industry-standard methodologies. This skill activates when the user asks to write PRD, create a product requirements document, draft product requirements, do product planning, do feature planning, write a product spec, or create a product document. It synthesizes best practices from the Google PRD framework, the Amazon Working Backwards methodology, and the Stripe Product Spec approach to produce comprehensive, actionable PRDs tailored to the user's project.
/propagateWalk an upstream documentation change downstream — when a PRD, SRS, tech-design, or feature spec is edited, find every dependent document, identify which sections are now stale, and interactively update them to keep the entire doc chain consistent. Use after editing any spec-forge document, or run periodically with --since to catch accumulated drift.
Other plugins' skills for the same job