Land a feature branch: pull from main, rebase the branch, create a PR, and merge it via rebase with automatic branch deletion. Use when ready to land a completed feature branch.
Use this skill to land a feature branch in one smooth flow.
Note: Steps 1-2 use scripts in
./scripts/that are pre-allowlisted in settings.json, so they won't require permission prompts.
main)# Use the allowlisted script to verify we're ready to land
./scripts/verify-branch
This script checks:
main (need to be on a feature branch)If you accidentally made commits directly on main instead of a feature branch:
# Check how many commits you're ahead of origin/main
git log --oneline origin/main..HEAD
# Create a new branch with your commits (pick a descriptive name)
git branch my-feature-branch
# Reset main back to match origin/main
git reset --hard origin/main
# Switch to your new branch
git checkout my-feature-branch
# Verify: your commits should now be on the feature branch
git log --oneline -5
Why this works:
git branch creates a new branch pointing to your current commitgit reset --hard origin/main moves main back to where it should beNow continue with the land-branch workflow from Step 2.
# Use the allowlisted script to fetch, rebase, and push
./scripts/rebase-main
This script:
.claude-workspace)--force-with-lease (safe force push)If rebase has conflicts, resolve them manually, run git rebase --continue,
then re-run the script.
IMPORTANT: If your changes modified any pattern's input type (the type
parameter to pattern<Input>), you MUST check if other patterns import and use
that pattern.
# Get list of changed .tsx files
CHANGED_PATTERNS=$(git diff --name-only $MAIN_REMOTE/main...HEAD -- '*.tsx')
if [ -n "$CHANGED_PATTERNS" ]; then
echo "Changed patterns:"
echo "$CHANGED_PATTERNS"
echo ""
echo "Checking for downstream dependencies..."
for file in $CHANGED_PATTERNS; do
# Extract the pattern name from the file path
PATTERN_NAME=$(basename "$file" .tsx)
# Search for imports of this pattern in other files
IMPORTERS=$(grep -l "from.*['\"].*${PATTERN_NAME}['\"]" patterns/**/*.tsx 2>/dev/null | grep -v "$file" || true)
if [ -n "$IMPORTERS" ]; then
echo ""
echo "ā ļø $PATTERN_NAME is imported by:"
echo "$IMPORTERS"
echo " ā Check if input type changes require updates to these files!"
fi
done
fi
What to check:
page-creator.tsx imports many patterns for its launcher buttonsExample: If hotel-membership-extractor.tsx input changes from 10 fields to
3 fields, page-creator.tsx must be updated to only pass the 3 valid fields.
After updating any importing patterns, you MUST verify they compile and deploy:
# For each pattern that imports the changed pattern, test deployment
# Example: if page-creator.tsx imports hotel-membership-extractor.tsx
cd ../labs && deno task cf piece new \
--api-url http://localhost:8000 \
--identity ../labs/claude.key \
--space testing \
/path/to/community-patterns/patterns/$USER/page-creator.tsx
Why this matters:
If deployment fails:
IMPORTANT: Before creating a PR, verify that
patterns/$GITHUB_USER/README.md is up to date for any patterns touched in this
branch.
# Get list of changed pattern files
CHANGED_PATTERNS=$(git diff --name-only $MAIN_REMOTE/main...HEAD -- 'patterns/*/[^W]*.tsx' 'patterns/*/WIP/*.tsx')
if [ -n "$CHANGED_PATTERNS" ]; then
echo "Patterns changed in this branch:"
echo "$CHANGED_PATTERNS"
echo ""
echo "ā ļø Verify README.md is updated for these patterns!"
fi
For each changed pattern, check:
New patterns - Add a complete entry to README.md:
Significantly modified patterns - Review the existing entry:
Patterns moved from WIP to root - Update both sections:
Example README entry format:
#### `pattern-name.tsx`
One-line description of what this pattern does.
**Interesting features:**
- Notable implementation detail or framework feature used
- Interesting pattern or technique
- Integration with other patterns
If README needs updating:
patterns/$GITHUB_USER/README.md to add/update pattern entriesCRITICAL: Always verify changed patterns compile before creating a PR. This catches missing imports, type mismatches, and other errors that will fail CI.
# From community-patterns directory, test that a pattern compiles
# Note: Command must be on ONE LINE (multi-line breaks argument parsing)
cd ../labs && deno task cf piece new --identity ../labs/claude.key --api-url http://localhost:8000 --space test-compile ../community-patterns/patterns/$GITHUB_USER/my-pattern.tsx
If compilation succeeds: You'll see a piece ID like baedrei...
If compilation fails: You'll see a CompilerError with the exact file and
line:
[ERROR] Cannot find name 'computed'.
1039 | const notesDiffChunks = computed(() => {
| ^
To fix:
computed, cell, derive)Why this matters:
# Check if PR already exists for this branch
EXISTING_PR=$(gh pr view $CURRENT_BRANCH --json number --jq '.number' 2>/dev/null)
if [ -n "$EXISTING_PR" ]; then
echo "PR #$EXISTING_PR already exists for this branch"
PR_NUMBER=$EXISTING_PR
else
# Create new PR
# Adjust --repo flag based on fork status
if [ "$IS_FORK" = "true" ]; then
gh pr create \
--repo jkomoros/community-patterns \
--title "$(git log -1 --format=%s)" \
--body "$(cat <<'EOF'
## Summary
Auto-generated PR for branch landing.
## Testing
- [x] Tested locally
š¤ Generated with [Claude Code](https://claude.com/claude-code)
EOF
)"
else
gh pr create \
--title "$(git log -1 --format=%s)" \
--body "$(cat <<'EOF'
## Summary
Auto-generated PR for branch landing.
## Testing
- [x] Tested locally
š¤ Generated with [Claude Code](https://claude.com/claude-code)
EOF
)"
fi
# Get the PR number
PR_NUMBER=$(gh pr view --json number --jq '.number')
fi
echo "PR #$PR_NUMBER ready"
By default, wait for CI checks to pass before merging.
# Wait for CI then merge (default behavior)
./scripts/land-pr
# Or specify a PR number explicitly
./scripts/land-pr 123
To skip waiting for CI (use with caution):
# Force merge without waiting for CI
./scripts/land-pr --force
# Or with explicit PR number
./scripts/land-pr --force 123
The land-pr script:
--force is used)All steps use allowlisted scripts that don't require permission prompts:
# Step 1: Verify we're ready
./scripts/verify-branch
# Step 2: Rebase and push
./scripts/rebase-main
# Step 3: Create PR (use gh commands as shown above)
# Step 4: Wait for CI and merge
./scripts/land-pr
# Or force merge without waiting for CI
./scripts/land-pr --force
--force sparingly - only when you're confident CI will pass--rebase for merging (preserves commit history)