lockscenes
Skill0 starsChanged 7 months agoMITView on GitHub
On-demand write protection for approved files during final assembly, implemented via Claude Code PreToolUse hooks — a rare working example of hook-based file guards. Use when the user enters a final-assembly phase, wants to freeze approved work, or says "lock scenes", "protect these files", "freeze approved", "/lockscenes", "add a write guard", or asks how to temporarily block edits during a critical phase. Trigger this skill whenever the user needs temporary, scoped file-level guards without restructuring the repo.
In this repository5 other files it gives its agents.
- clip-feedbackSkill
- debug-pipelineSkill
- go-loopSkill
- nb2-batchSkill
- verifySkill
The file
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 1 is distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 44
When invoked, Claude creates a lock file at runs/.scene_lock with patterns to protect.
- Distinctive: line 70
If the target file path matches any pattern, the edit is denied.
- Very specific: line 75
When /lockscenes is invoked:
- Very specific: line 78
If "unlock": delete runs/.scene_lock and confirm
- Very specific: line 79
If no arguments: write default lock patterns to .scene_lock
- Very specific: line 80
If item IDs given: write those IDs as patterns to .scene_lock
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Lock Scenes — On-Demand Write Protection
Blocks Edit/Write to approved files during final assembly. Only active when invoked via /lockscenes. The hook is removed when the session ends.
This is a rare example of Claude Code's PreToolUse hooks used for on-demand file guards. Useful pattern for any project that has an "approved" or "frozen" state.
Usage
Lock default set (everything approved)
/lockscenesThis writes a lock file and activates the PreToolUse hook. Any attempt to Edit or Write a file matching a locked pattern is denied.
Lock specific items
/lockscenes shot-01 shot-02 cut-01Unlock (remove all locks)
/lockscenes unlockWhat Gets Locked
When invoked, Claude creates a lock file at runs/.scene_lock with patterns to protect.
Default lock (no arguments) — protect common approved paths:
review_data.json
cleaned_prompts.json
references/approved/
scene_bundles/Customize the defaults in scripts/guard-approved.sh for your project.
Item-specific lock — add IDs as patterns:
shot-01
shot-02
cut-01How It Works
- You invoke
/lockscenes. The skill activates for this session. - Claude Code runs the hook script (
guard-approved.sh) before every Edit/Write. - The script reads
runs/.scene_lockfor locked patterns. - If the target file path matches any pattern, the edit is denied.
- Claude sees the denial message and skips that file.
Implementation Steps (for Claude)
When /lockscenes is invoked:
- Parse arguments — specific item IDs or "unlock"
- If "unlock": delete
runs/.scene_lockand confirm - If no arguments: write default lock patterns to
.scene_lock - If item IDs given: write those IDs as patterns to
.scene_lock - Confirm: "Locked N patterns. Edit/Write to matching files will be blocked this session."
Gotchas
- The lock file is just a text file with patterns, one per line. Lines starting with
#are comments. - The hook only blocks Edit and Write tools. Bash commands like
sedorecho >are NOT blocked. This is intentional — if you need to force-edit, you can, but you have to be deliberate. - The lock persists in the file system, but the hook only runs while the skill is active. Stale lock files are harmless but should be cleaned up.
- The lock file should live in a gitignored path (e.g.,
runs/), not in the repo.
Why this pattern matters
Claude Code hooks are powerful but underused. This skill shows a real production use:
- On-demand activation (not always-on — flips on only during final assembly)
- Scoped to a specific tool matcher (Edit|Write)
- Uses a simple text file as state
- Zero dependencies beyond bash
Fork the pattern for any lifecycle stage where you need temporary guards.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

