generate-tests
/generate-tests
Use this skill whenever the user wants to generate tests before refactoring, create a test plan, add safety net tests, lock down behavior with tests, or generate test code for existing modules. Triggers include: "generate tests", "create test plan", "add tests before refactoring", "write tests for this", "I need safety net tests", "test this module", "lock down behavior", or any request to add tests in preparation for code changes. Also use when the user asks to "prepare for refactoring" and needs the testing phase. Do NOT use for running tests or verifying test results — use verify-changes fo
- Author
- guilhermevozniak ↗
- Repository
- refactor-pilot-framework ↗
- Licence
- MIT
- Last repository change
- 12.06.2026
Assessment and security
- Files in this package
- 2
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 0
No signals detected. Repository changed on 12.06.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
What it does and when to use it
Use this skill whenever the user wants to generate tests before refactoring, create a test plan, add safety net tests, lock down behavior with tests, or generate test code for existing modules. Triggers include: "generate tests", "create test plan", "add tests before refactoring", "write tests for this", "I need safety net tests", "test this module", "lock down behavior", or any request to add tests in preparation for code changes. Also use when the user asks to "prepare for refactoring" and needs the testing phase. Do NOT use for running tests or verifying test results — use verify-changes fo
Triggers from the description
Original author description
Use this skill whenever the user wants to generate tests before refactoring, create a test plan, add safety net tests, lock down behavior with tests, or generate test code for existing modules. Triggers include: "generate tests", "create test plan", "add tests before refactoring", "write tests for this", "I need safety net tests", "test this module", "lock down behavior", or any request to add tests in preparation for code changes. Also use when the user asks to "prepare for refactoring" and needs the testing phase. Do NOT use for running tests or verifying test results — use verify-changes fo
How it works
- Quick Decision Tree
- Prerequisites
- Workflow
- Output
- Important Notes
SKILL.md preview
--- name: generate-tests description: > Use this skill whenever the user wants to generate tests before refactoring, create a test plan, add safety net tests, lock down behavior with tests, or generate test code for existing modules. Triggers include: "generate tests", "create test plan", "add tests before refactoring", "write tests for this", "I need safety net tests", "test this module", "lock down behavior", or any request to add tests in preparation for code changes. Also use when the user asks to "prepare for refactoring" and needs the testing phase. Do NOT use for running tests or verifying test results — use verify-changes for that. --- # Generate Tests Skill You are performing Phase 2 (Prepare & Create Safety Nets) of the Refactor Pilot Framework. Your job is to generate tests that lock down current behavior and build a refactoring plan. ## Quick Decision Tree ``` Does refactor-notes/ exist with Phase 1 outputs? ├── NO → Suggest running analyze-codebase first └── YES → Continue Does refactor-notes/00-requirements.md exist? ├── NO → Start with Step 1 (Define Requirements) └── YES → Skip to Step 2 Does the project have existing tests? ├── YES → Run coverage analysis, focus on gaps └── NO → Generate safety net tests for everything in scope What testing framework does the project use? ├── Jest/Vitest → Use describe/it/expect patterns ├── pytest → Use test_ functions with assert ├── Go testing → Use Test* functions with t.Error └── None configured → Recommend one based on stack ``` ## Prerequisites Phase 1 analysis should be complete. If `refactor-notes/` does not exist, suggest running the `analyze-codebase` skill first. ## Workflow ### Step 1: Define Requirements (if not done) If `refactor-notes/00-requirements.md` doesn't exist, help the user define: - Refactoring goals and success criteria - Hard constraints (what can't change) - Coding standards for the refactored code - Scope (what's in, what's out) Save as `refactor-notes/00-requirements.md`. ### Step 2: Generate Test Plan For the target module or file, produce a test plan covering: - **Behavior tests**: What each export does with valid input - **Edge cases**: Empty, null, undefined, boundary values, special characters - **Integration points**: API calls, shared state, event handlers - **Side effects**: Storage, cookies, analytics, DOM manipulation - **Error handling**: Thrown errors, caught errors, error states Format as a nested list with priority levels (Critical / Important / Nice to have). Present the test plan to the user for review before generating code. ### Step 3: Generate Test Code After the user approves the plan, generate test files: **Detect the testing framework** from the project: - Look for `jest.config.*`, `vitest.config.*`, `pytest.ini`, `conftest.py`, etc. - Check `package.json` or `pyproject.toml` for test dependencies - If no framework is configured, recommend one based on the project's stack **Generate tests that:** - Test behavior, not implementation details - Use descriptive test names that explain the scenario - Group related tests in describe/context blocks - Mock external dependencies - Handle async operations correctly - Include meaningful assertions (not just "doesn't crash") **DO NOT:** - Generate snapshot tests (they break during refactoring) - Test private methods or internal state - Generate tests that won't pass against the current code - Use implementation-specific selectors (prefer role-based or text-based) ### Step 3b: Verify Tests Pass Run the generated tests against the current (un-refactored) code. Fix any failures. Tests MUST pass before proceeding. ### Step 4: Refine Scope Based on test coverage results, refine the refactoring scope: - Which areas are now safe to refactor (good coverage)? - Which areas need more tests before they can be touched? - Are there quick wins to tackle first? - What should be deferred to a future cycle? Update `refactor-notes/00-requirements.md` with refined scope. ### Step 5: Build Refactor Plan Generate a detailed refactoring plan with: 1. Goal statement 2. Target file/directory structure 3. Step-by-step changes (each small enough for a single commit) 4. New utilities and types to create 5. Design patterns to introduce (if `refactor-notes/03c-pattern-opportunities.md` exists, incorporate HIGH-priority patterns into the plan; see `skills/design-patterns/` for guides) 6. Breaking changes and migration paths 7. Risk assessment per step Present the refactor plan to the user for approval. ## Output Save all artifacts: - `refactor-notes/00-requirements.md` (if created) - `refactor-notes/05-test-plan.md` - Test files alongside the source (following project conventions) - `refactor-notes/06-refactor-plan.md` ## Important Notes - Always present the test plan for review before generating code. - Run tests immediately after generating them. If they fail, fix them. - The refactor plan must be approved before Phase 3 begins. - Be skeptical of your own test generation — encourage the user to review. - Use expensive models for the refactor plan, cheaper models for test code generation.
Files in this package (2)
- SKILL.md 5 KB
- references/test-patterns.md 2 KB
Versions
| Repository | Score | Licence |
|---|---|---|
| This page · guilhermevozniak/refactor-pilot-framework | 100 | MIT |
| coco-research/coco | 100 | MIT |
| frootai/frootai | 100 | MIT |
| kjgarza/marketplace-claude | 100 | MIT |
| livlign/claude-skills | 100 | MIT |
| buildbetter-app/skills | 100 | MIT |
| buildbetter-app/skills | 100 | MIT |
| mavka-ai/unit-tests-skills | 100 | MIT |
| Uniswap/ai-toolkit | 84 | MIT |
Database snapshot: 13.11.2026 · package version f9fa744d55f8 (SHA-256 digest of the entire package)
Downloads in the last 30 days: 0 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 100characterization-test-generator
Generates tests that capture current behavior of existing code before refactoring. Use when you need a safety net before AI-assisted refactoring or modifying legacy code. - 100generate
Generate Playwright tests. Use when user says "write tests", "generate tests", "add tests for", "test this component", "e2e test", "create test for", "test this page", or "test this feature". - 100generate
Generate Playwright tests. Use when user says "write tests", "generate tests", "add tests for", "test this component", "e2e test", "create test for", "test this page", or "test this feature". - 100generate
Generate Playwright tests. Use when user says \"write tests\", \"generate tests\", \"add tests for\", \"test this component\", \"e2e test\", \"create test for\", \"test this page\", or \"test this feature\". - 100generate
Generate Playwright tests. Use when user says "write tests", "generate tests", "add tests for", "test this component", "e2e test", "create test for", "test this page", or "test this feature". - 100testing
Characterization testing and safety-net backfill for existing code. Use when legacy, under-tested, or risky code needs tests before a refactor, bug fix, or behavior change. Captures current behavior through public interfaces, identifies coverage gaps, and adds focused unit,…