| name | debug-cli |
| description | Use when users need to debug, modify, or extend the code-forge application's CLI commands, argument parsing, or CLI behavior. This includes adding new commands, fixing CLI bugs, updating command options, or troubleshooting CLI-related issues. |
CLI Debug Skill
This skill provides a systematic workflow for debugging and verifying changes to the forge CLI application.
Core Principles
- Always get latest docs first: Run
--help to see current commands and options
- Use
-p for testing: Test forge by giving it tasks with the -p flag
- Never commit: This is for debugging only - don't commit changes
- Clone conversations: When debugging conversation bugs, clone the source conversation before reproducing
Workflow
1. Build the Application
Always build in debug mode after making changes:
cargo build
Never use cargo build --release for debugging - it's significantly slower and unnecessary for verification.
2. Get Latest Documentation
Always start by checking the latest help to understand current commands and options:
./target/debug/forge --help
./target/debug/forge [COMMAND] --help
./target/debug/forge [COMMAND] [SUBCOMMAND] --help
3. Test with -p Flag
Use the -p flag to give forge a task to complete without interactive mode:
./target/debug/forge -p "create a hello world rust program"
./target/debug/forge -p "read the README.md file and summarize it"
./target/debug/forge -p "analyze the code structure and suggest improvements"
4. Debug with Conversation Dumps
When debugging prompts or conversation issues, use conversation dump to export conversations. The command automatically creates a timestamped file:
./target/debug/forge conversation dump <conversation-id>
./target/debug/forge conversation dump --html <conversation-id>
./target/debug/forge --conversation 2025-11-23_12-28-52-dump.json
5. Clone Before Reproducing Bugs
Critical: When a user provides a conversation with a bug, always clone it first:
./target/debug/forge conversation clone <source-conversation-id>
./target/debug/forge --conversation-id <new-cloned-id>
Why clone?
- Preserves original bug evidence
- Allows multiple reproduction attempts
- Enables A/B testing of fixes
- Keeps source conversation clean
Common Testing Patterns
Test New Features
cargo build
./target/debug/forge --help
./target/debug/forge new-command --help
./target/debug/forge -p "test the new feature"
Reproduce Reported Bugs
./target/debug/forge conversation dump <bug-conversation-id>
./target/debug/forge conversation clone <bug-conversation-id>
./target/debug/forge --conversation-id <cloned-id> -p "reproduce the issue"
./target/debug/forge conversation clone <bug-conversation-id>
./target/debug/forge --conversation-id <new-clone-id> -p "verify fix"
Test Edge Cases
./target/debug/forge command
./target/debug/forge -p "invalid task with special chars: <>|&"
./target/debug/forge -p "create a file with a very long name..."
Debug Prompt Optimization
./target/debug/forge conversation dump <id>
cat 2025-11-23_12-28-52-dump.json | jq '.messages[] | {role, content}'
./target/debug/forge conversation dump --html <id>
./target/debug/forge -p "your optimized prompt here"
Integration with Development Workflow
After Code Changes
- Build:
cargo build
- Docs:
./target/debug/forge --help (verify documentation)
- Test:
./target/debug/forge -p "relevant task"
- Verify: Check output matches expectations
Debugging a Bug Report
- Clone:
./target/debug/forge conversation clone <source-id>
- Build:
cargo build (with potential fixes)
- Test:
./target/debug/forge --conversation-id <cloned-id> -p "reproduce"
- Iterate: Repeat until verified
- Never commit during debugging - only after full verification
Quick Reference
cargo build
./target/debug/forge --help
./target/debug/forge -p "your test task"
./target/debug/forge conversation dump <id>
./target/debug/forge conversation dump --html <id>
./target/debug/forge --conversation 2025-11-23_12-28-52-dump.json
./target/debug/forge conversation clone <source-id>
./target/debug/forge --conversation-id <cloned-id> -p "reproduce bug"
cat 2025-11-23_12-28-52-dump.json | jq '.messages[] | {role, content}'
./target/debug/forge --verbose -p "test task"
Tips
- Always
--help first: Get latest docs before testing
- Use
-p for testing: Don't test interactively, use prompts
- Clone conversations: Never modify original bug conversations
- Never commit: This is for debugging only
- Dump creates files:
dump automatically creates timestamped files (no > needed)
- HTML exports: Use
--html flag for human-readable conversation views
- Use relative paths: Binary is at
./target/debug/forge from project root
- Check exit codes: Use
echo $? to verify exit codes
- Watch for warnings: Build warnings often indicate issues