write-rows
Changing rows through the sql-server write tool with a counted expectedRows and a person's approval. Use when inserting, updating, deleting or merging rows on…
by melodic-software★ 34 GitHub stars
Install write-rows in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
About this skill
Write rows
Preconditions
writeruns only on a registration started with--write, against an environment whose write block names a write login and whose write mode is on.describe_environmentsshows the write mode and the most rows one write may expect. When writes are off there, tell the person: opening them is their change to the registration or the config.- Use the environment and database settled with the choose-environment skill. A write must name its database when the environment allows more than one, and a pattern counts as more than one.
- A change of several statements that must land together goes to the run-scripts skill, never
to a run of
writecalls: eachwritecall commits on its own.
Workflow
- Write one INSERT, UPDATE, DELETE or MERGE, optionally led by WITH. The
writetool's own description lists what it refuses. - Count the rows first with
query, using the exact filter the write will use. That count isexpectedRows: the write commits only when the statement affects exactly that many rows of the target table, and rolls back otherwise. Never choose the number to fit whatever the statement happens to do. - Run
preview_writeon the target table. It lists the triggers on the table and the foreign keys whose delete or update action cascades from it. The row check counts only the target table, so rows a trigger or cascade changes are not counted and only this preview shows them. - Before the call, show the person the environment, the database, the statement,
expectedRowswith the query that counted it, and whatpreview_writelisted. A person approves everywritecall, and this is what they need to judge it. - When the count is above the most the environment lets one write expect, split the write by key into calls that each stay within it.
Outcomes
- Committed: report
committedandrowCount. - A row-count mismatch rolls back and returns an error naming both counts, so nothing changed. Find out why the counts differ (the filter, a concurrent change, a trigger) and show the person before any new attempt.
- After a timeout, or when a trigger returns more rows than the row cap, whether the write committed is not known. Read the table to learn its state and tell the person before anything else; never resend the write blind.
- On a refusal, read the message and do its
nextstep. On any other error, report the message to the person.
Next
- The write committed and the person wants the result checked: the query-safely skill.
- The change needs several statements to land together: the run-scripts skill.
Related
- No sql-server registration is available, or a call reports that the config is invalid: the setup skill.
Gotchas
- A sequence of
writecalls is not one transaction. When a later call fails, the earlier ones have already committed; a change that must land whole belongs in a script. - Leaving out
databaseon an environment with several databases or a pattern is refused for a write, even where a read without it would run in the default database.
Allowed tools
Tools this skill is permitted to call.
No restriction — this skill can use any tool.
FAQ
What does the write-rows skill do?
Changing rows through the sql-server write tool with a counted expectedRows and a person's approval. Use when inserting, updating, deleting or merging rows on a sql-server registration, or a write rolled back or its outcome is unknown. Not for reads: the query-safely skill.
How do I install the write-rows skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the write-rows skill run scripts?
No, this skill is instructions only (SKILL.md) with no executable scripts.
Related skills
doc-coauthoring
AnthropicGuide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
academy-guide
AnthropicStop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
internal-comms
AnthropicA set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
skill-development
AnthropicThis skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…