Use when user wants to "hand off to SDK", "run autonomous agent", "bridge CLI and SDK", "long-running tasks", "autonomous development", or mentions SDK bridge workflows. Provides comprehensive patterns for hybrid CLI/SDK development with the Claude Agent SDK.
Inherits all available tools
Additional assets for this skill
This skill inherits all available tools. When active, it can use any tool Claude has access to.
examples/handoff-scenarios.mdexamples/workflow-example.mdreferences/configuration.mdreferences/state-files.mdBridge Claude Code CLI and Agent SDK for seamless hybrid workflows. Hand off long-running tasks to autonomous agents, monitor progress, and resume in CLI when complete.
Commands:
/sdk-bridge:init - Initialize project for SDK bridge/sdk-bridge:handoff - Hand off work to autonomous SDK agent/sdk-bridge:status - Monitor progress/sdk-bridge:resume - Resume in CLI after completion/sdk-bridge:cancel - Stop running SDK agentWorkflow: Plan → Init → Handoff → Monitor → Resume
✅ Use SDK Bridge when:
❌ Don't use for:
Work interactively to create a comprehensive plan:
# Create plan with feature list
/plan
# Review generated feature_list.json
cat feature_list.json | jq '.[] | {description, test}'
# Refine if needed
# Edit feature_list.json to clarify vague features
# Ensure each feature has clear test criteria
# Commit the plan
git add feature_list.json CLAUDE.md
git commit -m "Initial project plan"
Best practices:
/sdk-bridge:init
This creates .claude/sdk-bridge.local.md with configuration:
Review and customize the configuration for your project needs.
/sdk-bridge:handoff
What happens:
Validation: Handoff-validator agent checks:
feature_list.json exists with failing featuresLaunch: If validation passes:
nohup.claude/sdk-bridge.pid.claude/sdk-bridge.log.claude/handoff-context.jsonAutonomous Work: SDK agent:
feature_list.json and claude-progress.txtpasses: true in feature_list.jsonclaude-progress.txtYou can close the CLI - the SDK agent runs independently.
/sdk-bridge:status
Shows:
Monitoring options:
/sdk-bridge:statustail -f .claude/sdk-bridge.loggit log --onelinejq '.[] | select(.passes==true) | .description' feature_list.json/sdk-bridge:resume
What happens:
Completion check: Verifies .claude/sdk_complete.json exists
Analysis: Completion-reviewer agent:
Report: Presents comprehensive summary:
Continue: You're back in interactive CLI mode
During SDK bridge workflows, these files coordinate state:
project/
├── feature_list.json # Source of truth for features (SDK reads/writes)
├── claude-progress.txt # Session-to-session memory (SDK writes)
├── CLAUDE.md # Session protocol (SDK reads)
├── init.sh # Environment bootstrap (SDK executes)
├── .git/ # Version control (SDK commits)
└── .claude/
├── sdk-bridge.local.md # Configuration (plugin reads)
├── handoff-context.json # Handoff tracking (plugin writes)
├── sdk-bridge.log # SDK output (harness writes)
├── sdk-bridge.pid # Process ID (plugin writes)
└── sdk_complete.json # Completion signal (harness/plugin writes)
Edit .claude/sdk-bridge.local.md to customize:
---
enabled: true
model: claude-sonnet-4-5-20250929 # or claude-opus-4-5-20251101
max_sessions: 20
reserve_sessions: 2
progress_stall_threshold: 3
auto_handoff_after_plan: false
---
# SDK Bridge Configuration
[Your project-specific notes]
model: Which Claude model SDK uses
claude-sonnet-4-5-20250929 (default) - Fast, capable, cost-effectiveclaude-opus-4-5-20251101 - Most capable, slower, more expensivemax_sessions: Total sessions before stopping (default: 20)
max_sessions - reserve_sessionsreserve_sessions: Keep N for manual intervention (default: 2)
progress_stall_threshold: Stop if no progress for N sessions (default: 3)
auto_handoff_after_plan: Auto-launch after /plan (default: false)
true: Immediately hand off after plan creationfalse: Manual handoff with /sdk-bridge:handoff# Day 1: Planning
/plan
# Create 40 features for a new web app
/sdk-bridge:init
/sdk-bridge:handoff
# Close laptop, go home
# Day 2: Check progress
/sdk-bridge:status
# 32/40 features passing, 12 sessions used
# Day 3: SDK completes
/sdk-bridge:resume
# Review: 38/40 done, 2 features need clarification
# Fix issues manually, continue development
# Round 1: Bulk implementation
/sdk-bridge:handoff
# ... SDK completes 30/50 features ...
/sdk-bridge:resume
# Review quality, fix issues
# Improve implementations, add tests
git commit -m "Refine SDK implementations"
# Round 2: Continue remaining features
/sdk-bridge:handoff
# ... SDK completes remaining 20 ...
/sdk-bridge:resume
# Implement core features first
jq '.[0:20]' all-features.json > feature_list.json
git add feature_list.json && git commit -m "Phase 1 features"
/sdk-bridge:handoff
# ... SDK completes 20 features ...
/sdk-bridge:resume
# Add next batch
jq '.[20:40]' all-features.json > feature_list.json
git add feature_list.json && git commit -m "Phase 2 features"
/sdk-bridge:handoff
# ... continue ...
# SDK heading wrong direction
/sdk-bridge:status
# Only 3/50 passing after 10 sessions - something's wrong
/sdk-bridge:cancel
# Review what happened
git log --oneline -10
tail -100 .claude/sdk-bridge.log
cat claude-progress.txt
# Identify issue: Feature #1 was too vague
vim feature_list.json
# Clarify feature descriptions, add better test criteria
git commit -m "Clarify feature requirements"
# Try again with better guidance
/sdk-bridge:handoff
# .claude/sdk-bridge.local.md
---
auto_handoff_after_plan: true
---
/plan
# Automatically hands off immediately
# Check progress later with /sdk-bridge:status
Good:
{
"description": "User can register with email and password",
"passes": false,
"test": "POST /api/register with valid data returns 201 and JWT token"
}
Bad:
{
"description": "Authentication",
"passes": false,
"test": "it works"
}
Put foundational features first:
Start simple, add complexity:
Check status every few hours:
/sdk-bridge:status
# If progress seems slow
tail -50 .claude/sdk-bridge.log
# If stuck on one feature
grep "Feature #N" claude-progress.txt
Before handoff, commit your plan:
git add .
git commit -m "Initial plan with 40 features"
After resume, review and commit:
git log --oneline -20 # Review SDK commits
# If satisfied
git commit -m "SDK completed features 1-38"
# If not
git reset --hard HEAD~5 # Revert last 5 commits
If SDK uses 18/20 sessions and stops:
If SDK attempts same feature 3+ times:
feature_list.json to clarify or skipTry with a small test:
# Create 5-feature test plan
echo '[...]' > feature_list.json
/sdk-bridge:handoff
# Wait 15 minutes
/sdk-bridge:status
# If working well, scale up to full plan
# Check logs
cat .claude/sdk-bridge.log
# Common issues:
# 1. API key not set
echo $ANTHROPIC_API_KEY # Should not be empty
# Or use OAuth: claude setup-token
# 2. SDK not installed
python3 -c "import claude_agent_sdk"
# 3. Harness missing
ls ~/.claude/skills/long-running-agent/harness/autonomous_agent.py
# If missing: /user:lra-setup
# 4. Git not initialized
git status
# If not a repo: git init
/sdk-bridge:status
# Sessions: 10/20, Features: 3/50 (only 3 done in 10 sessions!)
# Check what's failing
tail -100 .claude/sdk-bridge.log
cat claude-progress.txt | tail -50
# Common causes:
# - Feature too vague
# - Tests failing repeatedly
# - External dependency missing
# Fix:
/sdk-bridge:cancel
vim feature_list.json # Clarify or skip stuck feature
git commit -m "Clarify feature requirements"
/sdk-bridge:handoff
/sdk-bridge:resume
# Shows: "❌ Tests failing"
# Check which tests
npm test # or pytest
# Common issues:
# - SDK implemented feature but tests need update
# - Edge cases not covered
# - Environment differences (API keys, DB)
# Fix:
# Update tests or implementation
git add .
git commit -m "Fix edge cases found by tests"
# SDK stopped but no completion signal
ps aux | grep autonomous_agent # Not running
# Check logs for errors
tail -100 .claude/sdk-bridge.log
# Manually check progress
jq '.[] | select(.passes==false) | .description' feature_list.json
# If work complete, manually resume
cat > .claude/sdk_complete.json << EOF
{
"timestamp": "$(date -u +%Y-%m-%dT%H:%M:%SZ)",
"reason": "manual_completion",
"session_count": 15
}
EOF
/sdk-bridge:resume
# Use Sonnet instead of Opus
# Edit .claude/sdk-bridge.local.md:
model: claude-sonnet-4-5-20250929
# Reduce max sessions
max_sessions: 15 # Instead of 30
# Better features = fewer retries
# Make feature descriptions clearer
SDK can signal early completion:
{
"timestamp": "2025-12-15T10:30:00Z",
"reason": "blocked_on_external_dependency",
"session_count": 8,
"exit_code": 2,
"message": "Need Stripe API keys before continuing",
"blocking_features": [23, 24, 25]
}
This allows graceful handback when SDK encounters blockers.
Create .claude/CLAUDE.md with project-specific guidance:
# Project Protocol
## Code Standards
- Use TypeScript strict mode
- All functions must have JSDoc comments
- Tests required for all public APIs
## Testing
- Run `npm test` after each feature
- Feature passes only if all tests pass
- Add tests before implementation
## Git
- Commit after each passing feature
- Use conventional commit format
- Never force push
The SDK reads this before each session.
Use different models for different work:
# Use Opus for complex features
model: claude-opus-4-5-20251101
/sdk-bridge:handoff
# ... completes complex features ...
/sdk-bridge:resume
# Switch to Sonnet for simple features
# Edit .claude/sdk-bridge.local.md:
model: claude-sonnet-4-5-20250929
/sdk-bridge:handoff
# ... completes remaining simple features ...
Examples:
examples/workflow-example.md - Complete end-to-end workflowexamples/handoff-scenarios.md - Common handoff patternsReferences:
references/state-files.md - State file formats and meaningsreferences/configuration.md - Complete configuration referenceScripts:
scripts/launch-harness.sh - Harness subprocess managementscripts/monitor-progress.sh - Progress trackingscripts/parse-state.sh - State file parsingSDK Bridge wraps the existing long-running-agent harness:
Relationship:
~/.claude/skills/long-running-agent/harness/autonomous_agent.pyDirect harness use:
python ~/.claude/skills/long-running-agent/harness/autonomous_agent.py \
--project-dir . \
--spec ./requirements.txt
SDK Bridge use:
/sdk-bridge:handoff # Wraps the above
Coexistence:
Choose SDK Bridge for ease of use, direct harness for advanced control.
For detailed examples and references, see the examples/ and references/ directories in this skill.