Claude-skill-registry feature-in-worktree
Develop features in isolated git worktrees with autonomous testing and iteration. Use when the user asks to develop a feature in a separate worktree, wants isolated feature development, or mentions working without affecting the current directory.
install
source · Clone the upstream repo
git clone https://github.com/majiayu000/claude-skill-registry
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/feature-in-worktree" ~/.claude/skills/majiayu000-claude-skill-registry-feature-in-worktree && rm -rf "$T"
manifest:
skills/data/feature-in-worktree/SKILL.mdsource content
Feature Development in Git Worktree
Develop features autonomously in isolated git worktrees, allowing you to work on new features without disrupting your current working directory.
Worktree Location Pattern
All worktrees are created in:
../dungeons-kotlin-worktree/{feature-name}
Example:
- Feature:
authentication-refactor - Worktree path:
../dungeons-kotlin-worktree/authentication-refactor - Branch:
feature/authentication-refactor
Workflow Instructions
1. Create Worktree
git worktree add ../dungeons-kotlin-worktree/{feature-name} {branch-name}
- Use descriptive feature names (e.g.,
,integration-tests
,user-auth
)dice-rolling - Branch names typically follow:
feature/{feature-name}
2. Work in Isolated Environment
Navigate to worktree and work using absolute paths:
- Edit files in
/Users/lars/devel/playground/dungeons-kotlin-worktree/{feature-name}/... - Run commands with appropriate working directory context
Permission Strategy:
- Request permissions based on the worktree root directory:
../dungeons-kotlin-worktree/{feature-name} - Do NOT request permissions for subdirectories (e.g.,
,src/main/kotlin/
)src/test/kotlin/ - This is more efficient - one root-level approval covers all work in the worktree
- Example: Ask for permission to work in
not../dungeons-kotlin-worktree/character-validation../dungeons-kotlin-worktree/character-validation/src/main/kotlin/io/dungeons/...
3. Implement Feature
- Make code changes
- Write/update tests
- Follow project conventions from
CLAUDE.md - Consult
for testing guidelinesdoc/unit_tests.md - Check
for architectural patternsdoc/decisions.md
4. Test Iteratively
cd ../dungeons-kotlin-worktree/{feature-name} ./gradlew clean build ./gradlew test
- Run tests after each significant change
- Fix failures iteratively
- Rely on Gradle output and test results for error detection
- Continue until all tests pass
5. Commit Changes
git add . git commit -m "feat: {description} 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>"
6. Push and Create PR (Optional)
git push -u origin {branch-name} gh pr create --title "{title}" --body "..."
7. Cleanup When Done
# After merging or abandoning feature git worktree remove ../dungeons-kotlin-worktree/{feature-name} # If branch should be deleted too git branch -d {branch-name}
Benefits
- Non-disruptive: Main working directory remains untouched
- Parallel work: Multiple worktrees for different features
- Clean testing: Isolated environment for each feature
- Safe experimentation: Easy to abandon without cleanup
- Full autonomy: Complete implementation cycles without interruption
Important Notes
- Always use absolute paths when working in worktrees
- Each worktree has its own working directory and index
- Worktrees share the same repository and branches
- Don't create worktree for same branch twice
- Clean up worktrees when feature is complete/merged
- CRITICAL: Request permissions at worktree root level only (e.g.,
), NOT for subdirectories - this is much more efficient../dungeons-kotlin-worktree/{feature-name}
Tool Limitations in Worktrees
CRITICAL: JetBrains MCP tools are NOT available in worktrees because the worktree project is not open in IntelliJ IDEA.
Unavailable Tools (DO NOT USE):
- ❌
- Not availablemcp__jetbrains__get_file_problems - ❌
- Not availablemcp__jetbrains__get_run_configurations - ❌
- Not availablemcp__jetbrains__execute_run_configuration - ❌
- Not availablemcp__jetbrains__reformat_file - ❌
- Not availablemcp__jetbrains__find_files_by_* - ❌
- Not availablemcp__jetbrains__search_in_files_* - ❌
- Not availablemcp__jetbrains__get_symbol_info - ❌
- Not availablemcp__jetbrains__rename_refactoring - ❌ All other
toolsmcp__jetbrains__*
Available Tools (USE THESE):
- ✅
- Read files directlyRead - ✅
- Create new filesWrite - ✅
- Modify existing filesEdit - ✅
- Find files by patternGlob - ✅
- Search file contentsGrep - ✅
- Run gradle, git, and other commandsBash - ✅
/WebSearch
- Research documentationWebFetch
Error Detection Strategy
Since JetBrains tools are unavailable, rely on:
- Gradle output - Compilation errors and warnings
- Test results - Test failures and stack traces
- Manual code review - Read files to verify correctness
- Grep/Glob - Search for patterns and potential issues
Example Usage
User: "Implement character creation validation in a worktree"
- Create:
git worktree add ../dungeons-kotlin-worktree/character-validation feature/character-validation - Implement validation logic with tests
- Run:
until passing./gradlew test - Commit and push
- Create PR
- Cleanup after merge
Troubleshooting
- "Branch already checked out": Use different branch or remove existing worktree
- Tests fail in worktree: Ensure all dependencies are available (check MongoDB, etc.)
- Path not found: Verify parent directory
exists (create if needed)../dungeons-kotlin-worktree/