git-safety

Enforces native git commands for moving, renaming, and deleting tracked files.

Updated Jan 12, 2026
One-click install
npx skills add https://github.com/ab300819/keel-workflow --skill git-safety-ab300819
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: git-safety
Source: https://github.com/ab300819/keel-workflow/tree/main/skills/git-safety
Command: npx skills add https://github.com/ab300819/keel-workflow --skill git-safety-ab300819

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? When an AI agent uses plain mv or rm on Git-tracked files, Git loses the file history and records the change as a delete-plus-add, polluting the index and breaking traceability. This Skill prevents that by mandating native Git commands for all file operations on tracked files. ## Core Features & Use Cases - Safe Move & Rename: Requires git mv instead of mv so Git preserves file history during refactors. - Safe Delete: Requires git rm instead of rm so deletions are staged in the index immediately. - Pre-operation Self-check: Instructs the agent to run git ls-files <path> first, then choose git mv/git rm for tracked files or plain mv/rm for untracked ones. - Use Case: During a codebase restructure, the agent checks each file's tracking status before moving it, ensuring the Git history of every relocated module stays intact. ## Quick Start Before moving or deleting any file in this repository, check its tracking status with git ls-files and use git mv or git rm for tracked files.

Frequently Asked Questions about git-safety

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I move or rename a file in Git without losing history?▼

Use git mv <old_path> <new_path> instead of the plain mv command. Git then tracks the rename natively and preserves the file's commit history rather than recording a delete plus a new file.

How do I delete a Git-tracked file correctly?▼

Use git rm <path> or git rm -r <path> for directories. This removes the file from both the working tree and the index in one step, avoiding unstaged deletion leftovers that plain rm would cause.

How can I check if a file is tracked by Git before deleting it?▼

Run git ls-files <path>. If it returns the path, the file is tracked and you should use git mv or git rm; if it returns nothing, the file is untracked and plain mv or rm is safe.

Why does Git show my renamed file as deleted plus added?▼

This happens when the file was moved with the plain mv command instead of git mv. Git then treats the operation as a deletion and a new untracked file, which breaks history continuity for that path.

When should I check git status before bulk file moves?▼

Run git status before any large-scale move or cleanup operation to confirm the working tree is clean. A dirty tree makes it harder to review the structural changes and increases the risk of mixing unrelated modifications.