pub fn render_skill_file(command: &Command) -> StringExpand description
Render a structured Markdown skill file for a single command.
Skill files encode best practices, anti-patterns, and examples in a format
suitable for loading into an AI agent context (e.g. .claude/commands/).
Only sections that have content are emitted — empty best_practices, empty
anti_patterns, no arguments, etc. are silently omitted.
§Arguments
command— The command to produce a skill file for.
§Examples
let cmd = Command::builder("deploy")
.summary("Deploy the application")
.best_practice("always dry-run first")
.anti_pattern("deploy on Friday")
.build()
.unwrap();
let skill = render_skill_file(&cmd);
assert!(skill.contains("# Skill: deploy"));
assert!(skill.contains("## Safe Usage"));
assert!(skill.contains("## Avoid"));