pro-init-worktree
Skill6 starsChanged 32 days agoMITView on GitHub
Create a git worktree from a branch name and copy only the needed local files (found via .gitignore) with reasons. Use for worktree creation, branch-isolated work, or /init-worktree.
- Reads credentials
In this repository17 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- llms.txtllms.txt
- pro-agent-testSkill
- pro-changelog-deploySkill
- pro-commitSkill
- pro-desktop-controlSkill
- pro-figmaSkill
- pro-githubSkill
- pro-launchSkill
- pro-oss-consultSkill
- pro-reportSkill
- pro-reviewSkill
- pro-skill-creatorSkill
- pro-sshSkill
- pro-testcaseSkill
- pro-ui-designSkill
The file
We split this skill into the rules it gives an agent
9 rules. About 0 are common, 3 are distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 10
When you need a worktree, branch-isolated work or an independent work environment, or on /init-worktree.
- Distinctive: line 33
If there is no branch name, show the usage and stop
- Very specific: line 46
Do not write a temporary Python script.
- Very specific: line 60
If there is a set from last time, copy copy_now as is and judge only new_candidates.
- Very specific: line 82
Do not build the commit template yourself.
- Distinctive: line 85
If the issue cannot be read (no PAT and so on), leave out the template line.
- Very specific: line 99
Look for worktree_manager.py in this order:
- Distinctive: line 110
Do not type git worktree remove --force yourself.
- Very specific: line 116
If there are uncommitted changes, it returns dirty with the change list and stops.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Git worktree setup
When to use
- When you need a worktree, branch-isolated work or an independent work environment, or on
/init-worktree. - Typical requests: "create a worktree", "set up a worktree for this branch" (Korean: "워크트리 만들어줘", "worktree 생성해줘").
Take a branch name, create the git worktree automatically, survey local-file candidates from .gitignore, and copy only the files the worktree needs, each with a reason.
Talk to the user in the user's language (or the configured language preference).
User input
$ARGUMENTS
No input
Show the usage:
/init-worktree
20260120_#163_Add_a_template_for_Github_ProjectsProcess
Step 1: Extract the branch name
- Extract the branch name from the user input (keep it as is, including
#) - If there is no branch name, show the usage and stop
Step 2: Prepare the environment
# Go to the project root
cd [project_root]
# Git long path support (Windows, once)
git config --global core.longpaths trueStep 3: Create the worktree
Do not write a temporary Python script. Pass the branch name (with # and non-ASCII text as is) to --branch (script lookup: ../references/common-rules.md §Standard call pattern, SKILL=pro-init-worktree).
PYTHONIOENCODING=utf-8 {PYTHON} {SCRIPTS}/worktree_cli.py create --root {source_root} --branch "{branch name}" --base origin/develop- A new branch is cut from
--base. Without it, the branch is cut from the currently checked-out HEAD, so calling it on top of another work branch drags in unrelated commits. Name the development branch (origin/developand so on). An existing local or remote branch is used as is, regardless of--base. worktreein the result JSON is the new folder path. If it fails, read the first error inoutput_tail.
Step 4: Survey and selectively copy gitignored local files
Read references/local-files.md and follow it as written. The essentials:
- Recall first:
{PYTHON} {SCRIPTS}/worktree_cli.py recall --root {source_root}(script lookup:../references/common-rules.md§Standard call pattern,SKILL=pro-init-worktree). If there is a set from last time, copycopy_nowas is and judge onlynew_candidates. On the first run (first_time), judge everything. - Do not
cpthe remembered set by hand:{PYTHON} {SCRIPTS}/worktree_cli.py copy --root {source_root} --to {worktree_path}(files that already exist in the target are not touched without--overwrite; for newly judged files use--files a,b). - Record right after copying:
{PYTHON} {SCRIPTS}/worktree_cli.py record --root {source_root} --copied a,b --skipped c. Pass relative paths only (never file contents or values). If you skip this call, the next worktree makes the same judgment again. - First build an inventory of candidates that really exist in the source from
.gitignore. Do not copy only file names you happen to recognize. - Classify each candidate as
copy recommended/needs judgment/copy not recommended. If unclear, check whether project files reference it and promote it. (.env*·application-*.yml·key.properties·*.jks·google-services.json·GoogleService-Info.plistare recommended; caches, IDE files, dependencies and logs are not.) - Print copied, skipped and missing candidates all with a reason. Missing candidates are not treated as failures.
Step 5: Output the result
✅ Worktree created!
📍 Path: [worktree_path]
📋 Copied files:
✅ android/app/google-services.json
✅ ios/Runner/GoogleService-Info.plist
📝 Commit message template:
{template from get-commit-template, as is}Do not build the commit template yourself. Call github_cli.py get-issue {owner} {repo} {number} with the issue number from the branch name
to get the original title and URL, then show the template from github_cli.py get-commit-template "{original title}" "{issue URL}" as is.
The type is inferred from the title tag (bug → fix, feature → feat). If you hard-code feat, a bug fix bumps the minor version in a semver_auto repo.
If the issue cannot be read (no PAT and so on), leave out the template line.
Branch name rules
#: kept as is in the git branch name; converted to_only in the folder name- Special characters: converted to
_when building the folder name - Worktree location: the
{project name}-Worktree/folder (for examplemyapp-Worktree)
Script location
Skip the search below if the fixed entry point exists (#942):
~/.projectops/bin/projectops_cli.pyappears after any CLI has run once. Each call finds the newest installed script and passes the arguments through, so a plugin update mid-session does not pin you to an old path.PYTHONIOENCODING=utf-8 python3 ~/.projectops/bin/projectops_cli.py init-worktree <subcommand> ...(if it is missing or returnsscripts_not_found, use the search below). If the response hasnewer_installed, call this entry point again. In zsh, do not store the command in a variable (P="python3 …"; $Pexits 127). To shorten it, wrap it in a function:G(){ PYTHONIOENCODING=utf-8 python3 ~/.projectops/bin/projectops_cli.py init-worktree "$@"; }→G recall --root {source_root}.
Look for worktree_manager.py in this order:
scripts/worktree_manager.py
Customize
Your own language, tone and rules apply: see ../references/preferences.md. Read them once at the start: run the snippet in ../references/preferences.md with SKILL_ID=pro-init-worktree.
Keys for this skill: the common language, tone, rules only.
Preferences change presentation only; approval gates, secret protection and --dry-run stay in force.
Remove a finished worktree
Do not type git worktree remove --force yourself. First check that the issue is really closed, then:
PYTHONIOENCODING=utf-8 {PYTHON} {SCRIPTS}/worktree_cli.py remove --root {source_root} --branch "{branch name}"If there are uncommitted changes, it returns dirty with the change list and stops. Use --force only after the user decides they can be discarded. The branch and commits remain.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

