원클릭으로
test
Run tests with coverage report and gap analysis. MANDATORY before /commit and PR creation. Use after implementation or during validation.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Run tests with coverage report and gap analysis. MANDATORY before /commit and PR creation. Use after implementation or during validation.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Cross-project audit and sync. Backs up, bootstraps, promotes, syncs, and verifies all downstream projects.
Structured pre-planning research. Explores codebase, asks clarifying questions, and produces a brainstorm output file for /plan-feature input.
Capture knowledge from development sessions. Debug patterns, architecture decisions, framework gotchas, and integration learnings compound over time.
Load project context and show current status. Use at the start of a session or when context is needed.
Run parallel code reviews using specialized agents (security, performance, simplicity, nextjs-react). Produces a structured report.
Initialize a new project from Agent Kit boilerplate. Use when creating a new downstream project.
| name | test |
| description | Run tests with coverage report and gap analysis. MANDATORY before /commit and PR creation. Use after implementation or during validation. |
| allowed-tools | Bash, Read, Glob, Grep |
| argument-hint | ["unit|e2e|coverage|gaps|all"] |
Run unit tests, show coverage, identify gaps. This is a mandatory gate before any commit or PR.
Tests MUST pass before:
/commit executionIf tests fail, DO NOT proceed with commit. Fix the failures first.
cd frontend
# Check if test script exists
grep -q '"test"' package.json
if [ $? -ne 0 ]; then
echo "Tests not configured. Run /test-setup first."
exit 1
fi
/test or /test all - Run all unit tests:
cd frontend && pnpm run test
/test unit - Run unit tests only:
cd frontend && pnpm run test
/test e2e - Run E2E tests:
cd frontend && pnpm run test:e2e
/test coverage - Run with coverage report:
cd frontend && pnpm run test:coverage
/test gaps - Gap analysis only (no test run):
Skip to step 4.
Show results in structured format:
┌─────────────────────────────────────────────────────────────────┐
│ TEST RESULTS │
│ ──────────── │
│ │
│ Status: PASS / FAIL │
│ Total: 12 tests │
│ Passed: 12 │
│ Failed: 0 │
│ Duration: 1.2s │
│ │
│ Coverage: 64% lines | 58% branches | 70% functions │
│ │
└─────────────────────────────────────────────────────────────────┘
Identify files without test coverage:
.ts and .tsx files in lib/ and src/ (excluding __tests__/, test/, node_modules/)__tests__/*.test.ts exists┌─────────────────────────────────────────────────────────────────┐
│ TEST GAP ANALYSIS │
│ ───────────────── │
│ │
│ Files with tests: 3/7 │
│ Files without tests: 4/7 │
│ │
│ Uncovered: │
│ lib/notion-data.ts (complex, high priority) │
│ lib/auth-client.ts (auth, medium priority) │
│ lib/auth-server.ts (auth, medium priority) │
│ lib/convex.ts (config, low priority) │
│ │
│ Suggestion: Start with lib/notion-data.ts (most logic) │
│ │
└─────────────────────────────────────────────────────────────────┘
If this was run as a pre-commit check:
┌─────────────────────────────────────────────────────────────────┐
│ COMMIT GATE │
│ ─────────── │
│ │
│ Tests: PASS │
│ Coverage: 64% (threshold: 60%) │
│ │
│ Result: READY TO COMMIT │
│ │
└─────────────────────────────────────────────────────────────────┘
Or if tests fail:
┌─────────────────────────────────────────────────────────────────┐
│ COMMIT GATE │
│ │
│ Tests: FAIL (2 failures) │
│ │
│ Result: BLOCKED - Fix tests before commit │
│ │
│ Failures: │
│ lib/__tests__/utils.test.ts:15 │
│ Expected: "foo bar" │
│ Received: "bar foo" │
│ │
└─────────────────────────────────────────────────────────────────┘
| Metric | Minimum | Target |
|---|---|---|
| Lines | 60% | 80% |
| Branches | 50% | 70% |
| Functions | 60% | 80% |
When AI writes tests, these anti-patterns MUST be avoided:
| Anti-Pattern | Why It's Bad |
|---|---|
| Tests without meaningful assertions | expect(true).toBe(true) proves nothing |
| Verification instead of validation | Testing current behavior (including bugs) instead of intended behavior |
| Over-mocking | Mocking more than one layer deep creates false security |
| Implementation-coupled tests | Testing private methods/internal state breaks on refactor |
getByTestId as first choice | Use getByRole, getByLabelText, getByText first |
| Test suite flooding | Redundant tests slow CI without improving coverage |
| Practice | Example |
|---|---|
| Test behavior, not implementation | Assert on return values and side effects, not internal state |
| Include edge cases | Empty, null, boundary values alongside happy path |
| One assertion per test (when possible) | Clear failure messages, easy to locate issues |
| Descriptive test names | "returns false when session token is expired" not "test case 3" |
| Extract data-fetching logic | Move async logic out of Server Components into testable utilities |
Vitest cannot test async Server Components. For these:
/visual-verify (agent-browser) for layout verificationWhen testing code that captures process.env at module load time (e.g., const URL = process.env.AUTH_CONVEX_SITE_URL), standard process.env manipulation in beforeEach won't work because the value is already cached.
Fix: Use vi.resetModules() + dynamic imports:
beforeEach(() => {
vi.resetModules();
});
async function loadModule() {
const mod = await import("../my-module");
return mod.myFunction;
}
it("works with custom env", async () => {
process.env.MY_VAR = "test-value";
const myFunction = await loadModule();
// Now myFunction sees the updated env
});
This pattern is used in auth-helpers.test.ts for testing validateSession() with different AUTH_CONVEX_SITE_URL values.
/execute runs /test automatically after implementation/commit runs /test as a mandatory gate before committing/prime shows test health summary at session start/pre-production includes full test suite as quality gate