writing-tests

Write behavior-focused functional, integration, and unit tests with condition-based waiting.

20|3|Updated Aug 16, 2016
One-click install
npx skills add https://github.com/heyJordanParker/dotfiles --skill writing-tests-heyjordanparker
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: writing-tests
Source: https://github.com/heyJordanParker/dotfiles/tree/main/claude/.claude/skills/writing-tests
Command: npx skills add https://github.com/heyJordanParker/dotfiles --skill writing-tests-heyjordanparker

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill emphasizes writing tests that demonstrate expected behavior rather than validating implementation details, reducing brittleness and guiding reliable software quality.

Core Features & Use Cases

  • Functional testing: Validate end-to-end features by exercising entry points and user flows.
  • Integration and unit testing balance: Focus on tests that capture state mutations, API interactions, and deterministic outcomes; avoid overreliance on internal wiring.
  • Use Case: When a feature changes, write tests that verify user-visible behavior, fix flaky tests with condition-based waiting, and keep tests deletable and maintainable.

Quick Start

Execute the test suite for the new feature using your project's standard command and observe failures to adjust tests for behavior over implementation.

Frequently Asked Questions about writing-tests

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

FAQPage Schema
How do I write unit tests that verify behavior instead of implementation details?

To write behavior-focused unit tests, validate user-visible state mutations and deterministic outcomes rather than internal wiring. This approach reduces brittleness by proving expected software behavior, keeping tests maintainable and deletable when features change.

What is the best way to fix flaky tests in an integration testing workflow?

The best way to fix flaky tests is by replacing fixed delays with condition-based waiting. This enforces test discipline by ensuring integration tests proceed only when expected state mutations or API interactions are fully resolved, providing clear failure signals.

How many unit tests should I write per feature for functional testing?

For functional testing, you should avoid excessive unit tests per feature. Focus on a balanced integration and unit testing strategy that captures deterministic outcomes and API interactions, ensuring tests remain maintainable rather than over-reliant on internal wiring.

Why do my tests break when I refactor code even though the feature still works?

Tests break during refactoring because they validate implementation details rather than expected behavior. By writing targeted tests that exercise entry points and user flows, you ensure tests prove functional behavior and remain stable across internal code changes.

When do I need integration testing versus unit testing for state mutations?

You need integration testing when validating API interactions and end-to-end user flows, while unit testing suits isolated deterministic outcomes. Balance both to capture state mutations accurately, avoiding over-reliance on internal wiring and keeping the test suite maintainable.