Run unit tests, evaluate and fix relevant E2E tests, assess coverage needs, lint, and commit. Use when user says "test and commit", "run tests and commit", "verify and commit", or "CI and commit".
Run unit tests first, evaluate/fix relevant E2Es, assess coverage, lint, then commit.
Invoke when user says:
| Phase | Action | Gate |
|---|---|---|
| 1 | Run all unit tests | Must pass |
| 2 | Identify relevant E2E tests | Based on changes |
| 3 | Fix failing E2Es, run relevant only | Must pass |
| 4 | Evaluate coverage needs | Ask user |
| 5 | Write new tests if needed | Optional |
| 6 | Lint and fix errors | Must pass |
| 7 | Sync documentation | User approval |
| 8 | Commit changes | Only if all pass |
Track progress with TodoWrite.
Run the full unit test suite first. Stop if tests fail.
npm run test:unit -- --run
| Result | Action |
|---|---|
| All pass | Continue to Phase 2 |
| Failures | Fix failing tests, re-run until pass |
If failures are in changed files, fix them. If failures are pre-existing/unrelated, inform user and ask how to proceed.
git diff --name-only HEAD
| Changed File Pattern | Relevant E2E Tests |
|---|---|
src/pages/Sessions*.tsx |
playwright/tests/session-*.spec.ts |
src/pages/Accounts*.tsx |
playwright/tests/account-*.spec.ts |
src/pages/Contacts*.tsx |
playwright/tests/contact-*.spec.ts |
src/components/tables/*Table.tsx |
E2E for that domain |
src/hooks/use*.ts |
E2E for features using that hook |
src/services/*.service.ts |
E2E for features using that service |
Run only the relevant E2E tests identified in Phase 2:
npx playwright test <spec-file> --retries=3 --timeout=120000
| Result | Action |
|---|---|
| All pass | Continue to Phase 4 |
| Failures | Evaluate if failure is due to our changes |
If E2E fails due to our changes:
If E2E fails due to pre-existing issues:
Assess if new tests are needed for the changed files.
Identify changed testable files (.ts, .tsx in src/, excluding tests)
For each file, check:
Use AskUserQuestion if gaps exist:
{
questions: [
{
question: "Found coverage gaps. Create tests for these files?",
header: "Coverage",
options: [
{
label: "Yes, create tests",
description: "Write missing unit/E2E tests",
},
{ label: "Skip for now", description: "Commit without new tests" },
],
multiSelect: false,
},
];
}
If user approves, create tests following these patterns:
| Code Type | Test Type | Location |
|---|---|---|
| Component | Unit | src/**/__tests__/[name].test.tsx |
| Hook | Unit | src/hooks/__tests__/[name].test.ts |
| Service | Unit | src/services/__tests__/[name].test.ts |
| Page flow | E2E | playwright/tests/[feature].spec.ts |
Follow patterns in:
claude-patterns/testing-patterns.md (unit tests)claude-patterns/playwright-best-practices.md (E2E tests)Run new tests to verify they pass before continuing.
Lint all changed files:
git diff --name-only HEAD | grep -E '\.(ts|tsx)$' | xargs npx eslint --max-warnings 0
| Result | Action |
|---|---|
| Pass | Continue to Phase 8 |
| Errors | Run --fix, then fix remaining manually |
# Auto-fix what's possible
git diff --name-only HEAD | grep -E '\.(ts|tsx)$' | xargs npx eslint --fix
Check if code changes affect documentation in .claude/rules/ and claude-patterns/.
git diff --name-only HEAD | grep -E '\.(ts|tsx)$'
# For each changed file, search with multiple patterns
grep -rE "(src/path/to/file\.ts|filename\.ts)" claude-patterns/ .claude/rules/
For each doc file with references to changed code:
Categorize updates needed:
| Update Type | Action |
|---|---|
| File path renamed | Auto-update (context-aware, not blind replacement) |
| Function/type renamed (clear 1:1) | Auto-update with verification |
| Code deleted | Flag for user - may need doc section removal |
| Pattern/behavior changed | Flag for user - requires rewrite |
| Line number references | Flag for user - inherently unstable |
{
questions: [
{
question: "Found stale documentation references. How to proceed?",
header: "Doc Sync",
options: [
{
label: "Update docs",
description: "Apply context-aware updates, include in commit",
},
{
label: "Review each",
description: "Show me each change before applying",
},
{ label: "Skip", description: "Commit code without doc updates" },
],
multiSelect: false,
},
];
}
| Result | Action |
|---|---|
| Update docs | Apply updates, continue to Phase 7 |
| Review each | Show diff for each doc, apply approved changes |
| Skip | Continue to Phase 8 without doc changes |
| No stale refs found | Continue to Phase 8 (no prompt needed) |
Known Limitations:
git add <files>
git commit -m "$(cat <<'EOF'
<type>(<scope>): <description>
<body>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
EOF
)"
| Gate | Phase | Question |
|---|---|---|
| Pre-existing failures | 1, 3 | "Tests failed but unrelated to changes. Skip or fix?" |
| Coverage gaps | 4 | "Create tests for uncovered files?" |
| Doc sync | 7 | "Found stale doc references. Update?" |
| Commit scope | 8 | "Which files to commit?" (if mixed changes) |
# Phase 1: Unit tests
npm run test:unit -- --run
# Phase 3: Specific E2E
npx playwright test <spec-file> --retries=3
# Phase 6: Lint changed files
git diff --name-only HEAD | grep -E '\.(ts|tsx)$' | xargs npx eslint --max-warnings 0
For commands: references/commands.md For test locations: references/test-locations.md
v5.1.0 (2026-01-20): Add Phase 7 for documentation synchronization
.claude/rules/ and claude-patterns/v5.0.0 (2026-01-20): Complete workflow restructure
v4.1.0 (2025-01-18): AI optimization updates
v4.0.0 (2025-12-29): Slimmed down - removed checks handled by pre-push
v3.0.0 (2025-12-28): Refactored to follow skill-authoring-patterns
v1.0.0 (2025-11-30): Initial release