skills/workflow/git-workflow/SKILL.md
Use when making commits, creating branches, or managing Git operations. Ensures consistent Git practices and proper commit messages.
npx skillsauth add liauw-media/codeassist git-workflowInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Maintain clean, readable Git history with meaningful commits and consistent branching practices.
This is a firm policy. Commits represent human accountability.
MANDATORY: Use verification-before-completion skill before EVERY commit.
Never commit without:
One logical change per commit.
✅ Good commits:
feat(auth): add email validation to login formfix(api): handle null values in user profile endpointtest(checkout): add e2e tests for payment flow❌ Bad commits:
feat: add login, fix bugs, update tests, refactor codeWhy small commits:
When changes affect both frontend and backend:
MANDATORY before commit:
1. ✅ Backend tests pass (unit + integration)
2. ✅ E2E tests pass (full user flow)
3. ✅ API tests pass (if API changed)
4. ✅ Frontend tests pass (component + integration)
Never commit:
Every project MUST have pre-commit hooks.
Minimum hooks required:
See: .claude/skills/safety/pre-commit-hooks/SKILL.md for setup
<type>(<scope>): <subject>
<body>
<footer>
Must be one of:
feat: New featurefix: Bug fixdocs: Documentation only changesstyle: Code style changes (formatting, missing semi-colons, etc)refactor: Code refactoring (no functional changes)perf: Performance improvementstest: Adding or updating testsbuild: Build system or dependenciesci: CI/CD changeschore: Other changes (gitignore, etc)Component or module affected:
auth: Authenticationapi: API endpointsdatabase: Database changesui: User interfacetests: Test filesBREAKING CHANGE: descriptionCloses #123, Fixes #456feat(auth): add JWT token-based authentication
Implement stateless authentication using Laravel Sanctum:
- User registration with email/password
- Login returns bearer token
- Protected routes use auth:sanctum middleware
- Token revocation on logout
Closes #45
fix(api): resolve N+1 query in user list endpoint
Added eager loading for user relationships to prevent
multiple database queries per user.
Performance improvement: 50+ queries → 2 queries
Fixes #78
docs: update README with authentication setup
Add step-by-step guide for:
- Installing Sanctum
- Configuring .env variables
- Running migrations
- Testing authentication
❌ Updated stuff
- Too vague, no context
❌ Added authentication.
- Capitalized, has period, no detail
❌ feat: add auth with JWT and social login and fix bugs and update docs
- Too long, multiple unrelated changes
❌ WIP
- Meaningless, what is in progress?
❌ fix: fixed the bug
- Redundant, no detail about which bug
<type>/<short-description>
Types:
feature/ - New featuresfix/ - Bug fixeshotfix/ - Urgent production fixesrefactor/ - Code refactoringdocs/ - Documentationtest/ - Test-related workExamples:
feature/jwt-authenticationfix/login-validation-errorhotfix/security-patch-xssrefactor/user-controllerdocs/api-documentation# Ensure you're on main/master and up to date
git checkout main
git pull origin main
# Create and switch to new branch
git checkout -b feature/authentication
# Or create from specific branch
git checkout -b fix/login-bug develop
# Make changes
[edit files]
# Stage changes
git add path/to/file.php
# Or stage all changes (careful!)
git add .
# Commit with good message
git commit -m "feat(auth): add user registration endpoint
Implement registration with email/password validation.
Returns JWT token on successful registration.
Closes #23"
# Push to remote
git push -u origin feature/authentication
# Option 1: Merge (preserves history)
git checkout main
git pull origin main
git checkout feature/authentication
git merge main
# Option 2: Rebase (cleaner history)
git checkout feature/authentication
git fetch origin
git rebase origin/main
See finishing-a-development-branch skill for complete checklist.
✅ DO commit:
❌ DON'T commit:
Ensure proper .gitignore for your framework:
Laravel:
/vendor/
/node_modules/
.env
.env.*.local
/storage/*.key
/public/hot
/public/storage
/storage/logs/
/bootstrap/cache/*.php
backups/
Node.js:
node_modules/
.env
.env.*.local
dist/
build/
*.log
.DS_Store
Python:
__pycache__/
*.pyc
.env
.venv/
venv/
*.log
.pytest_cache/
.coverage
Before committing:
# Add forgotten files to last commit
git add forgotten-file.php
git commit --amend --no-edit
# Or change commit message
git commit --amend -m "new commit message"
# ⚠️ Only amend commits that haven't been pushed
# Discard changes in working directory
git restore path/to/file.php
# Unstage changes (keep in working directory)
git restore --staged path/to/file.php
# Undo last commit (keep changes)
git reset HEAD~1
# Undo last commit (discard changes) ⚠️
git reset --hard HEAD~1
# Save current changes temporarily
git stash
# List stashes
git stash list
# Apply most recent stash
git stash pop
# Apply specific stash
git stash apply stash@{0}
# Apply specific commit from another branch
git cherry-pick <commit-hash>
GitHub:
# Using GitHub CLI
gh pr create --title "feat(auth): Add JWT authentication" --body "Implements user authentication with JWT tokens
- Registration endpoint
- Login endpoint
- Protected routes
- Tests included
Closes #45"
GitLab:
# Using GitLab CLI
glab mr create --title "feat(auth): Add JWT authentication" --description "Implements user authentication with JWT tokens
- Registration endpoint
- Login endpoint
- Protected routes
- Tests included
Closes #45"
Use the same format as commit messages:
## What
Implements JWT authentication for API
## Why
Needed stateless authentication for mobile app support
## Changes
- Added Laravel Sanctum
- User registration endpoint
- Login/logout endpoints
- Auth middleware on protected routes
- 15 tests covering auth flows
## Testing
- All tests pass (127 total)
- Manual testing completed
- API documentation updated
Closes #45
Use before committing:
code-review - Review your changesverification-before-completion - Ensure everything worksdatabase-backup - Before running testsRelated skills:
finishing-a-development-branch - Complete checklist before PR/MRgit-worktrees - Working on multiple branchesThis skill is based on:
Social Proof: Companies like Google, Microsoft, and GitHub use commit message conventions.
Before making commits:
Bottom Line: Git history is documentation. Write it for humans who will read it later (including future you). Clean Git history makes debugging, code review, and collaboration easier.
development
Use when decomposing complex work. Dispatch fresh subagent per task, review between tasks. Flow: Load plan → Dispatch task → Review output → Apply feedback → Mark complete → Next task. No skipping reviews, no parallel dispatch.
development
# Server Documentation System Set up a documentation system that tracks changes and maintains server/project documentation with Claude Code hooks. ## When to Use - Setting up a new server or development environment - Need to track configuration changes over time - Want automatic documentation of work sessions - Maintaining changelog for infrastructure ## Directory Structure ``` ~/docs/ # User home directory (cross-platform) ├── changelog.md # Global over
development
Delegate tasks to remote Claude Code agent containers for parallel execution, long-running analysis, or resource-intensive operations.
development
Use when working on multiple features simultaneously. Creates isolated workspaces without branch switching, enabling parallel development.