بنقرة واحدة
branch
Start any unit of work — creates worktree + branch + optional Linear link
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Start any unit of work — creates worktree + branch + optional Linear link
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Feature-scoped security gate that runs at the Building → UAT seam (before pk ship). It classifies the change into sensitive categories (auth, payments, user-input, external-APIs, file-storage, PII) and, on any match, runs the category-specific security checklist against the feature's diff — producing a PASS/FAIL report + a Linear comment, and on PASS the sha-matched sentinel pk ship hard-requires (v4.17.0) on any project with a categories file. It does not transition state. Portable framework; the project's category definitions live in a per-project checks file. Different from /security-review (periodic repo-wide audit) and /pr-security-review (PR-scoped antagonistic review).
V2 daily-loop skill — plan + execute a Linear issue from inside its worktree. Use after pk branch opens a worktree. Use when an Approved Linear issue is ready for implementation. Native-on-Workflow is the sole executor (v4.0.0 removed the pluggable vbw backend).
Structured spec generation with auto-cycled agent review + tier auto-derive (v2.7.0-rc1+). Use when a Linear issue moves to spec stage. Use when writing/refining a feature spec before /work. Use when /spec-validator flags gaps.
Production-readiness gate for a feature about to reach its production environment — verifies the operational preconditions (error monitoring wired, no secrets in the client bundle, rate limiting on new public endpoints, backups active, feature flag for risky paths, dashboard chart) that the pre-deploy gate (/verify) does not. Produces a PASS/FAIL report + a Linear comment, and on PASS the sentinel pk promote hard-requires at the final hop (v4.17.0) on any project with a checks file; it does not transition state. Portable framework; concrete checks live in a per-project checks file. Different from /verify (code readiness) and /security-review (security audit).
verify — tier-aware evidence-gated pre-deploy gate. tier:standard|heavy write Logs/Verify/<date>/<id>/{evidence.txt,reality-check.md,verify-complete.md}; tier:quick writes only verify-complete.md on PASS. pk ship gates on a verify-complete.md whose sha matches HEAD. Use when a Linear issue is ready for verify (Stage 3). Use when /work finished and you need a Pass/Partial/Fail verdict per AC before pk ship.
Bug pipeline — intake, reproduce, regression-test-first, fix, ship, postmortem. Wraps /work and pk ship with discipline gates. Invoke when a bug is reported or spotted. Linear is the source of truth — resume by passing the issue ID.
| name | branch |
| description | Start any unit of work — creates worktree + branch + optional Linear link |
You are a branch and worktree manager. Your job is to create worktree-based branches for the project. Read method.config.md for the worktree prefix and project name. You handle features, fixes, and hotfixes.
/branch/branch <name> -> feature/ branch from dev
/branch --fix <name> -> fix/ branch from dev
/branch --hotfix <name> -> hotfix/ branch from main
/branch --linear PROJ-XX -> link to Linear issue
/branch finish -> clean up current worktree + branch
/branch list -> show active worktrees
| Flag | Branch Prefix | Base Branch | Use Case |
|---|---|---|---|
| (default) | feature/ | dev | New features |
--fix | fix/ | dev | Bug fixes |
--hotfix | hotfix/ | main | Production hotfixes (skip dev/beta) |
--linear PROJ-XX flagExample parsing:
/branch smart-add-panel -> feature/smart-add-panel from dev/branch --fix login-redirect -> fix/login-redirect from dev/branch --hotfix auth-crash -> hotfix/auth-crash from main--linear is passed (v1.8.0+)When the user passes only --linear PROJ-XX (no explicit name argument), derive the slug from the Linear issue title — but short (issue ID + 2-3 meaningful words), not the verbose gitBranchName field Linear returns.
Algorithm:
with, and, the, for, of, to, in, on, a, an, change, tracking, record (the last three are common Linear filler — extend the list as patterns surface).Result format: <PREFIX>-<NN>-<word1>-<word2>[-<word3>]
Examples (real Linear titles):
RS-21 — Record edit + delete with change tracking → RS-21-edit-deleteRS-19 — Sales results grid (AG Grid Community) → RS-19-sales-resultsRS-22 — Server-side audit logging → RS-22-audit-loggingIf the user passes both --linear PROJ-XX and an explicit name, the explicit name wins (use the user's name as the slug; still prefix with the Linear ID for traceability: <PREFIX>-<NN>-<user-name>).
This is deterministic — same Linear title always yields the same slug.
# Determine base branch
BASE_BRANCH="dev" # or "main" for --hotfix
git checkout "$BASE_BRANCH" 2>/dev/null || true
git pull origin "$BASE_BRANCH"
--linear is passed)If --linear PROJ-XX was specified, before any worktree creation, fetch the Linear issue and inspect its current status. This catches issues that have already been shipped, canceled, or duplicated and prevents wasted setup time.
1. mcp__linear-server__get_issue identifier=PROJ-XX
2. Inspect status name:
- Done / Canceled / Duplicate
→ AskUserQuestion:
"PROJ-XX is already {status}. Create worktree anyway?"
Options: ["Abort" (default), "Create anyway"]
If user picks Abort: stop here, no worktree, no symlinks.
If user picks Create anyway: proceed to Step 4 (worktree creation).
- In Progress / Building
→ Print warning: "⚠ PROJ-XX is already {status} — someone else may
be working on it. Proceeding."
Continue without prompting.
- Any other status (Approved, Specced, Needs Spec, On Deck, etc.)
→ Proceed silently.
3. Only after this status check passes, continue to worktree creation.
If --linear was not passed, skip this step entirely (no Linear API call, no behavior change).
This is the only Linear API call before worktree creation. Do not re-query Linear later in the flow — Step 6 (Linear status transition) reuses what we know from this check.
WORKTREE_PATH="{worktree prefix from method.config.md}{kebab-name}"
# Create worktree with new branch
git worktree add "$WORKTREE_PATH" -b {prefix}{kebab-name}
Only symlink files that actually exist -- skip any that are missing without error.
MAIN_REPO="$(git rev-parse --show-toplevel)"
# MCP servers
ln -sf "$MAIN_REPO/.mcp.json" "$WORKTREE_PATH/.mcp.json"
# Environment variables
ln -sf "$MAIN_REPO/.env" "$WORKTREE_PATH/.env"
# App-specific env
[ -f "$MAIN_REPO/apps/web/.env.local" ] && \
mkdir -p "$WORKTREE_PATH/apps/web" && \
ln -sf "$MAIN_REPO/apps/web/.env.local" "$WORKTREE_PATH/apps/web/.env.local"
# Sentry CLI config
[ -f "$MAIN_REPO/.sentryclirc" ] && \
ln -sf "$MAIN_REPO/.sentryclirc" "$WORKTREE_PATH/.sentryclirc"
# Claude Code local settings
[ -f "$MAIN_REPO/.claude/settings.local.json" ] && \
ln -sf "$MAIN_REPO/.claude/settings.local.json" "$WORKTREE_PATH/.claude/settings.local.json"
If --linear PROJ-XX was specified and the user did not abort in Step 3, update the Linear issue status to "In Progress" via mcp__linear-server__save_issue.
This preserves the prior post-creation behavior. The pre-check in Step 3 only inspects status; the transition happens here once the worktree exists.
Rename the current cmux workspace so it reflects the new work context:
bash ~/.claude/scripts/cmux-workspace-name.sh "{kebab-name}"
This sets the workspace title to {project} - {kebab-name} (read project name from method.config.md). Skip silently if cmux is unavailable.
Branch: {prefix}{kebab-name}
Worktree: {worktree prefix from method.config.md}{kebab-name}
Base: dev (or main for hotfix)
To start working:
cd {worktree prefix from method.config.md}{kebab-name} && claude --dangerously-skip-permissions
When done:
/branch finish
/branch finish cleans up a worktree and its branch.
Run from the parent repo (~/Projects/<repo>), not from inside the worktree being removed. git worktree remove fails if you're inside the directory it's deleting.
Typical sequence after the feature PR is rebase-merged:
# Inside the worktree:
exit # leave claude (drops to shell)
# Back at the parent shell:
cd ~/Projects/<repo> # if not already there
claude # or attach to your existing parent session
# In parent claude:
/branch finish RS-XX-edit-delete # explicit arg = unambiguous
# or:
/branch finish # no arg = auto-detect merged worktrees
In priority order:
/branch finish RS-XX-edit-delete) — match against git worktree list paths. If found, use it. If not, error: "no worktree matches RS-XX-edit-delete."exit and re-run from the parent:
"Detected /branch finish run from inside the worktree at . Re-run from the parent repo at —
git worktree removecan't delete the directory you're sitting in."
git worktree list worktrees that are NOT the parent. For each, check:
origin? (git branch -r --merged origin/dev | grep <branch>)delete_branch_on_merge=true is set on the repo (v1.7.0+ recommendation).# Run from the parent repo (this is where /branch finish executes):
git worktree remove "$WORKTREE_PATH"
git branch -d "$BRANCH_NAME" # only if merged
# Note: with delete_branch_on_merge=true, the remote branch is already gone.
# Only run the next line if for some reason it isn't:
# git push origin --delete "$BRANCH_NAME"
If git branch -d fails ("not fully merged" — happens after squash-merge because squash creates a new commit on dev that doesn't match the feature branch's commits in ancestry), use git branch -D (force-delete). Squash-merge is the correct case for -D; the content is on dev, the commit objects are not.
/branch list shows all active worktrees:
git worktree list