Agent skill

Ecto Constraint Debug

by oliver-kriska in oliver-kriska/claude-elixir-phoenix

Debug Ecto constraint violations - trace triggers, check migrations, find duplicate data.

MITAuto-check passedDevelopment

Install Ecto Constraint Debug

skills CLI
$ npx skills add oliver-kriska/claude-elixir-phoenix --skill ecto-constraint-debug -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install oliver-kriska/claude-elixir-phoenix ecto-constraint-debug --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/oliver-kriska/claude-elixir-phoenix.git skills-src && mkdir -p .claude/skills && cp -r skills-src/targets/pi/skills/ecto-constraint-debug .claude/skills/ecto-constraint-debug && rm -rf skills-src

Use ~/.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/

Facts

Skill name
ecto-constraint-debug
GitHub stars
565
Token cost
~799 tokens
SKILL.md length
352 words
Files
2 (incl. references)
Skills in repo
105
Repo updated
First seen
Licence
MIT

At a glance

Debug Ecto constraint violations - trace triggers, check migrations, find duplicate data.

  • Works in 6 steps: Parse the Error → Find the Migration → Find the Schema → …
  • Seeing uniqueconstraint
  • SKILL.md covers Iron Laws, Step-by-Step Debugging, Quick Fixes by Constraint Type and References
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Ecto Constraint Debug is an agent skill from oliver-kriska/claude-elixir-phoenix. Debug Ecto constraint violations - trace triggers, check migrations, find duplicate data. Use when seeing uniqueconstraint, foreignkeyconstraint, or checkconstraint errors.

Its SKILL.md is about 800 tokens, which your agent loads only when the skill is triggered. The skill folder holds 2 other files, including reference files (for example `references/constraint-patterns.md`).

It sits in Development, covering Debugging. The repository describes itself as: Claude Code plugin for Elixir/Phoenix/LiveView — 26 specialist agents, Iron Laws enforcement, and Tidewave MCP integration. Plan features with parallel research agents, execute… The licence is MIT.

When your agent uses it

  • Seeing uniqueconstraint
  • Foreignkeyconstraint
  • Checkconstraint errors

Example prompts

  • “/ecto-constraint-debug”

Workflow steps

6 steps, taken from the step headings in SKILL.md.

  1. Parse the Error
  2. Find the Migration
  3. Find the Schema
  4. Trace Insert Paths
  5. Identify the Cause
  6. Apply Fix

What it can do on your machine

Read from SKILL.md and the folder at commit 9767a82. It shows what the files ask for, not the result of running them.

  • Tool permissions

    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.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Ecto Constraint Debug loads about 799 tokens when it runs, and up to ~2.1k if it reads all its reference files. Until then it costs about 50 tokens; SKILL.md has 352 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~50
When it runs · the whole SKILL.md, loaded when a task matches
~799
With references · SKILL.md plus every file in references/, read only if the agent opens them
~2.1k

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.

Safety

Auto-check passed

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.

SKILL.md

The full file from oliver-kriska/claude-elixir-phoenix at commit 9767a82, republished under its MIT licence (© oliver-kriska). 352 words, ~799 tokens.

Download SKILL.mdSave it as .claude/skills/ecto-constraint-debug/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.
name
ecto-constraint-debug
description
Debug Ecto constraint violations - trace triggers, check migrations, find duplicate data. Use when seeing unique_constraint, foreign_key_constraint, or check_constraint errors.

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)
  • Conflicting values (if available in logs)
Step 2: Find the Migration

Use Grep to search for the constraint name in priv/repo/migrations/. Also check for create unique_index, create index, add constraint.

Verify: Does the migration constraint match the schema's unique_constraint/3 or foreign_key_constraint/3 call?

Step 3: Find the Schema

Use Grep to find constraint handling in changesets (unique_constraint, foreign_key_constraint, check_constraint) in lib/.

Show full SKILL.md (140 more words)Show less
Step 4: Trace Insert Paths

Find ALL callers that insert/update this schema:

