add-tool
Use when adding a CLI binary or a verb to a plugin in this marketplace: the qsm.json declaration, the handler, its errors, its test, the generated noun and the docs. Triggers: add a tool, add a verb, add a CLI command, new qsm-* command, new subcommand, qsm.json command, pridej tool, pridej verb, pridej prikaz. Where the work goes is add-plugin, a hook that calls the verb is add-hook, code two plugins share is add-lib.
- License 许可
- GPL-3.0
- 最近更新
- 2026-11-13
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- add-tool
- description
- Use when adding a CLI binary or a verb to a plugin in this marketplace: the qsm.json declaration, the handler, its errors, its test, the generated noun and the docs. Triggers: add a tool, add a verb, add a CLI command, new qsm-* command, new subcommand, qsm.json command, pridej tool, pridej verb, pridej prikaz. Where the work goes is add-plugin, a hook that calls the verb is add-hook, code two plugins share is add-lib.
03 SKILL.md 正文
Add Tool
A tool is a CLI bin, or one more verb of a bin a plugin already has, so the person, a script and a
hook reach the same logic through one declared surface. This skill makes the build use the kit in
root lib/ instead of growing a private copy. It does not decide whether the capability is a new
plugin (add-plugin does).
Steps
- Search first for a verb that does this, a helper in root
lib/, a plugin that owns the concept. An owner found means edit it in place. - Declare the verb in the plugin's
qsm.jsonunderqsm.commands, key"<bin> <verb>", withdescriptionand typedargs. A first verb also addsqsm.bin(named after the plugin, one bin per plugin) andqsm.noun. A verb may be several words (qsm-usage toon encode); the noun joins them into one method ($.usage.toonEncode), and help, completions and the noun read this one source. - Put the logic in the plugin's
lib/. The handler inscripts/cli.tsreads the call through thelib/cli-base.tsaccessors (optionalString,requiredString,optionalNumber,requiredNumber,flagArg,stringList) and returnsok(data, message)orfail(code, message). - Register the handler in the map given to
runCli(manifest, bin, handlers). - Refresh the noun:
bun lib/generate-noun.ts plugins/<name>. A first noun also namestypes/index.d.tsastypesinplugin.json. - Add the verb's row to
USAGE.mdand a scenario toopenspec/specs/<name>/spec.md. - Write the test, then run Done means and hand the diff to the review.
Hard rules
- Declare every verb in
qsm.jsonand handle it throughrunCli, because a mismatch throws at start. Gate:checkHandlers,validate-generated. - Read arguments through the accessors, never
process.argv, becauseparseCallalready validated them. Gate: review. - A failure is
fail(code, message)or a thrownQsmError(UsageErrorfor a wrong call), never a plugin error class, becauserunClimaps only these. Gate: review. - Name the cause with an outcome code (
failed,usage,worse,missing,blocked,partial) and take no fallback path, because a silent success on a broken state hides the bug. Gate: review. - Print output only through
runCli's--jsonenvelope, because scripts and the noun parse it. Gate: the test readsenvelopeOf. - Read only arguments,
QSM_*and the harness'sCLAUDE_*variables, and HOME,XDG_*andCLAUDE_CONFIG_DIRonly throughlib/paths.ts, because a test points them at a sandbox. Gate:validate-no-private-helpers. A helper rootlib/already exports is imported, never copied (add-lib). - Never hand-edit the generated noun (
types/index.d.ts,hooks/noun.generated.ts) and commit it withqsm.json. Gate:validate-generated. - Test through the real entry:
runBinwithisolatedEnv, temp dirs fromsandboxDir, fakes fromfakeBinorcliShim, repos fromlib/fixtures/git.ts, and never a spread of the whole environment, because a test that reads the real HOME passes here and fails elsewhere. A unit test only for logic the real run cannot reach. Gates:validate-no-private-helpers(the spread),validate-test-temp(mkdtemp,tmpdir()in test code), thebun testpreloadlib/fixtures/sandbox.ts, which fails the run naming every leftover temp dir; the rest is review. - Nothing invokes the CLI through a path into this repository, not a hook, a skill or an agent: install compiles it and links it onto PATH, and everything it needs at run time is inside it, because the binary must run from a shell or a test with no checkout in the room. Gate: review.
Done means
From the repository root, each exits 0:
mise exec -- bun run validate
mise exec -- bun run lint
mise exec -- bun run typecheck
mise exec -- bun test ./ ./.gates
Run the new verb for real with --json and read what it printed. Then hand the diff to the
qsm-review strict-reviewer agent with the hard rules as its checklist; the build is not done
until it returns no blocker.
Say it in the reply
The verb and where it lives, the commands with their exit codes, the real run's output line, and the review's verdict.
04 同仓库更多 Skills
worktrunk
Use when working with git worktrees or wt (worktrunk): creating, switching, merging or removing a branch workspace, configuring wt (project or personal config, workflow hooks around switch, commit and merge, commit-message generation, hook approvals), or a wt command that failed. Triggers: make a worktree for this branch, wt merge, wt remove, configure wt, .config/wt.toml, run tests before merge, install deps when a worktree is created, wt hook, wt switch does not cd, nastav wt, wt nefunguje.
web-ladder
Use when a task needs something the internet holds: look something up, search the web, find which page answers a question, read a page, check a library's current docs, a page that needs a browser or shows a captcha. Runs one research loop: searxng search, keywords, cases, search again up to three times, Context7 for a library, Tavily when the keywords will not come, one page in a browser, the person on a wall. Triggers: look this up, search the web, find out online, read this page, check the docs, the page is blocked, captcha, najdi na webu, otevri tu stranku. A multi-round question goes to the qsm-web:web-research agent; one tool's commands are its own skill (searxng, browserbox, opensrc).
searxng
Use when running a web search through the person's own SearXNG instance with qsm-web searxng: choosing a search profile or engines, the instance, time range or language, reading its JSON, a suspended engine. Triggers: search with searxng, qsm-web searxng, search profile, niche search, academic search, IT search, vyhledavaci profil, searxng is down, which engines. The research loop around it is the web-ladder skill.
opensrc
Use when the source code of an open-source library or repository is needed on disk to read: the docs are silent, the behaviour must be checked in code, the version the project pins. Runs qsm-web opensrc get with a package spec or a repository address. Triggers: get the source of this package, clone this library, read the library's code, qsm-web opensrc, stahni zdrojak knihovny. Library docs are the Context7 skill; the research loop is the web-ladder skill.
browserbox
Use when one page needs a real browser through qsm-web browserbox: content built by script, a page that blocks plain fetching, a captcha to solve or hand to the person, a scripted sequence of clicks, a login the person is present for. Triggers: open it in a browser, the page is empty without JavaScript, captcha, take over the browser, run these steps on the page, log in to this site, browserbox. When to reach for a browser at all is the web-ladder skill.
usage
Use when the user wants a review of how they use Claude Code, or setup hands over after a first install: review my Claude Code usage, audit my setup, what does my setup cost, where did my tokens go, clean up my Claude Code, usage report, zkontroluj moje pouzivani. One walkthrough of four stages (machine, work, habits, extensions), questions after each, then one plan. A question about one topic (which hooks are slow) goes to that topic's skill; this session's tokens alone is `/qsm-usage`.