coding by oliver-kriska
Phoenix Contexts Reference oliver-kriska/phoenix-contexts
Phoenix context design — creating/splitting contexts, Scope (1.8+), Ecto.Multi, PubSub, routers, plugs, controllers.
What it changes View full report → Passed 21 of 22 test cases with the skill, and 16 of 22 without it.
Without skill 73%
With skill 95%
Checks it passed that the model alone missed Accepts `%Scope{} = scope` as the first parameter. Accepts `%Scope{}` as the first parameter of `Blog.get_post`. Filters query records using user or tenant fields from `scope`.and 3 more in the full report
5 fixed16 passed either way1 still failing0 broke
Pass-rate lift +23 pp
Tokens +7%
Agent turns 0%
Response time -29% Model gemini-3.6-flashMeasured 8/19/2026 v2 21 of 22 cases passed with skill
Use this skill Claude Code DecimalAI agent CLI & files
Save it into your project's skills folder. Claude Code picks it up in its next session.
curl -fsSL --create-dirs -o .claude/skills/oliver-kriska-phoenix-contexts/SKILL.md https://app.decimal.ai/s/oliver-kriska-phoenix-contexts/SKILL.md Copy command Copy SKILL.md
Want it pinned and updatable? pip install "decimalai>=0.15", then decimalai skills add oliver-kriska-phoenix-contexts, and start Claude Code with claude --plugin-dir "$(git rev-parse --show-toplevel)/.agents"
Linked stays up to date: your agents get the author's new versions automatically.
Editable copy is yours to change; the author's updates won't reach it.
Install linked skill Create editable copy
1 · One-time — install the CLI (
docs ↗ )
$ pip install "decimalai>=0.15"Copy
2 · Get the skill — writes .agents/skills/oliver-kriska-phoenix-contexts/ and pins it in .decimal/skills.lock
$ decimalai skills add oliver-kriska-phoenix-contextsCopy
Copy link Copy README badge Copy SKILL.md No CLI? Get the same file — curl · raw file $ curl -fsSL --create-dirs -o .claude/skills/oliver-kriska-phoenix-contexts/SKILL.md https://app.decimal.ai/s/oliver-kriska-phoenix-contexts/SKILL.mdCopy
Safety checks: 3 of 3 passed
Code scan Clean Intent Passed Content Clean
Overview Benchmark Contents Activity Versions 2 Ratings 0
See it in action One of 5 test cases the skill fixed. Same model, same prompt, with and without the skill.
Prompt Write a Phoenix 1.8 context function `Blog.get_post/2` that retrieves a post belonging to an authenticated user context.
What was checked, without and with the skill Checked Without skill With skill Accepts `%Scope{}` as the first parameter of `Blog.get_post`. Missed Passed
Show both answers
What's inside The instructions your model reads when the skill loads.
SKILL.md 94 lines 6 files
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
CONTEXTS OWN THEIR DATA — Never query another context's schema directly via Repo
SCOPES ARE MANDATORY (Phoenix 1.8+) — Every context function MUST accept scope as first parameter
THIN CONTROLLERS/LIVEVIEWS — Controllers translate HTTP, business logic stays in contexts
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:
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()
|> broadcast(scope, :created)
end
When it activates Automatically, when a task matches.
Use when editing contexts, routers, or designing boundaries.
Track record Benchmark 21 / 22
test cases passed, vs 16 / 22 without
Adoption
Users 0
Times used 0 View activity → Safety and source details
SkillSafety ✓ 3 of 3 passed ✓ Code scan 15 of 15 checks clean
0 critical · 0 warning · 0 info — scanner v4 — 8/3/2026
View 15 scanner checks live_secret remote_code_execution reverse_shell data_exfiltration ssrf_metadata agent_snooping anti_refusal destructive_commands obfuscated_unicode unicode_homoglyph opaque_blob suspicious_url tool_overreach trigger_abuse prompt_injection_phrasing
✓ Intent Safe
LLM judge · does the skill do what it claims
✓ Content Clean
LLM judge · policy & harmful-content review
Source Imported oliver-kriska / claude-elixir-phoenix
plugins/elixir-phoenix/skills/phoenix-contexts/SKILL.md
View on GitHub ↗ License MITImported 8/3/2026Version v2Bundled 5 files