toolhive: Skill for Claude Code

.claude/skills/add-rule/SKILL.md

add-rule is a skill for Claude Code from stacklok/toolhive. It costs 31 tokens per session (1,163 once invoked), scanned A, original, Apache-2.0.

A workflow for recording a team's coding convention in the project's Claude rules or agent files so it is applied automatically in the relevant work.

In plain words
What is it for?
Use it to add rules about testing, context handling, CLI output formats, or other conventions, while choosing the appropriate file and scope.
Why use it?
It turns informal advice or corrections into reusable project guidance and preserves the reason behind each rule for future decisions.

Skill for Claude Code

Written for Claude Code: installed under .claude/. Also seen: reads .claude/ paths; mentions CLAUDE.md.

This is stacklok/toolhive's own configuration. It tells Claude Code how to work on toolhive itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything toolhive configures →

About the project

ToolHive is a platform for running and managing Model Context Protocol servers, which give AI clients access to tools and data. Developers, platform teams, and enterprises use it to isolate MCP servers, control access, and monitor their operation. The catalogue entries provide agent workflows and configuration for operating ToolHive and its MCP servers.

stacklok/toolhive · 2,307 stars · on GitHub · stacklok.com

Reuse

Borrowing it

Nothing to install: this file belongs to stacklok/toolhive. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/stacklok/toolhive/main/.claude/skills/add-rule/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/stacklok/toolhive

Made for: Claude Code.

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-rule

README.md
[![agentmods](https://agentmods.dev/badge/skills/stacklok/toolhive/add-rule/github.svg)](https://agentmods.dev/skills/stacklok/toolhive/add-rule)
Your own site
<a href="https://agentmods.dev/skills/stacklok/toolhive/add-rule"><img src="https://agentmods.dev/badge/skills/stacklok/toolhive/add-rule/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for add-rule

Your own site · 80×15
<a href="https://agentmods.dev/skills/stacklok/toolhive/add-rule"><img src="https://agentmods.dev/badge/skills/stacklok/toolhive/add-rule.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 31 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,163 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector warn 7 Sept 2026
SkillSpector: 1 finding, up to medium

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • medium Rogue Agent · line 50
    Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.
    Fix: Remove any persistence mechanisms (cron jobs, startup scripts, state files). Skills should not maintain state across sessions without explicit user consent.
How audits are shown
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.1 $0.00031 $0.01163
Opus 5.5 $0.00012 $0.00465
Sonnet 5.5 $0.00006 $0.00233
Haiku 4.5 $0.00003 $0.00116

Measured 1mo ago against content hash 01603ed05788, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

add-rule 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 1mo 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.

.claude/skills/add-rule/SKILL.md · 100 lines

How it starts

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

Add Rule — Capture a Team Convention

Purpose

Formalize a convention, best practice, or correction into the project's .claude/rules/ or .claude/agents/ files so it applies automatically for all team members.

Input

The user provides a convention in natural language. Examples:

  • /add-rule "prefer require.NoError over t.Fatal for error assertions"
  • /add-rule "use context.Background() in tests, not context.TODO()"
  • /add-rule "CLI commands must support --format json"

If no argument is provided, ask: "What convention would you like to add?"

Instructions

1. Understand the Convention

Parse the user's input to identify:

  • The rule: What should or should not be done
  • The scope: Which files or areas it applies to (Go code, tests, CLI, operator, etc.)
  • The reason: Why this convention exists (ask if not provided — the "why" is critical for future developers to judge edge cases)

2. Find the Right Target File

Rules vs Agents — key principle: Rules define conventions; agents reference rules. Never duplicate rule content in agent files.

  • Rules files (.claude/rules/): Auto-loaded based on paths: frontmatter globs when Claude touches matching files. These define the canonical conventions (style, testing patterns, error handling, etc.).
  • Agent files (.claude/agents/): Define agent-specific behavior — persona, review checklist, output format, workflow steps. Agents inherit the full conversation context (including CLAUDE.md), so they already have access to all loaded rules. Agent files should reference rules (e.g., "Follows conventions in .claude/rules/testing.md"), never restate them.

Match the convention to an existing file based on scope:

Scope Target file What goes here
General Go code .claude/rules/go-style.md Style, naming, error handling conventions
Test files .claude/rules/testing.md Testing patterns, framework usage
CLI commands .claude/rules/cli-commands.md CLI architecture, flag conventions
Kubernetes operator .claude/rules/operator.md CRD, controller conventions
PR creation .claude/rules/pr-creation.md PR format, review expectations
Agent workflow/persona .claude/agents/<agent-name>.md Agent-specific behavior, checklists, output format

Read the full file on GitHub · 100 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. 1mo ago First seen · 100 lines · 31 tokens per session scan A 01603ed05788

Subscribe to this mod's changes

add-rule is a skill published in the GitHub repository stacklok/toolhive (2,307 stars, last pushed today), licensed Apache-2.0. It adds 31 tokens to every session and 1,163 once invoked, about $0.0001 per session on Opus 5.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-30.

Related

Other skills, from other repositories

clinical-trial-protocol-skill

Generate clinical trial protocols for medical devices or drugs. This skill should be used when users say "Create a clinical trial protocol", "Generate protocol for [device/drug]", "Help me design a clinical study", "Research similar trials for [intervention]", or when developing FDA submission documentation for…

Agent-Threat-Rule/agent-threat-rules · 70 tokens

claude-d3js-skill

This skill provides guidance for creating sophisticated, interactive data visualisations using d3.js.

Agent-Threat-Rule/agent-threat-rules · 25 tokens

adr-skill

Create and maintain Architecture Decision Records (ADRs) optimized for agentic coding workflows. Use when you need to propose, write, update, accept/reject, deprecate, or supersede an ADR; bootstrap an adr folder and index; consult existing ADRs before implementing changes; or enforce ADR conventions. This skill uses…

Agent-Threat-Rule/agent-threat-rules · 89 tokens

terraform-skill

Terraform infrastructure as code best practices.

Agent-Threat-Rule/agent-threat-rules · 10 tokens

create-auth-skill

Scaffold and implement authentication in TypeScript/JavaScript apps using Better Auth. Detect frameworks, configure database adapters, set up route handlers, add OAuth providers, and create auth UI pages. Use when users want to add login, sign-up, or authentication to a new or existing project with Better Auth.

Agent-Threat-Rule/agent-threat-rules · 66 tokens

prior-auth-review-skill

Automate payer review of prior authorization (PA) requests. This skill should be used when users say "Review this PA request", "Process prior authorization for [procedure]", "Assess medical necessity", "Generate PA decision", or when processing clinical documentation for coverage policy validation and authorization…

Agent-Threat-Rule/agent-threat-rules · 63 tokens