- Home
- Skills
- DevOps & Cloud
- git branch
Works with the AI Agents you already use
git branch
Automated Git branch selection and repository state validation to prevent upstream conflicts and history rewrites.
Free
git branch
Example session with this skill installed
I need to add a new dark mode toggle to the settings page. Check the repo and set up the branch.
- Read your context and instructions
- Compiled the git branch
I have analyzed the repository state. A new branch feat/dark-mode-toggle has been created based on origin/main. No conflicting PRs or worktrees were found.
Git Branch Selection Report
| Category | Status | Details |
|---|---|---|
| Action | Created new branch | feat/dark-mode-toggle |
| Base | origin/main | Synced via git fetch --prune |
| Current State | Clean | No dirty files or detached HEAD |
| Upstream PRs | None | No active PRs found for settings work |
| Risk Check | Passed | No squash-merged branch conflicts detected |
Next steps
- Begin implementing the
DarkModeTogglecomponent insrc/components/Settings. - Add the necessary state logic to the
ThemeContext. - Commit changes to the new branch once the toggle is functional.
Connects securely to your tools. The creator never sees your data.
About this skill
Developers often lose time rewriting history because they started coding on the wrong branch. This skill enforces a rigorous Git workflow by analyzing the repository state, PR status, and worktrees before the first line of code is written. It prevents common mistakes like committing to the default branch, adding feature code to unrelated fix branches, or working on squash-merged stubs.
What it does
- State validation runs pruning fetches and checks for dirty trees or detached HEAD states.
- Branch routing determines if a task requires a new feature branch or an update to an unmerged PR.
- Risk assessment identifies squash-merged branches that appear active but are actually closed.
- Naming enforcement pulls the repo's default branch name and follows existing remote naming conventions.
- Safety checks prevents accidental stashing, rebasing, or force-pushing without explicit consent.
How it works
- Sync and Inspect triggers a prune fetch and inspects local branches, upstreams, and active worktrees.
- Context analysis checks for existing PRs via GitHub CLI to see if the current task belongs to an open thread.
- Branch selection creates a new branch from the correct base or stays on the current active feature branch.
- Resolution reporting provides a concise summary of the chosen path and any mitigated risks.
Frameworks & tools
This skill requires git and works best when gh (GitHub CLI) is available for PR status checks.
Why this beats prompting it yourself
Manual branching is prone to "stale head" errors where you branch off an outdated main. This skill automates the fetch-and-check cycle, ensuring every task starts from the actual origin state while avoiding the trap of squash-merged local branches.
Use cases
- Start a new feature off the correct, up-to-date default branch.
- Identify when a bug fix should be added to an existing unmerged PR.
- Prevent commits to branches that have already been squash-merged upstream.
- Navigate complex repos with multiple active worktrees and detached HEADs.
Known limitations
Requires a local Git environment. Cannot perform stashes, rebases, or force-pushes without direct user confirmation.
Requires local git environment. Cannot auto-resolve merge conflicts. Will not perform destructive actions like force-push or stash without explicit user permission.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before any payment.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
1 use
Times used to date
Free forever
No account required to browse
Trust & safety
Security scan
Security scan passed 1 month ago
- Free with an Agensi account
Requires