This skill installs a wrapper, a streaming route and tests that run Claude agents inside a Next.js app through the Claude Agent SDK. It is for agents that need the Claude Code engine’s own file and shell tools, skills and MCP, or for products that already run the SDK.
An agent is a directory with an AGENTS.md, optional knowledge files, local skills and an MCP config. One function runs any agent, so no agent name appears in code. The skill also covers the chat UI contract, the tool boundary and what to settle before the agent leaves localhost.
What You Get
- A wrapper, a route that lists and streams agents, a unit test for the contract and a live test for every agent
- A script that creates an agent directory with its AGENTS.md, and optional knowledge and MCP files
- A script that lists each MCP server’s tools next to the ones granted
- Two finished example agents, copied only on request: a knowledge agent and a research agent
- A playbook reference with the measurement behind each option
Common Use Cases
- Adding a support or research agent to a Next.js product
- Restricting an agent to a few MCP tools and its own knowledge files
- Preparing an embedded agent for deployment on a long-lived Node host
- Writing live tests that pin what an agent refuses or cites
What Makes It Unique
It is the second of two embedded-agent skills, and says when to pick it: only when the agent needs the Claude Code engine or the app already runs it. Its tool boundary has six measured layers, from an allowlist of built-in tools to turn and budget caps, and the live test suite stays out of the normal gate because it costs money.
Under The Hood
The skill is mostly instructions, with two Node scripts and TypeScript templates. The agent runs npm installs, copies template files into the app and runs new-agent.mjs, which writes a new agent directory. The discover script starts each MCP server from the agent’s config, which can reach the network with the agent’s secrets, reads the tool list and writes nothing. The wrapper starts the Claude Code engine as a subprocess with built-in file tools only on an allowlist, and the live tests call the real model.