# How i-have-adhd Handles Destructive Actions Like rm -rf and Schema Migrations

> Learn how i-have-adhd protects against destructive commands like rm -rf and schema migrations with a mandatory confirmation workflow. Prevent accidental data loss.

- Repository: [Ayoub Ghriss/i-have-adhd](https://github.com/ayghri/i-have-adhd)
- Tags: how-to-guide
- Published: 2026-08-26

---

**The i-have-adhd skill enforces a mandatory confirmation workflow for destructive commands by defining a safety rule in [`SKILL.md`](https://github.com/ayghri/i-have-adhd/blob/main/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`](https://github.com/ayghri/i-have-adhd/blob/main/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:

1. **Parse the user intent** – The agent analyzes the request to identify the underlying command or operation.

2. **Query the rule engine** – The system consults [`SKILL.md`](https://github.com/ayghri/i-have-adhd/blob/main/SKILL.md) to check for applicable behavioral rules.

3. **Detect destructive patterns** – If the command matches keywords like *`rm -rf`*, *force push*, or *drop table*, the rule triggers the confirmation branch.

4. **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 run `rm -rf ./tmp`? Reply 'yes' to confirm."*

5. **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:

```bash
User: rm -rf ./tmp

```

The agent responds with a mandatory confirmation:

```text
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:

```bash
User: run migration to drop the `orders` table

```

The agent intercepts the request:

```text
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`](https://github.com/ayghri/i-have-adhd/blob/main/skills/i-have-adhd/SKILL.md), but the repository maintains a synchronized copy at [`.cursor/skills/i-have-adhd/SKILL.md`](https://github.com/ayghri/i-have-adhd/blob/main/.cursor/skills/i-have-adhd/SKILL.md) (also referencing line 122) specifically for the Cursor environment. According to [`AGENTS.md`](https://github.com/ayghri/i-have-adhd/blob/main/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`](https://github.com/ayghri/i-have-adhd/blob/main/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`](https://github.com/ayghri/i-have-adhd/blob/main/SKILL.md) requires explicit confirmation.

### Where is the destructive action rule defined?

The rule is defined in [`skills/i-have-adhd/SKILL.md`](https://github.com/ayghri/i-have-adhd/blob/main/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`](https://github.com/ayghri/i-have-adhd/blob/main/.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`](https://github.com/ayghri/i-have-adhd/blob/main/AGENTS.md), Claude, Codex, OpenCode, Pi, OMP, and Cursor all load the same [`SKILL.md`](https://github.com/ayghri/i-have-adhd/blob/main/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.