ecto-nested-associations

Installation
SKILL.md

Ecto Nested Associations

Canonical FP bar: docs/fcis-engineering-rules.mdFunctional Core, Imperative Shell: pure domain modules; side effects at edges. Build changesets/Multi in pure-ish functions; run Repo once at the context edge.

RULES — Follow these with no exceptions

1. Use cast_assoc/3 for has_many/has_one — never manually insert children in a separate step 2. Use Ecto.Multi for operations spanning multiple unrelated tables — do NOT use Ecto.Multi for nested associations 3. Set on_delete explicitly in migrations:delete_all for owned children, :nothing for independent entities 4. Always create indexes on foreign key columns 5. Use on_replace: :delete in cast_assoc for list management 6. Preload associations before updating themcast_assoc compares against currently loaded data 7. Do NOT require foreign keys in child changesetscast_assoc sets them automatically 8. Use Repo.transaction/1 with Ecto.Multi — wrap multi-table operations for atomicity

End-to-End Workflow

Installs
14
GitHub Stars
1
First Seen
Jun 20, 2026
ecto-nested-associations — igmarin/elixir-phoenix-skills