git-safe-workflow
Safely inspect, stage, commit, and (only if asked) push changes made by an AI agent. Use for commit/push requests, end-of-task checkpoints, merge conflict resolution, worktree safety checks, or deciding whether to use git commit --amend.
Security Assessment
About git-safe-workflow
The git-safe-workflow skill provides a structured and secure approach for managing Git repositories when working with AI agents. It ensures that any changes made by the AI are inspected, staged, committed, and optionally pushed with minimal risk of data loss or repository corruption. By enforcing strict rules around non-destructive commands and cautious worktree handling, this skill addresses common challenges such as detached HEAD states, unexpected branches, and conflicts caused by multiple worktrees, helping users maintain a safe and predictable workflow.
The skill's main capabilities include collecting repository and worktree context non-destructively, safely staging changes, generating detailed commit messages using Conventional Commits conventions, and verifying commits before pushing. It provides clear guidelines on avoiding high-risk commands like forced resets, rebases, and destructive cleans unless explicitly requested. Worktree safety rules prevent unintended commits in detached HEAD states or in branches already checked out elsewhere. Additionally, it supports creating checkpoint commits, inspecting detailed diffs, and safely using 'git commit --amend' for small, local fixes.
Typical use cases include checkpointing AI-generated code, resolving merge conflicts, and maintaining clean commit histories in multi-branch or multi-worktree setups. The target users are developers and teams integrating AI-assisted coding workflows, code reviewers, or DevOps engineers who need to ensure repository integrity while using automated agents. By providing explicit safety guidelines and structured procedures, git-safe-workflow reduces the risk of mistakes while streamlining the process of incorporating AI-generated changes into production code.
FAQ
Can I use git-safe-workflow on any Git repository?
Yes, it is compatible with standard Git repositories. However, it requires that you have proper access permissions and that the repository is not in a detached or locked state unless you explicitly manage it.
Does the skill automatically push commits?
No, the skill will only push changes if explicitly requested. By default, it focuses on safe inspection, staging, and committing without automatically performing high-risk operations like pushing with force.
How does git-safe-workflow handle detached HEAD situations?
If the repository is in a detached HEAD state, it will not commit changes automatically. It explains the situation and asks whether to create a new branch before committing, ensuring users understand the potential risks.
Are destructive Git commands ever executed?
No destructive commands such as 'git reset --hard' or 'git clean -fd' are executed unless explicitly requested by the user. When requested, the skill explains the risks and confirms the exact command before proceeding.
Is git-safe-workflow suitable for large or security-sensitive changes?
Yes, it includes guidance to inspect full diffs for large or sensitive changes and encourages careful staging and commit messages, ensuring changes are documented and reviewed properly before integration.
Install git-safe-workflow
Quick Setup:
- Copy the skill folder to
.claude/skills/ - Claude will automatically detect and use the skill
Repository
regenrek/agent-skills