afc-test
Test strategy and writing — unit, integration, e2e tests, coverage improvement
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Test strategy and writing — unit, integration, e2e tests, coverage improvement
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
| name | afc:test |
| description | Test strategy and writing — unit, integration, e2e tests, coverage improvement |
| argument-hint | [target: file path, feature name, or coverage] |
| allowed-tools | ["Read","Write","Edit","Bash","Glob","Grep"] |
| model | sonnet |
Establishes a test strategy for implemented code and writes tests. Standalone command — not part of the auto pipeline. Use after implement or before review.
$ARGUMENTS — (required) Test target. One of:
src/features/auth/)login flow)coverage — full coverage analysis and gap remediation!cat .claude/afc.config.md 2>/dev/null || echo "[CONFIG NOT FOUND] .claude/afc.config.md not found. Create it with /afc:init."
Values used: {config.gate} (CI), {config.architecture} (layers), test framework from Project Context.
Parse $ARGUMENTS:
Existing coverage check: Before writing new tests, evaluate what already exists:
Determine characteristics of target code:
### Test Strategy
- Target: {file/feature}
- Framework: {test framework from Project Context}
- Test types:
- [ ] Unit tests: {list of target functions/methods}
- [ ] Integration tests: {component interactions}
- [ ] E2E tests: {user scenarios} (only if applicable)
- Mocking strategy: {mocking approach per dependency}
Confirm strategy with user before proceeding.
Principles:
it('should {expected behavior} when {condition}') formatPriority:
Test file location: follows project convention
{filename}.test.{ext} (same directory)__tests__/{filename}.test.{ext} or tests/ directoryAlways read
${CLAUDE_SKILL_DIR}/../../docs/critic-loop-rules.mdfirst and follow it.
Run the critic loop until convergence. Safety cap: 5 passes.
| Criterion | Validation |
|---|---|
| COVERAGE | Are all core logic and branch points covered? |
| QUALITY | Do tests validate behavior, not implementation details? Are there any brittle tests? |
Follow verdict handling and output format per docs/critic-loop-rules.md.
{config.gate}
On failure:
Maximum 3 retries.
Tests complete
├─ Target: {file/feature}
├─ Written: {N} tests ({unit X, integration Y, E2E Z})
├─ Coverage: {summary of key branch point coverage}
├─ Critic: converged ({N} passes, {M} fixes, {E} escalations)
├─ Verified: all tests passing
└─ Found: {bug details if found, otherwise "no issues"}
Code and component analysis — analyze code, trace flows, audit consistency, inspect components
Architecture analysis and design review
Full auto pipeline — run spec-to-clean cycle automatically for new features
Save session state for later resumption
Resolve spec ambiguities with clarifying questions
Pipeline artifact cleanup and codebase hygiene