exunit-code-review
Skill91 starsChanged 4 days agoApache-2.0View on GitHub
Reviews ExUnit test code for async safety, Ecto Sandbox usage, boundary mocking with Req.Test and Mox, and test adapters. Use when reviewing _test.exs files or test helper configurations.
In this repository85 other files it gives its agents.
- AGENTS.mdAGENTS.md
- llms.txtllms.txt
- agent-architecture-analysisSkill
- app-intents-code-reviewSkill
- artifact-analysisSkill
- axum-code-reviewSkill
- brainstorm-beagleSkill
- bubbletea-code-reviewSkill
- cloudkit-code-reviewSkill
- elixir-performance-reviewSkill
- elixir-security-reviewSkill
- elixir-writing-docsSkill
- exdoc-configSkill
- fastapi-code-reviewSkill
- fetch-pr-feedbackSkill
- ffi-code-reviewSkill
- fix-llm-artifactsSkill
- fowler-refactoringSkill
- gen-test-planSkill
- go-architectSkill
- go-code-reviewSkill
- go-data-persistenceSkill
- go-testing-code-reviewSkill
- healthkit-code-reviewSkill
- humanize-beagleSkill
- improve-docSkill
- ios-animation-code-reviewSkill
- liveview-code-reviewSkill
- llm-artifacts-detectionSkill
- llm-judgeSkill
- macros-code-reviewSkill
- phoenix-code-reviewSkill
- postgres-code-reviewSkill
- prfaq-beagleSkill
- prometheus-go-code-reviewSkill
- pytest-code-reviewSkill
- quick-planSkill
- react-flow-code-reviewSkill
- react-flowSkill
- react-router-code-reviewSkill
- react-router-v7Skill
- receive-feedbackSkill
- refactor-repoSkill
- resolve-beagleSkill
- respond-pr-feedbackSkill
- review-ai-writingSkill
- review-elixirSkill
- review-frontendSkill
- review-goSkill
- review-iosSkill
- review-llm-artifactsSkill
- review-planSkill
- review-pythonSkill
- review-remix-v2Skill
- review-rustSkill
- review-skillSkill
- review-structureSkill
- review-tuiSkill
- review-verification-protocolSkill
- run-test-planSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 57
Simple inline test data: - Not everything needs fixtures or factories
- Very specific: line 84
Use [FILE:LINE] ISSUE_TITLE per finding after Gates (sequence) and the review-verification-protocol skill (review-verification-protocol) …
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
ExUnit Code Review
Quick Reference
| Issue Type | Reference |
Async pitfalls, Application.put_env, CaptureLog, setup_all | references/exunit-patterns.md |
Behavior-based mocking, $callers, Mox.allow | references/mox-boundaries.md |
Req.Test, Bypass, Swoosh, Oban testing | references/test-adapters.md |
| What to mock vs real, Ecto Sandbox, fixtures | references/integration-tests.md |
Mock Boundary Philosophy
Mock at external boundaries:
- HTTP clients, external APIs, third-party services (
Req.TestforReq,Bypass/Moxfor other clients) - Slow resources: file system, email (
Swoosh.Adapters.Test), job queues (Oban.Testing) - Non-deterministic:
DateTime.utc_now/0,:rand
DO NOT mock internal code:
- Contexts, schemas, GenServers
- Internal modules, PubSub
- Anything you wrote
Review Checklist
Test Structure & Async Safety
- Tests use
async: truewhen isolated (includinguse MyApp.DataCase, async: truevia Ecto Sandbox) async: falseused when mutating global state (Application.put_env/3, named singletons,{:shared, self()}sandbox, globalCaptureLog)setup_alldoes not leak sandbox connections or per-test state across tests
Mocking & HTTP Testing
Req.Test(stub/2,expect/3,json/2) used forReq-based HTTP clients (nimble_ownershipsupportsasync: truewithout ports)BypassorMoxused for non-Reqexternal boundaries (behaviors defined for interfaces)- No mocking of internal modules (contexts, schemas,
Repo) verify_on_exit!in setup for strictMoxmocking; noMox.allowrace conditions after process spawn
Test Adapters
Req.TestorBypassfor HTTP endpoint mockingSwoosh.Adapters.Testfor email testingOban.Testingfor background job assertions (assertingOban.drain_queuereturn map%{success: _, failure: 0})
Database
Ecto.Adapters.SQL.Sandbox(start_owner!(Repo, shared: not tags[:async])) for isolation- Shared sandbox calls use
{:shared, self()}(not bare:shared) - Phoenix fixtures (
test/support/fixtures/) used consistently (ExMachinais legacy)
Valid Patterns (Do NOT Flag)
use MyApp.DataCase, async: true- Database tests run in isolated Ecto Sandbox transactions- Mock in unit test, real in integration - Different test levels have different needs
- Not mocking database in integration tests - Database is internal
- Simple inline test data - Not everything needs fixtures or factories
- Testing private functions via public API - Correct approach
Task.asyncinheritingMox/Req.Test/ Sandbox via$callers- Automatic in modern Elixir without manualallow
Context-Sensitive Rules
| Issue | Flag ONLY IF |
async: true race | Test mutates global state (Application.put_env, named process, ETS, {:shared, self()}) |
| Missing mock | External call exists AND no Req.Test / Bypass / Mox |
| Mock internal | Module being mocked is internal code |
Gates (sequence)
Complete in order. Do not emit a finding until the prior step passes for that issue.
- Evidence from the file — Open the test module (or helper) and tie the claim to concrete lines.
- Pass when: Each prospective finding includes
[FILE:LINE]and a one-line factual description of what is on that line (or an adjacent line you name), not a generic style complaint.
- Pass when: Each prospective finding includes
- ExUnit false-positive veto — Check this skill’s Valid Patterns and Context-Sensitive Rules for the case.
- Pass when: You can state “not covered by Do NOT Flag / Flag ONLY IF” in one sentence, or you drop the finding.
- Cross-protocol verification — Apply the
review-verification-protocolskill (review-verification-protocol) (e.g. read full function/block, search usages before “unused” claims) to that same finding.- Pass when: At least one protocol check relevant to the claim type is satisfied and would appear in your rationale if challenged.
Before Submitting Findings
Use [FILE:LINE] ISSUE_TITLE per finding after Gates (sequence) and the review-verification-protocol skill (review-verification-protocol) are satisfied.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

