Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

embedded-agents-messages-api

БесплатноЗапускает вложенные скриптыНе проверен

Building, adding or wiring up an agent or an agent chat inside a Next.js app: embed Claude agents on the Messages API, the default way.

sickn33от sickn33★ 50 670 звёзд на GitHub

Об этом скилле

Embedded agents — Claude API

Operational boundaries

Keep the scope, sandbox, credentials and approval settings supplied by the user or host. Obtain authorization before delegating, exposing project files to another provider, enabling connectors or hooks, using paid services or deploying. Use synthetic or redacted inputs for examples. Keep security reviews static and defensive, with findings and fixes grounded in source inspection.

When to Use

Building, adding or wiring up an agent or an agent chat inside a Next.js app: embed Claude agents on the Messages API, the default way.

Use the Messages API by default for a new product. The Anthropic SDK's tool runner (client.beta.messages.toolRunner) drives the loop inside the app's process. The agent has exactly the wrapper's tools, with nothing built in. Both embedded-agent skills run the same agent directories, which move between them unchanged (playbook § 10). Apply embedded-agents-agent-sdk only when the agent needs what only the Claude Code engine has, or when the product already runs it. That SDK starts the engine as a subprocess, provides built-in file and shell tools, and needs a long-lived Node host.

Read the product's own agent instructions before changing its embedded agents. Start with its root AGENTS.md or CLAUDE.md, and tell any subagent spawned for this work to read it too. Its rules on secrets, environment variables, validation, callers, tests and release apply here. Read reference/playbook.md before changing the wrapper's contract or explaining it in depth. It holds the full playbook and the measurement behind every choice.

Keep request, caller, storage and UI ownership in the app. The agent owns reasoning and tool choice. An agent is a directory, .claude/agents/<name>/, with AGENTS.md as its whole system prompt. It may also hold knowledge/, agent-local skills in .claude/skills/, and .mcp.json. One wrapper function, askAgent, runs any agent. No agent name appears in code.

1. First use: install the wrapper

Search for askAgent before installing another wrapper. If it exists, skip to § 2. If it imports @anthropic-ai/claude-agent-sdk, the product uses the other skill; migration is in playbook § 10. Otherwise:

  1. Create only the smallest requested app when none exists. Use Next.js App Router in TypeScript, which these files target. Add nothing unasked for: no database, sign-in or billing for a local prototype.

  2. Install the missing dependencies. Run npm i @anthropic-ai/sdk @modelcontextprotocol/sdk zod server-only and npm i -D vitest. Pin exact versions: the tool runner is marked beta in the TypeScript SDK, so an upgrade is re-tested, not assumed.

  3. Copy the wrapper, route and tests, changing only import paths.

    From this skill To the app
    templates/agent.ts src/lib/agent.ts — the wrapper
    templates/agent-mcp.ts src/lib/agent-mcp.ts — an agent's MCP servers, opened per run
    templates/route.ts src/app/api/agents/route.ts — GET lists agents, POST streams one
    templates/agent.test.ts tests/unit/agent.test.ts — the contract, inside npm test, no model call
    templates/agents.live.test.ts tests/live/agents.live.test.ts — every agent against the real model

    The tests import @/lib/agent and @/lib/agent-mcp, so Vitest needs the same @ alias as tsconfig.json. The live test gets its own Vitest config (include tests/live/**/*.live.test.ts, testTimeout: 180_000, fileParallelism: false, and process.loadEnvFile('.env') in a try) and a script, agents:live. It costs money, so it stays out of npm test and the gate.

  4. Set each required secret per environment and never commit it. Set ANTHROPIC_API_KEY and every secret referenced by an agent's .mcp.json; apply environments. On a developer's machine the SDK also reads a profile from ant auth login; a deployed product always uses the key.

  5. Keep the contract. Every choice in agentRequest() and askAgent() is pinned by the unit test and explained in the playbook (§ 3, § 7). Change one only after re-measuring it.

2. Add an agent

  1. Create the agent directory and write its complete instructions. Run node <skill dir>/scripts/new-agent.mjs <name> [--knowledge] [--mcp], then fill in AGENTS.md: role, sources, output format, refusals. It is the agent's whole system prompt, with no product preset underneath. A fixed sign-off line is the cheapest live-test proof that the instructions are in force.
  2. Confine knowledge tools to knowledge and load skills as instructions. Put files in knowledge/, and tell the agent in AGENTS.md to answer only from them. It gets list_files, search_files and read_file, confined to knowledge/ (playbook § 5). Name those tools in AGENTS.md, not Claude Code's Read/Glob/Grep. Put agent-local skills in .claude/agents/<name>/.claude/skills/<skill>/SKILL.md, with `descript
Полный SKILL.md на GitHub

Установить embedded-agents-messages-api в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

LICENSEexamples/knowledge-agent.live.test.tsexamples/knowledge-agent/AGENTS.mdexamples/knowledge-agent/knowledge/jtbd.mdexamples/knowledge-agent/knowledge/llms.mdexamples/knowledge-agent/knowledge/okrs.mdexamples/knowledge-agent/knowledge/product-strategy.mdexamples/knowledge-agent/knowledge/product-vision.mdexamples/research-agent.live.test.tsexamples/research-agent/.mcp.jsonexamples/research-agent/AGENTS.mdreference/playbook.mdscripts/discover-mcp-tools.mjsscripts/new-agent.mjstemplates/agent-mcp.tstemplates/agent.test.tstemplates/agent.tstemplates/agents.live.test.tstemplates/route.ts

FAQ

Что делает скилл embedded-agents-messages-api?

Building, adding or wiring up an agent or an agent chat inside a Next.js app: embed Claude agents on the Messages API, the default way.

Как установить скилл embedded-agents-messages-api?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл embedded-agents-messages-api запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить embedded-agents-messages-api с