essential-test-design

Guide test authors to verify observable behavior instead of internal implementation details.

1.5k|242|Updated Feb 16, 2017
One-click install
npx skills add https://github.com/growilabs/growi --skill essential-test-design
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: essential-test-design
Source: https://github.com/growilabs/growi/tree/main/.claude/skills/learned/essential-test-design
Command: npx skills add https://github.com/growilabs/growi --skill essential-test-design

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Tests that are tightly coupled to implementation details create false positives and false negatives, undermining their ability to detect real regressions. This Skill helps authors and reviewers shift focus from internal mechanics to the observable contract so tests remain valuable across refactors.

Core Features & Use Cases

  • Behavior-first guidance: Emphasizes asserting observable outcomes and boundary conditions rather than spying on internal calls.
  • Decision framework: A short checklist to define the contract, the regression to catch, and whether a test would survive internal refactoring.
  • Common scenarios: Practical patterns for async delays, debounce/throttle logic, data transformation, side effects (API/DB), and retry logic, with recommendations for fakes, mocks at boundaries, and boundary assertions.
  • Reviewer aid: Use during test reviews to identify brittle assertions and convert them into robust contract tests.

Quick Start

Ask the assistant to review a failing or flaky test and rewrite assertions so they verify the observable behavior boundary rather than implementation details.

Frequently Asked Questions about essential-test-design

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

FAQPage Schema
Why do my unit tests break during refactoring even when the code behavior hasn't changed?

Unit tests break during refactoring when they assert internal implementation calls rather than observable behavior. This Skill guides authors to verify the caller's contract using boundary assertions, ensuring tests pass when behavior is preserved and fail only on real regressions.

What is the best way to test debounce and throttle logic without creating flaky tests?

The best way to test debounce and throttle logic is using fake timers to control time progression and asserting observable outcomes at boundaries. This Skill provides practical patterns to verify timing behavior deterministically without relying on real delays.

How do I rewrite brittle test assertions to verify observable behavior instead of implementation details?

To rewrite brittle assertions, use this Skill's decision framework to define the contract, identify the regression to catch, and replace internal call spies with boundary assertions. Ask the assistant to review the failing test and rewrite it to verify the observable behavior boundary.

How should I test retry logic and external API side effects to avoid false positives?

Test retry logic and external API side effects by mocking external boundaries and asserting observable outcomes rather than internal function calls. This Skill recommends using fakes at boundaries with explicit regression scenarios to ensure tests catch real failures without coupling to internals.

When should I use fake timers instead of real timeouts in unit tests?

Use fake timers in unit tests whenever verifying async delays, debounce, throttle, or retry logic to prevent flaky tests. This Skill applies fake timers to control time progression deterministically, ensuring assertions reflect the caller's contract without relying on real-time execution.