ecto-essentials
Skill4 starsChanged 4 months agoMITView on GitHub
Use for Ecto schemas, queries, changesets, associations, preloads, transactions, and persistence boundaries in an existing Elixir project.
In this repository34 other files it gives its agents.
- AGENTS.mdAGENTS.md
- apply-phoenix-controller-conventionsSkill
- ash-frameworkSkill
- benchee-profilingSkill
- broadway-data-pipelinesSkill
- cachex-cachingSkill
- code-qualitySkill
- code-reviewSkill
- deployment-gotchasSkill
- ecto-changeset-patternsSkill
- ecto-migrationSkill
- ecto-nested-associationsSkill
- elixir-essentialsSkill
- gettext-i18nSkill
- liveview-streamsSkill
- mix-tasks-generatorsSkill
- oban-essentialsSkill
- otp-essentialsSkill
- phoenix-authenticationSkill
- phoenix-authorization-patternsSkill
- phoenix-channels-essentialsSkill
- phoenix-json-apiSkill
- phoenix-liveview-essentialsSkill
- phoenix-pubsub-patternsSkill
- phoenix-uploadsSkill
- property-based-testingSkill
- refactor-codeSkill
- req-http-clientSkill
- respond-to-reviewSkill
- security-essentialsSkill
- swoosh-emailsSkill
- telemetry-essentialsSkill
- testing-essentialsSkill
- typespec-dialyzerSkill
The file
We split this skill into the rules it gives an agent
8 rules. About 0 are common, 2 are distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 11
Follow the repository's Ecto and database conventions.
- Very specific: line 16
Use cast/3 with an explicit field allowlist for external maps.
- Very specific: line 18
Keep association ownership and delete behavior explicit.
- Distinctive: line 23
Keep reusable filters and ordering in query functions.
- Very specific: line 25
Use Repo.one/1, Repo.all/1, and bang variants according to the caller's expected absence and error contract.
- Very specific: line 30
Use Ecto.Multi when a transaction has multiple named steps or its failure step matters to the caller.
- Distinctive: line 31
Do not put network calls or other irreversible side effects inside a database transaction.
- Very specific: line 36
Add or update tests for the changed persistence behavior.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Ecto Essentials
Follow the repository's Ecto and database conventions. Keep business rules in the context or pure domain modules; keep Repo calls at the persistence edge.
Schemas and changesets
- Model persisted data in schemas and validate external input with changesets.
- Use
cast/3with an explicit field allowlist for external maps. Usechange/2for trusted internal updates. - Attach database constraints to changesets with
unique_constraint/3,foreign_key_constraint/3, or the matching constraint helper so expected database errors return changeset errors. - Keep association ownership and delete behavior explicit. Use
cast_assoc/3only when nested input is part of the public operation.
Queries and associations
- Compose
Ecto.Queryfragments with named bindings and parameterized values. Never interpolate user input into SQL. - Keep reusable filters and ordering in query functions; keep policy and orchestration in the context.
- Preload what the caller needs. For lists, inspect query counts and prefer joins or batched preloads over per-row
Repo.get/2calls. - Use
Repo.one/1,Repo.all/1, and bang variants according to the caller's expected absence and error contract.
Writes and transactions
- Return
{:ok, value}/{:error, changeset_or_reason}from expected failures. - Use
Ecto.Multiwhen a transaction has multiple named steps or its failure step matters to the caller. Use a normal transaction for a small atomic block. - Do not put network calls or other irreversible side effects inside a database transaction.
- For upserts, state the conflict target and verify the database constraint matches it.
Verification
Add or update tests for the changed persistence behavior. Run the focused test, then the project checks that cover Ecto and migrations. Use ecto-changeset-patterns, ecto-nested-associations, or ecto-migration only when that narrower behavior is central.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

