git-workflow
Branch naming, Conventional Commits, PR creation, issue linking, GitHub Actions CI, code review process, and merge rules for Fantasy Football PI. Use when: creating branches, writing commits, opening PRs, linking issues, reviewing PRs, or understanding the CI pipeline.
Install
mkdir -p .claude/skills/git-workflow-npgrant81 && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/15288" && unzip -o skill.zip -d .claude/skills/git-workflow-npgrant81 && rm skill.zipInstalls to .claude/skills/git-workflow-npgrant81
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Branch naming, Conventional Commits, PR creation, issue linking, GitHub Actions CI, code review process, and merge rules for Fantasy Football PI. Use when: creating branches, writing commits, opening PRs, linking issues, reviewing PRs, or understanding the CI pipeline.About this skill
Git Workflow
Why This Exists
Consistent branch naming, commit messages, and PR structure keep the issue tracker accurate, enable automatic issue closing on merge, and make the history readable for ML audit trails and regression investigations.
Branch Naming
feat/issue-<N>-<slug> New feature
fix/issue-<N>-<slug> Bug fix
chore/issue-<N>-<slug> Non-functional changes (docs, deps, config)
perf/issue-<N>-<slug> Performance improvements
refactor/issue-<N>-<slug> Refactoring without behavior change
docs/issue-<N>-<slug> Documentation only
# Multi-issue batches
feat/issue-<N1>-<N2>-<slug>
Examples:
feat/issue-48-waiver-opportunity-tracker
fix/issue-161-simulation-nan
chore/cloudflare-phase3-followup
perf/react-query-435
Conventional Commits
Format: <type>(<scope>): <description>
| Type | When |
|---|---|
feat | New user-facing feature |
fix | Bug fix |
chore | Maintenance, deps, CI, non-feature |
perf | Performance improvement |
refactor | Code restructure, no behavior change |
test | Test additions or fixes |
docs | Documentation only |
style | Formatting, whitespace, Tailwind token cleanup |
# Good
feat: add waiver wire opportunity tracker endpoint
Implements rolling opportunity analysis for free agents.
Returns opportunity_score composite with trend detection.
Closes #48
# Also good — multi-issue
feat: analytics suite — luck index, player consistency, playoff bracket
Closes #46
Closes #50
Refs #154
# Bad — no type, no reference
updated some stuff
Rules:
- Subject line: imperative mood, ≤72 chars, no period
- Body: explain WHY, not what (the diff shows what)
- Footer:
Closes #N(auto-closes issue on PR merge),Refs #N(cross-reference only)
PR Process
Repeatable Branch Sync Procedure (Required When Prompted)
When asked to "sync with main", "rebase current branch", or close out merge blockers caused by branch drift, run this exact safe flow.
Goal
- Update local
mainfromorigin/main - Rebase the current feature branch on top of latest
main - Preserve and restore any local tracked or untracked work
Safe Rebase Flow
- Confirm branch and working tree state:
git status --short --branch
git branch --show-current
- If working tree is dirty, stash tracked and untracked changes:
git stash push -u -m "autostash-before-main-sync-$(date +%Y%m%d-%H%M%S)"
- Update
mainsafely:
git fetch origin --prune
git checkout main
git pull --ff-only origin main
- Return to original feature branch and rebase:
git checkout -
git rebase main
- If a stash was created, restore it:
git stash pop
- Verify final state:
git status --short --branch
Push Rules After Rebase
- If branch has never been pushed:
git push -u origin <branch>
- If branch was previously pushed and history changed due to rebase:
git push --force-with-lease
Conflict Handling
- Rebase conflicts:
- Resolve files
git add <resolved-files>git rebase --continue
- Abort only if requested or necessary:
git rebase --abort
- Stash pop conflicts are handled the same way (resolve, stage, continue normal workflow).
Opening a PR
- Push branch:
git push origin feat/issue-48-waiver-tracker - GitHub prints PR URL — open it and fill in the template
- Title:
feat: waiver wire opportunity tracker (#48) - Body must include:
## Summary Brief description of changes. ## Closes Closes #48 ## Related Issues Refs #44 (Analytics Infrastructure parent) ## Testing - [ ] Backend: `python -m pytest tests/test_analytics_router.py` - [ ] Frontend: `npm test -- --run` - [ ] Build: `npm run build` - Assign yourself; add label matching issue type
Test-Delta Title Gate (CI)
Some PR validation checks require test-file deltas for feature/fix PRs. If a change is operational/non-behavioral (for example CI-only, docs-only, refactor-only), use an exempt PR title prefix so the gate can skip test-delta enforcement.
Accepted exempt prefixes at title start:
chore:/chore(/choredocs:/docs(/docsrefactor:/refactor(/refactorci:/ci(/cibuild:/build(/buildstyle:/style(/styletest:/test(/test
Example:
ci: implement dead/stale code detection reporting pipeline (#301)
If the PR is truly feature/bug behavior, keep feat/fix and include matching test file deltas.
PR Review Checklist
See .github/REVIEW_CHECKLIST.md for full list. Key gates:
- All CI checks pass (lint, test, build)
hist_%exclusion present on any new member-list query- No raw SQL
- No dark-only Tailwind classes
Closes #Nin PR body- Tests added for new logic
Validation architecture gates (Issue #76):
- Validation dependency install path is preserved in CI (
backend/requirements-validation.txt) - Validation-focused tests pass:
backend/tests/test_validation_service.pyandetl/test_validation_framework.py - PR summary states which validation boundary changed (API boundary, dynamic rules, DataFrame schema, or expectations)
Copilot Review Monitoring (Required)
For every opened PR, initiate Copilot review and actively monitor/respond until no actionable feedback remains.
Flow:
- Open PR immediately after push (do not wait for deployment)
- Request Copilot review on the PR
- Monitor PR feedback cycles:
- Check review comments and unresolved threads
- Address code feedback in follow-up commits
- Resolve threads only after fix is merged/pushed
- Record outcomes in notes:
- Add a short "Copilot Feedback" section to
docs/PR_NOTES.md - Update related issue close-out notes with any behavioral changes introduced by review fixes
- Add a short "Copilot Feedback" section to
Minimum PR notes block:
## Copilot Feedback
- Review requested: YYYY-MM-DD
- Threads opened: <N>
- Threads resolved: <N>
- Follow-up commits: <sha1>, <sha2>
- Residual risk: None / <brief note>
Merge Rules
- Squash merge preferred for feature branches (clean history)
- Never force-push to
main - Never push directly to
main— always via PR - Delete branch after merge:
git branch -d feat/issue-48-...
CI Pipeline
On every push/PR, GitHub Actions runs:
- Backend lint (
flake8/black --check) - Backend tests (
pytest) - Frontend lint (
npm run lint) - Frontend tests (
npm test -- --run) - Frontend build (
npm run build)
All 5 must pass before merge is allowed.
Local pre-commit checks
# Run before pushing to catch issues early
cd backend && python -m pytest
cd frontend && npm run lint && npm test -- --run && npm run build
Pre-commit hooks are configured in .pre-commit-config.yaml.
Issue Linking
Closes #Nin commit or PR body → auto-closes issue when PR merges to mainFixes #N→ same behaviorRefs #N→ cross-reference without auto-close- Mention branch name in issue comments for tracking
Issue Close-Out Notes (Tracking Requirement)
For analytics and multi-issue batches (like #46, #48, #50), auto-closing is not enough. Add an issue comment with implementation/deploy evidence so issue history is auditable.
Use this flow:
- During PR: include
Closes #N/Refs #Nin PR body - After merge: add close-out comment to each issue with summary + evidence
- After deploy: update comment (or add follow-up) confirming production validation
Recommended references:
ISSUE_STATUS.mdfor roll-up status trackingdocs/PR_NOTES.mdfor reusable close-out note snippets
Posting Close-Out Comments via MCP
The GitHub MCP server is configured in ~/.config/Code/User/mcp.json. Copilot can post issue comments directly using the create_issue_comment MCP tool — no manual browser step needed.
When asked to close out an issue, use this tool:
Tool: create_issue_comment
owner: NPGrant81
repo: fantasy-football-pi
issue_number: <N>
body: <close-out comment text>
The MCP server requires GITHUB_TOKEN in the environment (set via ~/.bashrc → export GITHUB_TOKEN=$(gh auth token)). If the tool is unavailable, fall back to the manual gh CLI:
gh issue comment <N> --repo NPGrant81/fantasy-football-pi --body "..."
Issue comment template:
## Close-Out Notes
- Implemented in PR #<N>
- Branch: <branch-name>
- Commits: <sha1>, <sha2>
- Validation:
- [x] Backend tests passed
- [x] Frontend tests/build passed
- [x] Feature check completed
- Deployment: merged / deployed on YYYY-MM-DD
- Follow-ups: None / Refs #<N>
Worktree Rules
- Max 2 active worktrees:
main+ current feature branch - After PR merges:
git worktree remove <path>+git worktree prune - Never leave uncommitted changes in a worktree before switching
Always Do
- Create a branch for every change — never commit directly to
main - Include
Closes #Nin the PR body for every issue being addressed - Run the local test suite before pushing
- When prompted to sync/rebase, use the safe stash -> update main -> rebase -> restore flow above
- Reference the parent issue when working on sub-stories
- Keep commits atomic — one logical change per commit
- Post close-out notes on each related issue when work merges (and update after deploy)
- Request Copilot review on every PR and monitor threads to resolution
Never Do
- Never
git push --forceonmainor shared branches - Never
git reset --hardon a branch with unverified pushes - Never commit
.env, secrets, or__pycache__ - Never merge without CI passing
- Never rebase public branches after others have checked them out
Related Skills
- Project Bootstrap — repo setup
- Deployment — release process
- Testing — what CI runs
- Security —
.gitleaks.tomlsecret scanning in pre-comm
Content truncated.