Official agent skill

Add Middleware

by NVIDIA in NVIDIA/NeMo-Relay

Add a new NeMo Relay guardrail or intercept type, registration surface, or pipeline stage.

OfficialApache-2.0Auto-check passedAI & LLM Engineering

Install Add Middleware

skills CLI
$ npx skills add NVIDIA/NeMo-Relay --skill add-middleware -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install NVIDIA/NeMo-Relay add-middleware --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/NVIDIA/NeMo-Relay.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/add-middleware .claude/skills/add-middleware && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
add-middleware
GitHub stars
190
Token cost
~1.2k tokens
SKILL.md length
515 words
Files
1
Skills in repo
30
Repo updated
First seen
Licence
Apache-2.0

At a glance

Add a new NeMo Relay guardrail or intercept type, registration surface, or pipeline stage.

  • Works in 2 steps: Define or reuse the callback type alias in → Add the registry field to…
  • Changing an existing middleware implementation without a new middleware contract
  • SKILL.md covers Lock The Design First, Pipeline Order, Core Steps and Required Tests, plus 1 more section
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Add Middleware is an agent skill from NVIDIA/NeMo-Relay, published by the product's own GitHub organization. Add a new NeMo Relay guardrail or intercept type, registration surface, or pipeline stage. Do not use for changing an existing middleware implementation without a new middleware contract.

Its SKILL.md is about 1.2k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in AI & LLM Engineering. The repository describes itself as: Multi-language agent runtime and library for execution scope management, lifecycle events, and middleware on tool and LLM calls. The licence is Apache-2.0.

When your agent uses it

  • Changing an existing middleware implementation without a new middleware contract

Example prompts

  • “/add-middleware”

Workflow steps

2 steps, taken from the first numbered list in SKILL.md.

  1. Define or reuse the callback type alias in
  2. Add the registry field to NemoRelayContextState in

What it can do on your machine

Read from SKILL.md and the folder at commit 651453f. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are rust).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Add Middleware loads about 1.2k tokens when it runs. Until then it costs about 51 tokens; SKILL.md has 515 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~51
When it runs · the whole SKILL.md, loaded when a task matches
~1.2k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from NVIDIA/NeMo-Relay at commit 651453f, republished under its Apache-2.0 licence (© NVIDIA). 515 words, ~1,242 tokens.

