К основному содержанию
скилл CX Codex

create-client-tool — скилл для Claude Code

Скилл создаёт клиентский инструмент AtlasTool для чата useAtlasChat в веб-приложении. Он описывает схему TypeBox, настраивает вызов логики в браузере и подключает инструмент к чату.

Установить в Claude Code · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add cognitedata/builder-skills --skill create-client-tool -a claude-code
Открыть на GitHub

Что делает create-client-tool

Скилл генерирует шаблон инструмента AtlasTool, позволяя агенту Atlas выполнять клиентский код прямо в браузере: менять локальное состояние или строить графики. Параметры описываются через @sinclair/typebox для проверки типов при сборке и валидации аргументов во время работы. Функция execute() возвращает текстовый output агенту и объект details для интерфейса приложения.

Скилл анализирует файлы проекта, находит вызов хука useAtlasChat, создаёт файл инструмента и добавляет его в массив tools. Результаты работы выводятся через message.toolCalls в компонентах интерфейса.

Без предварительно скопированной папки src/atlas-agent/ и установленного пакета @sinclair/typebox сгенерированный код не скомпилируется. Для боковой панели EOS этот скилл не подходит: для неё нужно действие Fusion через integrate-fusion-agent.

Какие задачи решает

  • сгенерировать шаблон AtlasTool со схемой TypeBox
  • подключить клиентский инструмент к хуку useAtlasChat
  • вернуть структурированные данные details для отображения в UI
  • передать текстовый результат работы браузерного кода агенту

Примеры запросов агенту

  • Сделай клиентский инструмент export_pdf для скачивания отчётов в формате PDF
  • Создай тул show_filter_panel для открытия боковой панели фильтров в интерфейсе
  • Добавь AtlasTool navigate_to_asset для перехода на страницу выбранного актива

Как установить create-client-tool

1Через Skills CLI (Vercel)

npx skills add cognitedata/builder-skills --skill create-client-tool -a claude-code

2Вручную: положить файлы

~/.claude/skills/create-client-tool/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/create-client-tool/

По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов

Вопросы о create-client-tool

Как установить create-client-tool в Claude Code?

Выполните команду npx skills add cognitedata/builder-skills --skill create-client-tool -a claude-code.

Что делает скилл create-client-tool?

Он создаёт определение AtlasTool с валидацией через TypeBox, браузерным методом execute и прописывает его в массиве tools хука useAtlasChat.

Что требуется перед запуском create-client-tool?

В проекте должны быть установлена библиотека @sinclair/typebox и перенесена директория src/atlas-agent/, подготовленные ранее через integrate-atlas-chat.

Исходный текст

SKILL.md · Apache-2.0
---
name: create-client-tool
description: "Scaffolds an AtlasTool for an already-approved in-app useAtlasChat UI. For EOS sidebar tools, use integrate-fusion-agent (createAgentAction) instead. Triggers: AtlasTool, useAtlasChat tool, in-app atlas client tool."
allowed-tools: Read, Glob, Grep, Edit, Write
metadata:
  argument-hint: "[tool-name] [brief description of what it does]"
---

# Create a Client Tool

Scaffold an `AtlasTool` named **$ARGUMENTS**. If the app has no approved in-app `useAtlasChat`, implement a Fusion **action** via **`integrate-fusion-agent`** instead.

**Prerequisite:** vendored `src/atlas-agent/` and `@sinclair/typebox` from `integrate-atlas-chat`.

## Background

Client tools let the Atlas Agent invoke browser-side logic — charts, local state, UI panels, navigation. The agent decides when to call; the app executes and returns a result.

1. Agent responds with a `clientTool` action
2. TypeBox validates the arguments
3. `execute()` runs in the browser and returns `{ output, details }`
4. `output` (string) is sent back to the agent
5. `details` is available on `message.toolCalls` for the UI to render

---

## Step 1 — Understand the codebase

Before writing anything, read:

- The file where `useAtlasChat` is called (often `src/App.tsx` or a chat hook) to find where `tools` is passed — imports are typically from `./atlas-agent/react` after **`integrate-atlas-chat`**
- Any existing tool definitions to match the file/naming conventions

---

## Step 2 — Define the tool

Use `Type` from `@sinclair/typebox` for the parameters schema (compile-time types + runtime validation).

```ts
import { Type } from "@sinclair/typebox";
import type { AtlasTool } from "./atlas-agent/types";

export const myTool: AtlasTool = {
  name: "my_tool",            // snake_case — this is what the agent uses to invoke it
  description:
    "One sentence describing what this tool does and when the agent should call it.",
  parameters: Type.Object({
    exampleParam: Type.String({ description: "What this param is for" }),
    optionalNum: Type.Optional(Type.Number({ description: "..." })),
  }),
  execute: async (args) => {
    return {
      output: "Plain text summary sent back to the agent",
      details: {
        // Any structured data you want available in the UI via message.toolCalls
      },
    };
  },
};
```

