You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adds the clerk-cli skill at <repo-root>/skills/clerk-cli/ as a sibling
to the CLI source, distributed alongside the CLI but not bundled into
the binary. The skill is installed at clerk init time via the same
`npx skills add` mechanism as the upstream framework-pattern skills.
The clerk-cli source URL is constructed from CLI_VERSION:
https://github.com/clerk/cli/tree/v${CLI_VERSION}/skills/clerk-cli
Every published release (stable, canary, snapshot) tags as v${version}
per release.yml/snapshot.ts, so the same template works for all of
them. Dev builds (CLI_VERSION undefined or "0.0.0-dev") fall back to
the main branch.
The two installer calls (clerk-cli + upstream framework skills) share
one runner detection and fail independently, a problem with one
source doesn't block the other.
Copy file name to clipboardExpand all lines: packages/cli-core/src/commands/init/README.md
+27-5Lines changed: 27 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -165,12 +165,28 @@ If no entry file is found, a post-instruction is printed pointing to the Clerk J
165
165
166
166
## Agent skills install
167
167
168
-
After scaffolding (and after env keys are pulled or keyless instructions are printed), `clerk init` offers to install Clerk's framework-specific agent skills from [`clerk/skills`](https://github.com/clerk/skills)via the [`skills`](https://www.npmjs.com/package/skills) CLI. The runner is detected from the project's package manager (`bunx`, `npx`, `pnpm dlx`, or `yarn dlx`), so a Bun project installs via `bunx skills add clerk/skills`, a pnpm project via `pnpm dlx skills add clerk/skills`, and so on. This step is optional and non-fatal: if no package runner is available on PATH or the install command exits non-zero, init prints a yellow warning with a runner-appropriate manual command and still exits successfully.
168
+
After scaffolding (and after env keys are pulled or keyless instructions are printed), `clerk init` offers to install Clerk's agent skills via the [`skills`](https://www.npmjs.com/package/skills) CLI. The runner is detected from the project's package manager (`bunx`, `npx`, `pnpm dlx`, or `yarn dlx`), so a Bun project installs via `bunx skills add ...`, a pnpm project via `pnpm dlx skills add ...`, and so on. This step is optional and non-fatal: if no package runner is available on PATH or an install command exits non-zero, init prints a yellow warning with a runner-appropriate manual command and still exits successfully.
169
169
170
-
-**Human mode**: prompts `Install agent skills? (...)` defaulting to yes. Pass `--no-skills` to suppress the prompt entirely, or `-y/--yes` to accept it without confirmation. When more than one runner is available, a second prompt picks which one to use (the project's package manager wins by default).
171
-
-**Agent mode / `--prompt`**: `clerk init` exits early before the skills step runs (see the `if (options.prompt || isAgent()) { ... return }` branch in [`index.ts`](./index.ts)), so nothing is installed. Agent users should run `skills add clerk/skills` via their preferred runner manually, or have their agent do it.
170
+
-**Human mode**: prompts `Install agent skills? (...)` defaulting to yes. Pass `--no-skills` to suppress the prompt entirely, or `-y/--yes` to accept it without confirmation. When more than one runner (`bunx`, `npx`, `pnpm dlx`, `yarn dlx`) is available, a second prompt picks the runner; the project's package manager is the default choice.
171
+
-**Agent mode / `--prompt`**: `clerk init` exits early before the skills step runs (see the `if (options.prompt || isAgent()) { ... return }` branch in [`index.ts`](./index.ts)), so nothing is installed. Agent users should run `skills add clerk/skills`(and the version-pinned `clerk-cli` skill URL) via their preferred runner manually, or have their agent do it.
172
172
173
-
The base skills `clerk` and `clerk-setup` are always included. The detected framework dependency adds a matching skill:
173
+
Two install commands run, sharing one runner:
174
+
175
+
### 1. The version-pinned `clerk-cli` skill
176
+
177
+
The `clerk-cli` skill ships **from this repo** at [`<repo-root>/skills/clerk-cli/`](../../../../../skills/clerk-cli/). It is **not** bundled into the binary, it's fetched at install time by the `skills` CLI, the same way any other skill would be.
178
+
179
+
The source URL is constructed from `CLI_VERSION` (the compile-time global injected by `scripts/build.ts`):
Every published release (stable, canary, and snapshot) tags as `v${CLI_VERSION}` (see `.github/workflows/release.yml`), so the same `tree/v<version>/skills/clerk-cli` URL works for all of them. The only case without a matching tag is the local-dev sentinel `0.0.0-dev` (set by `scripts/build.ts` when no `--version` is passed), which falls back to `main`.
186
+
187
+
### 2. The upstream framework-pattern skills
188
+
189
+
The base skills `clerk` and `clerk-setup` are always included from [`clerk/skills`](https://github.com/clerk/skills). The detected framework dependency adds a matching skill:
@@ -185,7 +201,13 @@ The base skills `clerk` and `clerk-setup` are always included. The detected fram
185
201
|`express`|`clerk-backend-api`|
186
202
|`fastify`|`clerk-backend-api`|
187
203
188
-
Implementation lives in [`skills.ts`](./skills.ts). Note that the E2E fixture setup runs `clerk init --yes --no-skills` because the skill templates reference framework-generated types (e.g. React Router's `./+types/root`) that don't exist outside a real app directory and would break the fixture's `tsc` step.
204
+
These skills version independently of the CLI, so no pin is applied.
205
+
206
+
### Failure handling
207
+
208
+
The two install commands fail independently, a problem fetching the version-pinned `clerk-cli` skill (e.g. tag doesn't exist yet, network error) does not block the upstream skills install, and vice versa. Each failure prints its own yellow warning with a manual install command. Init continues and exits successfully either way.
209
+
210
+
Implementation lives in [`skills.ts`](./skills.ts). Note that the E2E fixture setup runs `clerk init --yes --no-skills` because the framework template skills reference auto-generated types (e.g. React Router's `./+types/root`) that don't exist outside a real app directory and would break the fixture's `tsc` step.
0 commit comments