My5t3r10us/cesizen / .agents/skills/apex
apex
VerifiedSystematic implementation using APEX methodology (Analyze-Plan-Execute-eXamine) with optional parallel subagents, self-validation, and adversarial review. Use when implementing features, fixing bugs, or making code changes that benefit from structured workflow.
steps/step-04-validate.md
View on GitHub---
name: step-04-validate
description: Self-check - run tests, verify AC, audit implementation quality
prev_step: steps/step-03-execute.md
next_step: steps/step-05-examine.md
---
# Step 4: Validate (Self-Check)
## MANDATORY EXECUTION RULES (READ FIRST):
- π NEVER claim checks pass when they don't
- π NEVER skip any validation step
- β
ALWAYS run typecheck, lint, and tests
- β
ALWAYS verify each acceptance criterion
- β
ALWAYS fix failures before proceeding
- π YOU ARE A VALIDATOR, not an implementer
- π¬ FOCUS on "Does it work correctly?"
- π« FORBIDDEN to proceed with failing checks
## EXECUTION PROTOCOLS:
- π― Run all validation commands
- πΎ Log results to output (if save_mode)
- π Check each AC against implementation
- π« FORBIDDEN to mark complete with failures
## CONTEXT BOUNDARIES:
- Implementation from step-03 (or step-03-execute-teams) is complete
- Tests may or may not pass yet
- Type errors may exist
- Focus is on verification, not new implementation
- **If `{teams_mode}` = true:** The agent team is still alive. Do NOT shutdown or dismiss teammates. Team shutdown happens in step-09-finish only.
## YOUR TASK:
Validate the implementation by running checks, verifying acceptance criteria, and ensuring quality.
---
<available_state>
From previous steps:
| Variable | Description |
|----------|-------------|
| `{task_description}` | What was implemented |
| `{task_id}` | Kebab-case identifier |
| `{acceptance_criteria}` | Success criteria |
| `{auto_mode}` | Skip confirmations |
| `{save_mode}` | Save outputs to files |
| `{test_mode}` | Include test steps |
| `{examine_mode}` | Auto-proceed to review |
| `{output_dir}` | Path to output (if save_mode) |
| Implementation | Completed in step-03 |
</available_state>
---
## EXECUTION SEQUENCE:
### 1. Initialize Save Output (if save_mode)
**If `{save_mode}` = true:**
```bash
bash {skill_dir}/scripts/update-progress.sh "{task_id}" "04" "validate" "in_progress"
```
Append results to `{output_dir}/04-validate.md` as you work.
### 2. Discover Available Commands
Check `package.json` for exact command names:
```bash
cat package.json | grep -A 20 '"scripts"'
```
Look for: `type-check`, `lint`, `test`, `build`
### 3. Run Validation Suite
**3.1 Typecheck**
```bash
bun run type-check
```
**MUST PASS.** If fails:
1. Read error messages
2. Fix type issues
3. Re-run until passing
**3.2 Lint**
```bash
bun run lint
```
**MUST PASS.** If fails:
1. Run `bun run lint -- --fix` when an automatic fix is appropriate
2. Manually fix remaining
3. Re-run until passing
**3.3 Tests**
```bash
bun run test:unit
```
**MUST PASS.** If fails:
1. Identify failing test
2. Determine if code bug or test bug
3. Fix the root cause
4. Re-run until passing
**If `{save_mode}` = true:** Log each result
### 4. Self-Audit Checklist
Verify each item:
**Tasks Complete:**
- [ ] All todos from step-03 marked complete
- [ ] No tasks skipped without reason
- [ ] Any blocked tasks have explanation
**Tests Passing:**
- [ ] All existing tests pass
- [ ] New tests written for new functionality
- [ ] No skipped tests without reason
**Acceptance Criteria:**
- [ ] Each AC demonstrably met
- [ ] Can explain how implementation satisfies AC
- [ ] Edge cases considered
**Patterns Followed:**
- [ ] Code follows existing patterns
- [ ] Error handling consistent
- [ ] Naming conventions match
### 5. Format Code
Run a formatter only when `package.json` exposes one. CESIZen currently does
not define a formatting script.
### 6. Final Verification
Re-run all checks:
```bash
bun run type-check && bun run lint
```
Both MUST pass.
### 7. Present Validation Results
```
**Validation Complete**
**Typecheck:** β Passed
**Lint:** β Passed
**Tests:** β {X}/{X} passing
**Format:** β Applied
**Acceptance Criteria:**
- [β] AC1: Verified by [how]
- [β] AC2: Verified by [how]
**Files Modified:** {list}
**Summary:** All checks passing, ready for next step.
```
### 8. Determine Next Step
**Decision tree:**
```
IF {test_mode} = true:
β Load step-07-tests.md (test analysis and creation)
ELSE IF {examine_mode} = true:
β Load step-05-examine.md (adversarial review)
ELSE IF {verify_mode} = true:
β Load step-10-verify.md (feature verification)
ELSE IF {auto_mode} = false:
β Ask user:
```
```yaml
questions:
- header: "Next"
question: "Validation complete. What would you like to do?"
options:
- label: "Run adversarial review"
description: "Deep review for security, logic, and quality"
- label: "Verify feature"
description: "Launch app and test feature works"
- label: "Complete workflow"
description: "Skip review and finalize"
- label: "Add tests"
description: "Create additional tests first"
multiSelect: false
```
```
ELSE:
β Complete workflow (show final summary)
```
### 9. Complete Save Output (if save_mode)
**If `{save_mode}` = true:**
Append to `{output_dir}/04-validate.md`:
```markdown
---
## Step Complete
**Status:** β Complete
**Typecheck:** β
**Lint:** β
**Tests:** β
**Next:** {next step based on flags}
**Timestamp:** {ISO timestamp}
```
---
## SUCCESS METRICS:
β
Typecheck passes
β
Lint passes
β
All tests pass
β
All AC verified
β
Code formatted
β
User informed of status
## FAILURE MODES:
β Claiming checks pass when they don't
β Not running all validation commands
β Skipping tests for modified code
β Missing AC verification
β Proceeding with failures
β **CRITICAL**: Not using AskUserQuestion for next step
## VALIDATION PROTOCOLS:
- Run EVERY validation command
- Fix failures IMMEDIATELY
- Don't proceed until all green
- Verify EACH acceptance criterion
- Document all results
---
## NEXT STEP:
Based on flags (check in order):
- **If test_mode:** Load `./step-07-tests.md`
- **If examine_mode OR user requests:** Load `./step-05-examine.md`
- **If verify_mode:** Load `./step-10-verify.md` to verify feature
- **If pr_mode:** Load `./step-09-finish.md` to create pull request
- **Otherwise:** Workflow complete - show summary
<critical>
Remember: NEVER proceed with failing checks - fix everything first!
If teams_mode is active: NEVER shutdown teammates β they stay alive until step-09-finish!
</critical>
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why β repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" β or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself β your human partner chose inline execution, or no subagent tool is available | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |