agentleFS
zademyzademy/lu-query/skills/lu-query-plan-data-changes/SKILL.md

lu-query-plan-data-changes

Skill2 starsChanged 29 days agoMITView on GitHub

Use lu-query to change Oracle rows safely - preview the blast radius with execute_dml_preview, rehearse with execute_dml_rollback_first, commit with execute_dml, and pick new keys with find_free_id or get_next_sequence_value. Use for INSERT/UPDATE/DELETE/MERGE where the user approved the change.

The file

Files
SKILL.md

Plan and apply data changes with lu-query

When to use

  • The user has approved an INSERT, UPDATE, DELETE or MERGE on existing tables.
  • You need a new primary key value from a sequence or the next free integer id.

When not to use

  • The change alters structure (DDL) → lu-query-manage-schema.
  • You are still deciding what to change → lu-query-audit-data-quality first.

The three modes (choose explicitly)

ToolExecutes?Commits?Use for
execute_dml_previewnonoalways first: how many rows, which columns
execute_dml_rollback_firstyesno (rolled back)rehearsing triggers, FKs and constraint violations
execute_dmlyesyesthe approved change, once

Workflow

  1. Preview. execute_dml_preview on the exact statement. It counts the affected rows with a mirror SELECT built from your own SQL, so an alias or a subquery in the predicate is honoured. It returns detectedKind, affectedRowCount and up to 10 sampleRows. If affectedRowCount is not what you expect, stop and re-check the predicate.
  2. Rehearse when risky. execute_dml_rollback_first proves the statement passes triggers/FKs/NOT NULL and shows rowsAffected, then rolls back. Use it before any bulk UPDATE.
  3. Obtain keys deliberately. find_free_id returns the lowest unused integer in a range (default 1..1000, hard cap 10000) - it does not reserve it. get_next_sequence_value consumes the next value (gaps are normal).
  4. Apply. execute_dml with the same statement text you previewed. It commits through the chokepoint.
  5. Verify. Re-run the read (count_rows, run_query) and quote it. Do not report success from rowsAffected alone.
  6. Record. The session audit Markdown contains the verbatim SQL, WRITE type and affected rows; quote that entry as evidence.

Reading results correctly

  • execute_dml returns {statementKind, rowsAffected}.
  • execute_dml_preview returns sampleRows from the current table state, not from the statement's projection; it does not show the values the statement would write.
  • MERGE and exotic syntax may come back as an unknown kind from the parser; the statement still reaches Oracle unchanged. Trust Oracle's error, not the parser's guess.

Safety

  • execute_dml is irreversible from the tool's point of view: no undo tool exists. Preview, then apply.
  • Sequences and SYSDATE are not transactional: rollback does not return sequence numbers.
  • Identifiers and literals are validated/escaped by the server, but the statement is still your responsibility.

Tool reference

ToolSignatureReturns
execute_dml_previewsql*{detectedKind, table, affectedRowCount, sampleColumns, sampleRows, sampleCount, note}
execute_dml_rollback_firstsql*{detectedKind, rowsAffected, rolledBack: true, note}
execute_dmlsql*{statementKind, rowsAffected}
find_free_idtable*, column*, maxRange?, excludeTable?, schema?{schema, table, column, maxRange, excludeTable, candidateId}
get_next_sequence_valuesequence*, schema?{schema, sequence, nextValue}

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

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.