Adjust the `./atlas-agent/...` path if the tool file is not directly under `src/` next to the `atlas-agent` folder (for example `../atlas-agent/types` from `src/tools/`).

### TypeBox quick reference

| Schema | Usage |
|---|---|
| `Type.String()` | string |
| `Type.Number()` | number |
| `Type.Boolean()` | boolean |
| `Type.Literal("foo")` | exact value |
| `Type.Union([Type.Literal("a"), Type.Literal("b")])` | enum |
| `Type.Array(Type.String())` | string[] |
| `Type.Object({ ... })` | object |
| `Type.Optional(...)` | mark any field optional |

Always add a `description` on the tool and on each parameter — the agent uses those strings.

---

## Step 3 — Wire into useAtlasChat

Find the `useAtlasChat` call and add the tool to the `tools` array:

```ts
const { messages, send, ... } = useAtlasChat({
  client: isLoading ? null : sdk,
  agentExternalId: AGENT_EXTERNAL_ID,
  tools: [myTool],   // add here
});
```

---

## Step 4 — Render tool results (if needed)

If the tool returns structured `details`, render them in the message list.
`message.toolCalls` is a `ToolCall[]` — one entry per tool call (client-side and server-side) in call order.

```tsx
{msg.toolCalls?.map((tc, i) => (
  // tc.name    — tool name
  // tc.output  — the string sent back to the agent
  // tc.details — your structured data (cast to your known shape)
  <MyToolOutput key={i} data={tc.details as MyToolDetails} />
))}
```

© cognitedata · Apache-2.0 · cognitedata/builder-skills

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

Все скиллы по теме «Настройка агента: память, контекст, субагенты» →
apollo-client apollographql Скилл ведёт агента по настройке Apollo Client 4.x в React: запросы, мутации, кэш, локальное состояние и разбор ошибок. CX Codex +1 5 600установок nextjs-server-client-components wsimmonds Помогает выбрать между Server и Client Components в Next.js App Router, настроить чтение cookies, работу с searchParams и избежать смешивания клиентских и серверных API. CX Codex +1 360установок nextjs-client-cookie-pattern wsimmonds Скилл показывает, как из клиентского компонента Next.js выставить серверную куку через server action. Пригодится для тем, авторизации и языковых настроек. CX Codex +1 323установок create-mcp-app modelcontextprotocol Ведёт агента через сборку MCP App: MCP-инструмент плюс HTML-ресурс с интерфейсом, который хост рисует рядом с результатом инструмента. CX Codex +1 2 700установок react-graphql-apollo-client-cursorrules-prompt-file PatrickJS Правило задаёт Cursor подход к React-разработке с GraphQL и Apollo Client. Оно пригодится для единого устройства запросов, мутаций и компонентов. ★ 41 024звёзд репо experience-ui-bundle-agentforce-client-generate forcedotcom Встраивает клиент Agentforce Conversation в React и Angular UI Bundle: находит нужный пакет, проверяет agentId и подключает компонент на страницу. CX Codex +1 5 000установок

Из того же набора24

code-quality Скилл проводит ревью TypeScript- и React-кода, опираясь на линтер, строгую типизацию и проверку размеров компонентов. Пригодится перед созданием PR или после завершения фичи. CX Codex +1 2 000установок use-topbar Скилл ставит в приложение Flows/Fusion единый топбар из @aura/topbar: хлебные крошки, переключатель темы, кнопка Atlas. CX Codex +1 1 900установок pull-changes-resolve-conflicts Скилл ведёт агента через слияние веток: сначала показывает конфликты и спрашивает, потом правит. Пригодится, когда в проекте несколько контрибьюторов. CX Codex +1 1 900установок performance Скилл помогает находить узкие места в производительности Flows и проверять изменения замерами. Используйте его при лишних перерисовках, медленных запросах или большом объёме данных. CX Codex +1 1 900установок graph-viewer Скилл помогает встроить интерактивный граф модели данных CDF в приложение на Flows: узлы, связи и обратные связи. CX Codex +1 1 900установок setup-flows-auth Настраивает авторизацию React-приложений в Cognite Flows и Fusion iframe. Скилл определяет тип интеграции, ставит нужные SDK и правит конфигурацию Vite. CX Codex +1 1 900установок setup-python-tools Ставит клиентское выполнение Python-инструментов через Pyodide в приложение с уже готовым useAtlasChat. Нужен, когда агент отдаёт код инструмента, а считать он должен в браузере. CX Codex +1 1 900установок dm-limits-and-best-practices Справочный скилл про лимиты CDF Data Modeling: конкурентность и 429, пагинация, батчи, QueuedTaskRunner. Пригодится, когда код сыпет ошибками на нагрузке. CX Codex +1 1 900установок

Спонсоры проекта

Компании, которые помогают держать аналитику открытой