test-conventions

Guide test planning with failing-test-first and test pyramid layers.

4|1|Updated Mar 11, 2026
One-click install
npx skills add https://github.com/jcdendrite/claude-config --skill test-conventions-jcdendrite
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-conventions
Source: https://github.com/jcdendrite/claude-config/tree/main/claude/.claude/skills/test-conventions
Command: npx skills add https://github.com/jcdendrite/claude-config --skill test-conventions-jcdendrite

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps teams consistently write tests that actually catch bugs early, avoid flaky behavior, and make maintenance cheaper over time.

Core Features & Use Cases

  • Test strategy guidance: Use the right test pyramid layer (unit, integration, contract, E2E, smoke) for each change.
  • Test-first discipline: Enforce “failing test first” for production code, while documenting legitimate exceptions.
  • Testability and isolation: Improve designs via dependency injection and ensure globals/DB state are properly isolated.
  • Practical conventions: Apply clear naming, Arrange/Act/Assert structure, safe parallelization rules, and non-tautological mocks.

Quick Start

Ask how to structure new tests for a feature while choosing the correct test layer and ensuring the changes remain isolated and non-flaky.

Frequently Asked Questions about test-conventions

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I choose the right test pyramid layer for a new feature?

To choose the right test layer, match your change's scope to unit, integration, contract, E2E, or smoke tests, ensuring adequate coverage without unnecessary overhead or slow execution times.

What's the best way to isolate global state and databases in tests?

Isolate global state and databases by applying dependency injection and proper fixture design, ensuring tests remain parallel-safe and preventing shared state from causing unexpected flaky behavior.

Why do I need a failing test before writing production code?

A failing test first confirms the test actually catches regressions. Documenting legitimate exceptions for spikes or hard-to-test code maintains this discipline while acknowledging practical engineering constraints.

How do I prevent flaky tests in parallel test execution?

Prevent flaky tests during parallel execution by enforcing test isolation, using non-tautological mocks, and ensuring global and database state is properly reset or injected for each test run.

Can I document exceptions for code that is hard to test?

Yes, you can document exceptions for hard-to-test code or spikes, maintaining test-first discipline for production code while acknowledging practical engineering constraints and technical debt.

How does contract testing work with test isolation?

Contract testing validates interactions between services using isolated fixtures and mocks, ensuring global state and database dependencies are properly separated to prevent cross-service contamination and flaky behavior.