phoenix-scopes

Installation
SKILL.md

Phoenix Scopes

Canonical FP bar: docs/fcis-engineering-rules.mdFunctional Core, Imperative Shell: pure domain modules; side effects at edges. Authorization decisions should be pure checks on scope/user data; persist only at the edge.

RULES — Follow these with no exceptions

1. Use bracket access in templatesassigns[:current_scope] prevents crashes when unauthenticated 2. Test both authenticated and unauthenticated states — scope-based auth has two distinct code paths 3. Define anonymous/0 for the unauthenticated case — return a Scope with user: nil 4. Pass scope to context functions, not a bare user — centralizes authorization and enables tenant/permission checks 5. Guard mutating events with Scope.can?/2 — enforce authorization server-side; never rely on hidden UI controls

Scope Struct Definition

defmodule MyApp.Scope do
  defstruct [:user, :role, :permissions, :tenant]
Installs
12
GitHub Stars
1
First Seen
Jun 20, 2026
phoenix-scopes — igmarin/elixir-phoenix-skills