Skip to main content
skill CX Codex

git-workflow · asyrafhussin — Claude Code skill: what it does, how to install

Defines standards for Conventional Commits, branch naming patterns, and pull request structures. Useful when setting up clean Git habits across a project.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add AsyrafHussin/agent-skills --skill git-workflow -a claude-code
Open on GitHub

What git-workflow does

The skill groups Git practices into five priority levels: commit messages, branching strategy, pull requests, history management, and collaboration. It relies on Conventional Commits (feat, fix, refactor, chore, and related tags). Every commit must stay atomic. One commit handles one logical change.

It provides branch naming conventions like feature/* and hotfix/*, guidelines on rebase versus merge, and a pull request description template with test checkboxes. The prompt also suggests enforcing rules with Husky and commitlint. Without automated Git hooks, following these standards remains entirely manual for team members.

What it helps with

  • write Conventional Commits with exact types and scopes
  • name branches consistently for features and hotfixes
  • structure pull request descriptions with testing checklists
  • break large code changes into atomic commits

Example prompts for the agent

  • Write a conventional commit message for the cart update
  • Suggest a branch name for the login redirect fix
  • Draft a pull request description for the new authentication routes

How to install git-workflow

1Skills CLI (Vercel)

npx skills add AsyrafHussin/agent-skills --skill git-workflow -a claude-code

2Manually: put the files in place

~/.claude/skills/git-workflow/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/git-workflow/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about git-workflow

How do I install git-workflow in Claude Code?

Run npx skills add AsyrafHussin/agent-skills --skill git-workflow -a claude-code in your terminal.

Which commit types does this skill support?

It covers standard Conventional Commits types: feat, fix, docs, style, refactor, perf, test, chore, ci, build, and revert.

Are Husky and commitlint required?

No, the skill guides the agent without extra tools. Husky and commitlint are simply recommended to enforce the rules automatically during git commit.

Source text

SKILL.md · MIT
---
name: git-workflow
description: 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".
license: MIT
metadata:
  author: AsyrafHussin
  version: "1.2.0"
---

# 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

# IDE
.idea/
.vscode/
*.swp

# OS files
.DS_Store
Thumbs.db

# Logs
*.log
logs/

# Test coverage
coverage/

# Cache
.cache/
*.cache
```

### Useful Git Commands

```bash
# View commit history
git log --oneline --graph --all

# See what changed
git diff --staged
git diff HEAD~1

# Undo last commit (keep changes)
git reset --soft HEAD~1

# Discard local changes
git checkout -- file.ts
git restore file.ts  # Git 2.23+

# Stash changes
git stash
git stash pop
git stash list

# Cherry-pick commit
git cherry-pick abc123

# Find who changed a line
git blame file.ts

# Search commits
git log --grep="fix"
git log -S "functionName"
```

## Output Format

When reviewing git practices, output findings:

```
[category] Description of issue or suggestion
```

Example:
```
[commit] Use imperative mood: "Add feature" not "Added feature"
[branch] Branch name 'test' should follow pattern: feature/description
[pr] PR is too large (50+ files), consider splitting
```

## How to Use

Read individual rule files for detailed explanations:

```
rules/commit-conventional-format.md
rules/branch-naming-convention.md
rules/pr-small-focused.md
```

## References

- [Git Official Documentation](https://git-scm.com/doc) - Comprehensive Git documentation
- [Pro Git Book](https://git-scm.com/book/en/v2) - The complete Pro Git book
- [Conventional Commits](https://www.conventionalcommits.org) - Commit message specification
- [GitHub Flow](https://docs.github.com/en/get-started/quickstart/github-flow) - Lightweight workflow
- [How to Write a Git Commit Message](https://chris.beams.io/posts/git-commit/) - Commit message guide
- [Google Code Review Practices](https://google.github.io/eng-practices/review/) - Code review best practices

## Examples from Well-Known Projects

Learn from projects with excellent git practices:
- **Linux Kernel** - Detailed commit messages and patch workflow
- **React** - Conventional commits and thorough PR reviews
- **Vue.js** - Clean commit history and good PR templates
- **TypeScript** - Structured branching and clear release process
- **Next.js** - Conventional commits and automated releases

## Configuration Examples

### Commitlint

```javascript
// commitlint.config.js
module.exports = {
  extends: ['@commitlint/config-conventional'],
  rules: {
    'type-enum': [
      2,
      'always',
      ['feat', 'fix', 'docs', 'style', 'refactor', 'perf', 'test', 'chore', 'ci', 'build', 'revert']
    ],
    'subject-max-length': [2, 'always', 72],
    'body-max-line-length': [2, 'always', 100]
  }
};
```

### Husky Git Hooks

```bash
# .husky/commit-msg
#!/bin/sh
npx commitlint --edit $1

# .husky/pre-commit
#!/bin/sh
npm run lint
npm test
```

### GitHub PR Template

```markdown
# .github/PULL_REQUEST_TEMPLATE.md
## Summary
Brief description of changes

## Changes
- List key changes
- One per line

## Testing
- [ ] Unit tests pass
- [ ] Integration tests pass
- [ ] Manual testing completed

## Related
Closes #issue-number
```

---

## Metadata

**Skill Version:** 1.2.0
**Last Updated:** 2026-03-08
**Total Rules:** 31
**Categories:** 5 (Commit Messages, Branching Strategy, Pull Requests, History Management, Collaboration)

**Compatible With:**
- Git 2.0+
- GitHub, GitLab, Bitbucket, Azure DevOps

**Recommended Tools:**
- [Git](https://git-scm.com/) - Version control system
- [GitHub CLI](https://cli.github.com/) - GitHub command-line tool
- [Commitlint](https://commitlint.js.org/) - Commit message linter
- [Husky](https://typicode.github.io/husky/) - Git hooks
- [Semantic Release](https://semantic-release.gitbook.io/) - Automated versioning

---

## License

MIT License. This skill is provided as-is for educational and development purposes.

© AsyrafHussin · MIT · AsyrafHussin/agent-skills

Similar skills

All skills for Git and GitHub →

git-workflow by other authors comes first.

git-workflow affaan-m A skill that hands your agent Git conventions: which branching strategy to pick, how to word commits, and when rebase beats merge. CX Codex +1 5,000installs git-workflow agno-team A skill that enforces best practices for commits, branch names, and pull requests. Includes commit message validation, branch naming templates, and PR checklist structure — useful if your team has git standards. CX Codex +1 665installs git-workflow ruvnet A skill that walks branches, conflicts and the pull request lifecycle, with a diff-risk score before every merge. CX Codex +1 743installs git-workflow Galaxy-Dawn Enforces Git standards: Conventional Commits, branch naming, no-ff merge flows, and conflict resolution. Useful for teams needing consistent version control habits. CX Codex +1 374installs git-workflow jezweb Guides Git work for pull requests, merged-branch cleanup, conflict resolution, and monorepo release tags in Claude Code. CX Codex +1 1,200installs triage Matt Pocock This skill moves issues and external PRs through triage states, verification, and agent briefs. It fits maintainers managing an issue queue. 990,453installs code-review Matt Pocock Reviews changes from a chosen reference point against repository standards and the originating spec. Use it for a branch, PR, or work in progress. 789,521installs implement Matt Pocock Implements work from a specification or tickets, following a test-driven flow and ending with review and a commit. Use it when a coding task needs a defined delivery routine. 774,700installs git-guardrails-claude-code Matt Pocock This skill adds a Claude Code hook that stops risky Git commands before they run. Use it when an agent must not push or discard working-tree changes. 499,069installs setup-pre-commit Matt Pocock This skill configures pre-commit checks for a JavaScript repository, running Prettier, type checking, and tests before each commit. 489,289installs scaffold-exercises Matt Pocock This skill builds course exercise directories with sections, problems, solutions, and explainers. Use it when starting a new course section or creating exercise stubs. 480,196installs

From the same set17

tailwind-best-practices Tailwind CSS v3.4+ and v4 conventions for AI coding agents. It guides responsive mobile-first layouts, dark mode, and migrations to version 4. CX Codex +1 941installs api-design-patterns A skill with 38 REST API rules covering resources, errors, security, pagination and versioning. Useful when an agent writes or reviews endpoints. CX Codex +1 929installs laravel-testing Guides AI agents in writing Laravel 13 feature and unit tests with Pest 4 or PHPUnit 12, covering model factories and service mocks. CX Codex +1 907installs testing-best-practices A rule set for unit and integration tests and TDD: 34 rules in 7 categories, TypeScript with Jest and Vitest. Useful while writing tests or reviewing someone else's. CX Codex +1 899installs e2e-playwright-testing A skill that guides the agent through writing Playwright E2E tests: locators, auth reuse, forms, assertions and CI config. CX Codex +1 796installs state-management A skill that hands your agent ready patterns for TanStack Query v5 and Zustand v5: fetching, caching, mutations, optimistic updates and client stores. CX Codex +1 783installs code-slop Flags synthetic AI patterns in PHP/Laravel and TypeScript/React codebases. Use it during PR reviews to weed out empty wrappers, mock-everything tests, and narrating comments. CX Codex +1 769installs laravel-ai-sdk A coding assistant skill containing 17 rules for laravel/ai. It guides the agent through building AI workflows, embeddings, and tests in Laravel 13. CX Codex +1 656installs

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor