Token导航 LogoToken导航TokenDH.com
待分类需要联网github未标认证来源可访问许可证需确认审计提醒

setup-branch设置分支

Agent Skill

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

总安装

1,572

周安装

63

GitHub Stars

公开资料未说明

下载量

509
CodexClaudeCursorGemini CLI

安装说明

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

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/morphet81/cheat-sheets --skill setup-branch

简介

用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息。

  • 适合在 Codex、Claude、Cursor、Gemini CLI 中围绕仓库状态、代码变更或协作事项进行整理。
  • 通过 npx skills add 命令从 morphet81/cheat-sheets 仓库安装。
  • 安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。
  • setup-branch 属于待分类类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

Create a new git branch and worktree from a JIRA ticket. Automatically names the branch based on the JIRA item type and sets up the worktree ready to work in.

Usage:

  • /setup-branch PROJ-123 - Create branch from JIRA ID
  • /setup-branch https://mycompany.atlassian.net/browse/PROJ-123 - Create branch from JIRA URL

Instructions:

  1. Check prerequisites:

- Atlassian CLI (acli): Run acli auth status to check if the CLI is installed and authenticated. - If the command is not found, display the following message and STOP: ` ## Missing Prerequisite: Atlassian CLI The acli command is not installed. This skill requires the Atlassian CLI to fetch JIRA issue details. Install it with: brew tap atlassian/acli && brew install acli - If the command fails with an authentication error, display the following message and **STOP**: ## Missing Prerequisite: Atlassian CLI Authentication The Atlassian CLI is not authenticated. Please run acli auth login to authenticate before using this skill. - **GitHub CLI (gh):** Run gh --version to check if the gh CLI is installed. If the command fails (not found), display the following message and **STOP**: ## Missing Prerequisite: GitHub CLI The gh command is not installed. This skill requires the GitHub CLI for repository operations. Install it from: https://cli.github.com/ - **GitHub CLI authentication:** Run gh auth status to check if gh is authenticated. If the command indicates the user is not logged in, display the following message and **STOP**: ## Missing Prerequisite: GitHub CLI Authentication The GitHub CLI is not authenticated. Please run gh auth login to authenticate before using this skill. `

  1. Parse the JIRA reference from $ARGUMENTS:

- If no argument is provided, inform the user of the expected usage and STOP - If the argument is a URL (contains atlassian.net/browse/ or similar), extract the JIRA ID from the URL path (e.g., https://mycompany.atlassian.net/browse/PROJ-123PROJ-123). If the JIRA ID cannot be extracted, show what was received and STOP - If the argument is already a JIRA ID (matches pattern like PROJ-123, ABC-1, etc.), use it directly - If the argument cannot be parsed as either a URL or JIRA ID, inform the user and STOP

  1. Fetch the JIRA item type:

- Use the Atlassian CLI to fetch the issue details for the extracted JIRA ID: acli jira workitem view <JIRA-ID> --fields issuetype --json - Identify the issue type (Bug, Story, Task, Epic, Sub-task, etc.) - If the fetch fails, ask the developer to provide the issue type manually using AskUserQuestion with options: "Bug", "Story/Task/Other"

  1. Determine the branch name:

- Lowercase the JIRA ID for use in the branch name (e.g., PROJ-123proj-123) - If the issue type is Bug: branch name is fix/<jira-id> (e.g., fix/proj-123) - For all other types (Story, Task, Epic, Sub-task, etc.): branch name is feat/<jira-id> (e.g., feat/proj-123)

  1. Ask which base branch to branch from:

- Run git branch --show-current to get the current working directory's branch name - Use AskUserQuestion to ask the developer which branch to use as the base - The first (default) option should be the current branch name (e.g., if you're on develop, suggest develop) - If the current branch is different from main, include main as a second option - Let the developer type a different branch name via the "Other" option

  1. Fetch the base branch from remote:

- Run git fetch origin <base-branch> - If the fetch fails (e.g., the base branch does not exist on the remote), show the error and STOP immediately. Do not continue with branch or worktree creation. - Do NOT checkout or pull the base branch — this avoids disrupting uncommitted work in the current worktree.

  1. Create the new branch and worktree together:

- If the branch name already exists locally (git rev-parse --verify <branch-name> succeeds), inform the user and STOP (do not force-create) - Determine the worktree path: take the parent directory of the current working directory and append the branch name with / replaced by - - Example: if CWD is /Users/dev/my-project and branch is fix/proj-123, the worktree path is /Users/dev/fix-proj-123 - If the worktree directory already exists, inform the user and STOP - Run git worktree add <worktree-path> -b <branch-name> origin/<base-branch> - This creates the new branch based on the remote base branch AND the worktree in a single command, without touching the current worktree - If the command fails, show the error and STOP

  1. Install dependencies in the new worktree:

- All commands in this step must run from the new worktree directory (use cd <worktree-path> before running them, or pass the cwd option) - Detect the package manager by checking for lock files in the new worktree directory: - bun.lockb or bun.lock → run bun install --frozen-lockfile - pnpm-lock.yaml → run pnpm install --frozen-lockfile - yarn.lock → run yarn install --frozen-lockfile - package-lock.json → run npm ci - If none of these lock files exist but a package.json is present → run npm install and warn that no lock file was found - If no package.json exists → skip dependency installation entirely - If the install command fails, show the error but do NOT delete the worktree — the developer may want to fix the issue manually

  1. Trust mise configuration:

- Run mise trust from the new worktree directory to trust any .mise.toml or .tool-versions file present - If mise is not installed (command not found), skip this step silently - If the command fails for any other reason, show a warning but continue

  1. Copy .env file to the new worktree:
  • Check if a .env file exists in the current working directory
  • If it exists, copy it to the root of the new worktree directory (cp.env <worktree-path>/.env)
  • If it does not exist, skip this step silently
  1. Create .agent file in the new worktree:
  • Write a simple config file at <worktree-path>/.agent containing the base branch name: baseBranch=<base-branch>
  • Example: if the base branch is main, the file contents would be baseBranch=main
  1. Show success message:

Display a summary with all relevant information:

## Branch Setup Complete

- JIRA: PROJ-123
- Type: Bug → fix/proj-123
- Base: origin/main
- Worktree: /Users/dev/fix-proj-123
- Dependencies: installed (npm ci)

To start working:
  cd /Users/dev/fix-proj-123

To push for the first time:
  git push -u origin fix/proj-123

适合场景

01

用户想查找某类 Agent Skill 时

02

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

03

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

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

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

能力 4

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

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

平台分布

Codex

37.77%
按下载量换算192

Claude

31.53%
按下载量换算160

Cursor

16.16%
按下载量换算82

Gemini CLI

9.27%
按下载量换算47

安全审计

Gen Agent Trust Hub

可疑

Socket

通过

Snyk

通过

权限和风险

需要联网

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

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills