Git Stash Helper

Save, name, list, and restore git stashes without losing track of what's in them.

Install
cmdop skills install agensi-git-stash-helper

Git Stash Helper is a skill for AI agents that adds structured management around git stash operations. Instead of producing cryptic, anonymous stash entries, it automatically generates stash messages that include the branch name, a timestamp, and a summary of the work in progress, making stash history searchable and self-documenting.

When restoring stashes, the skill validates the worktree status and checks that the target stash index exists before attempting a pop. This prevents accidental data loss from popping into a dirty worktree and avoids errors caused by referencing a missing stash index. It also guards against edge cases such as detached HEAD states that would otherwise cause silent failures or confusing error output.

Listing stashes converts standard git output into a clean, numbered format so an agent can select the correct stash without parsing raw git stash list output. The skill also prevents empty stashes from being created in the first place.

This skill is optimized for terminal-based AI agents with filesystem and shell access, such as Claude Code and Codex, and works in any standard Git repository. It requires no environment variables and has no external service dependencies. The skill does not replace the git CLI; it wraps stash workflows with additional safety checks and consistent naming conventions that make automated or agent-driven development easier to follow.

Use cases

  • Save work in progress on a feature branch with a message that includes branch name and timestamp before switching context
  • Restore a specific stash safely after verifying the worktree is clean and the stash index exists
  • List all current stashes in a numbered, human-readable format so an agent can identify the correct one to pop
  • Prevent empty stash entries from being created when there are no uncommitted changes
  • Handle detached HEAD state gracefully during stash operations without manual debugging

When to use it

  • An AI agent needs to context-switch between tasks in a Git repository and must preserve uncommitted work
  • Automated workflows require stash operations with consistent, searchable message formats
  • An agent must restore stashed work safely without risking merge conflicts in a dirty worktree
  • Stash history has grown long and needs structured listing to identify the right entry

When not to use it

  • The environment does not have shell and filesystem access, as the skill requires terminal-based agent capabilities
  • The repository uses a version control system other than Git
  • Full branch management or commit history operations are needed beyond stash scope
  • There is no Git repository present in the working directory