Token导航 LogoToken导航TokenDH.com
运维和基础设施需要联网github未标认证来源可访问clear审计通过

branch-discipline支部纪律

Agent Skill

branch-discipline 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

593

周安装

24

GitHub Stars

6

下载量

186
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:branch-discipline(支部纪律)
来源仓库:https://github.com/troykelly/claude-skills
仓库路径:skills/branch-discipline
安装命令:
npx skills add https://github.com/troykelly/claude-skills --skill branch-discipline
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/troykelly/claude-skills --skill branch-discipline

简介

branch-discipline 强制所有开发工作在 feature 分支上进行,保护 main 分支不被直接修改。

  • 适用于团队协作规范 enforcement、防止误操作与保障主干稳定性,内置硬拦截机制阻断违规提交。
  • 首次使用需展示当前分支状态,若发现位于 main 则立即终止并提示创建新分支,形成开发纪律闭环。
  • 仅依赖本地 Git 命令运行,无外部依赖,适合集成至 pre-commit hook 或 CI 门禁检查流程。
  • 适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

SKILL.md

Branch Discipline

Overview

Never work on main. Create feature branches for all work.

Core principle: The main branch is sacred. All work happens in feature branches.

This is a HARD GATE. Do not proceed with code changes if on main.

The Gate

┌─────────────────────────────────────┐
│         CODE CHANGE NEEDED          │
└─────────────────┬───────────────────┘
                  │
                  ▼
        ┌─────────────────┐
        │ Current branch? │
        └────────┬────────┘
                 │
       ┌─────────┴─────────┐
       │                   │
     main              feature/*
       │                   │
       ▼                   ▼
  ┌─────────┐         ┌─────────┐
  │  STOP   │         │ PROCEED │
  │ Create  │         │  with   │
  │ branch  │         │  work   │
  └─────────┘         └─────────┘

Check Current Branch

# Show current branch
git branch --show-current

# If output is "main" or "master" → STOP
# If output is feature/* or fix/* → PROCEED

Branch Naming Convention

Format

[type]/issue-[number]-[short-description]

Types

TypeUse For
featureNew functionality
fixBug fixes
choreMaintenance, dependencies
docsDocumentation only
refactorCode restructuring
testTest additions/fixes

Examples

feature/issue-123-user-authentication
fix/issue-456-login-redirect-loop
chore/issue-789-update-dependencies
docs/issue-101-api-documentation
refactor/issue-202-extract-validation
test/issue-303-add-integration-tests

Creating a Feature Branch

From Main (Default)

# Ensure main is up to date
git checkout main
git pull origin main

# Create and checkout new branch
git checkout -b feature/issue-[NUMBER]-[description]

# Push branch to remote (establishes tracking)
git push -u origin feature/issue-[NUMBER]-[description]

From Existing Feature Branch

When building on in-progress work:

# Checkout the base branch
git checkout feature/issue-100-base-feature

# Ensure it's up to date
git pull origin feature/issue-100-base-feature

# Create new branch from it
git checkout -b feature/issue-101-dependent-feature

Document the dependency in the issue.

Branch Lifecycle

Create → Work → Push → PR → Merge → Delete

After Merge

# Switch to main
git checkout main

# Pull the merge
git pull origin main

# Delete local branch
git branch -d feature/issue-123-completed-feature

# Delete remote branch (usually done via PR UI)
git push origin --delete feature/issue-123-completed-feature

Handling Stale Branches

If main has moved ahead:

# Option 1: Rebase (preferred for clean history)
git checkout feature/issue-123-my-feature
git fetch origin
git rebase origin/main

# Option 2: Merge (if conflicts are complex)
git checkout feature/issue-123-my-feature
git fetch origin
git merge origin/main

Protected Branches

Main should be protected. Never:

  • Push directly to main
  • Force push to main
  • Delete main

If you accidentally commit to main:

# If not yet pushed - move commits to new branch
git branch feature/issue-123-accidental-main
git reset --hard origin/main

# If already pushed - DO NOT force push
# Instead, revert and recreate in proper branch

Multiple Issues, Same Branch?

Generally NO. Each issue gets its own branch.

Exception: Tightly coupled sub-issues from issue-decomposition MAY share a branch if:

  • They are sequential dependencies
  • They will be merged together
  • They are part of the same PR

Document this in the issues if doing so.

Verification

Before making any code change:

# Check current branch
BRANCH=$(git branch --show-current)

# Verify not on main
if [ "$BRANCH" = "main" ] || [ "$BRANCH" = "master" ]; then
    echo "ERROR: On protected branch. Create feature branch first."
    exit 1
fi

# Verify branch follows naming convention
if ! echo "$BRANCH" | grep -qE '^(feature|fix|chore|docs|refactor|test)/issue-[0-9]+-'; then
    echo "WARNING: Branch name doesn't follow convention"
fi

Common Mistakes

MistakePrevention
Committing to mainCheck branch before every commit
Pushing to mainBranch protection rules
Wrong base branchVerify before creating branch
Outdated branchRebase/merge before PR
Branch name typosUse consistent naming

Checklist

Before writing any code:

  • Current branch is NOT main
  • Branch name follows convention
  • Branch is from correct base
  • Branch is pushed to remote
  • Issue number is in branch name

Integration

This skill is called by:

  • issue-driven-development - Step 6

This skill enables:

  • Clean separation of work
  • Easy PR creation
  • Safe experimentation

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Gemini CLI

29.24%
按下载量换算54

Antigravity

21.25%
按下载量换算40

Claude Code

18.38%
按下载量换算34

OpenCode

14.26%
按下载量换算27

Cursor

8.04%
按下载量换算15

Codex

3.65%
按下载量换算7

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。

来源信息

继续浏览同类 Skills