用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/simstudioai/sim --skill add-tools命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
The response, error, pagination, and validation contract every `/api/v2` endpoint must satisfy. Use when adding or changing a route under `apps/sim/app/api/v2/`, or when auditing one for conformance.
Commit, push, and open a PR to staging in one shot — runs the cleanup pass and, when migrations changed, the db-migrate safety review first
Keep the executable tool registry out of client-reachable module graphs — when to read `@/tools/metadata` instead of `getTool`, how to measure whether an import edge pulls the registry, and how to regenerate the metadata artifacts. Use when touching `apps/sim/tools/registry.ts`, `tools/utils.ts`, `tools/params.ts`, or anything that calls `getTool`.
正在显示 SKILL.md
| name | add-tools |
| description | Create tool configurations for a Sim integration by reading API docs |
| argument-hint | <service-name> [api-docs-url] |
You are an expert at creating tool configurations for Sim integrations. Your job is to read API documentation and create properly structured tool files.
When the user asks you to create tools for a service:
If the docs do not clearly show the response JSON for a tool, you MUST tell the user exactly which outputs are unknown and stop short of guessing.
transformResponse against unverified payloadsIf the response shape is unknown, do one of these instead:
Create files in apps/sim/tools/{service}/:
tools/{service}/
├── index.ts # Barrel export
├── types.ts # Parameter & response types
└── {action}.ts # Individual tool files (one per operation)
Every tool MUST follow this exact structure:
import type { {ServiceName}{Action}Params } from '@/tools/{service}/types'
import type { ToolConfig } from '@/tools/types'
interface {ServiceName}{Action}Response {
success: boolean
output: {
// Define output structure here
}
}
export const {serviceName}{Action}Tool: ToolConfig<
{ServiceName}{Action}Params,
{ServiceName}{Action}Response
> = {
id: '{service}_{action}', // snake_case, matches tool name
name: '{Service} {Action}', // Human readable
description: 'Brief description', // One sentence
version: '1.0.0',
// OAuth config (if service uses OAuth)
oauth: {
required: true,
provider: '{service}', // Must match OAuth provider ID
},
params: {
: {
: ,
: ,
: ,
: ,
},
: {
: ,
: ,
: ,
: ,
},
: {
: ,
: ,
: ,
: ,
},
},
: {
: ,
: ,
: ({
: ,
: ,
}),
: ({
}),
},
: (: ) => {
data = response.()
{
: ,
: {
},
}
},
: {
},
}
'hidden' - System-injected (OAuth tokens, internal params). User never sees.'user-only' - User must provide (credentials, api keys, account-specific IDs)'user-or-llm' - User provides OR LLM can compute (search queries, content, filters, most fall into this category)'string' - Text values'number' - Numeric values'boolean' - True/false'json' - Complex objects (NOT 'object', use 'json')'file' - Single file'file[]' - Multiple filesrequired: true or required: falserequired: falserequest.modelInput selector.request.modelInput before the existing formatter parses it; do not add a
separate hard-rejection mechanism.privateProvenance for actual inline/raw model bytes or
request.secretProvenance for durable writes and execution handoffs. Do not treat a storage key,
path, signed URL, or remote URL as provenance for fetched bytes; authorize tracked stored bytes at
the owning model-egress boundary. Authenticate first, validate the exact selection and scope,
strip the private envelope, then import or propagate provenance at the receiving boundary.
Preserve documented headerless legacy behavior.'string', 'number', 'boolean' - Primitives'json' - Complex objects (use this, NOT 'object')'array' - Arrays with items property'object' - Objects with properties propertyAdd optional: true for fields that may not exist in the response:
closedAt: {
type: 'string',
description: 'When the issue was closed',
optional: true,
},
When using type: 'json' and you know the object shape in advance, always define the inner structure using properties so downstream consumers know what fields are available:
// BAD: Opaque json with no info about what's inside
metadata: {
type: 'json',
description: 'Response metadata',
},
// GOOD: Define the known properties
metadata: {
type: 'json',
description: 'Response metadata',
properties: {
id: { type: 'string', description: 'Unique ID' },
status: { type: 'string', description: 'Current status' },
count: { type: 'number', description: 'Total count' },
},
},
For arrays of objects, define the item structure:
items: {
type: 'array',
description: 'List of items',
items: {
type: 'object',
properties: {
id: { type: 'string', description: 'Item ID' },
name: { type: 'string', description: 'Item name' },
},
},
},
Only use bare type: 'json' without properties when the shape is truly dynamic or unknown.
If the response shape is unknown because the docs do not provide it, you MUST tell the user and stop. Unknown is not the same as dynamic. Never guess outputs.
ALWAYS use ?? null for fields that may be undefined:
transformResponse: async (response: Response) => {
const data = await response.json()
return {
success: true,
output: {
id: data.id,
title: data.title,
body: data.body ?? null, // May be undefined
assignee: data.assignee ?? null, // May be undefined
labels: data.labels ?? [], // Default to empty array
closedAt: data.closed_at ?? null, // May be undefined
},
}
}
DON'T do this:
output: {
data: data, // BAD - raw JSON dump
}
DO this instead - extract meaningful fields:
output: {
id: data.id,
name: data.name,
status: data.status,
metadata: {
createdAt: data.created_at,
updatedAt: data.updated_at,
},
}
Create types.ts with interfaces for all params and responses:
import type { ToolResponse } from '@/tools/types'
// Parameter interfaces
export interface {Service}{Action}Params {
accessToken: string
requiredField: string
optionalField?: string
}
// Response interfaces (extend ToolResponse)
export interface {Service}{Action}Response extends ToolResponse {
output: {
field1: string
field2: number
optionalField?: string | null
}
}
// Export all tools
export { serviceTool1 } from './{action1}'
export { serviceTool2 } from './{action2}'
// Export types
export * from './types'
After creating tools:
apps/sim/tools/registry.tstools object with snake_case keys (alphabetically):import { serviceActionTool } from '@/tools/{service}'
export const tools = {
// ... existing tools ...
{service}_{action}: serviceActionTool,
}
bun run tool-metadata:generate
Client code reads a tool's params/outputs from generated metadata rather than
importing the registry, so a tool you add, change or remove is invisible to the UI until
these are regenerated — and CI fails on stale artifacts. Commit the result. See
.agents/skills/tool-registry-boundary/SKILL.md.
After registering in tools/registry.ts, you MUST also update the block definition at apps/sim/blocks/blocks/{service}.ts. This is not optional — tools are only usable from the UI if they are wired into the block.
tools.accesstools: {
access: [
// existing tools...
'service_new_action', // Add every new tool ID here
],
config: { ... }
}
If the block uses an operation dropdown, add an option for each new tool:
{
id: 'operation',
type: 'dropdown',
options: [
// existing options...
{ label: 'New Action', id: 'new_action' }, // id maps to what tools.config.tool returns
],
}
For each new tool, add subBlocks covering all its required params (and optional ones where useful). Apply condition to show them only for the right operation, and mark required params with required:
// Required param for new_action
{
id: 'someParam',
title: 'Some Param',
type: 'short-input',
placeholder: 'e.g., value',
condition: { field: 'operation', value: 'new_action' },
required: { field: 'operation', value: 'new_action' },
},
// Optional param — put in advanced mode
{
id: 'optionalParam',
title: 'Optional Param',
type: 'short-input',
condition: { field: 'operation', value: 'new_action' },
mode: 'advanced',
},
tools.config.toolEnsure the tool selector returns the correct tool ID for every new operation. The simplest pattern:
tool: (params) => `service_${params.operation}`,
// If operation dropdown IDs already match tool IDs, this requires no change.
If the dropdown IDs differ from tool IDs, add explicit mappings:
tool: (params) => {
const map: Record<string, string> = {
new_action: 'service_new_action',
// ...
}
return map[params.operation] ?? `service_${params.operation}`
},
tools.config.paramsAdd any type coercions needed for new params (runs at execution time, after variable resolution):
params: (params) => {
const result: Record<string, unknown> = {}
if (params.limit != null && params.limit !== '') result.limit = Number(params.limit)
if (params.newParamName) result.toolParamName = params.newParamName // rename if IDs differ
return result
},
Add any new fields returned by the new tools to the block outputs:
outputs: {
// existing outputs...
newField: { type: 'string', description: 'Description of new field' },
}
Add new subBlock param IDs to the block inputs section:
inputs: {
// existing inputs...
someParam: { type: 'string', description: 'Param description' },
optionalParam: { type: 'string', description: 'Optional param description' },
}
tools.accesscondition (only show for the right operation)mode: 'advanced'tools.config.tool returns correct ID for every new operationtools.config.params handles any ID remapping or type coercionsoutputsinputsIf creating V2 tools (API-aligned outputs), use _v2 suffix:
{service}_{action}_v2{action}V2Tool'2.0.0'All tool IDs MUST use snake_case: {service}_{action} (e.g., x_create_tweet, slack_send_message). Never use camelCase or PascalCase for tool IDs.
required: true or required: falsevisibility?? nulloptional: trueexport * from './types')tools/registry.tsbun run tool-metadata:generate run and the regenerated artifacts committedtools.access, dropdown options, subBlocks, tools.config, outputs, inputs{{...}} resolution path requires themAfter creating all tools, you MUST validate every tool before finishing:
required: truerequired: falsetransformResponse extracts the correct fields from the API responsetypes.ts match all tools that use them