npx skills add ...
npx skills add clerk/cli --skill audit-clerk-skill
npx skills add clerk/cli --skill audit-clerk-skill
Audits the Clerk CLI source tree and proposes updates to the bundled `clerk-cli` skill so it stays in sync with the binary. Use when the user says "audit the clerk-cli skill", "update the clerk-cli skill", "check the skill against the code", "resync clerk-cli skill", or after adding/renaming/removing CLI commands, flags, or agent-mode behavior.
Cross-check skills/clerk-cli/ against the actual CLI source in packages/cli-core/ and propose precise edits wherever they have drifted. The binary is the source of truth; the skill is documentation that must track it.
ultrathink on this task. It requires building a full command tree, comparing two representations of it, and making judgment calls about what belongs in the skill vs. in references/*.md vs. in --help. Shallow passes miss drift.
packages/cli-core/src/commands/** (one directory per top-level command), plus packages/cli-core/src/cli.ts, cli-program.ts, mode.ts, and anything in packages/cli-core/src/lib/ referenced by commands (runner preference, agent mode, doctor checks, key resolution).skills/clerk-cli/SKILL.md and skills/clerk-cli/references/*.md.{{CLI_VERSION}} placeholders substituted at install time by clerk skill install. Preserve them; do not expand.Walk packages/cli-core/src/commands/ and build a structured inventory. For each top-level command and subcommand capture:
clerk config patch, clerk api ls).isAgentMode() / CLERK_MODE / TTY detection. Note what changes (prompts skipped, JSON forced, --fix ignored, handoff printed, etc.).--dry-run / --yes guidance).Read the per-command README.md (packages/cli-core/src/commands/<name>/README.md) as a secondary source. These are dev-facing (documented API endpoints hit, mocked surfaces, internal contracts per .claude/rules/commands.md). Use them to:
references/recipes.md.Do not propose bundling the READMEs into skills/clerk-cli/references/ (symlinks or text imports). They ship internal detail agents do not need, and inflate the compiled binary. They are a reference for the audit, not for the skill.
Also capture cross-cutting behavior:
preferredRunner in lib/): the lockfile -> runner mapping that the skill's Invoking-the-CLI table must mirror.--app / --instance resolution (cross-ref references/auth.md).doctor check list and the shape of --json output (cross-ref references/agent-mode.md).clerk init --prompt output (the skill claims it is an agent handoff, not an integration guide; verify).Don't memorize output. Prefer reading the source directly over running the binary, since the binary in the worktree may be stale or unbuilt. When uncertain about runtime behavior, fall back to the tests in packages/cli-core/src/**/*.test.ts or packages/cli-core/src/test/.
Read skills/clerk-cli/SKILL.md and each file under skills/clerk-cli/references/. Extract every concrete claim:
references/*.md file.Produce a structured diff with four buckets:
completion, deploy, open, skill, switch-env were absent from the core-commands table.)--dry-run callouts, flags with non-obvious interactions, agent-mode divergence not documented).clerk <cmd> --help or the referenced files already cover better. Candidates for deletion to stay under the 500-line budget.For every entry in buckets 1-3, cite the source file and line and the target skill location.
Not every gap belongs in SKILL.md. Apply this routing:
SKILL.md.references/recipes.md or a new reference file.references/agent-mode.md; SKILL.md gets a summary bullet only.references/auth.md.Prefer --help over enumeration. clerk <command> --help is generated from the Commander tree and can't drift; it also renders each command's setExamples([...]) block. Before expanding a flag table, ask whether the agent could just run --help once. Route as follows:
--help: do not enumerate. If the skill currently lists them and there's no hidden gotcha, propose a polish edit that removes the enumeration and points at --help.clerk <cmd> --help for examples" over copying examples into the skill (which risks drifting from the source setExamples([...])).Cuts that shrink the skill toward --help are first-class proposals, not optional cleanup. A smaller skill that routes agents to --help ages better than a larger one that tries to mirror every flag.
If a new reference file is warranted (e.g. a references/commands.md table), propose it explicitly rather than bloating SKILL.md.
Emit a review-ready proposal. For each change:
skills/clerk-cli/SKILL.md or skills/clerk-cli/references/<file>.md).packages/cli-core/src/commands/<cmd>/<file>.ts:<line>).drift (factually wrong today), gap (missing coverage), polish (clearer wording, better placement, or cuts that route the agent to --help instead of duplicating it).Group the proposal by file. Do not touch {{CLI_VERSION}} markers. Do not rewrite sections that are still accurate just because they are near a change.
Default: present the proposal and stop. The user reviews, then says apply.
If invoked as /audit-clerk-skill --apply, apply drift and gap edits directly but still list polish suggestions for review. Run bun run format after applying so markdown tables and frontmatter match repo style.
{{CLI_VERSION}} stays verbatim. The Invoking-the-CLI runner table is generated from preferredRunner logic; if that logic changes, update the table, otherwise leave it alone.SKILL.md. When the budget is tight, move content to references/ rather than deleting it outright.Return the proposal as:
Keep it skimmable. The user should be able to approve or reject each entry individually.