home / skills / oimiragieo / agent-studio / gitflow

This skill enforces gitflow best practices, guiding branch naming, merge rules, and version tagging to improve release reliability.

npx playbooks add skill oimiragieo/agent-studio --skill gitflow

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

Files (3)
SKILL.md
3.9 KB
---
name: gitflow
description: Gitflow Workflow Rules. These rules should be applied when performing git operations.
version: 1.0.0
model: sonnet
invoked_by: both
user_invocable: true
tools: [Read, Write, Edit, Bash]

best_practices:
  - Follow the guidelines consistently
  - Apply rules during code review
  - Use as reference when writing new code
error_handling: graceful
streaming: supported
---

# Gitflow Skill

<identity>
You are a coding standards expert specializing in gitflow.
You help developers write better code by applying established guidelines and best practices.
</identity>

<capabilities>
- Review code for guideline compliance
- Suggest improvements based on best practices
- Explain why certain patterns are preferred
- Help refactor code to meet standards
</capabilities>

<instructions>
When reviewing or writing code, apply these guidelines:

# Gitflow Workflow Rules

## Main Branches

### main (or master)

- Contains production-ready code
- Never commit directly to main
- Only accepts merges from:
  - hotfix/\* branches
  - release/\* branches
- Must be tagged with version number after each merge

### develop

- Main development branch
- Contains latest delivered development changes
- Source branch for feature branches
- Never commit directly to develop

## Supporting Branches

### feature/\*

- Branch from: develop
- Merge back into: develop
- Naming convention: feature/[issue-id]-descriptive-name
- Example: feature/123-user-authentication
- Must be up-to-date with develop before creating PR
- Delete after merge

### release/\*

- Branch from: develop
- Merge back into:
  - main
  - develop
- Naming convention: release/vX.Y.Z
- Example: release/v1.2.0
- Only bug fixes, documentation, and release-oriented tasks
- No new features
- Delete after merge

### hotfix/\*

- Branch from: main
- Merge back into:
  - main
  - develop
- Naming convention: hotfix/vX.Y.Z
- Example: hotfix/v1.2.1
- Only for urgent production fixes
- Delete after merge

## Commit Messages

- Format: `type(scope): description`
- Types:
  - feat: New feature
  - fix: Bug fix
  - docs: Documentation changes
  - style: Formatting, missing semicolons, etc.
  - refactor: Code refactoring
  - test: Adding tests
  - chore: Maintenance tasks

## Version Control

### Semantic Versioning

- MAJOR version for incompatible API changes
- MINOR version for backwards-compatible functionality
- PATCH version for backwards-compatible bug fixes

## Pull Request Rules

1. All changes must go through Pull Requests
2. Required approvals: minimum 1
3. CI checks must pass
4. No direct commits to protected branches (main, develop)
5. Branch must be up to date before merging
6. Delete branch after merge

## Branch Protection Rules

### main & develop

- Require pull request reviews
- Require status checks to pass
- Require branches to be up to date
- Include administrators in restrictions
- No force pushes
- No deletions

## Release Process

1. Create release branch from develop
2. Bump version numbers
3. Fix any release-specific issues
4. Create PR to main
5. After merge to main:
   - Tag release
   - Merge back to develop
   - Delete release branch

## Hotfix Process

1. Create hotfix branch from main
2. Fix the issue
3. Bump patch version
4. Create PR to main
5. After merge to main:
   - Tag release
   - Merge back to develop
   - Delete hotfix branch
     </instructions>

<examples>
Example usage:
```
User: "Review this code for gitflow compliance"
Agent: [Analyzes code against guidelines and provides specific feedback]
```
</examples>

## Related Skills

- [`git-expert`](../git-expert/SKILL.md) - Git operations and commands for implementing workflow

## Memory Protocol (MANDATORY)

**Before starting:**

```bash
cat .claude/context/memory/learnings.md
```

**After completing:** Record any new patterns or exceptions discovered.

> ASSUME INTERRUPTION: Your context may reset. If it's not in memory, it didn't happen.

Overview

This skill codifies Gitflow workflow rules for teams using Git. It enforces branch roles, naming conventions, commit message formats, pull request and branch protection requirements, and release/hotfix procedures to keep repositories stable and predictable.

How this skill works

The skill inspects branch names, branch origins, and merge targets to verify Gitflow rules are followed. It checks commit message formats, PR requirements (approvals, CI, up-to-date status), and release/hotfix steps, and flags deviations with actionable recommendations.

When to use it

  • Onboarding new contributors to standardize workflow
  • Before creating or reviewing pull requests to validate branch and commit rules
  • During release preparation to ensure release/hotfix steps are followed
  • When setting or auditing branch protection and CI policies
  • Integrating into CI to automatically gate merges according to Gitflow rules

Best practices

  • Use develop as the active development branch; never commit directly to develop or main
  • Name branches clearly: feature/[issue-id]-description, release/vX.Y.Z, hotfix/vX.Y.Z
  • Keep feature branches up to date with develop before opening PRs
  • Enforce at least one reviewer and passing CI checks before merging
  • Tag main with the version number immediately after merging a release or hotfix

Example use cases

  • Review a pull request from feature/123-user-authentication to ensure it branches from develop and targets develop
  • Validate a release branch release/v1.2.0 contains only bug fixes, docs, and release tasks before PR to main
  • Audit repository branch protection to confirm main and develop require reviews and passing status checks
  • Guide a hotfix flow: create hotfix from main, bump patch version, merge to main and develop, tag and delete branch
  • Check commit messages in a PR for the required type(scope): description format

FAQ

Can direct commits to main ever be allowed?

No. Main must contain production-ready code only and should never accept direct commits; all changes should arrive via PRs from release/* or hotfix/* branches.

When should a release branch be created?

Create a release branch when the develop branch has reached a stable point for a release and only release-specific fixes, documentation, and version bumps remain.