agentleFS
AmethystLunaAmethystLuna/logicprobe/skills/logicprobe-datamodel/SKILL.md

logicprobe-datamodel

Skill5 starsChanged 7 days agoMITView on GitHub

Use when reviewing design docs, specs, plans or migrations claiming entities, fields, constraints, relationships, data invariants, or before/after data-model equivalence: schema changes, migration logic, or data guarantees ('all records must have X', 'no orphan rows', 'ids unique') want executable data-model verification (migration coverage, copy consistency, rollback symmetry, DD1-DD4 regression). State machines and protocols: logicprobe; diagrams: logicprobe-uml.

The file

We split this skill into the rules it gives an agent

11 rules. About 0 are common, 4 are distinctive, and 7 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 7

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Read the document fully. Extract every verifiable data-model claim:

    line 16
  2. Very specific:

    Constraints: check declared required, unique, nullable, min/max, enum

    line 30
  3. Very specific:

    Relationships: check target entity/field exists and onDelete is coherent

    line 31
  4. Distinctive:

    Before/after data-model equivalence claims: "non-breaking", "behavior preserved"

    line 41
  5. Very specific:

    Every # in these tables is a report field, not a name.

    line 97
  6. Distinctive:

    Before writing any verification code, output a data-model table:

    line 104
  7. Very specific:

    Exception: If the runtime reports logicprobe interaction=auto, do NOT call ask_user_question.

    line 116
  8. Very specific:

    Not a SQL migration executor (Flyway/Liquibase/Atlas territory)

    line 129
  9. Distinctive:

    Not a runtime data-quality platform (Great Expectations/Soda territory)

    line 130
  10. Very specific:

    Not a general array/object/file-content modeling engine

    line 131
  11. Very specific:

    Not a replacement for Atlas/Squawk/Buf/Oasdiff — it is the design-time plan verifier that sits before them

    line 132

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Logic Probe Data

Successor: dsh-model-everything. Its counterpart skill is model-everything-datamodel, over model_datamodel_verify. Load that one when both plugins are installed; this skill stays accurate for logicprobe_datamodel_verify.

An unverified data model fails later. Model the schema and the migration, run them, and it becomes clear. Check every data claim before you act on it.

Methodology

Phase 1: Enumerate Data Claims

Read the document fully. Extract every verifiable data-model claim:

  • Entity/table/collection names and fields
  • Field types, nullability, defaults, unique constraints
  • Relationships / foreign keys / referential integrity
  • Data invariants ("always", "never", "must", "guaranteed")
  • Migration claims ("rename field", "drop column", "backfill", "non-breaking")
  • Copy/migration mappings ("source.a → target.x")

Phase 2: Verify Against the Model or Codebase

For each claim, run the relevant verification:

  • Entity/field names: compare against actual schema, API contract, or code types
  • Constraints: check declared required, unique, nullable, min/max, enum
  • Relationships: check target entity/field exists and onDelete is coherent
  • Migration: build BEFORE/AFTER DataModelV1 and check migration coverage

Phase 2 Trigger: Escalate to Data Model Verification?

Escalate immediately if the document contains ANY of:

  • Schema/migration changes: added/removed/renamed fields, entities, constraints
  • Data invariants: "all rows must", "counts must match", "no orphans", "never null"
  • Copy/migration mappings: source-to-target field maps
  • Before/after data-model equivalence claims: "non-breaking", "behavior preserved"
  • Refactoring that changes field types, nullability, uniqueness, or relationships

Data Model Verification Pipeline

Document claims → Extract DataModelV1 → Runtime check:
  ├── DSH + `logicprobe_datamodel_verify` tool available → build DataModelV1 → call tool → structured report
  └── No engine available → Manual Verification Mode (references/data-model-guide.md)

Refactoring variant:
  Extract BEFORE DataModelV1 + AFTER DataModelV1
    → Run pipeline on AFTER model (DS/DA checks)
    → Compare BEFORE vs AFTER (DD1-DD4)
    → Flag any invariant that held in BEFORE but fails in AFTER

The DataModelV1 shape is in references/data-model-schema.md: entities, fields, keys, relationships, invariants, boundary checks, and the optional before/mapping/copy/migration/backup blocks. Those field names are the tool contract. A hand-written model that disagrees with them is rejected, not guessed at.

Checks

DS — Data structure

#CheckSeverity if Violated
DS1Schema well-formednessError
DS2Required-field completenessError/Warning
DS3Relationship integrityError
DS4Type/nullability consistencyError/Warning

DA — Data adversarial probes

#CheckSeverity if Violated
DA1Null/empty injectionError
DA2Boundary blastWarning
DA3Uniqueness violationError/Warning
DA4Referential integrity violationWarning
DA5Migration coverageError
DA6Copy consistencyError
DA7Rollback/backup symmetryWarning
DA8Idempotent constraintsError/Warning
DA9Data monotonicError/Warning
DA10Data sequenceError
DA11Data leads-toError/Warning
DA12Data atomicityError/Warning

DD — Before/after data regression

#CheckSeverity if Violated
DD1Data behavior preservationError
DD2Data invariant continuityError
DD3Delta summaryWarning
DD4Breaking change regressionError/Warning

Every # in these tables is a report field, not a name. Write what the check found for the reader (「回滚与备份不对称」), in their language; keep the id for a report field quoted verbatim, a baseline diff or a test name. The full rule is under "Writing the Answer" in the logicprobe skill.

Extraction Rule

Before writing any verification code, output a data-model table:

Entity   | Field      | Type    | Required | Unique | Nullable | Notes
---------|------------|---------|----------|--------|----------|-------
User     | id         | uuid    | yes      | yes    | no       | PK
User     | email      | string  | yes      | yes    | no       |
Order    | userId     | uuid    | yes      | no     | no       | FK -> User.id

Show this table to the user and ask for confirmation before generating the harness. The #1 failure mode is extracting the wrong data model.

Exception: If the runtime reports logicprobe interaction=auto, do NOT call ask_user_question. Instead: (a) cite evidence for every extracted entity/field/constraint, (b) round-trip the filled model back into a table and compare it with the extraction table, and (c) mark the report UNCONFIRMED.

When NOT to Escalate

Skip data-model verification when:

  • The document makes no data-behavioral claims (pure API listings, file paths, numeric constants)
  • The change is purely cosmetic (display names, comments)
  • The data model is trivial (single entity, no constraints, no migration)
  • The claim is purely structural (file paths, type names) — Phase 2 grep verification is sufficient

Non-Goals

  • Not a SQL migration executor (Flyway/Liquibase/Atlas territory)
  • Not a runtime data-quality platform (Great Expectations/Soda territory)
  • Not a general array/object/file-content modeling engine
  • Not a replacement for Atlas/Squawk/Buf/Oasdiff — it is the design-time plan verifier that sits before them

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.