home / skills / aidotnet / moyucode / git-workflow

git-workflow skill

/skills/community/git-workflow

This skill automates Git operations, generates Conventional Commits messages, manages branches, and creates PR descriptions to streamline version control

npx playbooks add skill aidotnet/moyucode --skill git-workflow

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
2.6 KB
---
name: git-workflow
description: 自动化Git操作,智能生成遵循Conventional Commits的提交信息、分支管理和PR描述生成。
metadata:
  short-description: 智能Git操作和提交信息
---

# Git Workflow Skill

## Description
Automate Git operations with intelligent commit messages, branch management, and PR descriptions.

## Trigger
- `/commit` command
- `/branch` command
- `/pr` command
- User requests Git assistance

## Prompt

You are a Git workflow expert that helps with version control operations.

### Commit Message Generation

Follow Conventional Commits format:

```
<type>(<scope>): <description>

[optional body]

[optional footer(s)]
```

#### Types
- `feat`: New feature
- `fix`: Bug fix
- `docs`: Documentation changes
- `style`: Code style (formatting, semicolons)
- `refactor`: Code refactoring
- `perf`: Performance improvements
- `test`: Adding/updating tests
- `chore`: Maintenance tasks
- `ci`: CI/CD changes

#### Examples

```bash
# Feature
feat(auth): add OAuth2 login with Google provider

- Implement GoogleAuthProvider class
- Add callback endpoint /auth/google/callback
- Store refresh tokens securely

Closes #123

# Bug fix
fix(api): handle null response in user service

The getUserById method was throwing when user not found.
Now returns null and lets caller handle the case.

Fixes #456

# Breaking change
feat(api)!: change response format for pagination

BREAKING CHANGE: Pagination now uses cursor-based format.
Old: { page, limit, total }
New: { cursor, hasMore, items }
```

### Branch Naming

```bash
# Feature branches
feature/user-authentication
feature/JIRA-123-add-payment-gateway

# Bug fix branches
fix/login-redirect-loop
fix/JIRA-456-null-pointer-exception

# Hotfix branches
hotfix/security-patch-xss

# Release branches
release/v1.2.0
```

### PR Description Template

```markdown
## Summary
Brief description of changes

## Changes
- Added UserAuthService with JWT support
- Created login/register API endpoints
- 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
```

### Git Commands Helper

```bash
# Interactive rebase last 3 commits
git rebase -i HEAD~3

# Squash commits
git rebase -i HEAD~N  # then change 'pick' to 'squash'

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

# Cherry-pick specific commit
git cherry-pick <commit-hash>

# Stash with message
git stash push -m "WIP: feature description"
```

## Tags
`git`, `version-control`, `workflow`, `automation`, `commits`

## Compatibility
- Codex: ✅
- Claude Code: ✅

Overview

This skill automates common Git operations and generates Conventional Commits–style messages, consistent branch names, and clear PR descriptions. It speeds up routine workflows by producing standardized commit text, suggesting branch names, and assembling PR templates ready for review. The skill supports interactive commands for commit, branch, and PR assistance.

How this skill works

The skill inspects staged changes, commit history, and user-provided context to propose a Conventional Commits message that includes type, scope, description, optional body, and footers. It suggests branch names based on work type and ticket IDs, and fills a PR description template with summary, change list, testing checklist, screenshots section, and related issues. It also provides common Git command snippets for rebasing, squashing, cherry-picking, stashing, and undoing commits.

When to use it

  • When you need a Conventional Commits-compliant commit message quickly
  • When creating a new feature, bugfix, hotfix, or release branch
  • When drafting a pull request description for reviewers
  • When you want quick Git command examples for rebasing, squashing, or undoing changes

Best practices

  • Provide a concise scope and clear description to keep commits meaningful
  • Reference issue or ticket IDs in the footer (e.g., Closes #123) to link changes to work items
  • Use suggested branch names that include type and ticket for traceability (feature/JIRA-123-name)
  • Run unit and integration tests before finalizing PR description checkboxes
  • Squash or rebase locally to keep history clean before opening a PR

Example use cases

  • Generate a Conventional Commits message for a new OAuth feature: feat(auth): add OAuth2 login with Google provider
  • Create a bugfix branch and commit message: branch fix/JIRA-456-handle-null && commit fix(api): handle null response in user service
  • Assemble a PR description that lists changes, testing steps, screenshots, and related issues
  • Get concise Git commands for interactive rebase, squash, cherry-pick, or undoing the last commit

FAQ

Which commit types are supported?

Supports common Conventional Commit types: feat, fix, docs, style, refactor, perf, test, chore, and ci.

Can it suggest branch names from ticket IDs?

Yes. Provide a ticket or short description and it will format branch names like feature/JIRA-123-add-payment-gateway.