SkillsReviewed · oliver-kriska

ecto-constraint-debug

ecto-constraint-debug is an assistant skill for Elixir developers investigating Ecto database errors, but its shared-association and concurrency fixes need careful review. It traces constraints through migrations, changesets and write paths, with examples for unique, foreign-key and check constraints.

Researched 17 Nov 2026

In short.

ecto-constraint-debug is a debugging skill for Elixir and Phoenix developers using Ecto, but its examples leave existing-row handling and concurrent-write behavior unresolved. Its useful core is a migration-first checklist connecting database rules to changesets and write paths. Bulk-insert return handling, conflict policies and transaction behavior require project-specific validation; runtime correctness and supported versions are not established.

Researched and written by an AI model and checked by a second AI model. How it works

Coverage comprises plugins/elixir-phoenix/skills/ecto-constraint-debug/SKILL.md and references/constraint-patterns.md, plus the repository root LICENSE, at revision 4621ae486f3ef3270cc5871685c9b13735ad5e60. Other repository skills, plugin installation material, Ash documentation and Tidewave implementation are outside scope. No code was executed; installation, database effects, concurrency behavior and version compatibility remain unassessed.

The overview

Identity

ecto-constraint-debug is a skill in the oliver-kriska/claude-elixir-phoenix repository. Its selected folder contains SKILL.md and references/constraint-patterns.md. These are instructions and examples for a coding assistant, rather than a standalone database utility.

