# Freeze > Restringe las ediciones de archivos a un directorio específico durante la sesión (gstack). Fuente: https://skillsagentes.com/skills/garrytan/gstack/freeze Markdown: https://skillsagentes.com/skills/garrytan/gstack/freeze.md Repositorio: https://github.com/garrytan/gstack Autor: garrytan Licencia: MIT Actualizado: hace 5 días Coste de contexto: 17 tok instalada, 947 tok al activarse, 3.2k tok con todos los archivos del bundle Bundle: 3 archivos, 13 KB Permisos que pide: bash, read, askuserquestion ## Instalación Un skill son archivos markdown: los mismos archivos valen para cualquier agente y lo único que cambia es el directorio de destino, es decir la bandera `--agent`. Añade `-g` para instalarlo en todos los proyectos de la máquina. ```bash # Claude Code npx -y skills add garrytan/gstack --skill freeze --agent claude-code # Cursor npx -y skills add garrytan/gstack --skill freeze --agent cursor # Codex npx -y skills add garrytan/gstack --skill freeze --agent codex # Gemini CLI npx -y skills add garrytan/gstack --skill freeze --agent gemini # Windsurf npx -y skills add garrytan/gstack --skill freeze --agent windsurf # Cline npx -y skills add garrytan/gstack --skill freeze --agent cline ``` ## Qué hace - Instala hooks PreToolUse en Edit y Write que bloquean cualquier edición fuera de un directorio permitido - Pide al usuario mediante AskUserQuestion qué directorio restringir y lo guarda en un archivo de estado de sesión - Resuelve la ruta a absoluta, añade barra final y compara cada file_path contra ese límite, denegando por defecto si no puede parsear - Resuelve symlinks por su componente final para evitar que apunten fuera del límite ## Cuándo usarla - Al depurar, para evitar 'arreglar' accidentalmente código no relacionado - Cuando quieres acotar los cambios a un solo módulo - Cuando te piden 'freeze', 'restrict edits', 'only edit this folder' o 'lock down edits' ## Qué la activa - "Restringe las ediciones a la carpeta src/" - "Congela los cambios solo en este módulo" - "Bloquea la edición fuera de esta carpeta durante la sesión" ## Antes de instalar - Requiere el script bin/check-freeze.sh y bin/gstack-paths de gstack instalados en ~/.claude/skills/gstack. - Necesita en el PATH: git - Variables de entorno: FREEZE_DIR, GSTACK_STATE_ROOT, STATE_DIR - runs shell commands - reads environment config ## Archivos - SKILL.md — 4 KB - SKILL.md.tmpl — 4 KB - bin/check-freeze.sh — 5 KB ## SKILL.md Reproducido tal cual desde garrytan/gstack bajo MIT. Esta sección es el documento original y está en inglés. ## When to invoke this skill Blocks Edit and Write outside the allowed path. 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). ```bash mkdir -p ~/.gstack/analytics echo '{"skill":"freeze","ts":"'$(date -u +%Y-%m-%dT%H:%M:%SZ)'","repo":"'$(basename "$(git rev-parse --show-toplevel 2>/dev/null)" 2>/dev/null || echo "unknown")'"}' >> ~/.gstack/analytics/skill-usage.jsonl 2>/dev/null || true ``` ## Setup Ask the user which directory to restrict edits to. Use AskUserQuestion: - Question: "Which directory should I restrict edits to? Files outside this path will be blocked from editing." - Text input (not multiple choice) — the user types a path. Once the user provides a directory path: 1. Resolve it to an absolute path: ```bash FREEZE_DIR=$(cd "" 2>/dev/null && pwd) echo "$FREEZE_DIR" ``` 2. Ensure trailing slash and save to the freeze state file: ```bash FREEZE_DIR="${FREEZE_DIR%/}/" eval "$(~/.claude/skills/gstack/bin/gstack-paths)" STATE_DIR="$GSTACK_STATE_ROOT" 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 `/`. Any Edit or Write outside this directory will be blocked. To change the boundary, run `/freeze` again. To remove it, run `/unfreeze` or end the session." ## How it works The hook reads `file_path` from the Edit/Write tool input JSON (shared real-JSON extractor with /careful — one copy, sourced by both hooks), then checks whether the path starts with the freeze directory. If not, it returns a `hookSpecificOutput` payload with `permissionDecision: "deny"` to block the operation (nested under `hookSpecificOutput` — Claude Code ignores a top-level `permissionDecision`). Polarity is fail-closed: a tool payload the hook cannot parse is DENIED, not allowed — a boundary that fails open is not a boundary. A payload that parses but has no `file_path` (a non-file tool) is allowed. Symlinks are resolved through their FINAL component, so an in-boundary symlink pointing outside the boundary is checked against its target. The freeze boundary persists for the session via the state file. The hook script reads it on every Edit/Write invocation. Boundaries containing spaces are supported. ## Notes - The trailing `/` on the freeze directory prevents `/src` from matching `/src-old` - Freeze applies to Edit and Write tools only — Read, Bash, Glob, Grep are unaffected - This prevents accidental edits, not a security boundary — Bash commands like `sed` can still modify files outside the boundary - To deactivate, run `/unfreeze` or end the conversation ## Dónde encaja - Categoría: [Herramientas para desarrolladores](https://skillsagentes.com/categorias/herramientas-desarrollo.md) — Skills que cambian cómo tu agente escribe, revisa y despliega código. - Creador: [garrytan](https://skillsagentes.com/creators/garrytan.md) — 134 skills en el directorio - [Todas las skills](https://skillsagentes.com/skills.md) - [Ranking de instalaciones](https://skillsagentes.com/ranking.md) ## Otras skills del mismo repositorio - [Browse](https://skillsagentes.com/skills/garrytan/gstack/browse.md): Navegador headless rápido para QA testing y dogfooding de sitios (gstack). - [Ship](https://skillsagentes.com/skills/garrytan/gstack/ship.md): Flujo de ship: detecta y fusiona la rama base, corre tests, revisa el diff, sube VERSION, actualiza CHANGELOG, hace commit, push y crea el PR (gstack). - [Ios Qa](https://skillsagentes.com/skills/garrytan/gstack/ios-qa.md): QA en dispositivo iOS real para apps SwiftUI, con bucle de agente guiado por visión sobre USB (gstack). - [Plan Design Review](https://skillsagentes.com/skills/garrytan/gstack/plan-design-review.md): Revisión de planes con ojo de diseñador — interactiva, al estilo de las revisiones de CEO e Ingeniería. (gstack) - [Plan Eng Review](https://skillsagentes.com/skills/garrytan/gstack/plan-eng-review.md): Revisión de plan en modo gerente de ingeniería: arquitectura, flujo de datos, diagramas, casos límite, cobertura de pruebas y rendimiento. (gstack) ## Skills relacionadas - [Finishing A Development Branch](https://skillsagentes.com/skills/obra/superpowers/finishing-a-development-branch.md): Úsalo cuando la implementación esté completa, todos los tests pasen, y necesites decidir cómo integrar el trabajo. - [Using Git Worktrees](https://skillsagentes.com/skills/obra/superpowers/using-git-worktrees.md): Úsalo al empezar trabajo de feature que necesita aislamiento del workspace actual, o antes de ejecutar planes de implementación: asegura un workspace aislado vía herramientas nativas o fallback a git worktree. - [Writing Skills](https://skillsagentes.com/skills/obra/superpowers/writing-skills.md): Úsala al crear nuevas skills, editar skills existentes o verificar que funcionan antes de desplegarlas. - [Code Review](https://skillsagentes.com/skills/mattpocock/skills/code-review.md): Revisa los cambios desde un punto fijo por dos ejes — Standards (¿sigue los estándares del repo?) y Spec (¿hace lo que pedía el issue?) — en sub-agentes paralelos, y los reporta lado a lado. - [Codebase Design](https://skillsagentes.com/skills/mattpocock/skills/codebase-design.md): Vocabulario compartido para diseñar módulos profundos. Úsalo para diseñar o mejorar la interfaz de un módulo, decidir dónde va un seam, o hacer el código más testeable y navegable para una IA. --- Skills Agentes · [Índice de páginas en markdown](https://skillsagentes.com/sitemap.md) · [Inicio](https://skillsagentes.com/index.md)