Skip to main content

/regression-check - Impact-Based Regression Test Selection

Analyzes code changes to determine which test suites to run, in what order, and flags flaky tests. Uses impact analysis to optimize test execution time while maintaining coverage.

System Prompt

EXECUTION DIRECTIVE: When the user invokes this command, you MUST:

  1. IMMEDIATELY execute - no questions first
  2. Load the skill at skills/regression-testing-patterns/SKILL.md
  3. Analyze git changes to identify impacted modules
  4. Select test suites based on change proximity and historical failure patterns
  5. Order tests according to the selected strategy
  6. Flag any quarantined flaky tests
  7. Generate execution plan with estimated duration
  8. Output results in requested format

Usage

/regression-check
/regression-check --changes HEAD~3..HEAD
/regression-check --strategy fastest-first
/regression-check --flaky-report
/regression-check --suite backend-api --json

Options

OptionDescription
--changes <ref>Analyze specific git changes (default: working directory)
--strategy <type>Test ordering strategy: fastest-first, most-failing-first, change-proximity-first (default: change-proximity-first)
--flaky-reportShow quarantined flaky tests and their failure patterns
--suite <name>Run specific test suite only
--jsonOutput results in JSON format
--dry-runShow execution plan without running tests
--threshold <num>Minimum impact score to include test (0-100, default: 20)
CommandRelationship
/release-gateUses regression-check as pre-release validation
/smoke-testComplementary post-deploy verification
/quality-dashboardConsumes regression test metrics

Success Output

Regression Analysis Complete
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Changes Analyzed: 12 files (3 modules)
Impact Score: 85/100 (HIGH)

Test Execution Plan (fastest-first):
1. backend-api/auth.test.ts (2.1s, impact: 95)
2. backend-api/models.test.ts (3.4s, impact: 78)
3. integration/api-flow.test.ts (8.2s, impact: 62)

Total Estimated Duration: 13.7s
Tests Selected: 3/47 suites (94% coverage maintained)

Flaky Tests Quarantined: 2
- integration/flaky-race.test.ts (fail rate: 12%)
- e2e/timing-dependent.test.ts (fail rate: 8%)

Ready to execute regression suite.

Completion Checklist

  • Changes analyzed and impacted modules identified
  • Test suites selected based on impact analysis
  • Tests ordered according to strategy
  • Flaky tests identified and quarantined
  • Execution plan generated with duration estimates
  • Coverage maintained at acceptable threshold (>90%)

Failure Indicators

  • "No tests selected" → Changes have no test coverage
  • "Coverage drop exceeds threshold" → Selected tests insufficient
  • "Flaky test in critical path" → Need to fix before regression
  • "Impact analysis failed" → Git history unavailable or malformed

When NOT to Use

  • Full CI pipeline - Use comprehensive test suite
  • Pre-commit hooks - Too slow, use unit tests only
  • Exploratory testing - Manual testing more appropriate
  • No code changes - Nothing to analyze

Anti-Patterns

  • Running ALL tests when only 10% are impacted
  • Ignoring flaky tests instead of quarantining them
  • Using same strategy for all scenarios (fastest isn't always best)
  • Skipping tests marked as flaky (they indicate real issues)

Principles

  • #3 Complete Execution - Analyzes changes, selects tests, generates plan automatically
  • #9 Based on Facts - Impact scores derived from code analysis and test history

Full Standard: CODITECT-STANDARD-AUTOMATION.md