Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

regression-test-generator

БесплатноБез исполняемых скриптовНе проверен

Generate regression tests when bugs are discovered during /debug or continuous checks. Auto-detects test framework, creates Arrange-Act-Assert tests, and…

marcusgollот marcusgoll★ 97 звёзд на GitHub19 установок в других каталогах

Об этом скилле

Automatically generate regression tests that capture bugs to prevent recurrence. Creates complete, framework-appropriate tests that: 1. Reproduce the bug scenario (fails before fix) 2. Verify correct behavior (passes after fix) 3. Link back to error-log.md for traceability Generate regression test for a bug:
  1. Collect bug details: error ID, symptoms, root cause, affected component
  2. Detect test framework from project (Jest, Vitest, pytest, Playwright)
  3. Generate test file following project patterns
  4. Present to user for review: [A] Save [B] Edit [C] Skip
  5. Save test to tests/regression/ and update error-log.md

Key principle: Tests should FAIL before the fix is applied (proves bug exists).

Before generating regression test:

  • Bug has been identified with symptoms and reproduction steps
  • Root cause determined (from 5 Whys or debugging)
  • Component/file affected is known
  • Error ID assigned (ERR-XXXX) or will be assigned

Check error-log.md to avoid duplicate tests for same error.

**Collect bug details**

Extract from debug context:

  • Error ID: ERR-XXXX from error-log.md (or generate new)
  • Title: Brief description (e.g., "Dashboard timeout due to missing pagination")
  • Symptoms: Observable behavior (error message, incorrect output)
  • Root cause: Why the bug occurred (from 5 Whys analysis)
  • Component: Affected file/function (e.g., StudentProgressService.fetchExternalData)
  • Reproduction steps: How to trigger the bug

Example:

error_id: ERR-0042
title: Dashboard timeout due to missing pagination
symptoms: Dashboard fails to load, timeout after 30s
root_cause: Missing pagination parameter causes over-fetching
component: src/services/StudentProgressService.ts:fetchExternalData
reproduction:
  - Navigate to /dashboard/student/123
  - Click "Load Data" button
  - Observe timeout error
**Detect test framework**

Check project configuration (in priority order):

  1. docs/project/tech-stack.md (if exists):

    grep -i "test\|jest\|vitest\|pytest\|playwright" docs/project/tech-stack.md
    
  2. package.json (JavaScript/TypeScript):

    # Check devDependencies
    grep -E '"(jest|vitest|@playwright/test|mocha)"' package.json
    
  3. pyproject.toml / requirements.txt (Python):

    grep -E "(pytest|unittest|nose)" pyproject.toml requirements.txt
    
  4. Existing test file patterns:

    # JavaScript patterns
    find . -name "*.test.ts" -o -name "*.spec.ts" | head -1
    
    # Python patterns
    find . -name "*_test.py" -o -name "test_*.py" | head -1
    
  5. Defaults:

    • JavaScript/TypeScript: Jest
    • Python: pytest
    • Document assumption in test file comment

Output: Framework name and test file extension (e.g., Jest → .test.ts)

**Determine test file location**

Find appropriate location:

  1. Check if tests/regression/ exists → use it
  2. Check project test structure:
    • tests/ directory → tests/regression/
    • __tests__/ directory → __tests__/regression/
    • Co-located tests (same dir as source) → src/__tests__/regression/
  3. Create tests/regression/ if no pattern found

File naming:

  • Format: regression-ERR-{ID}-{slug}.{ext}
  • Slug: lowercase kebab-case from title
  • Examples:
    • regression-ERR-0042-dashboard-timeout.test.ts
    • test_regression_err_0042_dashboard_timeout.py
**Generate test code**

Use framework-appropriate template from references/framework-templates.md.

Structure (Arrange-Act-Assert):

Header: Error ID, title, description, root cause, link to error-log

describe/class: "Regression: ERR-XXXX - {title_short}"
  test: "should {expected} when {condition}"
    ARRANGE: Set up bug scenario (data, mocks, state)
    ACT: Execute action that caused bug
    ASSERT: Verify correct behavior (would have failed before fix)

Required elements:

  • Error ID reference in comment header
  • Link to error-log.md entry
  • Clear test name describing expected behavior
  • Setup code matching reproduction steps
  • Assertion that validates the fix

See references/framework-templates.md for complete templates.

**Present to user for review**

Display generated test:

=== Regression Test Generated ===

Error: ERR-0042 - Dashboard Timeout Due to Missing Pagination

File: tests/regression/regression-ERR-0042-dashboard-timeout.test.ts

--- Generated Test Code ---
[Full test code here]
---

This test will:
- {describe what test validates}
- {explain why test would have failed before fix}

What would you like to do?
  [A] Save test and continue
  [B] Edit test before saving
  [C] Skip generation (add to debt tracker)

>

If user chooses:

  • A (Save): Write file, run test, update error-log.md
  • B (Edit): Show edit instructions, wa
Полный SKILL.md на GitHub

Установить regression-test-generator в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

references/framework-templates.md

FAQ

Что делает скилл regression-test-generator?

Generate regression tests when bugs are discovered during /debug or continuous checks. Auto-detects test framework, creates Arrange-Act-Assert tests, and links to error-log.md entries. (project)

Как установить скилл regression-test-generator?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл regression-test-generator запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить regression-test-generator с