From e564ffeeb43245a56738d75725916a47417324fb Mon Sep 17 00:00:00 2001 From: turtlebp Date: Fri, 10 Apr 2026 19:23:36 +0700 Subject: [PATCH] fix: correct installation method to use ~/.claude/skills/ symlink --- README.md | 33 ++++++++----------- install.sh | 96 +++++++++++++++++++++++------------------------------- 2 files changed, 53 insertions(+), 76 deletions(-) diff --git a/README.md b/README.md index 5261e0e..c1a628a 100644 --- a/README.md +++ b/README.md @@ -35,37 +35,30 @@ Your agent will use the updated skill automatically on the next conversation. No > **v2.0.0 (March 2026):** Major accuracy audit — 40+ fixes across 13 files. All contract actions, params, and tables verified against live mainnet ABIs. Critical fixes for DEX deposits, LOAN protocol, oracle indices, and more. See [PR #10](https://github.com/XPRNetwork/xpr-network-dev-skill/pull/10) for details. -### Method 1: Add to Claude Code settings - -Add this skill to your Claude Code settings file (`~/.claude/settings.json`): - -```json -{ - "skills": [ - { - "name": "xpr-network-dev", - "path": "/path/to/xpr-network-dev-skill/skill" - } - ] -} -``` +### Method 1: Manual symlink (personal skill) -### Method 2: Clone and reference +Personal skills are available across all your projects: ```bash git clone https://github.com/XPRNetwork/xpr-network-dev-skill.git -cd xpr-network-dev-skill +mkdir -p ~/.claude/skills +ln -s /path/to/xpr-network-dev-skill/skill ~/.claude/skills/xpr-network-dev ``` -Then add to your project's `CLAUDE.md`: +### Method 2: Project-level skill + +To make the skill available only in a specific project: -```markdown -For XPR Network development guidance, see: /path/to/xpr-network-dev-skill/skill/SKILL.md +```bash +mkdir -p .claude/skills +ln -s /path/to/xpr-network-dev-skill/skill .claude/skills/xpr-network-dev ``` +Commit `.claude/skills/xpr-network-dev` to version control so teammates get the skill automatically. + ### Method 3: Copy to project CLAUDE.md -Copy relevant sections from `skill/SKILL.md` directly into your project's `CLAUDE.md` file. +Copy relevant sections from `skill/SKILL.md` directly into your project's `CLAUDE.md` file. This is the simplest approach but the content always loads into context rather than on-demand. ## Usage with Other AI Tools diff --git a/install.sh b/install.sh index 0563510..1e94e6b 100755 --- a/install.sh +++ b/install.sh @@ -1,15 +1,15 @@ #!/bin/bash # XPR Network Developer Skill Installer for Claude Code -# This script helps install the skill into your Claude Code environment +# This script installs the skill by creating a symlink in ~/.claude/skills/ set -e SKILL_NAME="xpr-network-dev" SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" SKILL_DIR="$SCRIPT_DIR/skill" -CLAUDE_SETTINGS_DIR="$HOME/.claude" -CLAUDE_SETTINGS_FILE="$CLAUDE_SETTINGS_DIR/settings.json" +CLAUDE_SKILLS_DIR="$HOME/.claude/skills" +SKILL_LINK="$CLAUDE_SKILLS_DIR/$SKILL_NAME" echo "XPR Network Developer Skill Installer" echo "======================================" @@ -21,70 +21,54 @@ if [ ! -d "$SKILL_DIR" ]; then exit 1 fi -# Check if jq is available for JSON manipulation -if ! command -v jq &> /dev/null; then - echo "Note: jq is not installed. Manual installation required." - echo "" - echo "To install manually, add this to your Claude Code settings:" - echo "" - echo " File: $CLAUDE_SETTINGS_FILE" - echo "" - echo ' {' - echo ' "skills": [' - echo ' {' - echo " \"name\": \"$SKILL_NAME\"," - echo " \"path\": \"$SKILL_DIR\"" - echo ' }' - echo ' ]' - echo ' }' - echo "" - exit 0 +# Check if SKILL.md exists +if [ ! -f "$SKILL_DIR/SKILL.md" ]; then + echo "Error: SKILL.md not found at $SKILL_DIR/SKILL.md" + exit 1 fi -# Create settings directory if it doesn't exist -if [ ! -d "$CLAUDE_SETTINGS_DIR" ]; then - echo "Creating Claude settings directory..." - mkdir -p "$CLAUDE_SETTINGS_DIR" +# Create ~/.claude/skills/ directory if it doesn't exist +if [ ! -d "$CLAUDE_SKILLS_DIR" ]; then + echo "Creating $CLAUDE_SKILLS_DIR ..." + mkdir -p "$CLAUDE_SKILLS_DIR" fi -# Create or update settings file -if [ ! -f "$CLAUDE_SETTINGS_FILE" ]; then - echo "Creating new settings file..." - echo '{ - "skills": [ - { - "name": "'"$SKILL_NAME"'", - "path": "'"$SKILL_DIR"'" - } - ] -}' > "$CLAUDE_SETTINGS_FILE" - echo "Created $CLAUDE_SETTINGS_FILE" -else - echo "Updating existing settings file..." - - # Check if skill already exists - if jq -e ".skills[] | select(.name == \"$SKILL_NAME\")" "$CLAUDE_SETTINGS_FILE" > /dev/null 2>&1; then - echo "Skill '$SKILL_NAME' already installed. Updating path..." - jq "(.skills[] | select(.name == \"$SKILL_NAME\")).path = \"$SKILL_DIR\"" "$CLAUDE_SETTINGS_FILE" > "$CLAUDE_SETTINGS_FILE.tmp" - mv "$CLAUDE_SETTINGS_FILE.tmp" "$CLAUDE_SETTINGS_FILE" - else - # Add skill to existing array or create skills array - if jq -e ".skills" "$CLAUDE_SETTINGS_FILE" > /dev/null 2>&1; then - jq ".skills += [{\"name\": \"$SKILL_NAME\", \"path\": \"$SKILL_DIR\"}]" "$CLAUDE_SETTINGS_FILE" > "$CLAUDE_SETTINGS_FILE.tmp" - else - jq ". + {\"skills\": [{\"name\": \"$SKILL_NAME\", \"path\": \"$SKILL_DIR\"}]}" "$CLAUDE_SETTINGS_FILE" > "$CLAUDE_SETTINGS_FILE.tmp" +# Handle existing installation +if [ -e "$SKILL_LINK" ] || [ -L "$SKILL_LINK" ]; then + if [ -L "$SKILL_LINK" ]; then + EXISTING_TARGET="$(readlink "$SKILL_LINK")" + if [ "$EXISTING_TARGET" = "$SKILL_DIR" ]; then + echo "Skill '$SKILL_NAME' is already installed and up to date." + echo "" + echo "Skill location: $SKILL_DIR" + echo "Symlink: $SKILL_LINK -> $SKILL_DIR" + echo "" + echo "To update the skill content, run: git pull" + exit 0 fi - mv "$CLAUDE_SETTINGS_FILE.tmp" "$CLAUDE_SETTINGS_FILE" + echo "Updating existing symlink (was pointing to $EXISTING_TARGET)..." + rm "$SKILL_LINK" + else + echo "Error: $SKILL_LINK already exists and is not a symlink." + echo "Remove it manually and re-run this installer." + exit 1 fi - echo "Updated $CLAUDE_SETTINGS_FILE" fi -echo "" +# Create symlink +ln -s "$SKILL_DIR" "$SKILL_LINK" + echo "Installation complete!" echo "" -echo "The XPR Network Developer Skill is now available in Claude Code." +echo "Skill '$SKILL_NAME' is now available in Claude Code." +echo "Symlink: $SKILL_LINK -> $SKILL_DIR" +echo "" +echo "Usage:" +echo " - Invoke directly: /xpr-network-dev" +echo " - Claude auto-invokes when relevant to XPR Network development" echo "" -echo "Skill location: $SKILL_DIR" +echo "To update the skill content in the future, run:" +echo " git pull (inside the xpr-network-dev-skill directory)" echo "" echo "Try asking Claude:" echo " - How do I deploy a smart contract on XPR Network?"