Skip to content

Commit 175bca1

Browse files
justin808claude
andcommitted
Add sync-skills script for syncing skills to target projects
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 6c3a51e commit 175bca1

2 files changed

Lines changed: 80 additions & 7 deletions

File tree

README.md

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ Starter templates for new projects:
104104
| Script | Description |
105105
|--------|-------------|
106106
| [`bin/sync-commands`](bin/sync-commands) | Sync commands from this repo into a target project's `.claude/commands/` |
107+
| [`bin/sync-skills`](bin/sync-skills) | Sync skills from this repo into a target project's `.claude/skills/` |
107108
| [`bin/chrome-mcp`](bin/chrome-mcp) | Launch Chrome with a separate profile for MCP browser debugging |
108109
| `bin/set-review-instructions` | Initialize file-by-file review with instructions and changed file list |
109110
| `bin/print-git-diff` | Print diff, before/after, and review instructions for a single file |
@@ -120,9 +121,9 @@ Starter templates for new projects:
120121
| [Claude Code Review](.github/workflows/claude-code-review.yml) | Automatic PR review on open/sync |
121122
| [Claude Code](.github/workflows/claude.yml) | Respond to `@claude` mentions in issues/PRs |
122123

123-
## Syncing Commands to Your Project
124+
## Syncing to Your Project
124125

125-
This repo is the canonical source for shared commands like `/address-review`. To keep a project in sync:
126+
This repo is the canonical source for shared commands and skills. Use the sync scripts to keep a project up to date.
126127

127128
### One-Time Setup
128129

@@ -144,27 +145,33 @@ cp "$BOOSTERS/commands/address-review.md" .claude/commands/
144145

145146
### Keeping Up to Date
146147

147-
Run `bin/sync-commands` from this repo to pull the latest commands into a target project:
148+
Run the sync scripts from this repo to pull the latest commands or skills into a target project:
148149

149150
```bash
150151
# Sync all commands to a project
151152
./bin/sync-commands ~/projects/my-app
152153

153154
# Sync a specific command
154155
./bin/sync-commands ~/projects/my-app address-review
156+
157+
# Sync all skills to a project
158+
./bin/sync-skills ~/projects/my-app
159+
160+
# Sync a specific skill
161+
./bin/sync-skills ~/projects/my-app docs
155162
```
156163

157164
### For AI Agents in Consuming Repos
158165

159166
Add this to your project's `CLAUDE.md` or `AGENTS.md` so agents know where shared commands come from:
160167

161168
```markdown
162-
## Shared Commands
169+
## Shared Commands and Skills
163170

164-
The `/address-review` command is synced from
171+
Commands and skills are synced from
165172
[claude-code-commands-skills-agents](https://github.com/shakacode/claude-code-commands-skills-agents).
166-
Do not edit `.claude/commands/address-review.md` directly — update the
167-
canonical copy in the boosters repo and re-sync.
173+
Do not edit `.claude/commands/` or `.claude/skills/` directly — update the
174+
canonical copies in the boosters repo and re-sync.
168175
```
169176

170177
See the [templates/](templates/) directory for starter `CLAUDE.md` and `AGENTS.md` files that include this pattern.

bin/sync-skills

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Sync skills from this repo into a target project's .claude/skills/ directory.
4+
#
5+
# Usage:
6+
# ./bin/sync-skills <target-project-path> [skill-name]
7+
#
8+
# Examples:
9+
# ./bin/sync-skills ~/projects/my-app # Sync all skills
10+
# ./bin/sync-skills ~/projects/my-app docs # Sync one skill
11+
12+
set -euo pipefail
13+
14+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
15+
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
16+
SKILLS_DIR="$REPO_ROOT/skills"
17+
18+
if [ $# -lt 1 ]; then
19+
echo "Usage: $(basename "$0") <target-project-path> [skill-name]"
20+
echo ""
21+
echo "Syncs skills from claude-code-commands-skills-agents into a project."
22+
echo ""
23+
echo "Examples:"
24+
echo " $(basename "$0") ~/projects/my-app"
25+
echo " $(basename "$0") ~/projects/my-app docs"
26+
exit 1
27+
fi
28+
29+
TARGET="$1"
30+
SKILL="${2:-}"
31+
32+
if [ ! -d "$TARGET" ]; then
33+
echo "Error: target directory does not exist: $TARGET"
34+
exit 1
35+
fi
36+
37+
TARGET_DIR="$TARGET/.claude/skills"
38+
mkdir -p "$TARGET_DIR"
39+
40+
if [ -n "$SKILL" ]; then
41+
SOURCE="$SKILLS_DIR/$SKILL"
42+
if [ ! -d "$SOURCE" ]; then
43+
echo "Error: skill not found: $SOURCE"
44+
echo "Available skills:"
45+
for d in "$SKILLS_DIR"/*/; do
46+
[ -d "$d" ] && echo " $(basename "$d")"
47+
done
48+
exit 1
49+
fi
50+
cp -r "$SOURCE" "$TARGET_DIR/"
51+
echo "Synced $SKILL -> $TARGET_DIR/$SKILL/"
52+
else
53+
for d in "$SKILLS_DIR"/*/; do
54+
[ -d "$d" ] || continue
55+
SKILL_NAME="$(basename "$d")"
56+
cp -r "$d" "$TARGET_DIR/"
57+
echo "Synced $SKILL_NAME -> $TARGET_DIR/$SKILL_NAME/"
58+
done
59+
fi
60+
61+
echo ""
62+
echo "Done. Skills are now in $TARGET_DIR/"
63+
echo ""
64+
echo "To use skills, add the skills directory via --add-dir or settings.json:"
65+
echo " claude --add-dir $TARGET_DIR"
66+
echo " Or add to .claude/settings.json: {\"additionalDirectories\": [\"$TARGET_DIR\"]}"

0 commit comments

Comments
 (0)