# Freezing Edits

> Blocks all file writes and edits outside a specified directory for the rest of the session. Use when debugging, investigating, or doing exploratory work where you want to prevent accidental modifications to unrelated code. Pass the allowed directory as an argument, e.g. /freezing-edits src/components

- Skill: `riccardogrin/freezing-edits` (Agent Skill)
- Install (CLI): `npx skillmds@latest add riccardogrin/freezing-edits`
- Raw SKILL.md: https://api.skillmd.com/api/skills/riccardogrin/freezing-edits/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Integrations & APIs
- Author: RiccardoGrin (https://skillmd.com/u/riccardogrin)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/riccardogrin/freezing-edits

---


# Freezing Edits

Locks down file modifications to a single directory for the rest of the session.
Everything outside that directory becomes read-only to Claude.

## Usage

```
/freezing-edits src/components
```

This allows edits only to files under `src/components/` and blocks Write/Edit to anything else.

## Setup

When invoked, save the allowed directory to a config file so the hook can read it:

1. Resolve the argument to an absolute path relative to the current working directory
2. Create the config directory if needed: `${CLAUDE_PLUGIN_DATA:-$HOME/.claude/data/freezing-edits}/`
3. Write the config: `{"allowed_dir": "/absolute/path/to/directory"}`

The config file path is: `${CLAUDE_PLUGIN_DATA:-$HOME/.claude/data/freezing-edits}/freeze-config.json`

If no argument is provided, ask the user which directory to allow.

## How It Works

The skill registers a PreToolUse hook on Write and Edit tools.
Before any file modification, the hook checks whether the target file path starts with the allowed directory.
If it doesn't, the edit is blocked (exit code 2) and Claude sees which directory is allowed.

The hooks are **session-scoped** — they last until the session ends.

## Unfreezing

To remove the freeze within the same session, delete the config file:

```bash
rm "${CLAUDE_PLUGIN_DATA:-$HOME/.claude/data/freezing-edits}/freeze-config.json"
```

Or simply end the session — hooks don't persist.

## Gotchas

- The path comparison is a prefix match on absolute paths. `src/components` will also match `src/components-old/` if such a directory exists. Use trailing slashes in the config if precision matters.
- New file creation (Write) is also blocked outside the allowed directory, not just edits.
- The hook does not block Bash commands that write files (e.g., `echo > file`). It only covers Claude's Write and Edit tools. For full protection, combine with `/being-careful`.
- If you need to allow multiple directories, edit the config file to use an array and update the hook logic accordingly.

