Changeset
withastro/astro
Create a changeset for the Astro monorepo. An agent skill from withastro/astro.
A skill your agent uses when a resource needs multiple changesets (registration vs update), conditional validation, field transforms, or uniqueness validation — changeset composition.
$ npx skills add j-morgan6/elixir-phoenix-guide --skill ecto-changeset-patterns -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install j-morgan6/elixir-phoenix-guide ecto-changeset-patterns --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/j-morgan6/elixir-phoenix-guide.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/ecto-changeset-patterns .claude/skills/ecto-changeset-patterns && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "ecto-changeset-patterns" agent skill from https://github.com/j-morgan6/elixir-phoenix-guide/tree/main/skills/ecto-changeset-patterns into .claude/skills/ecto-changeset-patterns/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "ecto-changeset-patterns", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/j-morgan6/elixir-phoenix-guide/tree/main/skills/ecto-changeset-patternsType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add j-morgan6/elixir-phoenix-guide --skill ecto-changeset-patterns -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install j-morgan6/elixir-phoenix-guide ecto-changeset-patterns --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/j-morgan6/elixir-phoenix-guide.git skills-src && mkdir -p .agents/skills && cp -r skills-src/skills/ecto-changeset-patterns .agents/skills/ecto-changeset-patterns && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "ecto-changeset-patterns" agent skill from https://github.com/j-morgan6/elixir-phoenix-guide/tree/main/skills/ecto-changeset-patterns into .agents/skills/ecto-changeset-patterns/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "ecto-changeset-patterns", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add j-morgan6/elixir-phoenix-guide --skill ecto-changeset-patterns -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install j-morgan6/elixir-phoenix-guide ecto-changeset-patterns --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/j-morgan6/elixir-phoenix-guide.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/skills/ecto-changeset-patterns .cursor/skills/ecto-changeset-patterns && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "ecto-changeset-patterns" agent skill from https://github.com/j-morgan6/elixir-phoenix-guide/tree/main/skills/ecto-changeset-patterns into .cursor/skills/ecto-changeset-patterns/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "ecto-changeset-patterns", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/j-morgan6/elixir-phoenix-guide.git --path skills/ecto-changeset-patterns--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add j-morgan6/elixir-phoenix-guide --skill ecto-changeset-patterns -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install j-morgan6/elixir-phoenix-guide ecto-changeset-patterns --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/j-morgan6/elixir-phoenix-guide.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/skills/ecto-changeset-patterns .gemini/skills/ecto-changeset-patterns && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "ecto-changeset-patterns" agent skill from https://github.com/j-morgan6/elixir-phoenix-guide/tree/main/skills/ecto-changeset-patterns into .gemini/skills/ecto-changeset-patterns/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "ecto-changeset-patterns", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install j-morgan6/elixir-phoenix-guide ecto-changeset-patternsInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add j-morgan6/elixir-phoenix-guide --skill ecto-changeset-patterns -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/j-morgan6/elixir-phoenix-guide.git skills-src && mkdir -p .github/skills && cp -r skills-src/skills/ecto-changeset-patterns .github/skills/ecto-changeset-patterns && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "ecto-changeset-patterns" agent skill from https://github.com/j-morgan6/elixir-phoenix-guide/tree/main/skills/ecto-changeset-patterns into .github/skills/ecto-changeset-patterns/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "ecto-changeset-patterns", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add j-morgan6/elixir-phoenix-guide --skill ecto-changeset-patterns -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install j-morgan6/elixir-phoenix-guide ecto-changeset-patterns --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/j-morgan6/elixir-phoenix-guide.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/skills/ecto-changeset-patterns .opencode/skills/ecto-changeset-patterns && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "ecto-changeset-patterns" agent skill from https://github.com/j-morgan6/elixir-phoenix-guide/tree/main/skills/ecto-changeset-patterns into .opencode/skills/ecto-changeset-patterns/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "ecto-changeset-patterns", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
ecto-changeset-patternsA skill your agent uses when a resource needs multiple changesets (registration vs update), conditional validation, field transforms, or uniqueness validation — changeset composition.
Ecto Changeset Patterns is an agent skill from j-morgan6/elixir-phoenix-guide. Use when a resource needs multiple changesets (registration vs update), conditional validation, field transforms, or uniqueness validation — changeset composition.
Its SKILL.md is about 2.1k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.
The licence is MIT.
7 steps, taken from the first numbered list in SKILL.md.
Read from SKILL.md and the folder at commit cdfddac. It shows what the files ask for, not the result of running them.
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
No scripts in the folder and no shell commands in SKILL.md (its code samples are elixir).
From the folder's file list and the shell code blocks in SKILL.md.
No URLs in SKILL.md.
From URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Ecto Changeset Patterns loads about 2.1k tokens when it runs. Until then it costs about 47 tokens; SKILL.md has 264 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
The full file from j-morgan6/elixir-phoenix-guide at commit cdfddac, republished under its MIT licence (© j-morgan6). 264 words, ~2,122 tokens.
.claude/skills/ecto-changeset-patterns/SKILL.md (or your agent's skills folder).registration_changeset, email_changeset, password_changeset; never overload a single changeset/2cast_assoc child changesets — the parent sets them automatically; requiring them causes "can't be blank" errorsunsafe_validate_unique paired with unique_constraint — never one without the other; unsafe_validate_unique gives fast UI feedback, unique_constraint handles race conditionsupdate_change/3 for field transformations — trimming, downcasing, slugifying happen in the changeset, never in the controller or contextopts \\ [] for conditional validation — allows callers to toggle validation rules without creating yet another changeset functionRepo callsDifferent operations need different validation rules. Don't overload changeset/2.
defmodule MyApp.Accounts.User do
use Ecto.Schema
import Ecto.Changeset
schema "users" do
field :email, :string
field :username, :string
field :password, :string, virtual: true, redact: true
field :hashed_password, :string, redact: true
field :bio, :string
timestamps()
end
# Registration — all fields, password hashing
def registration_changeset(user, attrs, opts \\ []) do
user
|> cast(attrs, [:email, :username, :password])
|> validate_email(opts)
|> validate_username()
|> validate_password(opts)
end
# Email change — only email, requires reconfirmation
def email_changeset(user, attrs, opts \\ []) do
user
|> cast(attrs, [:email])
|> validate_email(opts)
end
# Password change — only password
def password_changeset(user, attrs, opts \\ []) do
user
|> cast(attrs, [:password])
|> validate_password(opts)
|> put_password_hash()
end
# Profile update — non-sensitive fields only
def profile_changeset(user, attrs) do
user
|> cast(attrs, [:username, :bio])
|> validate_username()
end
endThe most common source of "can't be blank" errors. Foreign keys are set automatically by the parent — never require them in the child changeset.
# Parent schema
defmodule MyApp.Blog.Post do
schema "posts" do
field :title, :string
has_many :ingredients, MyApp.Blog.Ingredient
timestamps()
end
def changeset(post, attrs) do
post
|> cast(attrs, [:title])
|> validate_required([:title])
|> cast_assoc(:ingredients, with: &MyApp.Blog.Ingredient.changeset/2)
end
end
# Child schema — DO NOT require :post_id
defmodule MyApp.Blog.Ingredient do
schema "ingredients" do
field :name, :string
field :quantity, :string
belongs_to :post, MyApp.Blog.Post
timestamps()
end
# Bad — :post_id is required but set automatically by cast_assoc
def changeset(ingredient, attrs) do
ingredient
|> cast(attrs, [:name, :quantity, :post_id])
|> validate_required([:name, :post_id]) # Fails!
end
# Good — only require user-provided fields
def changeset(ingredient, attrs) do
ingredient
|> cast(attrs, [:name, :quantity])
|> validate_required([:name])
end
endBreak validation into small, reusable functions. Compose with pipes.
defmodule MyApp.Accounts.User do
# Reusable validation components
defp validate_email(changeset, opts) do
changeset
|> validate_required([:email])
|> validate_format(:email, ~r/^[^\s]+@[^\s]+$/, message: "must have the @ sign and no spaces")
|> validate_length(:email, max: 160)
|> maybe_validate_unique_email(opts)
end
defp validate_username(changeset) do
changeset
|> validate_required([:username])
|> validate_format(:username, ~r/^[a-zA-Z0-9_]+$/, message: "only letters, numbers, and underscores")
|> validate_length(:username, min: 3, max: 30)
|> unsafe_validate_unique(:username, MyApp.Repo)
|> unique_constraint(:username)
end
defp validate_password(changeset, opts) do
changeset
|> validate_required([:password])
|> validate_length(:password, min: 8, max: 72)
|> maybe_hash_password(opts)
end
defp maybe_validate_unique_email(changeset, opts) do
if Keyword.get(opts, :validate_email, true) do
changeset
|> unsafe_validate_unique(:email, MyApp.Repo)
|> unique_constraint(:email)
else
changeset
end
end
defp maybe_hash_password(changeset, opts) do
if Keyword.get(opts, :hash_password, true) && changeset.valid? do
changeset
|> put_change(:hashed_password, Bcrypt.hash_pwd_salt(get_change(changeset, :password)))
|> delete_change(:password)
else
changeset
end
end
endUse opts to toggle validation behavior from the caller. This avoids creating a new changeset function for every variation.
# In the schema module
def registration_changeset(user, attrs, opts \\ []) do
user
|> cast(attrs, [:email, :username, :password])
|> validate_email(opts)
|> validate_password(opts)
end
# In the context — normal registration
def register_user(attrs) do
%User{}
|> User.registration_changeset(attrs)
|> Repo.insert()
end
# In tests — skip hashing for speed
def register_user_for_test(attrs) do
%User{}
|> User.registration_changeset(attrs, hash_password: false, validate_email: false)
|> Repo.insert()
endTransform field values in the changeset, not in the controller or LiveView.
def changeset(user, attrs) do
user
|> cast(attrs, [:email, :username])
|> update_change(:email, &String.downcase/1)
|> update_change(:username, &String.trim/1)
|> update_change(:username, &String.downcase/1)
end
# For slugs
def changeset(post, attrs) do
post
|> cast(attrs, [:title])
|> validate_required([:title])
|> generate_slug()
end
defp generate_slug(changeset) do
case get_change(changeset, :title) do
nil -> changeset
title ->
slug = title |> String.downcase() |> String.replace(~r/[^a-z0-9]+/, "-") |> String.trim("-")
put_change(changeset, :slug, slug)
end
endAlways pair unsafe_validate_unique with unique_constraint. They serve different purposes.
def changeset(user, attrs) do
user
|> cast(attrs, [:email, :username])
# Fast check — queries DB, gives immediate UI feedback
# "unsafe" because another insert could happen between check and insert
|> unsafe_validate_unique(:email, MyApp.Repo)
|> unsafe_validate_unique(:username, MyApp.Repo)
# Constraint check — catches race conditions at insert time
# Requires a matching unique index in the database
|> unique_constraint(:email)
|> unique_constraint(:username)
enddescribe "registration_changeset/2" do
test "valid with all required fields" do
changeset = User.registration_changeset(%User{}, %{
email: "test@example.com",
username: "testuser",
password: "validpassword123"
})
assert changeset.valid?
end
test "invalid without email" do
changeset = User.registration_changeset(%User{}, %{
username: "testuser",
password: "validpassword123"
})
refute changeset.valid?
assert "can't be blank" in errors_on(changeset).email
end
test "transforms email to lowercase" do
changeset = User.email_changeset(%User{}, %{email: "TEST@Example.COM"})
assert get_change(changeset, :email) == "test@example.com"
end
endSee ecto-essentials skill for schema and migration patterns.
See ecto-nested-associations skill for cast_assoc with nested data.
See testing-essentials skill for comprehensive testing patterns.
© j-morgan6, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
Just SKILL.md in skills/ecto-changeset-patterns of j-morgan6/elixir-phoenix-guide.
Open the folder on GitHubat commit cdfddac
Ecto Changeset Patterns next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Ecto Changeset Patterns this skillj-morgan6/elixir-phoenix-guide | 166 | — | ~2.1k | Automated safety check: Pass | MIT | |
| Changesetwithastro/astro | 63k | — | ~1.1k | Automated safety check: Pass | Custom licence | |
| Changesetudecode/plate | 17k | — | ~1.3k | Automated safety check: Pass | Custom licence | |
| Agent Resource Allocatorruvnet/ruflo | 74k | 2 repos | ~4.9k | Automated safety check: Pass | MIT | |
| Resourceswindmill-labs/windmill | 18k | — | ~1.7k | Automated safety check: Pass | Custom licence | |
| Resource Hintsthedaviddias/Front-End-Checklist | 74k | — | ~430 | Automated safety check: Pass | MIT |
withastro/astro
Create a changeset for the Astro monorepo. An agent skill from withastro/astro.
udecode/plate
Command: changeset
ruvnet/ruflo
Agent skill for resource-allocator - invoke with $agent-resource-allocator
windmill-labs/windmill
MUST use when managing resources.
thedaviddias/Front-End-Checklist
A skill your agent uses when auditing slow page loads, heavy assets, or rendering delays related to Use resource hints for faster loading.
garden-co/classic-jazz
Generate changeset files for versioning and changelog management in this monorepo.
j-morgan6/elixir-phoenix-guide
A skill your agent uses when refactoring for duplication, complexity, or dead code — includes the plugin's on-demand analysis scripts.
j-morgan6/elixir-phoenix-guide
A skill your agent uses when preparing releases or deployment config — runtime.exs vs compile-time config, release migrations, PHXHOST/PHXSERVER, assets, health checks.
j-morgan6/elixir-phoenix-guide
A skill your agent uses when defining schemas, writing queries, or creating migrations — schema design, Repo usage, indexes, query composition.
j-morgan6/elixir-phoenix-guide
A skill your agent uses when a form or operation manages parent and child records together — castassoc/castembed, onreplace, Ecto.Multi across tables, FK cascade design.
j-morgan6/elixir-phoenix-guide
A skill your agent uses when writing or refactoring core Elixir — pattern matching, case/cond/with, pipes, {:ok, }/{:error, } contracts.
j-morgan6/elixir-phoenix-guide
A skill your agent uses when writing background jobs with Oban — worker options, return contracts, idempotency, uniqueness, Oban.Testing.
A skill your agent uses when a resource needs multiple changesets (registration vs update), conditional validation, field transforms, or uniqueness validation — changeset composition. Ecto Changeset Patterns is an agent skill from j-morgan6/elixir-phoenix-guide. Use when a resource needs multiple changesets (registration vs update), conditional validation, field transforms, or uniqueness validation — changeset composition.
Ecto Changeset Patterns fits situations like: A resource needs multiple changesets (registration vs update); conditional validation; field transforms; uniqueness validation — changeset composition.
Run `npx skills add j-morgan6/elixir-phoenix-guide --skill ecto-changeset-patterns -a claude-code`. Or copy the skill folder (skills/ecto-changeset-patterns in j-morgan6/elixir-phoenix-guide) into .claude/skills/ecto-changeset-patterns in your project. Claude Code loads it when a task matches its description.
Run `npx skills add j-morgan6/elixir-phoenix-guide --skill ecto-changeset-patterns -a codex`. Or copy the skill folder (skills/ecto-changeset-patterns in j-morgan6/elixir-phoenix-guide) into .agents/skills/ecto-changeset-patterns in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add j-morgan6/elixir-phoenix-guide --skill ecto-changeset-patterns -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/ecto-changeset-patterns, .gemini/skills/ecto-changeset-patterns, .github/skills/ecto-changeset-patterns and .opencode/skills/ecto-changeset-patterns in your project.
SKILL.md names no scripts, command-line tools or credentials: Ecto Changeset Patterns is instructions for the agent only.
SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.
Ecto Changeset Patterns is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
About 2.1k tokens (SKILL.md is roughly 8.5k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.
Skills that share tags, products or a category with Ecto Changeset Patterns: Changeset (withastro/astro, 63k stars), Changeset (udecode/plate, 17k stars), Agent Resource Allocator (ruvnet/ruflo, 74k stars) and Resources (windmill-labs/windmill, 18k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
j-morgan6 (a GitHub user) maintains it in j-morgan6/elixir-phoenix-guide, which has 166 GitHub stars. The repository holds 19 skills in this directory. The repository was last updated on July 6, 2026.
Source: j-morgan6/elixir-phoenix-guide on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.