ash-framework

Guides Ash Framework resource, action, and policy patterns in Phoenix projects.

537|38|Updated Feb 12, 2026
One-click install
npx skills add https://github.com/oliver-kriska/claude-elixir-phoenix --skill ash-framework
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ash-framework
Source: https://github.com/oliver-kriska/claude-elixir-phoenix/tree/main/targets/codex/skills/ash-framework
Command: npx skills add https://github.com/oliver-kriska/claude-elixir-phoenix --skill ash-framework

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Ash Framework projects fail in subtle ways when developers call Ash.create directly from LiveViews, pass actors at execution time instead of query preparation, or hand-edit resource snapshots and migrations. This Skill encodes the correct patterns so generated and edited Ash code respects policies, code interfaces, and the codegen workflow.

Core Features & Use Cases

  • Iron Laws enforcement: Seven non-negotiable rules covering domain code interfaces, actor/scope placement at query prep, generator-first workflows, and the ban on direct Repo.* calls in Ash projects.
  • Code patterns: Ready-to-use examples for domain code interfaces, authorization with actor: or Ash.Scope, and the Ash.Scope.ToOpts protocol implementation.
  • Generator workflow: Documents mix ash.gen.resource, mix ash.gen.domain, mix ash.codegen, and file conventions for changes, checks, actions, types, and validations.
  • Use Case: When adding a new User resource with authentication policies, follow the Skill to generate the resource, define domain code interfaces, pass the actor at query preparation, and run mix ash.codegen to produce the migration.

Quick Start

Ask the assistant to create an Ash resource with policies and code interfaces for your Phoenix app, following the ash-framework guidelines.

Frequently Asked Questions about ash-framework

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create an Ash resource in a Phoenix project?

Run mix ash.gen.resource with the --yes flag to generate the resource, then run mix ash.codegen to produce migrations from resource snapshots. Never write AshPostgres migrations by hand or edit files under priv/resource_snapshots.

How do I pass the current user for Ash authorization?

Pass actor: or scope: to for_read/for_create/for_action at query preparation, not to Ash.read! or Ash.create! at execution. Execution-level actors bypass row-level policy evaluation, which breaks authorization.

Should I use Ash.Scope or a plain actor in Ash queries?

Use scope: consistently if the project defines a Scope module implementing Ash.Scope.ToOpts, since it bundles actor, tenant, and context. Otherwise use actor:, but never mix both styles in the same codebase.

Can I call Ash.create directly from a LiveView?

No. LiveViews and Controllers must call domain code interfaces such as MyApp.Accounts.register_user() defined on the domain. Direct Ash.create calls bypass the domain layer and its exposed action contracts.

Why is calling Repo.all a problem in an Ash project?

Repo.all, Repo.get, and Repo.insert bypass Ash policies and notifications, silently skipping authorization. Any Repo call in an Ash project is an escape hatch that must be explicitly documented.