Skip to content
⭐ Featuredtesting

Test Generator

Generate unit and integration tests for an existing function, class, or API endpoint.

/test-gen

Install this skill

  1. 1. Copy the SKILL.md content (button above)
  2. 2. Create a folder for the skill:
    # Mac/Linux
    mkdir -p ~/.claude/skills/test-gen
    
    # Windows (PowerShell)
    mkdir $env:USERPROFILE\.claude\skills\test-gen
  3. 3. Save the content as ~/.claude/skills/test-gen/SKILL.md
  4. 4. Restart Claude Code (or open a new session)
  5. 5. Type /test-gen to invoke it
unit-testsjestvitestplaywright

/test-gen

Genera tests cubriendo casos felices, bordes y errores.

Usage

/test-gen <file-path> /test-gen <file-path>:<line> # específico a una función /test-gen <file-path> --integration # tests con DB/network reales

Cobertura por default

Unit tests

  • ✅ Caso feliz (input válido → output esperado)
  • ✅ Inputs vacíos / null / undefined
  • ✅ Inputs en el límite (rangos, longitudes)
  • ✅ Inputs inválidos (debe throw o retornar error)
  • ✅ Side effects (mocks de DB, fetch, etc.)

Integration tests

  • ✅ Flujo completo end-to-end
  • ✅ Con DB real (rollback al final)
  • ✅ Con auth simulada

Frameworks soportados

Detecta automáticamente del package.json:

  • Jest, Vitest, Mocha, AVA (Node)
  • Pytest (Python)
  • RSpec (Ruby)
  • Go testing
  • Playwright (E2E)

Convenciones

  • Naming: <file-bajo-test>.test.ts o __tests__/
  • Sigue el patrón existente del repo si hay tests previos
  • Mock infraestructura externa, no la lógica del proyecto