Command Palette

Search for a command to run...

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

tool-generation

БесплатноБез исполняемых скриптовНе проверен

Guide for creating and registering new LLM tools in the DEVS platform. Use this when asked to create a new tool, add tool capabilities, or extend the tool…

codename-coот codename-co★ 54 звезды на GitHub

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

Tool Generation for DEVS

Tools are capabilities that LLM agents can invoke during conversations. They enable agents to search documents, execute code, interact with external services, and perform specialized operations. This guide covers the complete process of creating, registering, and testing new tools.

Architecture Overview

Tool Definition (types.ts)    →    Tool Handler (service.ts)
         ↓                                 ↓
    ToolDefinition                   Handler Function
    (JSON Schema)                    (async function)
         ↓                                 ↓
              Tool Registration (executor.ts)
                        ↓
              KnowledgeToolRegistry.register()
                        ↓
              Available to all agents via chat.ts

Directory Structure

Tools are organized by feature domain:

src/lib/
├── tool-executor/
│   ├── types.ts         # Core tool executor types
│   ├── executor.ts      # Registry, executor, registration functions
│   └── index.ts         # Public exports
├── knowledge-tools/     # Document search/read tools
│   ├── types.ts         # Params, results, and KNOWLEDGE_TOOL_DEFINITIONS
│   └── service.ts       # Handler implementations
├── math-tools/          # Calculation tools
│   ├── types.ts         # MATH_TOOL_DEFINITIONS
│   └── service.ts       # calculate() handler
├── code-tools/          # Code execution tools
│   ├── types.ts         # CODE_TOOL_DEFINITIONS
│   └── service.ts       # execute() handler
└── features/connectors/tools/  # External service tools
    ├── types.ts         # CONNECTOR_TOOL_DEFINITIONS
    └── service.ts       # Gmail, Drive, etc. handlers

Step 1: Define Types

Create parameter and result interfaces in types.ts:

/**
 * My Tool Types
 * @module lib/my-tools/types
 */

import type { ToolDefinition } from '@/lib/llm/types'

// ============================================================================
// Tool Parameter Types
// ============================================================================

/**
 * Parameters for the my_tool operation.
 * Document each parameter with JSDoc.
 */
export interface MyToolParams {
  /**
   * Required parameter description.
   */
  requiredParam: string

  /**
   * Optional parameter with default value.
   * @default 10
   */
  optionalParam?: number

  /**
   * Filter by specific values.
   */
  filter?: ('value1' | 'value2' | 'value3')[]
}

// ============================================================================
// Tool Result Types
// ============================================================================

/**
 * Result of my_tool operation.
 */
export interface MyToolResult {
  /** Whether the operation succeeded */
  success: boolean
  /** Error message if failed */
  error?: string
  /** The operation result data */
  data: MyToolData | null
  /** Execution duration in milliseconds */
  duration_ms: number
}

/**
 * Data returned by my_tool.
 */
export interface MyToolData {
  id: string
  name: string
  // ... other fields
}

// ============================================================================
// Tool Name Type
// ============================================================================

/**
 * Names of all tools in this module.
 */
export type MyToolName = 'my_tool' | 'my_other_tool'

// ============================================================================
// Tool Definitions
// ============================================================================

/**
 * Pre-defined tool definitions for my tools.
 * These can be directly passed to LLM requests.
 */
export const MY_TOOL_DEFINITIONS: Record<MyToolName, ToolDefinition> = {
  my_tool: {
    type: 'function',
    function: {
      name: 'my_tool',
      description:
        'Brief description of what the tool does. ' +
        'Include usage context: when to use it, what it returns. ' +
        'Mention any important limitations or requirements.',
      parameters: {
        type: 'object',
        properties: {
          requiredParam: {
            type: 'string',
            description: 'What this parameter does and expected values',
          },
          optionalParam: {
            type: 'integer',
            description: 'Optional description (default: 10)',
            minimum: 1,
            maximum: 100,
          },
          filter: {
            type: 'array',
            description: 'Filter results by these values',
            items: {
              type: 'string',
              enum: ['value1', 'value2', 'value3'],
            },
          },
        },
        required: ['requiredParam'],
      },
    },
  },

  my_other_tool: {
    // ... another tool definition
  },
}

Step 2: Implement Handler

Create handler functions in service.ts:

/**
 * My Tool Service
 * @module lib/my-tools/service
 */

import type { MyToolParams, MyToolResult } from './types'
import { db } from '@/lib/db'

/*
Полный SKILL.md на GitHub

Установить tool-generation в Claude Code и Claude Desktop

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

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

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

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

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

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

FAQ

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

Guide for creating and registering new LLM tools in the DEVS platform. Use this when asked to create a new tool, add tool capabilities, or extend the tool system.

Как установить скилл tool-generation?

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

Скилл tool-generation запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

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

Сравнить tool-generation с