Use Grep to find all insert/update paths (Repo.insert, Repo.update, Repo.insert_all, cast_assoc) in lib/.

Step 5: Identify the Cause
SymptomLikely CauseFix Pattern
Same user triggers twiceRace condition (double-click, retry)Upsert with on_conflict
Multiple parents share childcast_assoc doesn't dedup across changesetsDedup before building changesets
Concurrent API requestsMissing transaction isolationWrap in Repo.transaction or use upsert
Migration added constraint to existing dataData violates new constraintBackfill or clean data first
Step 6: Apply Fix

See references/constraint-patterns.md for detailed fix patterns.

Quick Fixes by Constraint Type

Unique violation → Upsert: Repo.insert(changeset, on_conflict: :replace_all, conflict_target: [:field])

Foreign key violation → Check: Does the referenced record exist? Was it deleted concurrently?

Check constraint → Validate: Does the value satisfy the constraint condition?

References

  • references/constraint-patterns.md - Detailed patterns for each constraint type

© oliver-kriska, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 1 other file (references) in targets/pi/skills/ecto-constraint-debug of oliver-kriska/claude-elixir-phoenix.

  • SKILL.md
  • references/constraint-patterns.md

Open the folder on GitHubat commit 9767a82

Compare with similar skills

Ecto Constraint Debug 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.

Ecto Constraint Debug compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Ecto Constraint Debug this skilloliver-kriska/claude-elixir-phoenix565—~799Automated safety check: PassMIT
Trellis Session Insightmindfold-ai/Trellis15k4 repos~1.7kAutomated safety check: PassAGPL-3.0
Native Data FetchingCherryHQ/cherry-studio-app4k6 repos~2.9kAutomated safety check: NotesMIT
Debugging Executionsn8n-io/n8n207k—~2.6kAutomated safety check: PassCustom licence
Aoti Debugpytorch/pytorch104k1 repos~1.7kAutomated safety check: PassCustom licence
Herdr Throwaway Reproductionherdrdev/herdr43k—~2.4kAutomated safety check: PassApache-2.0

Similar skills

  • Trellis Session Insight

    mindfold-ai/Trellis

    Reach into past AI conversation history through the trellis mem CLI.

    15k GitHub starsUsed in 4 repos~1.7k tokens
    DevelopmentAuto-check passed
  • Native Data Fetching

    CherryHQ/cherry-studio-app

    A skill your agent uses when implementing or debugging ANY network request, API call, or data fetching.

    4k GitHub starsUsed in 6 repos~2.9k tokens
    DevelopmentAuto-check: notes
  • Official

    Debug failed or wrong-output workflow executions using executions tools.

    207k GitHub stars~2.6k tokensUpdated today
    DevelopmentAuto-check passed
  • Aoti Debug

    pytorch/pytorch

    Debug AOTInductor (AOTI) errors and crashes. An agent skill from pytorch/pytorch.

    104k GitHub starsUsed in 1 repo~1.7k tokens
    DevelopmentAuto-check passed
  • Runs a disposable, uniquely named Herdr session inside an existing one so runtime, pane, terminal or API bugs can be reproduced without touching the main session.

    43k GitHub stars~2.4k tokensUpdated today
    DevelopmentAuto-check passed
  • Systematic Debugging

    ultralisp/ultralisp

    A skill your agent uses when encountering any bug, test failure, or unexpected behavior, before proposing fixes

    258 GitHub starsUsed in 51 repos~2.4k tokens
    DevelopmentAuto-check passed

More from oliver-kriska/claude-elixir-phoenix

