Skip to content

Practical Ecto patterns for Phoenix apps covering schemas, migrations, transactions, pagination, and tenancy.

CCM score
55 of 100
skills.sh installs
362
GitHub stars
79
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers schemas, changesets, migrations, queries, Ecto.Multi transactions, constraints, associations, pagination, multi-tenancy, performance, and testing
  • Includes worked code samples for user registration changesets, safe migrations, preloads, and multi-step onboarding with Ecto.Multi
  • Guides safe DDL with additive, nullable-first column changes, concurrent indexes, and small migration steps to avoid long locks
  • Designed for Phoenix teams that need database-enforced constraints and tenant-scoped data access patterns

Install

$ npx -y skills add bobmatnyc/claude-mpm-skills --skill ecto-patterns -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

Ecto Patterns for Phoenix/Elixir

Ecto is the data layer for Phoenix applications: schemas, changesets, queries, migrations, and transactions. Good Ecto practice keeps domain logic in contexts, enforces constraints in the database, and uses transactions for multi-step workflows.

Schemas and Changesets

defmodule MyApp.Accounts.User do
  use Ecto.Schema
  import Ecto.Changeset

  schema "users" do
    field :email, :string
    field :hashed_password, :string
    field :confirmed_at, :naive_datetime
    has_many :memberships, MyApp.Orgs.Membership
    timestamps()
  end

  def registration_changeset(user, attrs) do
    user
    |> cast(attrs, [:email, :password])
    |> validate_required([:email, :password])
    |> validate_format(:email, ~r/@/)
    |> validate_length(:password, min: 12)
    |> unique_constraint(:email)
    |> hash_password()
  end

  defp hash_password(%{valid?: true} = cs),
    do: put_change(cs, :hashed_password, Argon2.hash_pwd_salt(get_change(cs, :password)))
  defp hash_password(cs), do: cs
end

Details

Repository
github.com/bobmatnyc/claude-mpm-skills
Categories
Databases, Backend & APIs
First seen
Jun 3, 2026

Questions

What does the ecto-patterns skill cover?

ecto-patterns gives Phoenix and Elixir apps guidance on schemas, changesets, migrations, queries, Ecto.Multi, transactions, constraints, associations, pagination, tenant partitioning, performance, and testing. It keeps domain logic in contexts and enforces constraints in the database. Its examples show how to structure each of these areas in an Ecto data layer.

Who is ecto-patterns for?

ecto-patterns is for developers building Phoenix/Elixir applications who work with Ecto as their data layer. It helps them design schemas with validation, run migrations safely, and execute multi-step writes with Ecto.Multi. Its guidance also covers multi-tenant partitioning and query performance.

How do I install the ecto-patterns skill?

Run npx -y skills add bobmatnyc/claude-mpm-skills --skill ecto-patterns -y in your project. After installation, the agent can apply ecto-patterns when you work on Ecto schemas, migrations, queries, or transactions. The skill loads its Phoenix and Elixir data layer guidance for that work.

Which tools or accounts does ecto-patterns need?

ecto-patterns needs an Elixir project with Phoenix and Ecto, since its examples use mix ecto.create and mix ecto.migrate. Its testing examples rely on a DataCase test setup with a sandboxed database. The skill itself does not require API keys or external accounts.

Where does ecto-patterns sit among other database skills?

ecto-patterns is in the Databases category on Claude Marketplaces. It differs from the Postgres and Prisma skills in that it targets Elixir's Ecto library for Phoenix apps. Its scope is the Ecto data layer, with migration safety and tenant partitioning patterns.

More from bobmatnyc/claude-mpm-skills

All 154

Similar to Ecto Patterns

More Databases