test-code-guide

Guides test design, writing, and review to prevent implementation mirroring and flaky tests.

1|Updated Mar 18, 2026
One-click install
npx skills add https://github.com/psw7205/skills --skill test-code-guide-psw7205
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: test-code-guide
Source: https://github.com/psw7205/skills/tree/main/skills/test-code-guide
Command: npx skills add https://github.com/psw7205/skills --skill test-code-guide-psw7205

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? AI-generated tests often mirror implementation logic, chase meaningless coverage numbers, or become flaky and coupled to each other. This Skill enforces behavior-driven test design so tests verify contracts rather than duplicating code. ## Core Features & Use Cases - Three Modes: Design review (deciding what to test, at which level, with which technique), writing (following repo conventions and quality checklists), and read-only review of existing tests against four failure patterns. - ISTQB-Grounded References: Decision trees for technique selection (EP, BVA, pairwise, state transition, decision tables, property-based, metamorphic) plus automation quality rules for fixtures, oracles, async waits, and test data. - Use Case: When asked to "add unit tests for this function", the Skill first reads existing repo test conventions, defines the target behavior as a contract, picks the lowest sufficient test level, and writes deterministic, isolated tests with independent oracles. ## Quick Start Ask the AI to write tests for a specific function or review your existing test suite for flakiness and implementation mirroring.

Frequently Asked Questions about test-code-guide

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

FAQPage Schema
How do I write unit tests that don't break on every refactor?▼

Test public behavior and contracts rather than internal implementation steps. Derive expected values independently of the implementation, mock only boundary collaborators like network and time, and verify the test still passes after behavior-preserving refactors.

How to choose between unit, integration, and E2E test levels?▼

Place each behavior at the lowest level capable of verifying it, since higher levels are slower and harder to debug. Follow the test pyramid ratio principle and reserve E2E tests for integration points and user journeys only.

What test design techniques should I use for complex inputs?▼

Use equivalence partitioning with boundary value analysis for input ranges, pairwise combinatorial testing for parameter interactions, state transition testing for order-dependent logic, and decision tables for business rules. Pick techniques based on the defect hypothesis you are targeting.

Why are my tests flaky and how do I fix them?▼

Flakiness usually comes from hard-coded sleeps, real time or network dependencies, random values without fixed seeds, or shared state between tests. Replace sleeps with polling plus timeout or event subscription, inject clocks, and quarantine flaky tests for root-cause analysis instead of hiding them with retries.

Does this approach work with any test framework or language?▼

Yes, the Skill is framework-agnostic and enforces no specific runner, assertion library, or directory convention. It first reads the target repository's existing tests to adopt its conventions, then applies framework-independent quality principles.

When should I not use this test writing skill?▼

It does not trigger for requests that only run existing tests without writing or reviewing them. Full review-fix-commit iteration loops are delegated to a separate self-feedback-loop skill, and installing missing test infrastructure is handled as a separate request.