From 242585289fbdcd74973a3e6021c4af7d5e7312a1 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Tue, 16 Jun 2026 23:16:13 +0000 Subject: [PATCH 1/2] feat: add --user flag to install skills at user level When --user is passed to `detail skill`, installs skills to ~/.claude/skills/ instead of the current repo's .claude/skills/. This lets users access skills from any repo. Co-Authored-By: Sachin Iyer --- docs/HELP.md | 6 +++++- src/commands/skill.rs | 29 ++++++++++++++++++++++------- src/lib.rs | 6 +++++- 3 files changed, 32 insertions(+), 9 deletions(-) diff --git a/docs/HELP.md b/docs/HELP.md index 6c81514..825b980 100644 --- a/docs/HELP.md +++ b/docs/HELP.md @@ -487,12 +487,16 @@ List recent scans for a repository Install Detail skills (default: detail-bugs) -**Usage:** `detail skill [COMMAND]` +**Usage:** `detail skill [OPTIONS] [COMMAND]` ###### **Subcommands:** * `rules` — Install the detail-create-rules skill +###### **Options:** + +* `--user` — Install to user-level ~/.claude/skills instead of the current repo + ## `detail skill rules` diff --git a/src/commands/skill.rs b/src/commands/skill.rs index a49e9ac..9505a8b 100644 --- a/src/commands/skill.rs +++ b/src/commands/skill.rs @@ -5,6 +5,7 @@ use std::str; use anyhow::{Context, Result}; use clap::Subcommand; +use homedir::my_home; const BUGS_SKILL_CONTENT: &str = include_str!("../../.claude/skills/detail-bugs/SKILL.md"); const RULES_SKILL_CONTENT: &str = include_str!("../../.claude/skills/detail-create-rules/SKILL.md"); @@ -22,14 +23,19 @@ fn parse_git_root_output(success: bool, stdout: &[u8]) -> Result { Ok(PathBuf::from(root.trim())) } -fn skill_install_path(repo_root: &Path, skill_name: &str) -> PathBuf { - repo_root - .join(".claude") +fn skill_install_path(base: &Path, skill_name: &str) -> PathBuf { + base.join(".claude") .join("skills") .join(skill_name) .join("SKILL.md") } +fn user_home() -> Result { + my_home() + .context("failed to determine home directory")? + .context("home directory not found") +} + fn git_root() -> Result { let output = Command::new("git") .args(["rev-parse", "--show-toplevel"]) @@ -52,12 +58,12 @@ fn install_skill(repo_root: &Path, skill_name: &str, content: &str) -> Result<() Ok(()) } -pub fn handle(command: Option<&SkillCommands>) -> Result<()> { - let root = git_root()?; +pub fn handle(command: Option<&SkillCommands>, user: bool) -> Result<()> { + let base = if user { user_home()? } else { git_root()? }; match command { - None => install_skill(&root, "detail-bugs", BUGS_SKILL_CONTENT), + None => install_skill(&base, "detail-bugs", BUGS_SKILL_CONTENT), Some(SkillCommands::Rules) => { - install_skill(&root, "detail-create-rules", RULES_SKILL_CONTENT) + install_skill(&base, "detail-create-rules", RULES_SKILL_CONTENT) } } } @@ -101,4 +107,13 @@ mod tests { PathBuf::from("/work/repo/.claude/skills/detail-create-rules/SKILL.md") ); } + + #[test] + fn skill_install_path_user_level() { + let path = skill_install_path(Path::new("/home/alice"), "detail-bugs"); + assert_eq!( + path, + PathBuf::from("/home/alice/.claude/skills/detail-bugs/SKILL.md") + ); + } } diff --git a/src/lib.rs b/src/lib.rs index 4d9daa6..6b822d0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -148,7 +148,7 @@ impl Cli { Commands::SatisfyingSort => commands::satisfying_sort::handle().await, Commands::Repos { command } => commands::repos::handle(command, &self).await, Commands::Scans { command } => commands::scans::handle(command, &self).await, - Commands::Skill { command } => commands::skill::handle(command.as_ref()), + Commands::Skill { user, command } => commands::skill::handle(command.as_ref(), *user), Commands::Update => commands::update::handle().await, Commands::Version => { console::Term::stdout().write_line(&format!("detail-cli v{VERSION}"))?; @@ -209,6 +209,10 @@ enum Commands { /// Install Detail skills (default: detail-bugs) Skill { + /// Install to user-level ~/.claude/skills instead of the current repo + #[arg(long)] + user: bool, + #[command(subcommand)] command: Option, }, From 7c62d1deb822882a3f50c376f14a4b1ff45e5630 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Tue, 16 Jun 2026 23:19:24 +0000 Subject: [PATCH 2/2] fix: make --user flag global so it works after subcommand Allows both 'detail skill --user rules' and 'detail skill rules --user'. Co-Authored-By: Sachin Iyer --- src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 6b822d0..6e4c0d0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -210,7 +210,7 @@ enum Commands { /// Install Detail skills (default: detail-bugs) Skill { /// Install to user-level ~/.claude/skills instead of the current repo - #[arg(long)] + #[arg(long, global = true)] user: bool, #[command(subcommand)]