All 105 skills in this repo
  • Phx Brief

    oliver-kriska/claude-elixir-phoenix

    Interactive briefing of a plan file — explains reasoning, schema decisions, component choices.

    565 GitHub starsUsed in 1 repo~1.2k tokens
    Auto-check passed
  • Codex Ab

    oliver-kriska/claude-elixir-phoenix

    Run an A/B codex review experiment — holistic codex review vs 3 focused dimension passes (security, ecto, liveview) on the branch diff, classify findings, report a panel-value verdict.

    565 GitHub stars~977 tokensUpdated 2 days ago
    Auto-check passed
  • Audit

    oliver-kriska/claude-elixir-phoenix

    Project health audit and health check — architecture, performance, tests, dependencies, code quality.

    565 GitHub stars~2k tokensUpdated 2 days ago
    Auto-check passed
  • Compound Docs

    oliver-kriska/claude-elixir-phoenix

    Searchable Elixir/Phoenix/Ecto solution documentation system with; Use when consulting past solutions…

    565 GitHub stars~528 tokensUpdated 2 days ago
    Auto-check passed
  • Compound Docs

    oliver-kriska/claude-elixir-phoenix

    Searchable Elixir/Phoenix/Ecto solution documentation system with YAML frontmatter.

    565 GitHub stars~547 tokensUpdated 2 days ago
    Auto-check passed
  • Deploy

    oliver-kriska/claude-elixir-phoenix

    Elixir/Phoenix deployment patterns — Dockerfile, fly.toml, runtime.exs, mix release, rel/ overlays.

    565 GitHub stars~1.1k tokensUpdated 2 days ago
    Auto-check passed

Categories

Questions about Ecto Constraint Debug

What does Ecto Constraint Debug do?

Debug Ecto constraint violations - trace triggers, check migrations, find duplicate data. Ecto Constraint Debug is an agent skill from oliver-kriska/claude-elixir-phoenix. Debug Ecto constraint violations - trace triggers, check migrations, find duplicate data.

When should I use Ecto Constraint Debug?

Ecto Constraint Debug fits situations like: seeing uniqueconstraint; foreignkeyconstraint; checkconstraint errors.

How do I install Ecto Constraint Debug in Claude Code?

Run `npx skills add oliver-kriska/claude-elixir-phoenix --skill ecto-constraint-debug -a claude-code`. Or copy the skill folder (targets/pi/skills/ecto-constraint-debug in oliver-kriska/claude-elixir-phoenix) into .claude/skills/ecto-constraint-debug in your project. Claude Code loads it when a task matches its description.

How do I install Ecto Constraint Debug in Codex?

Run `npx skills add oliver-kriska/claude-elixir-phoenix --skill ecto-constraint-debug -a codex`. Or copy the skill folder (targets/pi/skills/ecto-constraint-debug in oliver-kriska/claude-elixir-phoenix) into .agents/skills/ecto-constraint-debug in your project. Codex loads it when a task matches its description.

Can I use Ecto Constraint Debug in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add oliver-kriska/claude-elixir-phoenix --skill ecto-constraint-debug -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-constraint-debug, .gemini/skills/ecto-constraint-debug, .github/skills/ecto-constraint-debug and .opencode/skills/ecto-constraint-debug in your project.

What does Ecto Constraint Debug need to run?

SKILL.md names no scripts, command-line tools or credentials: Ecto Constraint Debug is instructions for the agent only.

Does Ecto Constraint Debug access the network?

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.

Is Ecto Constraint Debug safe to install?

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.

What licence does Ecto Constraint Debug use?

Ecto Constraint Debug is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Ecto Constraint Debug use?

About 799 tokens (SKILL.md is roughly 3.2k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 1.3k tokens, read only when the agent opens those files.

What are the alternatives to Ecto Constraint Debug?

Skills that share tags, products or a category with Ecto Constraint Debug: Trellis Session Insight (mindfold-ai/Trellis, 15k stars), Native Data Fetching (CherryHQ/cherry-studio-app, 4k stars), Debugging Executions (n8n-io/n8n, 207k stars) and Aoti Debug (pytorch/pytorch, 104k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Ecto Constraint Debug?

oliver-kriska (a GitHub user) maintains it in oliver-kriska/claude-elixir-phoenix, which has 565 GitHub stars. The repository holds 105 skills in this directory. The repository was last updated on October 5, 2026.

Source: oliver-kriska/claude-elixir-phoenix on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.