refactor-tests

Analyze test files for refactoring candidates and detect large or mixed-responsibility tests.

Updated Jun 21, 2025
One-click install
npx skills add https://github.com/grad13/cctop --skill refactor-tests
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: refactor-tests
Source: https://github.com/grad13/cctop/tree/main/.claude/skills/refactor-tests
Command: npx skills add https://github.com/grad13/cctop --skill refactor-tests

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill identifies and suggests refactoring opportunities within test files to improve their maintainability and effectiveness.

Core Features & Use Cases

  • Detects large test files: Flags tests exceeding 500 lines, indicating a need for splitting.
  • Identifies mixed responsibilities: Pinpoints test files that cover multiple modules or concerns.
  • Flags manual mocking: Highlights instances where manual mock objects are used instead of standard mocking libraries.
  • Use Case: Refactor a large, complex test suite to make it more readable, maintainable, and efficient.

Quick Start

Analyze test files in the current directory for refactoring candidates.

Frequently Asked Questions about refactor-tests

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

FAQPage Schema
How do I identify refactoring candidates in large test files?

Test files exceeding 500 lines often indicate a need for splitting. Analyzing these large files helps detect mixed responsibilities where one test covers multiple modules or concerns, and flags manual mock objects that should be replaced with standard mocking libraries to improve overall maintainability.

How do I split test files that have mixed responsibilities across multiple modules?

To split test files with mixed responsibilities, analyze the code to pinpoint tests covering multiple modules or concerns. By detecting these mixed responsibilities, you can separate the tests into distinct, focused files that each target a single module, improving readability and maintainability.

What is the best way to analyze a test suite for code quality issues?

The best way to analyze a test suite for code quality issues is to collect the test files, prioritize those exceeding 500 lines, and analyze them sequentially. This approach detects large file sizes, mixed responsibilities, and manual mocking to suggest ideal refactoring states.

Can I detect manual mock objects instead of using standard mocking libraries in my tests?

Yes, you can detect manual mock objects in your tests by analyzing the test files for hardcoded mock implementations. This analysis flags instances where standard mocking libraries should be used instead, helping to improve test code quality and maintainability.