phoenix-contexts
Phoenix context design — creating/splitting contexts, Scope (1.8+), Ecto.Multi, PubSub, routers, plugs, controllers. Use when editing contexts, routers, or designing boundaries.
npx skills add oliver-kriska/claude-elixir-phoenix --skill phoenix-contexts --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.
# Phoenix Contexts Reference > **Ash projects**: `Ash.Domain` replaces Phoenix contexts for data access — use the `ash-framework` skill. Context boundary and PubSub patterns still apply. Reference for designing and implementing Phoenix contexts (bounded contexts). ## Iron Laws — Never Violate These 1. **CONTEXTS OWN THEIR DATA** — Never query another context's schema directly via Repo 2. **SCOPES ARE MANDATORY (Phoenix 1.8+)** — Every context function MUST accept scope as first parameter 3. **THIN CONTROLLERS/LIVEVIEWS** — Controllers translate HTTP, business logic stays in contexts 4. **NO SIDE EFFECTS IN SCHEMAS** — Use `Ecto.Multi` for transactions with side effects ## Context Structure ``` lib/my_app/ ├── accounts/ # Context directory │ ├── user.ex # Schema │ ├── scope.ex # Scope struct (Phoenix 1.8+) ├── accounts.ex # Context module (public API) ``` ## Phoenix 1.8+ Scopes (CRITICAL) All context functions MUST accept scope as first parameter: ```elixir def list_posts(%Scope{} = scope) do from(p in Post, where: p.user_id == ^scope.user.id) |> Repo.all() end def create_post(%Scope{} = scope, attrs) do %Post{user_id: scope.user.id} |> Post.changeset(attrs) |> Repo.insert() |> broa
- Iron Laws — Never Violate These
- Context Structure
- Phoenix 1.8+ Scopes (CRITICAL)
- Quick Decisions
- When to SPLIT contexts?
- When to KEEP together?
- Cross-Context References
- Anti-patterns
- Version Notes
- References
What does the phoenix-contexts skill do?
Phoenix context design — creating/splitting contexts, Scope (1.8+), Ecto.Multi, PubSub, routers, plugs, controllers. Use when editing contexts, routers, or designing boundaries.
How do I install it?
Run `npx skills add oliver-kriska/claude-elixir-phoenix --skill phoenix-contexts --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.