Download SKILL.mdSave it as .claude/skills/add-middleware/SKILL.md (or your agent's skills folder).
name
add-middleware
description
Add a new NeMo Relay guardrail or intercept type, registration surface, or pipeline stage. Do not use for changing an existing middleware implementation without a new middleware contract.
license
Apache-2.0

Add a Middleware Type

NeMo Relay supports guardrails (validate/gate) and intercepts (transform) at various pipeline stages. Adding a new middleware type requires checking every layer that exposes the new contract.

Use this skill when introducing a new middleware registration surface or adding middleware behavior to a new pipeline stage.

Lock The Design First

Decide these before editing code:

  • Is this for tools, LLMs, marks, scope events, or a combination?
  • Is it a conditional guardrail, sanitize guardrail, request intercept, or execution intercept?
  • Does it run on request input, inner callable execution, stream chunks, or final response output?
  • Is the callback fallible, and how should callback failures propagate?
  • Does it need both global and scope-local registration?
  • What should subscribers and exporters observe in the event payload after this middleware runs?
  • If this is an event sanitizer, which of data, category_profile, and metadata can change, and is the event used only as immutable context?

Pipeline Order

Refer to docs/about-nemo-relay/concepts/middleware.mdx for the full diagrams.

  • Tool execute: conditional guardrails -> request intercepts -> sanitize request (for events) | execution intercept chain(callable) -> sanitize response
  • LLM execute: conditional guardrails -> request intercepts -> sanitize request (for events) | execution intercept chain(callable) -> sanitize response
  • Mark and scope events: specialized tool or LLM sanitizer (when applicable) -> mark or scope event sanitizer -> subscriber and exporter dispatch

Tool execution callbacks and each execution-intercept next continuation return the canonical ToolExecutionResult { result, annotation }. A forwarding intercept must preserve both fields in ToolExecutionInterceptOutcome; Relay retains pending_marks separately. Tool sanitize-response guardrails receive only result. Scope-end event sanitizers govern the annotation after Relay projects it to category_profile.tool_result_annotation.

Show full SKILL.md (260 more words)Show less

Core Steps

  1. Define or reuse the callback type alias in crates/core/src/api/runtime/callbacks.rs.
rust
pub type MyNewFn = Box<dyn Fn(&str, Json) -> Json + Send + Sync>;
  1. Add the registry field to NemoRelayContextState in crates/core/src/api/runtime/state.rs.

Add a SortedRegistry<GuardrailEntry<MyNewFn>> or SortedRegistry<Intercept<MyNewFn>> field to the state struct.

  1. Add registration and deregistration APIs in crates/core/src/api/.

Use the existing global_*_registry_api! and scope_*_registry_api! macro patterns in crates/core/src/api/registry.rs. Both global and scope-local variants are needed unless the design explicitly rules one out.

  1. Add chain execution helpers to NemoRelayContextState in crates/core/src/api/runtime/state.rs.

Follow the pattern of tool_sanitize_request_chain or tool_request_intercepts_chain.

  1. Wire the chain into the execute path.

Update the relevant lifecycle owner to call the new chain method at the appropriate pipeline stage. Tool and LLM paths live in crates/core/src/api/tool.rs and crates/core/src/api/llm.rs; shared mark and scope event sanitization lives in crates/core/src/api/shared.rs and is called from crates/core/src/api/scope.rs.

  1. Expose the new middleware surface in every affected binding.

For a public middleware contract, implement the Rust source of truth, then update only the bindings, FFI, wrappers, documentation, and tests that expose or observe the new contract.

Required Tests

  • Registration and duplicate-name behavior
  • Deregistration and no-op missing-name behavior
  • Ordering by priority
  • Callback failure policy, including fail-open behavior when required
  • Scope-local registration, inheritance, and cleanup on pop
  • Event payload semantics after middleware mutation
  • Tool execution result and annotation preservation, replacement, and removal when the middleware touches tool execution
  • Mark and scope event field semantics, including immutable identity fields
  • Parity coverage in every affected binding

Key References

  • Pipeline logic: crates/core/src/api/tool.rs, crates/core/src/api/llm.rs
  • Type aliases: crates/core/src/api/runtime/callbacks.rs
  • Runtime state and chain builders: crates/core/src/api/runtime/state.rs
  • Scope-local registry merging: crates/core/src/context/registries.rs
  • Registry: crates/core/src/registry.rs
  • Pipeline docs: docs/about-nemo-relay/concepts/middleware.mdx
  • Architecture docs: docs/about-nemo-relay/architecture.mdx
  • Registration examples: docs/instrument-applications/advanced-guide.mdx

© NVIDIA, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .agents/skills/add-middleware of NVIDIA/NeMo-Relay.

Open the folder on GitHubat commit 651453f

Compare with similar skills

Add Middleware next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Add Middleware compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Add Middleware this skillNVIDIA/NeMo-Relay190—~1.2kAutomated safety check: PassApache-2.0
Agent BuildershareAI-lab/learn-claude-code78k6 repos~1.2kAutomated safety check: PassMIT
Add Uint Supportpytorch/pytorch104k2 repos~2.3kAutomated safety check: PassCustom licence
Peft Fine TuningOrchestra-Research/AI-Research-SKILLs13k9 repos~3.1kAutomated safety check: PassMIT
Segment Anything Model GuideOrchestra-Research/AI-Research-SKILLs13k9 repos~3.3kAutomated safety check: PassMIT
1passwordtrpc-group/trpc-agent-go1.8k13 repos~656Automated safety check: PassApache-2.0

Similar skills

  • Agent Builder

    shareAI-lab/learn-claude-code

    Design and build AI agents for any domain. An agent skill from shareAI-lab/learn-claude-code.

    78k GitHub starsUsed in 6 repos~1.2k tokens
    AI & LLM EngineeringAuto-check passed
  • Add Uint Support

    pytorch/pytorch

    Add unsigned integer (uint) type support to PyTorch operators by updating ATDISPATCH macros.

    104k GitHub starsUsed in 2 repos~2.3k tokens
    AI & LLM EngineeringAuto-check passed
  • Peft Fine Tuning

    Orchestra-Research/AI-Research-SKILLs

    Parameter-efficient fine-tuning for LLMs using LoRA, QLoRA, and 25+ methods.

    13k GitHub starsUsed in 9 repos~3.1k tokens
    AI & LLM EngineeringAuto-check passed
  • Segment Anything Model Guide

    Orchestra-Research/AI-Research-SKILLs

    Guide to using Meta's Segment Anything Model for zero-shot image segmentation with point, box or mask prompts, or automatic mask generation.

    13k GitHub starsUsed in 9 repos~3.3k tokens
    AI & LLM EngineeringAuto-check passed
  • 1password

    trpc-group/trpc-agent-go

    Set up and use 1Password CLI (op). An agent skill from trpc-group/trpc-agent-go.

    1.8k GitHub starsUsed in 13 repos~656 tokens
    AI & LLM EngineeringAuto-check passed
  • Chroma Vector Database

    Orchestra-Research/AI-Research-SKILLs

    Shows how to store documents and embeddings in Chroma, query them by similarity with metadata filters, and persist them to disk for RAG and semantic search projects.

    13k GitHub starsUsed in 8 repos~2.3k tokens
    AI & LLM EngineeringAuto-check passed

More from NVIDIA/NeMo-Relay

All 30 skills in this repo
  • Draft Release Notes

    NVIDIA/NeMo-Relay

    Official

    Compare NeMo Relay release refs and draft the current documentation release-notes page from verified repository evidence.

    190 GitHub stars~575 tokensUpdated yesterday
    Auto-check passed
  • Official

    A skill your agent uses when migrating applications, examples, integrations, documentation, manifests, or repository code from NeMo Flow to NeMo Relay across Python, Rust, Node.js, Go, C FFI, CLI…

    190 GitHub stars~1.8k tokensUpdated yesterday
    Auto-check passed
  • Contribute Docs

    NVIDIA/NeMo-Relay

    Official

    Author or edit NeMo Relay documentation or examples when repository-specific MDX, public API, integration, or release-history conventions matter.

    190 GitHub stars~710 tokensUpdated yesterday
    Auto-check passed
  • Maintain CI

    NVIDIA/NeMo-Relay

    Official

    Change or review NeMo Relay GitHub Actions workflows where permissions, pinned actions, caching, reusable workflows, or release gates require repository-specific handling.

    190 GitHub stars~1k tokensUpdated yesterday
    Auto-check passed
  • Nemo Relay Install

    NVIDIA/NeMo-Relay

    Official

    A skill your agent uses when choosing or running NeMo Relay installation for the CLI, Python, Node.js, Rust, OpenClaw, or maintained framework integrations, or when explaining Hermes Agent's…

    190 GitHub stars~1.7k tokensUpdated yesterday
    Auto-check passed
  • Nemo Relay Plugin Build

    NVIDIA/NeMo-Relay

    Official

    A skill your agent uses when building or packaging reusable NeMo Relay runtime behavior as an embedded configuration component or a manifest-backed rustdynamic native or worker gRPC plugin, with…

    190 GitHub stars~2.6k tokensUpdated yesterday
    Auto-check passed

Questions about Add Middleware

What does Add Middleware do?

Add a new NeMo Relay guardrail or intercept type, registration surface, or pipeline stage. Add Middleware is an agent skill from NVIDIA/NeMo-Relay, published by the product's own GitHub organization. Add a new NeMo Relay guardrail or intercept type, registration surface, or pipeline stage.

When should I use Add Middleware?

Add Middleware fits situations like: changing an existing middleware implementation without a new middleware contract.

How do I install Add Middleware in Claude Code?

Run `npx skills add NVIDIA/NeMo-Relay --skill add-middleware -a claude-code`. Or copy the skill folder (.agents/skills/add-middleware in NVIDIA/NeMo-Relay) into .claude/skills/add-middleware in your project. Claude Code loads it when a task matches its description.

How do I install Add Middleware in Codex?

Run `npx skills add NVIDIA/NeMo-Relay --skill add-middleware -a codex`. Or copy the skill folder (.agents/skills/add-middleware in NVIDIA/NeMo-Relay) into .agents/skills/add-middleware in your project. Codex loads it when a task matches its description.

Can I use Add Middleware in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add NVIDIA/NeMo-Relay --skill add-middleware -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/add-middleware, .gemini/skills/add-middleware, .github/skills/add-middleware and .opencode/skills/add-middleware in your project.

What does Add Middleware need to run?

SKILL.md names no scripts, command-line tools or credentials: Add Middleware is instructions for the agent only.

Does Add Middleware access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Add Middleware safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Add Middleware use?

Add Middleware is published under the Apache-2.0 licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Add Middleware use?

About 1.2k tokens (SKILL.md is roughly 5k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Add Middleware?

Skills that share tags, products or a category with Add Middleware: Agent Builder (shareAI-lab/learn-claude-code, 78k stars), Add Uint Support (pytorch/pytorch, 104k stars), Peft Fine Tuning (Orchestra-Research/AI-Research-SKILLs, 13k stars) and Segment Anything Model Guide (Orchestra-Research/AI-Research-SKILLs, 13k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Add Middleware?

NVIDIA (a GitHub organization, an official publisher) maintains it in NVIDIA/NeMo-Relay, which has 190 GitHub stars. The repository holds 30 skills in this directory. The repository was last updated on October 7, 2026.

Source: NVIDIA/NeMo-Relay on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.