debug-cli
Use when users need to debug, modify, or extend the code-anvil 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.
- License 许可
- Apache-2.0
- 所属仓库
- KaiavN/anvilcode
- 最近更新
- 2026-07-07
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- debug-cli
- description
- Use when users need to debug, modify, or extend the code-anvil 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.
02 资源文件 2
- 脚本scripts/README.md282 B
- 脚本scripts/test_cli.sh1.0 KB
03 SKILL.md 正文
CLI Debug Skill
This skill provides a systematic workflow for debugging and verifying changes to the anvil CLI application.
Core Principles
- Always get latest docs first: Run
--helpto see current commands and options - Use
-pfor testing: Test anvil by giving it tasks with the-pflag - 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:
# Main help - do this first
./target/debug/anvil --help
# Command-specific help
./target/debug/anvil [COMMAND] --help
# Subcommand help
./target/debug/anvil [COMMAND] [SUBCOMMAND] --help
3. Test with -p Flag
Use the -p flag to give anvil a task to complete without interactive mode:
# Test with a simple prompt
./target/debug/anvil -p "create a hello world rust program"
# Test with specific functionality
./target/debug/anvil -p "read the README.md file and summarize it"
# Test with complex tasks
./target/debug/anvil -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:
# Dump conversation as JSON (creates: YYYY-MM-DD_HH-MM-SS-dump.json)
./target/debug/anvil conversation dump <conversation-id>
# Export as HTML for human-readable format (creates: YYYY-MM-DD_HH-MM-SS-dump.html)
./target/debug/anvil conversation dump --html <conversation-id>
# Use dumped JSON to reproduce issues
./target/debug/anvil --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:
# Clone the conversation
./target/debug/anvil conversation clone <source-conversation-id>
# This creates a new conversation ID - use that for testing
./target/debug/anvil --conversation-id <new-cloned-id>
# Keep cloning the source until the fix is verified
# Never modify the original conversation
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
# Build and test new command
cargo build
./target/debug/anvil --help # Verify new command appears
./target/debug/anvil new-command --help # Check command docs
./target/debug/anvil -p "test the new feature"
Reproduce Reported Bugs
# 1. Dump the conversation (creates timestamped JSON file)
./target/debug/anvil conversation dump <bug-conversation-id>
# 2. Clone it for testing (preserves original)
./target/debug/anvil conversation clone <bug-conversation-id>
# 3. Reproduce with the cloned conversation
./target/debug/anvil --conversation-id <cloned-id> -p "reproduce the issue"
# 4. After fix, verify with new clone
./target/debug/anvil conversation clone <bug-conversation-id>
./target/debug/anvil --conversation-id <new-clone-id> -p "verify fix"
Test Edge Cases
# Test with missing arguments
./target/debug/anvil command
# Test with invalid input
./target/debug/anvil -p "invalid task with special chars: <>|&"
# Test with boundary values
./target/debug/anvil -p "create a file with a very long name..."
Debug Prompt Optimization
# 1. Dump conversation to analyze prompts (creates timestamped JSON)
./target/debug/anvil conversation dump <id>
# 2. Review the conversation structure
cat 2025-11-23_12-28-52-dump.json | jq '.messages[] | {role, content}'
# 3. Export as HTML for easier reading
./target/debug/anvil conversation dump --html <id>
# 4. Test modified prompts
./target/debug/anvil -p "your optimized prompt here"
Integration with Development Workflow
After Code Changes
- Build:
cargo build - Docs:
./target/debug/anvil --help(verify documentation) - Test:
./target/debug/anvil -p "relevant task" - Verify: Check output matches expectations
Debugging a Bug Report
- Clone:
./target/debug/anvil conversation clone <source-id> - Build:
cargo build(with potential fixes) - Test:
./target/debug/anvil --conversation-id <cloned-id> -p "reproduce" - Iterate: Repeat until verified
- Never commit during debugging - only after full verification
Quick Reference
# Standard debug workflow
cargo build
./target/debug/anvil --help # Always check docs first
./target/debug/anvil -p "your test task"
# Dump conversation (creates timestamped file)
./target/debug/anvil conversation dump <id>
# Output: 2025-11-23_12-28-52-dump.json
# Export as HTML for review
./target/debug/anvil conversation dump --html <id>
# Output: 2025-11-23_12-28-52-dump.html
# Use dumped conversation
./target/debug/anvil --conversation 2025-11-23_12-28-52-dump.json
# Clone and test bug
./target/debug/anvil conversation clone <source-id>
./target/debug/anvil --conversation-id <cloned-id> -p "reproduce bug"
# Debug prompts with jq (use actual filename)
cat 2025-11-23_12-28-52-dump.json | jq '.messages[] | {role, content}'
# Test with verbose output
./target/debug/anvil --verbose -p "test task"
Tips
- Always
--helpfirst: Get latest docs before testing - Use
-pfor testing: Don't test interactively, use prompts - Clone conversations: Never modify original bug conversations
- Never commit: This is for debugging only
- Dump creates files:
dumpautomatically creates timestamped files (no>needed) - HTML exports: Use
--htmlflag for human-readable conversation views - Use relative paths: Binary is at
./target/debug/anvilfrom project root - Check exit codes: Use
echo $?to verify exit codes - Watch for warnings: Build warnings often indicate issues
04 同仓库更多 Skills
github-pr-description
Generate and create pull request descriptions automatically using GitHub CLI. Use when the user asks to create a PR, generate a PR description, make a pull request, or submit changes for review. Analyzes git diff and commit history to create comprehensive, meaningful PR descriptions that explain what changed, why it matters, and how to test it.
execute-plan
Execute structured task plans with status tracking. Use when the user provides a plan file path in the format `plans/{current-date}-{task-name}-{version}.md` or explicitly asks you to execute a plan file.
create-skill
Guide for creating effective skills. This skill should be used when users want to create a new skill (or update an existing skill) that extends your capabilities with specialized knowledge, workflows, or tool integrations.
test-skill
A test skill with resources
minimal-skill
A minimal skill with no resources
write-release-notes
Generate engaging, high-energy release notes for a given version tag. Fetches the release from GitHub, retrieves every linked PR's title and description, then synthesizes all changes into a polished, user-facing release note with an enthusiastic tone. Use when the user asks to write, generate, or create release notes for a version (e.g. "write release notes for v1.32.0", "generate release notes for the latest release", "create changelog for v2.0").