Skip to content

Commit 181ce90

Browse files
committed
docs: improve skills-manager skill with troubleshooting, auth recovery, and tighter description
- Add troubleshooting section with 6 error-to-fix pairs (push rejected, rebase conflict, no skills found, unknown agents, auth failure, not a git repo) - Add scope boundary clarifying this tool doesn't install skills - Add quick reference table and installation fallback instructions - Document first-time behavior and possible outcomes for push/pull - Highlight non-interactive flags for AI agent automation - Add re-link-after-install workflow - Trim description to improve trigger accuracy while keeping all key phrases
1 parent f1bcd90 commit 181ce90

1 file changed

Lines changed: 162 additions & 33 deletions

File tree

skills/skills-manager/SKILL.md

Lines changed: 162 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,21 @@ description: Manage AI agent skills backup and sync via the skills-manager CLI.
77

88
CLI companion to [vercel-labs/skills](https://github.com/vercel-labs/skills) — backup, restore, and symlink AI agent skills via GitHub.
99

10-
## Invocation
10+
> **Scope boundary:** This tool backs up and syncs skills you already have. It does NOT install new skills from the registry — that's `npx skills add`. If the user wants to install a new skill, point them to `npx skills add <repo>` instead.
11+
12+
## Quick Reference
13+
14+
| Goal | Command |
15+
|------|---------|
16+
| Backup skills to GitHub | `sm push` |
17+
| Restore skills on new machine | `sm pull --repo owner/name` |
18+
| Re-link skills to agents | `sm link` |
19+
| Link skills to a project | `sm link --project` |
1120

12-
Two equivalent ways to run the CLI:
21+
## Invocation
1322

1423
```bash
15-
# Global install (recommended)
16-
npm install -g @tc9011/skills-manager
24+
# If globally installed
1725
sm push # short alias
1826
skills-manager push # full name
1927

@@ -22,7 +30,13 @@ export SM="$HOME/.agents/skills/skills-manager/scripts/sm.sh"
2230
"$SM" push
2331
```
2432

25-
Requires Node.js ≥ 20. [GitHub CLI](https://cli.github.com/) (`gh`) recommended for auth.
33+
Requires Node.js >= 20. [GitHub CLI](https://cli.github.com/) (`gh`) recommended for auth.
34+
35+
If neither `sm` nor `skills-manager` is found, install first:
36+
37+
```bash
38+
npm install -g @tc9011/skills-manager
39+
```
2640

2741
## Key Paths
2842

@@ -34,19 +48,28 @@ Requires Node.js ≥ 20. [GitHub CLI](https://cli.github.com/) (`gh`) recommende
3448

3549
## Authentication
3650

37-
Auth is **optional** — if git already has credentials (SSH keys, macOS Keychain, etc.), push/pull work without setup.
51+
Auth is **optional**. If git already has credentials configured (SSH keys, macOS Keychain, credential manager, etc.), push/pull work without any extra setup.
3852

39-
When git cannot authenticate, the CLI tries these sources in order:
53+
When git cannot authenticate on its own, the CLI looks for a token in this order:
4054

41-
1. `gh auth token` — GitHub CLI
55+
1. `gh auth token` — GitHub CLI (recommended)
4256
2. `$GITHUB_TOKEN` — environment variable
4357
3. `$GH_TOKEN` — environment variable
4458

45-
If push fails with an auth error:
46-
- **Has `gh`**`gh auth login`
47-
- **No `gh`**`export GITHUB_TOKEN=ghp_your_token_here`
59+
If none are found, git attempts the operation without a token — this works for public repos but fails for private ones.
60+
61+
**The `link` command never requires authentication.**
4862

49-
`link` never requires authentication.
63+
### Fixing Auth Failures
64+
65+
If push/pull fails with a permission or authentication error:
66+
67+
1. **Check if `gh` is installed:** run `gh --version`
68+
2. **If `gh` exists:** run `gh auth login` to authenticate, then retry
69+
3. **If `gh` missing:** set a token: `export GITHUB_TOKEN=ghp_your_token_here`, then retry
70+
4. **If using SSH:** ensure `~/.ssh/` has a valid key added to GitHub and `origin` uses the `git@github.com:` URL format
71+
72+
Tokens are used transiently in-memory — they are never persisted to `.git/config`.
5073

5174
## Commands
5275

@@ -59,19 +82,37 @@ sm push # auto-generated commit message
5982
sm push -m "add new skill" # custom message
6083
```
6184

62-
First run auto-initializes git repo and prompts for a remote URL. On conflict (remote ahead of local), rejects with instructions to pull first.
85+
**First-time behavior:**
86+
1. If `~/.agents/` is not a git repo, auto-runs `git init`
87+
2. If no `origin` remote exists, prompts for `owner/name`
88+
3. If `gh` CLI is installed, offers to create the repo on GitHub automatically
89+
4. If `gh` is not installed, shows a note telling the user to create the repo manually at https://github.com/new
90+
91+
**Possible outcomes:**
92+
- `Skills pushed successfully!` — new commit created and pushed
93+
- `Unpushed commits pushed successfully!` — working tree clean, but local was ahead
94+
- `No changes to push — already up to date.` — nothing new
95+
- `Push rejected` — see Troubleshooting below
6396

6497
### pull
6598

66-
Pull from GitHub. Auto-runs `link` afterward unless skipped.
99+
Pull from GitHub. Auto-runs `link` afterward unless `--skip-link` is passed.
67100

68101
```bash
69102
sm pull --repo owner/name # first time — specify repo
70103
sm pull # subsequent runs — uses existing remote
71-
sm pull --skip-link # pull only, skip auto-link
104+
sm pull --skip-link # pull only, don't re-link
72105
```
73106

74-
On rebase conflict, aborts and shows manual resolution steps.
107+
**First-time behavior:**
108+
- If no `--repo` and no existing `origin` remote, prompts for `owner/name`
109+
- If `~/.agents/` doesn't exist yet, clones into it
110+
111+
**Possible outcomes:**
112+
- `Skills cloned successfully!` — fresh clone on new machine, auto-runs link
113+
- `Skills updated from remote.` — pulled new changes, auto-runs link
114+
- `Already up to date.` — no new changes, skips link
115+
- `Rebase conflict` — see Troubleshooting below
75116

76117
### link (global mode)
77118

@@ -82,37 +123,53 @@ sm link # interactive prompt
82123
sm link --agents cursor opencode # non-interactive, skip prompt
83124
```
84125

85-
**Interactive prompt behavior:**
126+
**Interactive behavior:**
86127

87-
The agent selection uses a **searchable multiselect** with two sections:
128+
The agent selector has two sections:
129+
1. **Locked section** — 10 universal agents (amp, cline, codex, cursor, gemini-cli, github-copilot, kimi-cli, opencode, replit, universal) are always included because they share `~/.agents/skills/` as their path.
130+
2. **Searchable list** — 31 non-universal agents. Type to search/filter.
88131

89-
1. **Locked section** — Universal agents (amp, cline, codex, cursor, gemini-cli, github-copilot, kimi-cli, opencode, replit, universal) are always included. They share `~/.agents/skills/` as their project path, so linking them is a no-op beyond the global symlink — they're locked to avoid confusion.
132+
Pre-selection priority: saved config > `.skill-lock.json` > agents already existing on disk.
90133

91-
2. **Searchable list** — All 31 non-universal agents appear here. Type to filter by name. Pre-selection comes from (in priority order): last saved selection → `.skill-lock.json` → agents whose directory already exists on disk.
134+
When `--agents` is provided, the interactive prompt is skipped entirely. Use this for scripting and AI agent automation:
92135

93-
When `--agents` is provided, the prompt is skipped entirely. Selection is persisted to `~/.config/skills-manager/config.json` for the next run.
136+
```bash
137+
sm link --agents cursor opencode claude-code
138+
```
94139

95140
### link --project
96141

97-
Link or copy skills to the **current working directory**. Three-step interactive flow:
98-
99-
1. **Select skills** (`--skills`) — which skills to include (none pre-selected)
100-
2. **Copy or symlink** (`--mode`) — `copy` (default, recommended) or absolute `symlink`
101-
3. **Select agents** (`--agents`) — same searchable multiselect with locked universal section as global mode
142+
Link or copy skills to the **current working directory**.
102143

103144
```bash
104-
cd /path/to/project
105-
sm link --project # interactive
106-
sm link --project --agents cursor claude-code --skills my-skill --mode copy # non-interactive
145+
sm link --project # interactive
146+
sm link --project --agents cursor claude-code --skills my-skill # non-interactive (copy is default)
147+
sm link --project --agents cursor claude-code --skills my-skill --mode symlink # explicit symlink
107148
```
108149

109-
Agents sharing the same `projectPath` are deduplicated — one copy/link operation per unique path.
150+
**Interactive flow (3 steps):**
151+
1. **Select skills** (`--skills` to skip) — choose which skills to include
152+
2. **Select copy/symlink** — in practice this prompt is skipped because `--mode` defaults to `copy` in the CLI. Only appears if `linkCommand` is called programmatically without defaults
153+
3. **Select agents** (`--agents` to skip) — same searchable multiselect with locked universal section
154+
155+
**Copy vs symlink:**
156+
- `copy` (default, recommended) — creates independent files in project. Overwrites existing skill dirs
157+
- `symlink` — creates absolute symlinks pointing to `~/.agents/skills/`. Existing non-symlink dirs are skipped
158+
159+
Agents that share the same `projectPath` (e.g., `trae` and `trae-cn` both use `.trae/skills`) are deduplicated — one operation per unique path.
160+
161+
**For AI agents: the fully non-interactive version is almost always what you want:**
162+
163+
```bash
164+
sm link --project --agents cursor opencode claude-code --skills my-skill --mode copy
165+
```
110166

111167
## Common Workflows
112168

113169
### First-time setup on a new machine
114170

115171
```bash
172+
npm install -g @tc9011/skills-manager
116173
sm pull --repo owner/my-skills # clone + auto-link
117174
```
118175

@@ -127,18 +184,90 @@ sm push # backup local changes
127184

128185
```bash
129186
cd /path/to/project
130-
sm link --project
131-
# Creates e.g. .agents/skills/, .claude/skills/ in CWD
187+
sm link --project --skills my-skill --agents cursor opencode claude-code
188+
```
189+
190+
### Re-link after installing new skills
191+
192+
```bash
193+
npx skills add some-repo # install via vercel-labs/skills
194+
sm link # re-link to all agents
195+
sm push # backup the new skill
196+
```
197+
198+
## Troubleshooting
199+
200+
### Push rejected (remote ahead)
201+
202+
**Error:** `Push rejected — remote contains commits that you do not have locally.`
203+
204+
**Fix:**
205+
```bash
206+
sm pull # pulls and rebases
207+
sm push # retry
208+
```
209+
210+
Or manually:
211+
```bash
212+
cd ~/.agents
213+
git pull --rebase origin main
214+
sm push
215+
```
216+
217+
### Rebase conflict on pull
218+
219+
**Error:** `Rebase conflict detected. Your local skills have diverged from the remote.`
220+
221+
The CLI auto-aborts the failed rebase. To resolve:
222+
223+
```bash
224+
cd ~/.agents
225+
git fetch origin
226+
git rebase origin/main # resolve conflicts manually
227+
# OR if you want to discard local changes:
228+
git reset --hard origin/main
229+
```
230+
231+
### No skills found
232+
233+
**Error:** `No skills found in ~/.agents/skills.`
234+
235+
This means `~/.agents/skills/` is empty or doesn't exist. Either:
236+
- Run `sm pull --repo owner/name` to restore from backup
237+
- Install skills via `npx skills add <repo>`
238+
239+
### Unknown agent IDs
240+
241+
**Error:** `Unknown agent ID(s): foo. Run with no --agents to see available IDs.`
242+
243+
The `--agents` flag only accepts valid agent IDs from the 41-agent registry. Run `sm link` without `--agents` to see the interactive list.
244+
245+
### Auth failure during push/pull
246+
247+
**Symptom:** Git errors like `Authentication failed`, `Permission denied`, or `Repository not found`.
248+
249+
This means git has no credentials and no token was found. See the "Fixing Auth Failures" section above.
250+
251+
### ~/.agents/ is not a git repo
252+
253+
On first `push` or `pull`, the CLI auto-initializes git. If this somehow fails:
254+
255+
```bash
256+
cd ~/.agents
257+
git init
258+
git remote add origin https://github.com/owner/my-skills.git
259+
sm push
132260
```
133261

134262
## Supported Agents (41)
135263

136264
- **10 universal** (always locked in interactive prompts): amp, cline, codex, cursor, gemini-cli, github-copilot, kimi-cli, opencode, replit, universal
137-
- **31 non-universal** (appear in searchable list): claude-code, windsurf, trae, roo, augment, continue, goose, and more
265+
- **31 non-universal** (appear in searchable list): claude-code, windsurf, trae, roo, augment, continue, goose, kilo, kode, and more
138266

139267
## Constraints
140268

141269
- `.skill-lock.json` is READ ONLY — never create, modify, or delete it
142270
- `~/.agents/` is the git repo root (not `~/.agents/skills/`)
143271
- Global link = relative symlinks; project link = absolute symlinks or copies
144272
- Auth tokens are transient in-memory only — never persisted to `.git/config`
273+
- This tool does NOT install skills from the registry — use `npx skills add` for that

0 commit comments

Comments
 (0)