git-workflow
Git best practices, branching strategies, commit conventions, and PR workflows. Use when reviewing git history, writing commits, setting up branching strategy, or improving git practices. Triggers on "git best practices", "commit message", "branching strategy", or "PR workflow".
What this skill does
# Git Workflow
Git best practices, commit conventions, branching strategies, and pull request workflows. Guidelines for maintaining a clean, useful git history.
## When to Apply
Reference these guidelines when:
- Writing commit messages
- Creating branches
- Setting up git workflows
- Reviewing pull requests
- Maintaining git history
## Rule Categories by Priority
| Priority | Category | Impact | Prefix |
|----------|----------|--------|--------|
| 1 | Commit Messages | CRITICAL | `commit-` |
| 2 | Branching Strategy | HIGH | `branch-` |
| 3 | Pull Requests | HIGH | `pr-` |
| 4 | History Management | MEDIUM | `history-` |
| 5 | Collaboration | MEDIUM | `collab-` |
## Quick Reference
### 1. Commit Messages (CRITICAL)
- `commit-conventional` - Use conventional commits
- `commit-atomic` - Atomic commits (one logical change)
- `commit-present-tense` - Use imperative present tense
- `commit-meaningful` - Descriptive, meaningful messages
- `commit-body` - Add body for complex changes
- `commit-references` - Reference issues/tickets
- `commit-git-hooks` - Enforce standards with Husky + commitlint
### 2. Branching Strategy (HIGH)
- `branch-naming` - Consistent branch naming
- `branch-feature` - Feature branch workflow
- `branch-main-protected` - Protect main branch
- `branch-short-lived` - Keep branches short-lived
- `branch-delete-merged` - Delete merged branches
- `branch-release` - Release branch strategy
- `branch-workflow-strategies` - GitFlow vs GitHub Flow vs Trunk-Based
- `branch-monorepo` - Monorepo git workflows
### 3. Pull Requests (HIGH)
- `pr-small` - Keep PRs small and focused
- `pr-description` - Write clear descriptions
- `pr-reviewers` - Request appropriate reviewers
- `pr-ci-pass` - Ensure CI passes
- `pr-squash` - Squash when appropriate
- `pr-draft` - Use draft PRs for WIP and early feedback
### 4. History Management (MEDIUM)
- `history-rebase` - Rebase vs merge
- `history-no-force-push` - Avoid force push to shared branches
- `history-clean` - Keep history clean
- `history-tags` - Use tags for releases
- `history-worktree` - Work on multiple branches with git worktree
### 5. Collaboration (MEDIUM)
- `collab-code-review` - Effective code reviews
- `collab-conflicts` - Handle merge conflicts
- `collab-communication` - Communicate changes
- `collab-gitignore` - .gitignore best practices
## Essential Guidelines
### Conventional Commits
```
# Format
<type>(<scope>): <subject>
<body>
<footer>
```
#### Types
| Type | Description |
|------|-------------|
| `feat` | New feature |
| `fix` | Bug fix |
| `docs` | Documentation only |
| `style` | Formatting, no code change |
| `refactor` | Code change, no feature/fix |
| `perf` | Performance improvement |
| `test` | Adding/updating tests |
| `chore` | Maintenance, dependencies |
| `ci` | CI/CD changes |
| `build` | Build system changes |
| `revert` | Revert previous commit |
#### Examples
```bash
# ✅ Good commit messages
feat(auth): add password reset functionality
fix(cart): resolve quantity update race condition
docs(readme): add installation instructions
refactor(api): extract validation into middleware
test(user): add unit tests for registration
chore(deps): update dependencies to latest versions
# With body and footer
feat(orders): implement order cancellation
Add ability for users to cancel pending orders within 24 hours.
Cancelled orders trigger refund process automatically.
Closes #123
BREAKING CHANGE: Order status enum now includes 'cancelled'
# ❌ Bad commit messages
fix bug
update
WIP
asdfasdf
changes
misc fixes
```
### Branch Naming
```bash
# ✅ Good branch names
feature/user-authentication
feature/JIRA-123-password-reset
fix/cart-total-calculation
fix/issue-456-login-redirect
hotfix/security-patch
docs/api-documentation
refactor/database-queries
chore/update-dependencies
# ❌ Bad branch names
new-feature
john-branch
test
fix
temp
asdf
```
### Branch Workflow
```bash
# Main branches
main # Production-ready code
develop # Integration branch (optional)
# Supporting branches
feature/* # New features
fix/* # Bug fixes
hotfix/* # Production hotfixes
release/* # Release preparation
# Workflow
git checkout main
git pull origin main
git checkout -b feature/user-profile
# Work on feature...
git add .
git commit -m "feat(profile): add profile page"
# Keep branch updated
git fetch origin
git rebase origin/main
# Push and create PR
git push -u origin feature/user-profile
```
### Atomic Commits
```bash
# ❌ One commit doing multiple things
git commit -m "Add login, fix header, update deps"
# ✅ Separate commits for each change
git commit -m "feat(auth): add login page"
git commit -m "fix(header): correct navigation alignment"
git commit -m "chore(deps): update React to v18.2"
```
### Commit Frequently, Push Regularly
```bash
# ✅ Small, frequent commits
git commit -m "feat(cart): add product to cart"
git commit -m "feat(cart): display cart item count"
git commit -m "feat(cart): implement remove item"
git commit -m "test(cart): add unit tests"
# ❌ One massive commit
git commit -m "feat: implement entire shopping cart"
```
### Pull Request Best Practices
#### PR Title
```
# Format (like commit)
<type>(<scope>): <description>
# ✅ Good PR titles
feat(auth): implement OAuth2 login
fix(checkout): resolve payment processing error
docs(api): add endpoint documentation
# ❌ Bad PR titles
Update
Fix stuff
WIP
```
#### PR Description Template
```markdown
## Summary
Brief description of what this PR does.
## Changes
- Added user authentication endpoints
- Implemented JWT token generation
- Added password hashing with bcrypt
## Testing
- [ ] Unit tests pass
- [ ] Integration tests pass
- [ ] Manual testing completed
## Screenshots (if UI changes)
[Add screenshots here]
## Related Issues
Closes #123
Related to #456
## Checklist
- [ ] Code follows project conventions
- [ ] Self-review completed
- [ ] Tests added/updated
- [ ] Documentation updated
```
### Keep PRs Small
```
# ✅ Focused PRs
PR #1: Add user model and migrations
PR #2: Implement user registration endpoint
PR #3: Add email verification
PR #4: Implement login/logout
# ❌ Large unfocused PR
PR #1: Add entire user authentication system
(2000+ lines, 50+ files)
```
### Rebase vs Merge
```bash
# ✅ Rebase for feature branches (clean history)
git checkout feature/my-feature
git fetch origin
git rebase origin/main
# Resolve any conflicts
git push --force-with-lease # Only your branch!
# ✅ Merge for integrating to main (preserve context)
git checkout main
git merge --no-ff feature/my-feature
# Creates merge commit, preserves branch history
# ❌ Never force push to shared branches
git push --force origin main # NEVER DO THIS
```
### Interactive Rebase (Clean Up)
```bash
# Before pushing, clean up commits
git rebase -i HEAD~5
# In editor:
pick abc123 feat: add login page
squash def456 fix typo
squash ghi789 more fixes
pick jkl012 feat: add logout
# Result: clean history with meaningful commits
```
### Handling Conflicts
```bash
# During rebase
git rebase origin/main
# CONFLICT in file.ts
# 1. Open conflicted files
# 2. Resolve conflicts (remove markers)
# 3. Stage resolved files
git add file.ts
# 4. Continue rebase
git rebase --continue
# Or abort if needed
git rebase --abort
```
### Git Hooks
```bash
# .husky/pre-commit
#!/bin/sh
npm run lint
npm run test:unit
# .husky/commit-msg
#!/bin/sh
npx commitlint --edit $1
# commitlint.config.js
module.exports = {
extends: ['@commitlint/config-conventional'],
};
```
### Tagging Releases
```bash
# Semantic versioning tags
git tag -a v1.0.0 -m "Release version 1.0.0"
git push origin v1.0.0
# List tags
git tag -l "v1.*"
# Tag format
v1.0.0 # Major.Minor.Patch
v1.0.0-beta.1 # Pre-release
v1.0.0-rc.1 # Release candidate
```
### .gitignore Best Practices
```gitignore
# Dependencies
node_modules/
vendor/
# Build outputs
dist/
build/
.next/
# Environment files
.env
.env.local
.env.*.local
# IDRelated in Writing & Docs
jax-development
IncludedUse this skill when the user is writing, debugging, profiling, refactoring, reviewing, benchmarking, parallelising, exporting, or explaining JAX code, or when they mention JAX, jax.numpy, jit, grad, value_and_grad, vmap, scan, lax, random keys, pytrees, jax.Array, sharding, Mesh, PartitionSpec, NamedSharding, pmap, shard_map, Pallas, XLA, StableHLO, checkify, profiler, or the JAX repo. It helps turn NumPy or PyTorch-style code into pure functional JAX, fix tracer/control-flow/shape/PRNG bugs, remove recompiles and host-device syncs, choose transforms and sharding strategies, inspect jaxpr/lowering/IR, and benchmark compiled code correctly.
nature-article-writer
IncludedDrafts, rewrites, diagnostically critiques, and style-calibrates primary research manuscripts for Nature and Nature Portfolio journals. Use when the user wants a Nature-style title, summary paragraph or abstract, introduction, results, discussion, methods, figure legends, presubmission enquiry, cover letter, reviewer response, or when a scientific draft sounds generic, jargon-heavy, structurally weak, or AI-ish and needs precise, broad-reader-friendly prose without inventing data, analyses, or references. Best for primary research articles and letters rather than reviews or press releases unless explicitly adapting one.
deckrd
IncludedDocument-driven framework that derives requirements, specifications, implementation plans, and executable tasks from goals through structured AI dialogue. Use when user says "write requirements", "create spec", "plan implementation", "derive tasks", "structure this feature", "break down into tasks", or "document this module". Also use for reverse engineering existing code into docs (/deckrd rev). Do NOT use for direct code writing — use /deckrd-coder after tasks are generated. Do NOT use when the user only wants to run or fix existing code without planning.
clinical-decision-support
IncludedGenerate professional clinical decision support (CDS) documents for pharmaceutical and clinical research settings, including patient cohort analyses (biomarker-stratified with outcomes) and treatment recommendation reports (evidence-based guidelines with decision algorithms). Supports GRADE evidence grading, statistical analysis (hazard ratios, survival curves, waterfall plots), biomarker integration, and regulatory compliance. Outputs publication-ready LaTeX/PDF format optimized for drug development, clinical research, and evidence synthesis.
handling-sf-data
IncludedSalesforce data operations with 130-point scoring. Use this skill to create, update, delete, bulk import/export, generate test data, and clean up org records using sf CLI and anonymous Apex. TRIGGER when: user creates test data, performs bulk import/export, uses sf data CLI commands, needs data factory patterns for Apex tests, or needs to seed/clean records in a Salesforce org. DO NOT TRIGGER when: SOQL query writing only (use querying-soql), Apex test execution (use running-apex-tests), or metadata deployment (use deploying-metadata).
accelint-ac-to-playwright
IncludedConvert and validate acceptance criteria for Playwright test automation. Use when user asks to (1) review/evaluate/check if AC are ready for automation, (2) assess if AC can be converted as-is, (3) validate AC quality for Playwright, (4) turn AC into tests, (5) generate tests from acceptance criteria, (6) convert .md bullets or .feature Gherkin files to Playwright specs, (7) create test automation from requirements. Handles both bullet-style markdown and Gherkin syntax with JSON test plan generation and validation.