Refactoring Test Suites

Refactor test suites with naming, decomposition, parameterization, and relocation.

1|Updated Jun 4, 2025
One-click install
npx skills add https://github.com/kynoptic/markdownlint-trap --skill refactoring-test-suites
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Refactoring Test Suites
Source: https://github.com/kynoptic/markdownlint-trap/tree/main/.claude/skills/tests-refactor
Command: npx skills add https://github.com/kynoptic/markdownlint-trap --skill refactoring-test-suites

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill standardizes and cleans up messy test suites by applying project-wide conventions for test naming, structure, parameterization, and classification to improve CI reliability and developer readability across languages.

Core Features & Use Cases

  • Standardize behavioral test naming: Rename tests to describe outcomes rather than implementation details (e.g., test_should_X_when_Y, test_rejects_X_when_Y).
  • Decompose multi-assert tests: Split tests with multiple branches into atomic units with single assertions and concise summaries.
  • Parameterize repeated logic: Consolidate duplicate test structures into parameterized cases (e.g., @pytest.mark.parametrize in Python) and move shared setup to fixtures.
  • Classify and relocate tests: Move files into tests/unit/ or tests/features/ and update runners/imports.
  • Eliminate vanity tests: Remove tests that do not verify meaningful behavior; document rationale.
  • Tag and annotate tests: Add metadata tags like @unit or @integration and normalize inline comments.

Quick Start

Example: Run the Refactoring Test Suites skill on a messy PyTest project to rename tests, split atomic cases, parameterize inputs, and relocate files while applying tags for clear classification.

Frequently Asked Questions about Refactoring Test Suites

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

FAQPage Schema
How do I rename tests to follow a consistent naming convention?

Test naming conventions like `test_should_X_when_Y` describe outcomes instead of implementation details. This Skill renames tests across your suite to enforce behavioral naming patterns, improving readability and making test intent immediately clear to developers reviewing the codebase.

Why should I split multi-assert tests into separate test cases?

Multi-assert tests obscure which assertion failed and make debugging harder. Decomposing tests into atomic units with single assertions isolates failures, simplifies CI diagnostics, and ensures each test verifies one behavior, reducing maintenance friction.

Can I consolidate duplicate test logic using parameterization?

Yes. Parameterization via `@pytest.mark.parametrize` and similar language mechanisms consolidates repeated test structures into single cases with multiple inputs, reducing duplication, improving maintainability, and making the test suite faster to read and modify.

How do I organize tests into a standard directory structure?

This Skill relocates tests into conventional directories like `tests/unit/` or `tests/features/`, tags tests with metadata like `@unit` or `@integration`, and updates imports and CI runners accordingly, ensuring consistent discovery and execution across your project.

What should I do with tests that don't verify meaningful behavior?

Vanity tests that don't validate real behavior bloat your suite and create maintenance overhead. This Skill identifies and removes them while documenting the rationale, keeping your test suite focused on coverage that matters to reliability.