Skip to content

jitangupta/file-safety-guard

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

File Safety Guard

Your Cowork needs this

Prevents accidental file deletion, overwrites, and destructive operations in Claude Code and Cowork sessions. Adds automatic backups, dry-run planning, activity logging, and bulk operation approval.

Why

Claude Code and Cowork can read and write files directly. There are no built-in guardrails preventing accidental deletion, overwriting, or bulk changes to your files. This plugin adds a safety layer that asks before destructive operations, backs up files before modifications, and plans before complex tasks.

Installation

Claude Code

claude plugin marketplace add jitangupta/file-safety-guard
claude plugin install file-safety-guard@file-safety-guard

Cowork

  1. Download the latest release zip file
  2. Open Cowork β†’ Plugins β†’ Upload Plugin
  3. Select the zip file

The plugin is installed globally β€” one-time setup, works across all folders and sessions.

Usage

Claude Code

Skills auto-activate based on task context. No extra steps needed β€” just work normally and the guardrails apply automatically.

Cowork

Activating File Safety Guard in Cowork

Cowork does not auto-activate skills based on task context. At the start of each session, run the enable command to activate all safety skills:

file-safety-guard:enable

Once activated, the skills remain active for the entire session. You do not need to repeat this for follow-up tasks within the same session.

Why manual? Cowork does not yet support automatic skill activation based on task context. This is a platform limitation, not a plugin issue. Once activated, skills remain active for the entire session.

Fallback: If the /enable command is unavailable, you can activate skills manually:

Use file-safety-guard:file-safety, file-safety-guard:backup-first, and file-safety-guard:dry-run skills for all file operations in this session.

What It Does

Skills

file-safety β€” Core protection rules that apply to every file operation:

  • No file deletion without explicit approval (shows file name, path, and reason)
  • No direct overwrites β€” backup created first with timestamp
  • Operations restricted to granted working directory
  • Bulk operations (3+ files) require a numbered list approval
  • Defaults to read-only when intent is uncertain
  • Hidden and system files are never touched
  • Every operation logged to _cowork_activity_log.md

backup-first β€” Automatic backup before any file modification:

  • Creates timestamped backups in _backups/ folder
  • Format: originalname_backup_YYYYMMDD_HHMM.ext
  • Each modification creates a new backup with a unique timestamp β€” previous backups are preserved
  • Keeps maximum 3 backups per file, rotates oldest
  • Post-task summary showing files modified and backups created

dry-run β€” Plan-first approach for complex operations:

  • Creates plan.md listing all planned changes before execution
  • Waits for explicit user approval
  • Updates plan with actual results after completion
  • Deletion section defaults to NONE unless explicitly requested

Commands

/enable β€” Activate all safety skills for the current session in one command. No need to remember skill names or copy activation text.

Note: In Cowork, use the full command name: file-safety-guard:enable

/safety-check β€” Quick health report on your working folder:

  • Total file and folder count
  • Last 10 activity log entries
  • Backup folder status and backup count
  • Files modified in current session

Note: In Cowork, use the full command name: file-safety-guard:safety-check

Files Created During Use

File/Folder Purpose
_cowork_activity_log.md Log of all file operations with timestamps
_backups/ Timestamped backup copies of modified files
plan.md Operation plan for complex tasks (temporary)

All generated files use an underscore prefix so they sort to the top and are easy to identify.

Configuration

The plugin works with sensible defaults. To customize:

Setting File Default What to Change
Max backups per file skills/backup-first/SKILL.md 3 Change "maximum of 3 backups"
Bulk approval threshold skills/file-safety/SKILL.md 3 files Change "more than 3 files"
Dry run threshold skills/dry-run/SKILL.md 2 operations Change "more than 2 file operations"
Protected file patterns skills/file-safety/SKILL.md Hidden files (.) Add patterns to "Hands Off" section

Plugin Structure

file-safety-guard/
β”œβ”€β”€ .claude-plugin/
β”‚   β”œβ”€β”€ marketplace.json
β”‚   └── plugin.json
β”œβ”€β”€ skills/
β”‚   β”œβ”€β”€ file-safety/
β”‚   β”‚   └── SKILL.md
β”‚   β”œβ”€β”€ backup-first/
β”‚   β”‚   └── SKILL.md
β”‚   └── dry-run/
β”‚       └── SKILL.md
β”œβ”€β”€ commands/
β”‚   β”œβ”€β”€ enable.md
β”‚   └── safety-check.md
β”œβ”€β”€ LICENSE
└── README.md

License

MIT

About

πŸ›‘οΈ Claude plugin that prevents accidental file deletion, overwrites, and destructive operations. Auto-backups, dry-run planning, and activity logging for Claude Code & Cowork.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors