add-command

add-command is a skill for Claude Code, Codex from caiwuu/Riot. It costs 55 tokens per session (921 once invoked), scanned A, original, MIT.

A checklist for adding a Tauri command, a function that lets the web front end ask the Rust application to do something. It covers the five code and permission locations that must agree.

In plain words
What is it for?
Use it when adding a command: define it, register it, declare it, grant permission, and expose it through the front-end bridge.
Why use it?
It prevents commands that compile but fail at runtime, or permissions that make the build script crash. It also keeps Tauri calls in one front-end entry point so component tests can run without Tauri.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/caiwuu/riot/add-command
Any agent
npx skills add caiwuu/Riot --skill add-command
Clone the repo
git clone --depth 1 https://github.com/caiwuu/Riot

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for add-command

README.md
[![agentmods](https://agentmods.dev/badge/skills/caiwuu/riot/add-command.svg)](https://agentmods.dev/skills/caiwuu/riot/add-command)
Your own site
<a href="https://agentmods.dev/skills/caiwuu/riot/add-command"><img src="https://agentmods.dev/badge/skills/caiwuu/riot/add-command.svg" alt="Measured on agentmods" height="20"></a>
Per session 55 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 921 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00055 $0.00921
Opus 5 $0.00028 $0.00461
Sonnet 5 $0.00011 $0.00184
Haiku 4.5 $0.00006 $0.00092

Measured 3d ago against content hash 2441f8e8cd9f, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

add-command scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.riot/skills/add-command/SKILL.md · 94 lines

How it starts

The opening of the file, as written. The whole thing — 94 lines — stays where its author put it; the contents beside it link to each section on GitHub.

加一个 Tauri 命令

一个命令要在五处同时存在。src-tauri/tests/acl.rs 只守得住两处, 另外三处漏了不报编译错,表现是前端调用时 <name> not allowed. Command not found

五处清单

1. 命令本体 —— src-tauri/src/lib.rs

#[tauri::command]
async fn term_share(
    terms: tauri::State<'_, term::Terminals>,
    id: u32,
    shared: bool,
) -> HostResult<()> {
    terms.set_shared(id, shared);
    Ok(())
}

返回 HostResult<T>,错误用 HostError 的现成变体(HostError::TermHostError::ProviderHostError::Hook…)。参数名用 snake_case,前端那边 传 camelCase,Tauri 自己转。

2. 注册 —— lib.rsinvoke_handler 列表

[约束] invoke_handler 只能调用一次,调多次只有最后一次生效。所以是往 那个已有的列表里加一行,不是再写一个 .invoke_handler(...)

3. 声明存在 —— src-tauri/build.rsCOMMANDS

不加这里,自定义命令默认对所有 window/webview 开放,不受 capability 约束。那意味着将来加一个 OAuth window 或 devtools window,它自动拥有全部 命令权限。

4. 授予可用 —— src-tauri/capabilities/default.jsonpermissions

形式是 allow-<kebab-case>,例:term_share"allow-term-share"

声明「存在」和授予「可用」是两件事,所以要改两处。

5. 前端入口 —— src/bridge/index.ts

[约束] 这是唯一允许调 Tauri API 的地方。别处直接 import @tauri-apps/api 会让前端无法脱离 Tauri 运行,组件测试全部失效。

那个会让 build.rs panic 的坑

capability 里写了 allow-term-share,但 src-tauri/permissions/autogenerated/ 下还没有对应的 term_share.toml 时,tauri-build 会直接 panic:

Permission allow-term-share not found, expected one of allow-add-project, ...

那些 toml 是 tauri-build 生成的,但生成和校验在同一次构建里,所以第一次 加命令会撞上这个先后顺序。照现有文件的格式手写一个即可:

# Automatically generated - DO NOT EDIT!

[[permission]]
identifier = "allow-term-share"
description = "Enables the term_share command without any pre-configured scope."
commands.allow = ["term_share"]

[[permission]]
identifier = "deny-term-share"
description = "Denies the term_share command without any pre-configured scope."
commands.deny = ["term_share"]

一条边界

面板里的操作是用户自己在敲,不过权限链 —— 权限管的是「模型能不能做」。 但反过来要小心:如果这个命令会放宽模型的能力(例 term_share 让模型能读 一个终端),那么模型侧不能有对应的接口。它不能给自己开权限,这要靠 trait 上没有那个方法来保证,不是靠提示词劝。

验证

cargo test -p riot-host --test acl

Read the full file on GitHub · 94 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 94 lines · 55 tokens per session scan A 2441f8e8cd9f

Subscribe to this mod's changes

add-command is a skill published in the GitHub repository caiwuu/Riot (14 stars, last pushed today), licensed MIT. It adds 55 tokens to every session and 921 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

systematic-debugging

Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.

obra/superpowers · 21 tokens

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, or modifying behavior. Explores user intent, requirements and design before implementation.

obra/superpowers · 37 tokens

auto-perf-optimize

Run agent-driven VS Code performance or memory investigations. Use when asked to launch Code OSS, automate a VS Code scenario, run the Chat memory smoke runner, capture renderer heap snapshots, take workflow screenshots, compare run summaries, or drive a repeatable scenario before heap-snapshot analysis.

microsoft/vscode · 62 tokens

chat-perf

Run chat perf benchmarks and memory leak checks against the local dev build or any published VS Code version. Use when investigating chat rendering regressions, validating perf-sensitive changes to chat UI, or checking for memory leaks in the chat response pipeline.

microsoft/vscode · 51 tokens

chat-pet-sprite-creation

Use when creating or changing VS Code chat pet sprite art, sprite sheets, state animations, eye treatments, Stable/Insiders variants, or pet transitions under src/vs/workbench/contrib/chat/browser/widget/media/chatPet.

microsoft/vscode · 53 tokens

cpu-profile-analysis

Analyze V8/Chrome CPU profiles (.cpuprofile) and DevTools trace files (Trace-.json). Use when: profiling performance, investigating slow functions, comparing code paths, finding bottlenecks, analyzing timeToRequest, understanding call trees from sampling profiler data, analyzing layout/paint/rendering, investigating…

microsoft/vscode · 71 tokens