elixir-phoenix-ecto-constraint-debug

elixir-phoenix-ecto-constraint-debug is a skill for Codex from ccarvalho-eng/codex-elixir-phoenix. It costs 25 tokens per session (680 once invoked), scanned A, a copy of ecto-constraint-debug, MIT.

A debugging guide for Ecto constraint errors. Ecto is the Elixir library commonly used to map application data to a database; constraints are database rules such as unique values and valid references between tables.

In plain words
What is it for?
Use it when an Ecto constraint error occurs, including unique, foreign-key, or changeset constraint failures. It helps identify the failed constraint, inspect migrations, and find every code path that writes the affected data.
Why use it?
It helps trace whether the failure comes from a database migration, an unexpected insert path, or simultaneous requests trying to write the same data. This avoids relying only on surface-level validation messages.

Skill for Codex

Written for Codex: agents/openai.yaml present.

Good fit Use it when an Ecto constraint error occurs, including unique, foreign-key, or changeset constraint failures. It helps identify the failed constraint, inspect migrations, and find every code path that writes the affected data.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/ccarvalho-eng/codex-elixir-phoenix/elixir-phoenix-ecto-constraint-debug
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add ccarvalho-eng/codex-elixir-phoenix --skill elixir-phoenix-ecto-constraint-debug
Clone the repo
git clone --depth 1 https://github.com/ccarvalho-eng/codex-elixir-phoenix

Made for: Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for elixir-phoenix-ecto-constraint-debug

README.md
[![agentmods](https://agentmods.dev/badge/skills/ccarvalho-eng/codex-elixir-phoenix/elixir-phoenix-ecto-constraint-debug/github.svg)](https://agentmods.dev/skills/ccarvalho-eng/codex-elixir-phoenix/elixir-phoenix-ecto-constraint-debug)
Your own site
<a href="https://agentmods.dev/skills/ccarvalho-eng/codex-elixir-phoenix/elixir-phoenix-ecto-constraint-debug"><img src="https://agentmods.dev/badge/skills/ccarvalho-eng/codex-elixir-phoenix/elixir-phoenix-ecto-constraint-debug/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for elixir-phoenix-ecto-constraint-debug

Your own site · 80×15
<a href="https://agentmods.dev/skills/ccarvalho-eng/codex-elixir-phoenix/elixir-phoenix-ecto-constraint-debug"><img src="https://agentmods.dev/badge/skills/ccarvalho-eng/codex-elixir-phoenix/elixir-phoenix-ecto-constraint-debug.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 25 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 680 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin 86% copy Near-identical to another mod in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00025 $0.00680
Opus 5.5 $0.00010 $0.00272
Sonnet 5.5 $0.00005 $0.00136
Haiku 4.5 $0.00003 $0.00068

Measured 1mo ago against content hash 2fec8befb9c3, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

elixir-phoenix-ecto-constraint-debug scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

This is a copy

86% identical to ecto-constraint-debug — 19 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

skills/elixir-phoenix-ecto-constraint-debug/SKILL.md · 70 lines

How it starts

The opening of the file, as written. The whole thing — 70 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Ecto Constraint Debugging

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 rg 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 rg to find constraint handling in changesets (unique_constraint, foreign_key_constraint, check_constraint) in lib/.

Step 4: Trace Insert Paths

Find ALL callers that insert/update this schema:

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

Step 5: Identify the Cause

Symptom Likely Cause Fix Pattern
Same user triggers twice Race condition (double-click, retry) Upsert with on_conflict
Multiple parents share child cast_assoc doesn't dedup across changesets Dedup before building changesets
Concurrent API requests Missing transaction isolation Wrap in Repo.transaction or use upsert
Migration added constraint to existing data Data violates new constraint Backfill or clean data first

Read the full file on GitHub · 70 lines

Files

What ships with it

2 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 70 lines · 25 tokens per session scan A 2fec8befb9c3

Subscribe to this mod's changes

elixir-phoenix-ecto-constraint-debug is a skill published in the GitHub repository ccarvalho-eng/codex-elixir-phoenix (11 stars, last pushed 5mo ago), licensed MIT. It adds 25 tokens to every session and 680 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. It is 86% identical to ecto-constraint-debug, differing in 19 lines, and is treated as a copy.

Related

Other skills, from other repositories

ash-framework

Use this skill working with Ash Framework or any of its extensions. Always consult this when making any domain changes, features or fixes.

agentjido/jido_managed_agents · 29 tokens

langbot-plugin-dev

Develop, debug, and test LangBot plugins. Use when creating new LangBot plugins, fixing plugin bugs, setting up a LangBot test environment, or testing plugins via WebSocket. Covers plugin component architecture (EventListener, Command, Tool), the plugin SDK API (invokellm, getllmmodels, sendmessage, plugin storage)…

langbot-app/LangBot · 110 tokens

postgresql-indexing

PostgreSQL indexing best practices for Prowler: index design, partial indexes, partitioned table indexing, EXPLAIN ANALYZE validation, concurrent operations, monitoring, and maintenance. Trigger: When creating or modifying PostgreSQL indexes, analyzing query performance with EXPLAIN, debugging slow queries, reviewing…

prowler-cloud/prowler · 108 tokens

graphjin-eval

Create, extend, run, baseline, and diagnose GraphJin agent evaluations through the graphjin eval CLI.

dosco/graphjin · 27 tokens

ax-cpp-agent-observability

Use when writing C++ code with axllm for agent tracing, centralized and multi-tenant usage accounting, action logs, runtime diagnostics, replay, and production debugging.

ax-llm/ax · 44 tokens

troubleshoot

Diagnose and fix a failing or misbehaving Atomic Agents app — import errors, schema validation failures, empty or malformed LLM output, provider role/mode errors, history and context problems, MCP transport errors. Use when the user reports an error, traceback, or wrong behavior in atomic-agents code, asks "why is my…

Eigenwise/atomic-agents · 103 tokens