How i-have-adhd Handles Destructive Actions Like rm -rf and Schema Migrations
The i-have-adhd skill enforces a mandatory confirmation workflow for destructive commands by defining a safety rule in SKILL.md that requires explicit user approval before executing operations like rm -rf, force pushes, or database migrations.
The i-have-adhd repository provides a declarative skill system designed for AI coding agents, embedding safety guardrails directly into the agent's behavior definition. Unlike traditional shell aliases or wrapper scripts, this approach bakes the confirmation logic into the skill specification itself, ensuring consistent protection across multiple runtimes including Claude, Codex, and Cursor.
The Safety Rule in SKILL.md
The core protection mechanism lives in skills/i-have-adhd/SKILL.md within the "When to break the rules" section. At line 122, the skill explicitly defines the destructive action policy:
"Destructive action ahead (
rm -rf, force push, schema migration, dropping a table). Confirm before acting. Safety wins over brevity."
This declarative rule acts as a trigger pattern. When the runtime processes a request, it consults this skill file to determine whether the intended operation matches any prohibited destructive patterns.
How the Confirmation Workflow Works
When you issue a potentially dangerous command, the runtime executes a five-step safety protocol:
-
Parse the user intent – The agent analyzes the request to identify the underlying command or operation.
-
Query the rule engine – The system consults
SKILL.mdto check for applicable behavioral rules. -
Detect destructive patterns – If the command matches keywords like
rm -rf, force push, or drop table, the rule triggers the confirmation branch. -
Generate confirmation prompt – Instead of executing, the agent outputs a safety prompt such as:
"The command you entered is destructive. Do you really want to runrm -rf ./tmp? Reply 'yes' to confirm." -
Handle user response – Only an explicit affirmative (e.g.,
yes,confirm) proceeds; any other input aborts the operation.
Destructive Actions Covered
The safety rule targets specific high-risk operations:
rm -rf– Recursive, force-delete commands that bypass trash/recycle safeguards- Force pushes – Git operations that rewrite remote history and risk data loss
- Schema migrations – Database changes that alter table structures or constraints
- Dropping tables – SQL operations that permanently delete data definitions
Code Examples
Preventing Accidental Directory Deletion
When you request a recursive deletion:
User: rm -rf ./tmp
The agent responds with a mandatory confirmation:
The command you entered is destructive. Do you really want to run `rm -rf ./tmp`? Reply "yes" to confirm.
Execution proceeds only after you reply yes. Any other response cancels the operation.
Safeguarding Database Migrations
For schema modifications:
User: run migration to drop the `orders` table
The agent intercepts the request:
Dropping a table is a destructive operation. Confirm you want to execute this migration (yes/no)?
The migration script runs only upon explicit confirmation.
Cross-Platform Consistency
The canonical skill definition resides in skills/i-have-adhd/SKILL.md, but the repository maintains a synchronized copy at .cursor/skills/i-have-adhd/SKILL.md (also referencing line 122) specifically for the Cursor environment. According to AGENTS.md, runtimes including Claude, Codex, OpenCode, Pi, and OMP load this skill definition automatically, ensuring the confirm-first behavior is consistent regardless of which AI assistant you use.
Summary
- Declarative safety – Destructive action protection is defined in
SKILL.md, not hardcoded in agent binaries - Pattern matching – Triggers on
rm -rf, force pushes, schema migrations, and table drops - Explicit confirmation – Requires a "yes" or "confirm" response before proceeding
- Universal coverage – Works across Claude, Cursor, Codex, and other compatible runtimes via the skill system
Frequently Asked Questions
What types of commands trigger the confirmation prompt?
The skill triggers for rm -rf operations, git force pushes, database schema migrations, and SQL drop table commands. Any operation identified in the "Destructive action ahead" rule within SKILL.md requires explicit confirmation.
Where is the destructive action rule defined?
The rule is defined in skills/i-have-adhd/SKILL.md at line 122 within the "When to break the rules" section. A synchronized copy exists at .cursor/skills/i-have-adhd/SKILL.md for Cursor IDE compatibility.
Does this protection work across different AI coding assistants?
Yes. The skill system is runtime-agnostic. As documented in AGENTS.md, Claude, Codex, OpenCode, Pi, OMP, and Cursor all load the same SKILL.md definition, enforcing identical safety behavior across platforms.
What happens if I don't confirm the destructive action?
If you respond with anything other than an explicit affirmative like yes or confirm, the agent aborts the operation immediately. No command is sent to the underlying shell or database, preventing accidental data loss.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →