Verification Loop
Complete verification workflow for Elixir/Phoenix projects. Run this after making changes to ensure code quality before commits or PRs.
Iron Laws - Never Violate These
- •Run in order - Each step must pass before proceeding to the next
- •Fix issues immediately - Don't batch fixes; address each failure before continuing
- •Warnings are errors - Use
--warnings-as-errorsflag; no exceptions - •Full Dialyzer before PR - Always run Dialyzer before creating pull requests
Verification Sequence
Execute these commands in order, stopping on any failure:
Step 1: Compilation (Fast Feedback)
bash
mix compile --warnings-as-errors
Catches: Undefined functions, missing modules, type mismatches, unused variables
Step 2: Formatting
bash
mix format --check-formatted
If fails: Run mix format and re-check
Step 3: Credo Analysis
bash
mix credo --strict
Address all issues marked as consistency or design problems
Step 4: Run Tests
bash
# For specific context changes mix test test/my_app/[changed_context]_test.exs --trace # For full test suite mix test --trace
All tests must pass
Step 5: Dialyzer (Pre-PR Required)
bash
mix dialyzer
No new warnings allowed. First run builds PLT cache (slow).
Quick Reference
| Step | Command | Time | When Required |
|---|---|---|---|
| Compile | mix compile --warnings-as-errors | Fast | Always |
| Format | mix format --check-formatted | Fast | Always |
| Credo | mix credo --strict | Medium | Always |
| Test | mix test --trace | Medium | Always |
| Dialyzer | mix dialyzer | Slow | Before PR |
Usage
After making code changes:
- •Run
/phx:verifyto execute the full loop - •Address any failures before proceeding
- •Commit only after all checks pass
For partial verification during development, run individual steps as needed.