Agent skill · Data & Analytics

ecto-constraint-debug

Debug Ecto constraint violations - trace triggers, check migrations, find duplicate data. Use when seeing unique_constraint, foreign_key_constraint, or check_constraint errors.

oliver-kriskagithub.com/oliver-kriskaGitHub ↗
claude-codeMIT
Install
npx skills add oliver-kriska/claude-elixir-phoenix --skill ecto-constraint-debug --agent claude-code

Same command for any agent — swap --agent for codex, cursor, copilot.

Facts
Files in the skill folder: 2
SKILL.md size: 3 KB
Bundled scripts: none
Path: plugins/elixir-phoenix/skills/ecto-constraint-debug/SKILL.md
Open the folder on GitHub →
Where it comes from
Stars: 515
Language: Python

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

From the SKILL.md

# Ecto Constraint Debugging > **Ash projects**: Ash surfaces DB constraints through its own error DSL. Use the `ash-framework` skill — `mix usage_rules.search_docs "constraint" -p ash_postgres`. Systematic approach to diagnosing constraint violations. Load when you see `Ecto.ConstraintError`, `unique_constraint`, `foreign_key_constraint`, or constraint-related changeset errors. ## Iron Laws 1. **READ THE CONSTRAINT NAME** — The constraint name (e.g., `links_url_index`) tells you exactly which index/constraint failed. Parse it from the error message first 2. **CHECK MIGRATION BEFORE CODE** — Verify the constraint definition in `priv/repo/migrations/` matches what the schema expects 3. **TRACE ALL INSERT PATHS** — Find every code path that inserts into the constrained table. The bug is often in a path you didn't consider 4. **RACE CONDITION UNTIL PROVEN OTHERWISE** — If validation passes but constraint fails, assume concurrent inserts until you prove a single-request cause ## Step-by-Step Debugging ### Step 1: Parse the Error Extract from the error message: - **Constraint name** (e.g., `users_email_index`) - **Table name** (e.g., `users`) - **Operation** (insert, update, or delete) -

What's inside
Steps it walks through
  1. Iron Laws
  2. Step-by-Step Debugging
  3. Step 1: Parse the Error
  4. Step 2: Find the Migration
  5. Step 3: Find the Schema
  6. Step 4: Trace Insert Paths
  7. Step 5: Identify the Cause
  8. Step 6: Apply Fix
  9. Quick Fixes by Constraint Type
  10. References
Ships with 1 file
  • references/constraint-patterns.md
More from claude-elixir-phoenix
All skills →
About this skill
What does the ecto-constraint-debug skill do?

Debug Ecto constraint violations - trace triggers, check migrations, find duplicate data. Use when seeing unique_constraint, foreign_key_constraint, or check_constraint errors.

How do I install it?

Run `npx skills add oliver-kriska/claude-elixir-phoenix --skill ecto-constraint-debug --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.

Where does this skill come from?

From oliver-kriska/claude-elixir-phoenix, a repository with 515 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.

Is a popular skill a good skill?

Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.

Keep going