github-worktree

Creates GitHub Issue-linked branches and git worktrees for bk-ci development in Cursor.

2.5k|524|Updated May 29, 2019
One-click install
npx skills add https://github.com/TencentBlueKing/bk-ci --skill github-worktree
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: github-worktree
Source: https://github.com/TencentBlueKing/bk-ci/tree/main/ai/skills/github-worktree
Command: npx skills add https://github.com/TencentBlueKing/bk-ci --skill github-worktree

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

When working on the bk-ci repository's master branch, developers need a disciplined way to spin up isolated work environments tied to GitHub Issues without manually juggling branch naming, worktree creation, IDE config syncing, and jOOQ code generation.

Core Features & Use Cases

  • Issue-Driven Branching: Links work to an existing GitHub Issue or creates a new one on TencentBlueKing/bk-ci via GitHub MCP, then derives a conventional branch name like feat-knowledge-13058.
  • Automated Worktree Setup: Cross-platform scripts (PowerShell and Bash) create a new branch based on origin/master together with a git worktree, then sync .idea and .cursor configs into it.
  • Environment Bootstrap: After worktree creation, the scripts run all jOOQ generation Gradle tasks in src/backend/ci and open the new worktree in a new Cursor window.
  • Use Case: A developer on master is asked to fix a pipeline bug. The skill confirms the issue, creates branch bug-12994 with a matching worktree, syncs IDE settings, runs jOOQ generation, and opens a fresh Cursor window ready for coding.

Quick Start

Ask the assistant to create a worktree for GitHub Issue 12994 following the github-worktree workflow while on the master branch.

Frequently Asked Questions about github-worktree

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a git worktree with a new branch for a GitHub Issue?

Run the git-worktree script with the add action, passing the branch name and base ref origin/master. The script creates the branch and worktree together, then syncs .idea and .cursor configs into the new worktree.

How should I name branches linked to GitHub Issues in bk-ci?

Use the pattern {type}-{keywords}-{issue号}, where type is feat, bug, pref, refactor, or issue inferred from the issue title prefix, labels, or issue type. The issue number must be the final segment, e.g. feat-knowledge-13058.

Does this workflow work outside Cursor IDE?

No, the workflow only activates inside Cursor IDE, detected via Workspace Path and the cursor CLI. In other environments the skill is skipped and the user's request is handled directly.

What happens if the branch already exists locally when adding a worktree?

The add action fails immediately if a local branch with the same name exists, since it always creates a new branch together with the worktree. You must rename the branch or clean up the old branch and worktree first.

Why does worktree creation fail during jOOQ generation?

After creating the worktree, the script runs all jOOQ Gradle tasks in src/backend/ci, which requires database access. If the database is unreachable or generation errors occur, the script exits with failure until the connection or generation issue is fixed.