The original source folder is [https://github.com/oliver-kriska/claude-elixir-phoenix/tree/main/plugins/elixir-phoenix/skills/ecto-constraint-debug].

Assessment

The strongest feature is its investigation order: identify the failed constraint, inspect the migration, compare changeset handling and trace every write path. That gives an assistant concrete places to investigate instead of immediately changing validation code.

It is useful as a diagnostic checklist. Its short fix recipes need additional review, particularly where shared associations, existing records and simultaneous requests interact. The supplied material contains no execution results demonstrating those recipes.

Users

The intended users are developers encountering Ecto.ConstraintError or changeset errors involving unique, foreign-key or check constraints. Beginners get a sequence to follow; experienced developers get reminders to inspect bulk writes, associations and less obvious callers.

Understanding the proposed changes still requires familiarity with Ecto schemas, migrations and Repo operations. For Ash projects, the skill directs users to a separate ash-framework skill instead of presenting itself as the appropriate primary guide.

Capabilities

The skill covers extracting constraint names and conflicting values, finding migration definitions, inspecting changeset constraint declarations and locating insert or update paths. Its reference discusses double submissions, shared children through cast_assoc, duplicate bulk input, missing parents, deletion behavior, enum mismatches and range checks.

Suggested techniques include changeset inspection, targeted queries, deduplication and upserts. Optional Tidewave examples show SQL and project-evaluation calls; the files do not establish that this integration is installed or available.

Using it

Requirements

The procedure assumes an Elixir application using Ecto, access to the relevant error, migrations under priv/repo/migrations and application code under lib/. Database access is needed for the suggested existing-data queries.

The ${CLAUDE_SKILL_DIR} reference indicates a Claude-style skill environment, but compatible assistant hosts are not specified. Supported Elixir, Ecto, Phoenix and database-adapter versions are unknown. Tidewave is optional.

Mechanism

SKILL.md supplies the assistant with an ordered investigation: parse the error, locate the migration, find the schema, trace write paths, identify a likely cause and consult the companion reference for a fix pattern.

The mechanism is written guidance supported by illustrative Elixir and SQL operations. The captured folder contains no automatic diagnostic engine or bundled repair program.

Setup

Keep SKILL.md together with references/constraint-patterns.md in the documented folder layout. The main file resolves its detailed patterns through ${CLAUDE_SKILL_DIR}/references/constraint-patterns.md, so retaining that relationship matters.

Host installation commands, plugin registration and discovery behavior are not documented in these files. Before using the examples, identify the application's actual Repo, schemas, constraint names and conflict columns.

Example

For a duplicate URL failure, the procedure starts with the reported constraint name, checks the unique-index migration, examines Link.changeset and traces callers that insert links, including bulk writes and associations.

The companion create_or_update_link example uses Repo.insert with conflict_target: [:url], on_conflict: {:replace, [:updated_at]} and returning: true. It illustrates an explicit conflict target and a limited replacement policy. Whether those choices match a particular application's intended behavior is not established.

Assessment & evidence

Limitations

The shared-association example assumes a {:ok, links} result from Repo.insert_all; that return pattern needs checking against the installed Ecto API. It then constructs its URL-to-ID map solely from returned rows and shows no lookup for pre-existing links omitted from those results.

The parent-existence example shows a transaction but no explicit locking or isolation configuration, so concurrent-deletion protection cannot be inferred. The main checklist uses Repo.transaction while the reference uses Repo.transact, without stating version requirements.

The quick unique-constraint recipe uses :replace_all, while a reference example limits replacement to selected fields. Those policies are materially different and require an explicit application decision. Runtime behavior and compatibility were not assessed.

Reasoning

The investigation order connects the reported database rule to its migration definition, application handling and possible writers. This can expose causes outside the immediately failing function, such as separate association changesets inserting the same child.

The instruction to suspect concurrency when validation passes is a diagnostic heuristic. It does not establish that a particular failure is a race, and the reference itself also identifies conflicting existing data, incorrect IDs and schema-to-migration mismatches.

Alternatives

A developer can follow the same migration, changeset and write-path investigation manually, using the companion reference as a checklist without loading an assistant skill.

For Ash applications, SKILL.md points to ash-framework and an Ash Postgres documentation search. Those materials are outside the supplied scope, so their coverage and suitability are not assessed. No comparative results against other debugging resources are supplied.

Evidence

The available source comprises the complete selected skill folder and the repository root MIT notice. It supports analysis of the documented procedure and visible examples, but supplies no runtime results, benchmarks or compatibility matrix. Nothing was executed.

The immutable main file is [https://raw.githubusercontent.com/oliver-kriska/claude-elixir-phoenix/4621ae486f3ef3270cc5871685c9b13735ad5e60/plugins/elixir-phoenix/skills/ecto-constraint-debug/SKILL.md]. The companion reference is [https://raw.githubusercontent.com/oliver-kriska/claude-elixir-phoenix/4621ae486f3ef3270cc5871685c9b13735ad5e60/plugins/elixir-phoenix/skills/ecto-constraint-debug/references/constraint-patterns.md].

Access & freshness

Costs

The selected files state no price, token estimate or operating-cost figures. Assistant access, model usage and any database or hosting costs are unknown. The MIT licence does not establish the cost of those services.

Rights

The supplied repository licence is MIT, with copyright attributed to Oliver Kriska for 2025–2026. It permits use, modification, redistribution, sublicensing and sale, provided the copyright and permission notices accompany copies or substantial portions. It provides no warranty.

The captured notice is available at [https://raw.githubusercontent.com/oliver-kriska/claude-elixir-phoenix/4621ae486f3ef3270cc5871685c9b13735ad5e60/LICENSE].

Freshness

The supplied snapshot was captured on 2026-11-17 at 12:38:51.311 UTC and is pinned to revision 4621ae486f3ef3270cc5871685c9b13735ad5e60. The original folder URL follows main and may later show different content.

The files do not establish a release version, last substantive update or present branch state. Their capture date does not establish compatibility with any particular Ecto release.

Actions

Use the skill when an assistant needs a structured investigation of an Ecto constraint failure. Start with the exact error and compare the intended migration rule with the actual database definition and every relevant write path.

Before adopting a recipe, check bulk-insert return handling, account for existing shared records, choose explicit upsert fields and confirm transaction behavior for the installed versions. Verify duplicate-input, existing-row and concurrent-write cases in the target application before relying on a fix.

Evidence for this report

LICENSEnotice · checked 2026-11-17