Skip to content
Back to skills

Freeze

ASecurity

Restrict file edits to a specific directory for the session. Blocks Edit and Write outside the allowed path.

  • 7 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 3, 2026
ai-agentsbashdebugging

Works with

  • claude code

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned September 3, 2026

npx -y skills add timurgaleev/vibestack --skill freeze --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Freeze?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Freeze
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/timurgaleev-freeze/badge)](https://www.skillsdirectory.com/skills/timurgaleev-freeze)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: freeze
description: |
  Restrict file edits to a specific directory for the session. Blocks Edit and Write outside the allowed path.
allowed-tools:
  - Bash
  - Read
  - AskUserQuestion
hooks:
  PreToolUse:
    - matcher: "Edit"
      hooks:
        - type: command
          command: "bash ${CLAUDE_SKILL_DIR:-$HOME/.claude/skills/freeze}/bin/check-freeze.sh"
          statusMessage: "Checking freeze boundary..."
    - matcher: "Write"
      hooks:
        - type: command
          command: "bash ${CLAUDE_SKILL_DIR:-$HOME/.claude/skills/freeze}/bin/check-freeze.sh"
          statusMessage: "Checking freeze boundary..."
triggers:
  - freeze edits to directory
  - lock editing scope
  - restrict file changes
  - only edit this folder
---

## When to invoke

Use when debugging to prevent accidentally "fixing" unrelated code, or when you want to scope changes to one module. Use when asked to "freeze", "restrict edits", "only edit this folder", or "lock down edits".

# /freeze — Restrict Edits to a Directory

Lock file edits to a specific directory. Any Edit or Write operation targeting
a file outside the allowed path will be **blocked** (not just warned).

## Setup

Ask the user which directory to restrict edits to:

> "Which directory should I restrict edits to? Files outside this path will be blocked from editing."

Once the user provides a path:

```bash
FREEZE_DIR=$(cd "<user-provided-path>" 2>/dev/null && pwd)
FREEZE_DIR="${FREEZE_DIR%/}/"
STATE_DIR="${VIBESTACK_HOME:-$HOME/.vibestack}"
mkdir -p "$STATE_DIR"
echo "$FREEZE_DIR" > "$STATE_DIR/freeze-dir.txt"
echo "Freeze boundary set: $FREEZE_DIR"
```

Tell the user: "Edits are now restricted to `<path>/`. Any Edit or Write
outside this directory will be blocked. To change the boundary, run `/freeze`
again. To remove it, run `/unfreeze`."

## How it works

The hook parses `file_path` out of each Edit/Write payload, resolves the path
fully — including a final component that is itself a symlink — and checks whether
it starts with the frozen directory. If not, it returns a `hookSpecificOutput`
envelope carrying `permissionDecision: "deny"`. The nesting matters: Claude Code
ignores a top-level `permissionDecision`, so a deny emitted at the top level lets
the edit through.

Freeze is the **deny tier**, so it fails closed: a payload it cannot parse is
blocked, not allowed. Its ask-tier sibling `/careful` makes the opposite call on
the same input. Both share one extractor (`careful/bin/hook-extract.sh`).

The freeze boundary persists for the session via `~/.vibestack/freeze-dir.txt`.

## Notes

- The trailing `/` prevents `/src` from matching `/src-old`
- Applies to Edit and Write tools only — Read, Bash, Glob, Grep are unaffected
- Bash commands like `sed -i` can still modify files outside the boundary
- A symlink inside the boundary pointing outside it is resolved and blocked
- A path with spaces in it works — only leading and trailing whitespace is
  trimmed from the saved boundary, and a leading `~` is expanded
- To deactivate: run `/unfreeze` or end the conversation

Files in this skill

  • SKILL.md3 KB
  • bin/check-freeze.sh7.7 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.