Enforces strict GitHub workflow hygiene and best practices. Use this skill for ALL git and GitHub operations including commits, branches, pull requests, and repository management...
Enforce disciplined git workflow. No exceptions. No shortcuts.
# These commands on main/master require EXPLICIT user override
git commit # on main/master
git push origin main
git push origin master
git merge <branch> # while on main/master
git push --force # on ANY protected branch
git reset --hard # without explicit confirmation
Before ANY git operation: Check current branch first.
branch=$(git branch --show-current)
if [[ "$branch" == "main" || "$branch" == "master" ]]; then
# STOP - Require explicit user confirmation before proceeding
echo "ā On protected branch: $branch"
fi
# 1. Ensure main is current
git checkout main
git pull origin main
# 2. Create feature branch (REQUIRED before any changes)
git checkout -b <branch-type>/<description>
# Branch naming convention:
# feature/ - New functionality
# fix/ - Bug fixes
# hotfix/ - Urgent production fixes
# refactor/ - Code restructuring
# docs/ - Documentation only
# test/ - Test additions/changes
# chore/ - Maintenance tasks
Format: <type>/<ticket-or-description>
Good:
feature/user-authenticationfix/pathmon-timeout-handlinghotfix/triton-startup-crashrefactor/secflo-rls-policiesBad:
my-changes (no type prefix)feature/stuff (vague description)Feature/Auth (wrong case)<type>(<scope>): <description>
[optional body]
[optional footer]
Types:
feat - New featurefix - Bug fixdocs - Documentation onlystyle - Formatting, no code changerefactor - Code restructuringtest - Adding/updating testschore - Maintenance tasksperf - Performance improvementExamples:
feat(triton): add dual-core handshake timeout handling
Implements NASA JPL Power of 10 compliant timeout mechanism
for Pico core synchronization during startup sequence.
Closes #42
fix(pathmon): correct SLA evidence timestamp format
FCC complaint export now uses ISO 8601 format consistently.
ALWAYS use GitHub MCP for these operations:
| Operation | MCP Tool | NOT This |
|---|---|---|
| Create issue | create_issue |
GitHub web UI during session |
| Create PR | create_pull_request |
gh pr create without MCP |
| List PRs | list_pull_requests |
Manual checking |
| Get PR details | get_pull_request |
gh pr view |
| PR reviews | create_pull_request_review |
Web UI |
| Check CI status | get_pull_request |
Manually refreshing |
| Merge PR | merge_pull_request |
gh pr merge without MCP |
Why MCP over CLI:
Before GitHub operations, verify MCP is available:
/mcp
If GitHub MCP not configured, alert user:
ā ļø GitHub MCP not configured.
Add with: claude mcp add --transport http github https://api.githubcopilot.com/mcp -H "Authorization: Bearer YOUR_PAT"
create_pull_request# Switch to main and update
git checkout main
git pull origin main
# Delete local feature branch
git branch -d <branch-name>
# Delete remote feature branch (if not auto-deleted)
git push origin --delete <branch-name>
Run before every commit operation:
#!/bin/bash
# Reject commits on protected branches
branch=$(git branch --show-current)
protected=("main" "master" "production" "release")
for p in "${protected[@]}"; do
if [[ "$branch" == "$p" ]]; then
echo "ā Direct commits to '$branch' are not allowed"
echo "Create a feature branch: git checkout -b feature/your-change"
exit 1
fi
done
Verify before pushing:
# If not yet pushed - move commit to new branch
git branch feature/rescue-commit
git reset --hard HEAD~1
git checkout feature/rescue-commit
# STOP - Do not force push
# 1. Create PR to revert
# 2. Or coordinate with team for proper resolution
# Force push to main is NEVER acceptable without explicit team approval
| Situation | Action |
|---|---|
| Starting new feature | git checkout -b feature/<name> |
| Ready to commit | Check branch first, then commit |
| Ready to merge | Create PR via GitHub MCP |
| PR approved | Merge via MCP, delete branch |
| On wrong branch | Stash, switch, apply |
| Need main updates | git pull origin main (from feature branch: git rebase main) |
git push origin maingit commit while on main/mastergit push --force on any branchgit reset --hard anywherePairs with:
using-git-worktrees - For isolated development environmentstest-driven-development - Tests pass before commitsfinishing-a-development-branch - Proper branch cleanupAnnounce at start: "Using github-hygiene skill to ensure proper git workflow."