google-agents-cli-scaffold
Project scaffolding, deployment configuration, and CI/CD setup for Google ADK agents.
merge-pr
Prepare PR for merge and guide human to merge via GitHub web UI. MUST BE USED when user wants to merge a PR. Verifies CI passing, verifies Beads issue already closed (from PR creation), and provides merge instructions. Issue closure happens at PR creation time (create-pull-request skill), NOT at ...
Full skill instructions
Prepare PR for human merge via GitHub web UI (<30 seconds prep).
Final step in V3 workflow: commit → create PR → fix PR → merge PR
Philosophy: AI prepares, human executes merge (trust + safety)
Handles:
Human responsibility:
Trigger phrases:
Automatically invoked when:
# Get current branch
BRANCH=$(git branch --show-current)
# Extract FEATURE_KEY from feature-<KEY>
FEATURE_KEY=$(echo $BRANCH | sed 's/^feature-//')
# Get PR number and URL
gh pr view --json number,url -q '{number, url}'
A. Check CI Status
gh pr view --json statusCheckRollup -q '.statusCheckRollup[] | select(.status == "COMPLETED") | {name, conclusion}'
Criteria:
B. Check Approvals (Recommended)
gh pr view --json reviewDecision -q '.reviewDecision'
Criteria:
C. Check Merge Conflicts
gh pr view --json mergeable -q '.mergeable'
Criteria:
CRITICAL: Must be clean before closing Beads
git status --porcelain
If dirty:
If clean:
CRITICAL: Issue must be closed BEFORE merge (happens at PR creation)
# Get current issue status
STATUS=$(bd show $FEATURE_KEY --json | jq -r '.status')
if [ "$STATUS" != "closed" ]; then
echo "❌ Error: Beads issue must be closed BEFORE merge"
echo ""
echo "Current status: $STATUS"
echo "Expected: closed"
echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "Why this matters:"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""
echo "Issues should be closed at PR creation time, not merge time."
echo "This ensures JSONL merges atomically with code (no post-merge mutations)."
echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "Recovery options:"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""
echo "Option 1: Close issue now (less ideal but works)"
echo " bd close $FEATURE_KEY --reason \"Closing before merge in PR #$PR_NUMBER\""
echo " bd sync && git push"
echo " # Then retry merge"
echo ""
echo "Option 2: Close and recreate PR (atomic pattern)"
echo " bd close $FEATURE_KEY --reason \"Work complete, ready for review\""
echo " bd sync && git push"
echo " gh pr close $PR_NUMBER"
echo " gh pr create # Creates new PR with JSONL already closed"
echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "Future prevention:"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""
echo "When creating PRs, use create-pull-request skill which asks:"
echo " 'Is work complete?' → YES closes issue BEFORE creating PR"
echo ""
exit 1
fi
echo "✅ Beads issue already closed (status: $STATUS)"
echo " → JSONL will merge atomically with code"
echo ""
Why verify instead of close:
This confirmation is REQUIRED. Provide web UI link and clear instructions.
✅ PR #156 Ready to Merge
Feature: GUARD_SKILL_ACTIVATION
Branch: feature-GUARD_SKILL_ACTIVATION
Beads: bd-pso (closed ✅)
Status:
✅ CI: All checks passed
✅ Beads: Closed and committed to feature branch
✅ Conflicts: None
✅ Working tree: Clean
📝 Merge Instructions:
1. Open PR in GitHub web UI:
https://github.com/fengning-starsend/prime-radiant-ai/pull/156
2. Click "Squash and merge" button
3. Verify squash commit message includes:
- Feature title
- PR number
- All commits squashed
4. Check "Delete branch" checkbox ✅
5. Confirm merge
After you merge, say "cleanup" and I'll switch to master and pull latest.
Why human merges:
gh pr merge local cleanup failuresDo not proceed automatically. Wait for:
# Verify PR actually merged
STATE=$(gh pr view $PR_NUMBER --json state -q .state)
if [ "$STATE" != "MERGED" ]; then
echo "⚠️ PR not merged yet. Waiting for merge..."
exit 1
fi
# Get merge commit hash
MERGE_COMMIT=$(gh pr view $PR_NUMBER --json mergeCommit -q '.mergeCommit.oid' | cut -c1-7)
# Switch to master
git checkout master
# Pull latest (includes merge)
git pull origin master
# Verify merge commit is on master (search recent 20 commits, not just HEAD)
git log --oneline -20 | grep -q "$MERGE_COMMIT"
# Delete local feature branch (remote already deleted via web UI)
git branch -d feature-$FEATURE_KEY 2>/dev/null || echo "Branch already deleted"
# Sync Beads (imports closure from git)
bd sync
After successful merge, cache docs for searchability:
DOC_DIR="docs/$FEATURE_KEY"
if [ -d "$DOC_DIR" ]; then
echo "💾 Caching docs to Serena..."
# Get issue details
ISSUE_JSON=$(bd show $FEATURE_KEY --json)
ISSUE_TITLE=$(echo "$ISSUE_JSON" | jq -r '.title')
ISSUE_TYPE=$(echo "$ISSUE_JSON" | jq -r '.type')
# Combine all markdown files into cache
CACHE_CONTENT="# $FEATURE_KEY: $ISSUE_TITLE
**Status:** closed (merged in PR #$PR_NUMBER)
**Type:** $ISSUE_TYPE
**Merged:** $(date +%Y-%m-%d)
**Source:** $DOC_DIR/
**[CACHE]** This is a searchable cache. Source of truth: git ($DOC_DIR/)
---
"
# Append all markdown files
find "$DOC_DIR" -name "*.md" -type f | while read file; do
echo "## $(basename $file .md)" >> /tmp/cache_${FEATURE_KEY}.tmp
echo "" >> /tmp/cache_${FEATURE_KEY}.tmp
cat "$file" >> /tmp/cache_${FEATURE_KEY}.tmp
echo "" >> /tmp/cache_${FEATURE_KEY}.tmp
echo "---" >> /tmp/cache_${FEATURE_KEY}.tmp
echo "" >> /tmp/cache_${FEATURE_KEY}.tmp
done
CACHE_CONTENT+=$(cat /tmp/cache_${FEATURE_KEY}.tmp)
rm /tmp/cache_${FEATURE_KEY}.tmp
# Write to Serena using MCP tool
mcp__serena__write_memory(
memory_file_name="${FEATURE_KEY}_merged",
content="$CACHE_CONTENT"
)
echo "✅ Cached to Serena: ${FEATURE_KEY}_merged"
echo " Search with: /search '@serena ${FEATURE_KEY}'"
else
echo "ℹ️ No docs to cache (Beads only)"
fi
Why auto-cache:
Verification:
✅ Merge Complete
Merged: GUARD_SKILL_ACTIVATION → master
Commit: a1b2c3d (squashed 50 commits)
Beads: bd-pso (closed, synced to master)
Workspace:
✅ On master branch
✅ Pulled latest changes
✅ Local branch deleted
✅ Beads state synced
Ready for next feature.
Before preparing:
Auto-prep allowed:
Require user approval:
Never auto-prep:
✅ Verify PR merge-readiness (CI, approvals, conflicts) ✅ Check working tree clean (block if dirty) ✅ Verify Beads issue already closed (error if not) ✅ Provide merge instructions with web UI link ✅ Wait for human to merge ✅ Clean up local workspace after merge ✅ Sync Beads state from master ✅ Auto-cache docs to Serena (if exist)
❌ Merge PR automatically (human does via web UI) ❌ Delete remote branch (human does via web UI checkbox) ❌ Skip user confirmation (always waits for "merged" confirmation) ❌ Close Beads issue (already closed at PR creation time by create-pull-request skill) ❌ Push to master (never, pre-push hook blocks) ❌ Modify JSONL on master (never - atomic merge pattern prevents this)
❌ Closing Beads at merge time (should be closed at PR creation) ❌ Committing to master directly (pre-push hook blocks this) ❌ Auto-merging without human confirmation ❌ Skipping working tree check ❌ Not verifying merge succeeded before cleanup ❌ Modifying JSONL on master (causes hook conflicts)
User: "merge the PR"
AI:
1. Checks PR #156: CI passed ✅, No conflicts ✅
2. Checks working tree: Clean ✅
3. Verifies bd-pso status: closed ✅ (closed at PR creation)
4. Presents merge instructions with web UI link
5. Waits...
User: [Merges via web UI, deletes branch]
User: "merged"
AI:
6. Verifies PR state = MERGED
7. Switches to master, pulls
8. Deletes local branch
9. Syncs Beads
10. Caches docs to Serena
11. Confirms: "✅ Merge complete, workspace clean"
User: "merge the PR"
AI:
1. Checks PR status: ✅ Ready
2. Checks working tree: ❌ Dirty (.beads/beads.left.meta.json modified)
3. Asks: "Working tree has uncommitted changes. Options:
a) Commit changes now
b) Stash changes
c) Abort merge prep"
User: "commit them"
AI:
4. Commits changes with Feature-Key trailer
5. Pushes to feature branch
6. Proceeds with Beads verification
7. Verifies issue closed ✅
8. Presents merge instructions
User: "merge the PR"
AI:
1. Checks CI: ❌ 2 checks failing (lint, test)
2. Blocks merge prep
3. Suggests: "❌ Cannot prepare merge: CI checks failing
Failing checks:
- lint: Line too long
- test: AssertionError in test_foo
Suggestion: Use 'fix the PR' to address failures first."
User: "merge the PR"
AI:
1. Checks PR #200: CI passed ✅, No conflicts ✅
2. Checks working tree: Clean ✅
3. Checks Beads status: ❌ in_progress (NOT closed!)
4. Errors with recovery options:
"❌ Error: Beads issue must be closed BEFORE merge
Current status: in_progress
Expected: closed
Why this matters:
Issues should be closed at PR creation time, not merge time.
This ensures JSONL merges atomically with code.
Recovery options:
Option 1: Close issue now (less ideal but works)
bd close bd-xyz --reason 'Closing before merge in PR #200'
bd sync && git push
# Then retry merge
Option 2: Close and recreate PR (atomic pattern)
bd close bd-xyz --reason 'Work complete, ready for review'
bd sync && git push
gh pr close 200
gh pr create # Creates new PR with JSONL already closed
Future prevention:
When creating PRs, use create-pull-request skill which asks:
'Is work complete?' → YES closes issue BEFORE creating PR"
User: "merge the PR"
AI:
1. Prepares merge (closes Beads, commits, pushes)
2. Presents merge instructions
3. Waits for confirmation...
User: [Merges immediately without saying anything]
User: "check if it merged"
AI:
4. Checks PR state: MERGED ✅
5. Proceeds with cleanup
6. Confirms completion
Cause: Uncommitted changes in working tree Fix: Commit or stash changes, then retry
Cause: Not on a feature branch, or PR doesn't exist Fix: Switch to feature branch with open PR
Cause: Required checks not passing Fix: Use fix-pr-feedback skill to address failures
Cause: Branch conflicts with master
Fix: Rebase on master: git fetch origin master && git rebase origin/master
Cause: Beads issue doesn't exist or already closed Fix: Verify issue ID matches branch name
Last Updated: 2025-11-13 Related Skills: create-pull-request, fix-pr-feedback, sync-feature-branch Helper Scripts: scripts/bd-link-pr References:
Changelog:
Project scaffolding, deployment configuration, and CI/CD setup for Google ADK agents.
Set up tracing, logging, and monitoring for deployed ADK agents across Cloud Trace, BigQuery, and third-party platforms.
Enterprise Azure infrastructure architect generating Bicep or Terraform from workload descriptions.
Plan and configure production-ready Azure Kubernetes Service clusters with Day-0 and Day-1 best practices.
Raw mechanical interfaces fusing Swiss typographic print with military terminal aesthetics. Rigid grids, extreme type scale contrast, utilitarian color, analog degradation effects. For data-heavy dashboards, portfolios, or editorial sites that need to feel like declassified blueprints.
Web search, scraping, extraction, crawling, and monitoring via ScrapeGraph AI CLI.
Skill for working with Firebase Hosting (Classic). Use this when you want to deploy static web apps, Single Page Apps (SPAs), or simple microservices. Do NOT use for Firebase App Hosting.
Deploy and manage web apps with Firebase App Hosting. Use this skill when deploying Next.js/Angular apps with backends.
Deploy applications and websites to Vercel. Use when the user requests deployment actions like "deploy my app", "deploy and give me the link", "push this live", or "create a preview deployment".
Build SEO-optimized pages at scale using templates, data, and proven playbook patterns.
Design and build isolated, reusable Convex backend components with clear boundaries and app-facing wrappers.
Deploy and manage projects on Vercel using token-based authentication. Use when working with Vercel CLI using access tokens rather than interactive login — e.g. "deploy to vercel", "set up vercel", "add environment variables to vercel".
Opus.ai: Revolutionize Your Web Experience
Build a no-code AI app in minutes.
An IDE for code migration from legacy to modern frameworks through coding agents.
Automate CGI animation in live-action scenes
Branded artistic QR-code concepts
Launch a website in seconds with AI.
Streamline Your Coding Experience with AI Code Helper
Convert any screenshot or design to clean code.