Skill站外收录 @skilllib/skill-2117939930272411762
debug-cli
支持对代码生成工具的命令行界面进行深度调试与验证,涵盖新命令开发、参数解析修复、行为优化及对话流程问题排查,通过构建调试版二进制、实时查阅帮助文档、非交互式任务测试、会话克隆与结构化导出等手段,确保修改可复现、可验证且不污染原始数据。
效率工具 AI 技能
Skills.MD
# CLI Debug Skill
This skill provides a systematic workflow for debugging and verifying changes to the forge CLI application.
## Core Principles
1. **Always get latest docs first**: Run `--help` to see current commands and options
2. **Use `-p` for testing**: Test forge by giving it tasks with the `-p` flag
3. **Never commit**: This is for debugging only - don't commit changes
4. **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:
```bash
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:
```bash
# Main help - do this first
./target/debug/forge --help
# Command-specific help
./target/debug/forge [COMMAND] --help
# Subcommand 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:
```bash
# Test with a simple prompt
./target/debug/forge -p "create a hello world rust program"
# Test with specific functionality
./target/debug/forge -p "read the README.md file and summarize it"
# Test with complex tasks
./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:
```bash
# Dump conversation as JSON (creates: YYYY-MM-DD_HH-MM-SS-dump.json)
./target/debug/forge conversation dump <conversation-id>
# Export as HTML for human-readable format (creates: YYYY-MM-DD_HH-MM-SS-dump.html)
./target/debug/forge conversation dump --html <conversation-id>
# Use dumped JSON to reproduce issues
./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:
```bash
# Clone the conversation
./target/debug/forge conversation clone <source-conversation-id>
# This creates a new conversation ID - use that for testing
./target/debug/forge --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
```bash
# Build and test new command
cargo build
./target/debug/forge --help # Verify new command appears
./target/debug/forge new-command --help # Check command docs
./target/debug/forge -p "test the new feature"
```
### Reproduce Reported Bugs
```bash
# 1. Dump the conversation (creates timestamped JSON file)
./target/debug/forge conversation dump <bug-conversation-id>
# 2. Clone it for testing (preserves original)
./target/debug/forge conversation clone <bug-conversation-id>
# 3. Reproduce with the cloned conversation
./target/debug/forge --conversation-id <cloned-id> -p "reproduce the issue"
# 4. After fix, verify with new clone
./target/debug/forge conversation clone <bug-conversation-id>
./target/debug/forge --conversation-id <new-clone-id> -p "verify fix"
```
### Test Edge Cases
```bash
# Test with missing arguments
./target/debug/forge command
# Test with invalid input
./target/debug/forge -p "invalid task with special chars: <>|&"
# Test with boundary values
./target/debug/forge -p "create a file with a very long name..."
```
### Debug Prompt Optimization
```bash
# 1. Dump conversation to analyze prompts (creates timestamped JSON)
./target/debug/forge 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/forge conversation dump --html <id>
# 4. Test modified prompts
./target/debug/forge -p "your optimized prompt here"
```
## Integration with Development Workflow
### After Code Changes
1. **Build**: `cargo build`
2. **Docs**: `./target/debug/forge --help` (verify documentation)
3. **Test**: `./target/debug/forge -p "relevant task"`
4. **Verify**: Check output matches expectations
### Debugging a Bug Report
1. **Clone**: `./target/debug/forge conversation clone <source-id>`
2. **Build**: `cargo build` (with potential fixes)
3. **Test**: `./target/debug/forge --conversation-id <cloned-id> -p "reproduce"`
4. **Iterate**: Repeat until verified
5. **Never commit** during debugging - only after full verification
## Quick Reference
```bash
# Standard debug workflow
cargo build
./target/debug/forge --help # Always check docs first
./target/debug/forge -p "your test task"
# Dump conversation (creates timestamped file)
./target/debug/forge conversation dump <id>
# Output: 2025-11-23_12-28-52-dump.json
# Export as HTML for review
./target/debug/forge conversation dump --html <id>
# Output: 2025-11-23_12-28-52-dump.html
# Use dumped conversation
./target/debug/forge --conversation 2025-11-23_12-28-52-dump.json
# Clone and test bug
./target/debug/forge conversation clone <source-id>
./target/debug/forge --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/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
评论 0
还没有评论,来抢沙发。
相关内容
同类或同场景的收录内容
building-with-kafka-strimzi
在 Kubernetes 上构建基于 Apache Kafka 的事件驱动系统,支持高可靠的消息传递、事务性处理与精确一次语义,结合 Strimzi 运营商实现集群自动化管理,利用 Schema Registry 保障事件模式演进,适用于微服务间解耦通信与实时数据流处理场景。
站外数据与分析
609 0.0
personal-tool-builder
专注于从个人真实痛点出发快速构建实用工具,涵盖命令行程序、本地优先应用和自动化脚本的开发与演进,强调先满足自身需求再逐步扩展,通过持续自用打磨功能,避免过度设计,确保工具简洁有效且长期可维护。
站外商业与营销
196 0.0
threejs-lighting
实现三维场景中的光照与阴影控制,支持多种光源类型及环境光照明,提供从基础布光到高级阴影优化的完整方案,适用于需要真实感渲染或性能平衡的可视化项目。
站外效率工具
442 0.0
aggregation-helper
提供数据聚合场景的自动化辅助能力,涵盖 SQL 查询编写、统计分析建模、可视化方案设计及商业智能配置,支持从需求理解到生产级代码生成的全流程指导。
站外效率工具数据与分析
217 0.0
举报「debug-cli」
举报信息仅审核团队可见,同一资产 24 小时内仅可举报一次