agentleFS
zademyzademy/lu-query/skills/lu-query-audit-data-quality/SKILL.md

lu-query-audit-data-quality

Skill2 starsChanged 29 days agoMITView on GitHub

Use lu-query to check Oracle data quality - find duplicate key candidates with find_duplicates, count orphan rows of a foreign key with validate_fk_integrity, and get exact table counts with count_rows. Use when auditing a table before migrating, deduplicating, or validating a legacy FK.

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Read-only. Nothing here writes.

    line 45

≈ “Common” is an estimate: at least 1 in 5 of the 364,980 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

Audit data quality with lu-query

When to use

  • "Are there duplicates?", "does this FK actually hold?", "how many rows does the table have, exactly?"
  • Pre-migration or pre-deduplication checks.

When not to use

  • You need row values → lu-query-query-data.
  • You want to fix rows → audit first, then lu-query-plan-data-changes.

Workflow

  1. Size the table. count_rows (exact, no SQL handcrafting).
  2. Duplicates. find_duplicates with the candidate key column(s). Read groups: each entry has the duplicated value, CNT and a SAMPLE_ROWID you can join on.
  3. Referential integrity. validate_fk_integrity on the child table; optionally constraint to check one named FK. It reports orphans per constraint.
  4. Rank and report. Order findings by business impact, not by tool order. State the exact SQL-equivalent you would run to fix each one, and let the user approve before any write.

Reading results correctly

  • find_duplicates excludes NULLs (SQL GROUP BY semantics): a column that is NULL in most rows will not show up as a duplicate group. Verify nullability with describe_table before trusting "no duplicates".
  • minCount defaults to 2; raise it to find triplicates.
  • validate_fk_integrity returns one row per FK with orphan_count. 0 means every child row resolves to a parent among rows the tool can see; > 0 names real orphans.
  • Legacy orphans can only exist if the constraint was created (or left) NOVALIDATE. If a FK was created and validated, the answer is trivially 0 - that is a real finding, not a bug.

Tool reference

ToolSignatureReturns
count_rowstable*, schema?{schema, table, rowCount}
find_duplicatestable*, columns* (array), minCount?, schema?{schema, table, columns, minCount, groups: [{<col>: value, CNT: n, SAMPLE_ROWID: rid}]}
validate_fk_integritytable*, constraint?, schema?array of {constraint_name, child_columns, parent_owner, parent_table, parent_columns, orphan_count}

Details: references/tools.md. Verified transcripts: references/examples.md.

Safety

Read-only. Nothing here writes. But do not turn findings into UPDATEs on your own initiative: propose the fix, get approval, then use lu-query-plan-data-changes.

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.