ecto-patterns

ecto-patterns is a skill for Claude Code from oliver-kriska/claude-elixir-phoenix. It costs 51 tokens per session (995 once invoked), scanned A, original, MIT.

A reference for building and changing Ecto code, including database schemas, queries, migrations, associations, and transactions. Ecto is the Elixir library that maps application data to a database.

In plain words
What is it for?
Use it when editing Ecto schemas, changesets, queries, migrations, preloads, upserts, or database transactions in an Elixir project.
Why use it?
It helps prevent common database mistakes such as unsafe queries, repeated queries in loops, incorrect money types, and weak handling of race conditions.

Skill for Claude Code

Written for Claude Code: user-invocable in frontmatter.

Part of the phx plugin — 50 skills, 26 agents, 8 hooks shipped together

Good fit Use it when editing Ecto schemas, changesets, queries, migrations, preloads, upserts, or database transactions in an Elixir project.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/oliver-kriska/claude-elixir-phoenix/ecto-patterns
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add oliver-kriska/claude-elixir-phoenix --skill ecto-patterns
Clone the repo
git clone --depth 1 https://github.com/oliver-kriska/claude-elixir-phoenix

Made for: Claude Code.

Or install phx, the plugin that ships this one along with the rest of its 50 skills, 26 agents, 8 hooks.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for ecto-patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/oliver-kriska/claude-elixir-phoenix/ecto-patterns/github.svg)](https://agentmods.dev/skills/oliver-kriska/claude-elixir-phoenix/ecto-patterns)
Your own site
<a href="https://agentmods.dev/skills/oliver-kriska/claude-elixir-phoenix/ecto-patterns"><img src="https://agentmods.dev/badge/skills/oliver-kriska/claude-elixir-phoenix/ecto-patterns/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for ecto-patterns

Your own site · 80×15
<a href="https://agentmods.dev/skills/oliver-kriska/claude-elixir-phoenix/ecto-patterns"><img src="https://agentmods.dev/badge/skills/oliver-kriska/claude-elixir-phoenix/ecto-patterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 51 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 995 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00051 $0.00995
Opus 5.5 $0.00020 $0.00398
Sonnet 5.5 $0.00010 $0.00199
Haiku 4.5 $0.00005 $0.00100

Measured 2mo ago against content hash 3d7f0e835b84, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

ecto-patterns scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/elixir-phoenix/skills/ecto-patterns/SKILL.md · 91 lines

How it starts

The opening of the file, as written. The whole thing — 91 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Ecto Patterns Reference

Reference for working with Ecto schemas, queries, and migrations.

Iron Laws — Never Violate These

  1. CHANGESETS ARE FOR EXTERNAL DATA — Use cast/4 for user/API input, change/2 or put_change/3 for internal trusted data
  2. NEVER USE :float FOR MONEY — Always use :decimal or :integer (cents)
  3. NO RAILS-STYLE POLYMORPHIC ASSOCIATIONS — They break foreign key constraints; use multiple nullable FKs or separate join tables
  4. ALWAYS PIN VALUES IN QUERIES — u.name == ^user_input is safe, string interpolation causes SQL injection
  5. PRELOAD COLLECTIONS, NOT INDIVIDUALS — Preloading in loops = N+1 queries
  6. CONSTRAINTS BEAT VALIDATIONS FOR RACE CONDITIONS — Validations provide quick feedback, constraints provide DB-level safety
  7. SEPARATE QUERIES FOR has_many, JOIN FOR belongs_to — Avoids row multiplication
  8. NO IMPLICIT CROSS JOINS — from(a in A, b in B) without on: creates Cartesian product
  9. DEDUP BEFORE cast_assoc WITH SHARED DATA — When multiple parents share child data, deduplicate child records BEFORE building changesets. Dedup only works within a single changeset

Quick Schema Template

defmodule MyApp.Context.Entity do
  use Ecto.Schema
  import Ecto.Changeset

  @primary_key {:id, :binary_id, autogenerate: true}
  @foreign_key_type :binary_id

  schema "entities" do
    field :name, :string
    field :status, Ecto.Enum, values: [:draft, :active, :archived]
    field :amount_cents, :integer  # Never :float for money!
    belongs_to :user, MyApp.Accounts.User
    timestamps(type: :utc_datetime_usec)
  end

  def changeset(entity, attrs) do
    entity
    |> cast(attrs, [:name, :status, :amount_cents])
    |> validate_required([:name])
    |> foreign_key_constraint(:user_id)
  end
end

Quick Decisions

cast vs put_change vs change

Function Use When
cast/4 External data (user input, API)
put_change/3 Internal trusted data (timestamps, computed)
change/2 Internal data from existing struct

Read the full file on GitHub · 91 lines

Files

What ships with it

5 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2mo ago Changed · +1 tokens per session 3d7f0e835b84
  2. 2mo ago Changed · +5 tokens per session de42709043f5
  3. 3mo ago First seen · 91 lines · 45 tokens per session scan A ec5a106f842f

Subscribe to this mod's changes

ecto-patterns is a skill published in the GitHub repository oliver-kriska/claude-elixir-phoenix (580 stars, last pushed 4d ago), licensed MIT. It adds 51 tokens to every session and 995 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

ecto-patterns compared with skills from other repositories

ecto-patterns next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
ecto-patternsoliver-kriska/claude-elixir-phoenixSkill5804d agoMITA51Claude Code
311-frameworks-spring-jdbcjabrena/plinthSkill470yesterdayApache-2.0A173Claude Code, Codex
312-frameworks-spring-data-jdbcjabrena/plinthSkill470yesterdayApache-2.0A110Claude Code, Codex
412-frameworks-quarkus-panachejabrena/plinthSkill470yesterdayApache-2.0A189Claude Code, Codex
413-frameworks-quarkus-db-migrations-flywayjabrena/plinthSkill470yesterdayApache-2.0A136Claude Code, Codex
416-frameworks-quarkus-mongodb-migrations-mongockjabrena/plinthSkill470yesterdayApache-2.0A135Claude Code, Codex
411-frameworks-quarkus-jdbcjabrena/plinthSkill470yesterdayApache-2.0A112Claude Code, Codex