use crate::skills::bundled_skills::{
register_bundled_skill, BundledSkillDefinition, ContentBlock, SkillContext,
};
use crate::AgentError;
const DEFAULT_DEBUG_LINES_READ: usize = 20;
const TAIL_READ_BYTES: usize = 64 * 1024;
fn get_prompt_for_command(
args: &str,
_context: &SkillContext,
) -> Result<Vec<ContentBlock>, AgentError> {
let prompt = format!(
r#"# Debug Skill
Help the user debug an issue they're encountering in this current session.
## Debug Logging
Debug logging can be enabled to capture session activity.
## Issue Description
{}
## Instructions
1. Review the user's issue description
2. Look for errors, warnings, and failure patterns
3. Explain what you found in plain language
4. Suggest concrete fixes or next steps
"#,
if args.is_empty() {
"The user did not describe a specific issue.".to_string()
} else {
args.to_string()
}
);
Ok(vec![ContentBlock::Text { text: prompt }])
}
pub fn register_debug_skill() {
let _ = register_bundled_skill(BundledSkillDefinition {
name: "debug".to_string(),
description: "Enable debug logging for this session and help diagnose issues".to_string(),
aliases: None,
when_to_use: None,
argument_hint: Some("[issue description]".to_string()),
allowed_tools: Some(vec!["Read".to_string(), "Grep".to_string(), "Glob".to_string()]),
model: None,
disable_model_invocation: Some(true),
user_invocable: Some(true),
is_enabled: None,
context: None,
agent: None,
files: None,
get_prompt_for_command,
});
}