Write behavior-focused, refactor-resistant tests that verify intent and regressions.
Copy the install command and let the AI configure it · recommended for beginners
Please install the "test-discipline" skill from askskill: 1. Download https://raw.githubusercontent.com/microsoft/devsquad-copilot/main/.github/plugins/devsquad/skills/test-discipline/SKILL.md 2. Save it as ~/.claude/skills/test-discipline/SKILL.md 3. Reload skills and tell me it's ready
Design and write tests for this new feature. Verify observable behavior through public interfaces, avoid relying on internal implementation details, and explain the intent covered by each test.
A set of behavior-focused tests with brief explanations, covering key paths without depending on internals.
Here is a bug with the root cause already identified and ready to fix. First write a regression test that reliably reproduces the issue, then provide the fix so the test goes from failing to passing, and explain why the test prevents recurrence.
A regression test that fails first and then passes with the fix, plus an explanation of why it prevents recurrence.
Review the quality of this test suite. Focus on whether it verifies behavioral intent, is overly coupled to implementation details, and is resistant to refactoring, then provide actionable improvements.
A test quality review identifying problematic tests, risks, and specific improvement recommendations.
Tests verify behavior through public interfaces, not implementation details. Code can change entirely; tests should not break unless behavior changes. A good test reads like a specification.
Use TDD strategically, not dogmatically. The goal is high-quality tests that verify intent — the ordering of when tests are written is a means to that end, not the end itself.
Test-first (red-green-refactor) works best when:
Design-first-then-test works best when:
In both approaches, the quality criteria for the resulting tests are identical.
Regardless of test-first or design-first, deliver work in vertical slices — thin end-to-end paths through all layers.
Anti-pattern: horizontal slicing
Writing all tests first (or all of one layer first), then all implementation. This produces tests that verify imagined behavior and delays integration feedback.
AVOID (horizontal):
All tests → All implementation
All models → All services → All endpoints
PREFER (vertical):
Slice 1: User can create an order (all layers, happy path)
Slice 2: Order validates required fields (error handling)
Slice 3: Order calculates totals (business logic)
The first slice should be a tracer bullet: a thin end-to-end path that proves the architecture works.
Every test must satisfy these criteria regardless of when it was written:
| Criterion | Check |
|---|---|
| Behavior-focused | Tests what the system does, not how it does it |
| Public interface only | Uses the same API that callers use |
| Refactor-resistant | Would survive internal restructuring without changes |
| Independent | Does not depend on other tests or test execution order |
| Deterministic | Same result every run, no timing dependencies |
| Readable | Test name describes the behavior being verified |
For unit test rules, integration test rules, and test doubles hierarchy, follow coding-guidelines.md (always in context). This skill focuses on what coding-guidelines does not cover: the decision framework, per-task procedure, quality criteria, and anti-patterns.
Good tests exercise real code paths through public APIs. They describe what the system does, not how. They read like a specification: "user can checkout with valid cart" tells you exactly what capability exists.
Bad tests are coupled to implementation:
…
Systematically triage failures and fix broken builds or unexpected runtime issues.
Design and review software architecture diagrams for clearer, documentation-friendly visuals.
Create, switch, and verify Git branches before starting implementation work.
Initialize projects or verify and generate up-to-date SDD documentation templates.
Verify and create standard community and governance files for new projects.
Standardize formatting and writing style for project Markdown documentation.
Write failing tests first to implement features and bug fixes reliably.
Implement features and fixes by writing tests before production code.
Identify test anti-patterns and improve tests without polluting production code.
Design test strategies and plans with coverage, methods, and quality priorities.
Helps developers avoid common testing anti-patterns and write more reliable tests.
Build features, fix bugs, and refactor code with test-driven development.