git-state-validator
π―Skillfrom edanstarfire/claudecode_webui
Validates git repository state by checking working directory status, branch conflicts, and repository health before critical git operations.
Installation
npx skills add https://github.com/edanstarfire/claudecode_webui --skill git-state-validatorSkill Details
Check git repository status, detect conflicts, and validate branch state before operations. Use when verifying working directory cleanliness, checking for conflicts, or validating branch state.
Overview
# Git State Validator
Instructions
When to Invoke This Skill
- Before creating new branches
- Before switching branches
- Before merging or pulling
- After conflicts occur
- When verifying clean working directory
- Before committing changes
Core Validations
- Working Directory Status - Check for uncommitted changes
- Branch Validation - Verify current branch and relationship to main
- Conflict Detection - Identify merge conflicts
- Remote Sync Status - Check if local is ahead/behind remote
- Repository Health - Verify git repository integrity
Standard Workflows
#### Check Working Directory Status
- Get Status
```bash
git status
```
- Parse Output
- Clean: "nothing to commit, working tree clean"
- Unstaged changes: Modified files not added
- Staged changes: Files added but not committed
- Untracked files: New files not added to git
- Get Machine-Readable Status
```bash
git status --porcelain
```
Prefixes:
- M - Modified
- A - Added
- D - Deleted
- ?? - Untracked
- UU - Merge conflict
#### Validate Branch State
- Get Current Branch
```bash
git branch --show-current
```
- Check if on Main
```bash
git branch --show-current | grep -E "^(main|master)$"
```
- Get Branch List
```bash
git branch -a
```
- Local branches (no prefix)
- Remote branches (remotes/origin/...)
- Check Branch Relationship
```bash
git merge-base --is-ancestor main HEAD
```
Exit code 0: Current branch is based on main
#### Detect Conflicts
- Check for Conflict Markers
```bash
git diff --check
```
- List Conflicted Files
```bash
git diff --name-only --diff-filter=U
```
- View Conflict Details
```bash
git status
```
Look for "both modified" or "both added"
- Analyze Conflict Markers
Search files for:
```
<<<<<<< HEAD
=======
>>>>>>> branch-name
```
#### Check Remote Sync Status
- Fetch Remote State (without merging)
```bash
git fetch origin
```
- Compare with Remote
```bash
git status -sb
```
Output patterns:
- [ahead 3] - Local has 3 commits not pushed
- [behind 2] - Remote has 2 commits not pulled
- [ahead 1, behind 2] - Both have unpushed/unpulled commits
- View Unpushed Commits
```bash
git log origin/main..HEAD --oneline
```
- View Unpulled Commits
```bash
git log HEAD..origin/main --oneline
```
#### Validate Repository Health
- Check Repository Integrity
```bash
git fsck --full
```
- Verify Object Database
```bash
git count-objects -v
```
- Check for Corrupted Objects
```bash
git fsck --lost-found
```
Common Status Interpretations
#### Clean Working Directory
```
$ git status
On branch feat/new-feature
nothing to commit, working tree clean
```
Interpretation: Safe to switch branches, merge, or create new branch
#### Uncommitted Changes
```
$ git status
On branch feat/new-feature
Changes not staged for commit:
modified: src/main.py
modified: src/utils.py
```
Interpretation: Need to commit or stash before branch operations
#### Merge Conflict
```
$ git status
On branch feat/new-feature
You have unmerged paths.
Unmerged paths:
both modified: src/config.py
```
Interpretation: Must resolve conflicts before proceeding
#### Ahead of Remote
```
$ git status -sb
feat/new-feature...origin/feat/new-feature [ahead 3]
```
Interpretation: Local has 3 commits not pushed to remote
#### Behind Remote
```
$ git status -sb
main...origin/main [behind 5]
```
Interpretation: Remote has 5 commits not pulled locally
Error Scenarios
Not a Git Repository:
```
fatal: not a git repository (or any of the parent directories): .git
```
Action: Navigate to git repository or run git init
Detached HEAD State:
```
HEAD detached at
```
Action: Create branch or checkout existing branch
Corrupted Repository:
```
error: object file .git/objects/... is empty
```
Action: Try git fsck, may need to restore from backup
Examples
Example 1: Pre-branch creation validation
```
Context: About to create new feature branch
Action:
- Check status: git status
- Verify on main: git branch --show-current
- Check for uncommitted changes: git status --porcelain
- Verify remote sync: git status -sb
Output: "Working directory clean, on main, synced with remote - safe to create branch"
```
Example 2: Detect merge conflicts
```
Context: Pull resulted in conflicts
Action:
- Run git status
- Identify "both modified" files
- List conflicted files: git diff --name-only --diff-filter=U
- For each file, read and identify conflict markers
Output: "3 files have conflicts: src/main.py, src/utils.py, src/config.py"
```
Example 3: Validate before commit
```
Context: Ready to commit changes
Action:
- Check branch: git branch --show-current
- Verify not on main: Ensure branch name != main/master
- Review changes: git status
- View diff: git diff
Output: "On feature branch with 5 modified files - safe to commit"
```
Example 4: Sync status check
```
Context: Before pushing changes
Action:
- Fetch remote: git fetch origin
- Check status: git status -sb
- If behind: Suggest pull first
- If ahead: Confirm ready to push
Output: "Local is ahead by 2 commits - ready to push"
```
More from this repository10
Retrieves recent issues related to login, presents most relevant issue ``` Reads and analyzes GitHub issues to provide comprehensive context and implementation details.
Manages Git branches by safely creating, switching, and cleaning up branches with intelligent handling of uncommitted changes.
Synchronizes local main branch with remote, pulling latest changes and ensuring a clean, up-to-date base for new worktrees.
Automates GitHub pull request workflows by tracking, reviewing, and managing PRs across repositories with intelligent filtering and status updates
Explores codebases systematically by identifying relevant files, tracing functionality, and understanding architectural patterns through targeted search techniques.
Generates comprehensive, step-by-step implementation plans with clear technical details, testing strategies, and risk assessment for complex software features.
process-manager skill from edanstarfire/claudecode_webui
Analyzes code changes by tracing direct and indirect dependencies, identifying potential impacts and risks before implementing modifications.
Authenticates and troubleshoots GitHub CLI access by verifying credentials, refreshing tokens, and resolving permission issues.
Generates well-structured, semantic git commit messages by guiding developers through a standardized commit message composition process.