一键导入
test-fast
Quick unit + property-based test run with AI auto-fix loop
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Quick unit + property-based test run with AI auto-fix loop
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Complete test suite — unit, property, integration, e2e, mutation, and coverage audit
Lighthouse performance/SEO/a11y/best-practices optimization with AI self-loop to push all scores to 90+
Unit + property tests verified by mutation testing with AI self-improvement loop
Visual regression testing with Playwright screenshots and AI-powered diff analysis
Implement changes to align code with UX design files (product-ia.md, product-flows.md, product-interactions.md). Reads design specs and modifies code to match.
Product UX review from the user's perspective. Analyzes IA, user flows, and interactions for any web application.
| name | test-fast |
| description | Quick unit + property-based test run with AI auto-fix loop |
| user-invocable | true |
You are running a fast test verification cycle. Your goal: detect what changed, run scoped tests, fix broken tests (NOT source code), generate missing tests, and report results. Target: ~15 seconds for the test run itself.
Check if the user passed file paths as arguments (e.g., /test-fast src/lib/calculations.ts).
Run these commands to find changed files:
# Unstaged changes
git diff --name-only
# Staged changes
git diff --name-only --cached
# Untracked files (new files)
git ls-files --others --exclude-standard
Combine and deduplicate results. Filter to only source files: *.ts, *.tsx (exclude config files, test files themselves, markdown, CSS-only changes).
If no changed source files detected: → Tell the user: "No changed source files detected. Nothing to test." → Exit gracefully.
For each changed source file, find corresponding test files using these conventions:
| Source file pattern | Test file locations |
|---|---|
app/**/*.tsx | __tests__/components/**/*.test.tsx (match by component name) |
app/**/*.ts (route/action) | __tests__/api/**/*.test.ts or co-located *.test.ts |
components/**/*.tsx | __tests__/components/**/*.test.tsx (match by component name) |
lib/**/*.ts | __tests__/lib/**/*.test.ts or __tests__/property/**/*.test.ts |
| Any file | Co-located <name>.test.ts / <name>.test.tsx next to source |
Use find or glob patterns to locate existing test files. Build a list of:
For each changed source file that has no corresponding test file:
Test file conventions:
__tests__/ mirroring the source structure, or co-located if that's the existing pattern nearby.@/... using the path alias.describe / it blocks with clear test names describing behavior.@testing-library/react with render, screen, userEvent. Test user-visible behavior, NOT implementation details (no testing internal state, no wrapper.instance()).expect(true).toBe(true), snapshot-only tests, or tests that just check "it renders without crashing" with no assertions on content.vi.mock() sparingly — prefer real implementations where possible. Mock only external services (Supabase, Stripe, OpenAI, fetch)."Creating new test file: <path>"For each existing test file that maps to a changed source file:
git diff <source-file>) and the test file."Updating test: <path> — <reason>"Run scoped tests (NOT the full suite, NOT watch mode):
npx vitest run <space-separated list of test file paths>
If all tests pass → go to Step 5.
If any tests fail, analyze each failure:
Log: "Round N/3: fixing X failing tests..."
After fixing, re-run the same test command. Maximum 3 iterations. If tests still fail after 3 rounds → stop and report remaining failures.
CRITICAL: Never modify source files. Only modify test files.
Check if any changed source files contain:
If yes, check if property-based tests already exist in __tests__/property/.
If no property tests exist for the changed logic:
fast-check:import { describe, it, expect } from 'vitest'
import fc from 'fast-check'
describe('functionName property tests', () => {
it('should satisfy <property description>', () => {
fc.assert(
fc.property(fc.integer(), (n) => {
// Test invariant
const result = functionName(n)
expect(result).toSatisfy(/* invariant check */)
})
)
})
})
__tests__/property/<module-name>.property.test.tsRun property tests with the same iteration loop (max 3 rounds).
Print a clear summary:
═══════════════════════════════════════
/test-fast Results
═══════════════════════════════════════
Changed files scoped: N
Tests run: N
Tests passed: N ✓
Tests failed: N ✗
New tests created: N
Tests updated: N
Property tests: N
───────────────────────────────────────
Status: PASS | NEEDS ATTENTION | MAX ITERATIONS REACHED
═══════════════════════════════════════
If status is NEEDS ATTENTION, list each issue:
If status is PASS, just show the summary — no extra commentary needed.