/dev10x-db:sql-handofffrom dev10x-db
Handles SQL write operations (UPDATE, INSERT, DELETE, DDL) that the agent cannot execute directly. Prints a paste-safe SQL block for the user to run, then verifies the result via a SELECT read-back.
Ships in dev10x-db. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Announce: "Using dev10x-db:sql-handoff to hand the write to you and verify it afterwards."
This skill follows references/task-orchestration.md patterns.
REQUIRED: Create a task at invocation. Execute at startup:
TaskCreate(subject="Hand off SQL write to supervisor", activeForm="Handing off SQL")Mark completed only after Step 5 verifies the write:
TaskUpdate(taskId, status="completed")
The agent may run SELECTs through dev10x-db:db-psql; every write goes
through the supervisor's own psql session. The handoff is where a
write goes wrong: the wrong database, a stale WHERE clause, a
statement mangled in the copy-paste, or an agent that assumes "done"
means "worked". The five rules below close each of those gaps. One
handoff carries exactly one statement.
Never put SQL inside an AskUserQuestion prompt. The widget
renders with box-drawing characters, and copying out of it
carries them into psql (see Gotchas). Print the SQL first, in
plain chat text, as a fenced sql block whose first line is
the target header:
-- Run against: <alias> (<label>)
Then ask with AskUserQuestion — a question that only refers
to the block above, never one that contains it.
Verify with a SELECT after the user says it ran. Run a
read-back through dev10x-db:db-psql before continuing. Never trust
the paste, a pasted psql output, or "done" on its own.
One statement per handoff. State the exact WHERE clause and
the expected row count (-- Expect: UPDATE 1) inside the block.
A second write waits for the first one's verification.
Confirm the target first when the row is ambiguous. If more than one row could match, or the agent picked the row from inference rather than a primary key, run (or hand over) a SELECT with the same WHERE clause first, and only write once it returns exactly the expected rows.
Never bypass the read-only hook or wrap writes in scripts. No
psql -c, no -f /tmp/fix.sql through db.sh, no Python or
shell wrapper that opens a connection, no BEGIN; ... COMMIT;
smuggled into a SELECT. The hook block is the signal to hand off,
not an obstacle to route around.
Resolve the alias and label from databases.yaml
(db.sh --list). Build the WHERE clause from a primary key
whenever one is known. If the target is ambiguous, apply Rule 4
before Step 2.
In plain chat text, not inside a tool call:
```sql
-- Run against: bs (backend-staging)
-- Expect: UPDATE 1
UPDATE shop SET is_active = false WHERE id = 4182;
```
The block holds the header, the expected count, and one statement — nothing else for the user to trim.
REQUIRED: Call AskUserQuestion (do NOT use plain text). The
question names the statement and the alias but holds no SQL, e.g.
"Did you run the UPDATE above on bs?". Options:
The agent cannot see the psql session, so the question says so
(skill-gates.md § state): "…on bs? I can't see your session — the
read-back will confirm."
Run a read-back through dev10x-db:db-psql that selects the changed
columns with the same WHERE clause. Compare against the intended
end state. A mismatch is a finding to report, never something to
"fix" with another write in the same breath — go back to Step 1.
Box-drawing characters break the paste. The AskUserQuestion
widget draws its prompt inside a frame. A statement embedded in the
question arrives in the clipboard with the frame attached:
│ UPDATE shop SET is_active = false WHERE id = 4182; │
psql rejects it:
ERROR: syntax error at or near "│"
LINE 1: │ UPDATE shop SET is_active = false WHERE id = 4182; │
^
The user then hand-cleans the line, and hand-cleaning is exactly where a WHERE clause gets truncated. Keep the SQL in a fenced block in chat text (Rule 1); the question only points at it.
A missing header sends the write to the wrong database. Several
psql sessions are usually open at once. Without
-- Run against: <alias> (<label>) on the first line, nothing in
the block says which one it belongs to.
"Done" is not evidence. The user may have hit the wrong session, an open transaction may never have committed, or a trigger may have rewritten the row. Only the Step 5 read-back is evidence.
See references/examples.md for a single
UPDATE, an ambiguous-row handoff with a confirming SELECT first, a
"Use a different row" correction, and a hook-blocked write.
dev10x-db:db — plans the query and verifies table and column
names before the handoffdev10x-db:db-psql — runs the confirming and verifying SELECTs;
its "When a Query Is Blocked" section hands off to this skillWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
sql-handoff, database-writes, read-only-bypass, verification
Other plugins' skills for the same job
npx claudepluginhub dev10x-guru/dev10x-claude --plugin dev10x-db4 skills in this plugin
/bqdev10x-db:bqRead-only BigQuery access through MCP tools that wrap the bq CLI — so an agent can explore datasets and run a SELECT against project.dataset.table without a blanket `Bash(bq query:*)` allow that would also approve DELETE, MERGE or a --destination_table write. TRIGGER when: reading BigQuery data, listing BigQuery datasets or tables, or checking a BigQuery table's columns. DO NOT TRIGGER when: querying Postgres (use dev10x-db:db-psql), or the statement writes (print it for the user, see dev10x-db:sql-handoff).
/dbdev10x-db:dbSafe database query planning for Claude Code. When querying any database, ensures schema-first construction and read-only safety so queries are accurate and never modify production data. TRIGGER when: code needs database queries, schema discovery, or SQL construction. DO NOT TRIGGER when: no database interaction needed, or user is writing application code that happens to mention SQL in comments.
/db-psqldev10x-db:db-psqlSafe read-only psql wrapper for Claude Code. Provides db.sh with SQL validation hook so database queries are safe and auditable. Configure databases in databases.yaml with env var or keyring backends. TRIGGER when: executing SQL against configured databases. DO NOT TRIGGER when: planning queries (use dev10x-db:db), or working with non-database tasks.