testing
Write or repair Elixir tests with ExUnit, sandbox isolation, async reliability, Mox, ExMachina, and LiveViewTest. Use for test files, test setup, or failing/flaky tests. NOT for investigating an application bug outside the test suite.
npx skills add oliver-kriska/claude-elixir-phoenix --skill testing --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# Elixir Testing Reference > **Ash projects**: Use `DataCase` with `Ash.Test` helpers; test actions via domain code interfaces, not direct `Repo` calls. See `ash-framework` skill. Quick reference for Elixir testing patterns. ## Iron Laws — Never Violate These 1. **ASYNC BY DEFAULT** — Use `async: true` unless tests modify global state 2. **SANDBOX ISOLATION** — All database tests use Ecto.Adapters.SQL.Sandbox 3. **MOCK ONLY AT BOUNDARIES** — Never mock database, internal modules, or stdlib 4. **BEHAVIOURS AS CONTRACTS** — All mocks must implement a defined `@callback` behaviour 5. **BUILD BY DEFAULT** — Use `build/2` in factories; `insert/2` only when DB needed 6. **NO PROCESS.SLEEP** — Use `assert_receive` with timeout for async operations 7. **VERIFY_ON_EXIT!** — Always call in Mox tests setup 8. **FACTORIES MATCH SCHEMA REQUIRED FIELDS** — Factory definitions must include all fields that have `validate_required` in the schema changeset. Missing fields cause cascading test failures ## Quick Decisions ### Which Test Case? | Testing | Use | |---------|-----| | Controller/API | `use MyAppWeb.ConnCase` | | Context/Schema | `use MyApp.DataCase` | | LiveView | `use MyAppWeb.ConnCase` +
- Iron Laws — Never Violate These
- Quick Decisions
- Which Test Case?
- When to use async: true?
- Mock or not?
- build() or insert()?
- Quick Patterns
- Common Anti-patterns
- References
What does the testing skill do?
Write or repair Elixir tests with ExUnit, sandbox isolation, async reliability, Mox, ExMachina, and LiveViewTest. Use for test files, test setup, or failing/flaky tests. NOT for investigating an application bug outside the test suite.
How do I install it?
Run `npx skills add oliver-kriska/claude-elixir-phoenix --skill testing --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From oliver-kriska/claude-elixir-phoenix, a repository with 515 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
