developing-genkit-tooling

Лучшие практики для создания инструментов Genkit, включая команды CLI и инструменты сервера MCP. Охватывает соглашения об именовании, архитектурные шаблоны и согласованность…

npx skills add https://github.com/firebase/genkit --skill developing-genkit-tooling

Developing Genkit Tooling

Naming Conventions

Consistency in naming helps users and agents navigate the tooling.

CLI Commands

Use kebab-case with colon separators for subcommands.

  • Format: noun:verb or category:action
  • Examples: flow:run, eval:run, init
  • Arguments: Use camelCase in code (flowName) but standard format in help text (<flowName>).

MCP Tools

Use snake_case for tool names to align with MCP standards.

  • Format: verb_noun
  • Examples: list_flows, run_flow, list_genkit_docs, read_genkit_docs

CLI Command Architecture

Commands are implemented in cli/src/commands/ using commander.

Runtime Interaction

Most commands require interacting with the user's project runtime. Use the runWithManager utility to handle the lifecycle of the runtime process.

import { runWithManager } from '../utils/manager-utils';

// ... command definition ...
.action(async (arg, options) => {
  await runWithManager(await findProjectRoot(), async (manager) => {
    // Interact with manager here
    const result = await manager.runAction({ key: arg });
  });
});

Output Formatting

  • Logging: Use logger from @genkit-ai/tools-common/utils.
  • Machine Readable: Provide options for JSON output or file writing when the command produces data.
  • Streaming: If the operation supports streaming (like flow:run), provide a --stream flag and pipe output to stdout.

MCP Tool Architecture

MCP tools in cli/src/mcp/ follow two distinct patterns: Static and Runtime.

Static Tools (e.g., Docs)

These tools do not require a running Genkit project context.

  • Registration: defineDocsTool(server: McpServer)
  • Dependencies: Only the server instance.
  • Use Case: Documentation, usage guides, global configuration.

Runtime Tools (e.g., Flows, Runtime Control)

These tools interact with a specific Genkit project's runtime.

  • Registration: defineRuntimeTools(server: McpServer, options: McpToolOptions)
  • Dependencies: Requires options containing manager (process manager) and projectRoot.
  • Schema: MUST use getCommonSchema(options.explicitProjectRoot, ...) to ensure the tool can accept a projectRoot argument when required (e.g., in multi-project environments).
// Runtime tool definition pattern
server.registerTool(
  'my_runtime_tool',
  {
    inputSchema: getCommonSchema(options.explicitProjectRoot, {
      myArg: z.string(),
    }),
  },
  async (opts) => {
    // Resolve project root before action
    const rootOrError = resolveProjectRoot(
      options.explicitProjectRoot,
      opts,
      options.projectRoot
    );
    if (typeof rootOrError !== 'string') return rootOrError;

    // access manager via options.manager
  }
);

Error Handling

MCP tools should generally catch errors and return them as content blocks with isError: true rather than throwing exceptions, which ensures the client receives a structured error response.

try {
  // operation
} catch (err) {
  const message = err instanceof Error ? err.message : String(err);
  return {
    isError: true,
    content: [{ type: 'text', text: `Error: ${message}` }],
  };
}

Больше skills от firebase

firebase-remote-config-basics
firebase
Всеобъемлющее руководство по Firebase Remote Config, включая управление шаблонами и использование SDK. Используйте этот навык, когда пользователю нужна помощь в настройке Remote Config, управлении функциональными флагами или динамическом обновлении поведения приложения.
officialdevelopmentapi
developing-genkit-dart
firebase
Унифицированный AI SDK для Dart, обеспечивающий генерацию кода, структурированные выходные данные, инструменты, потоки и агенты. Предоставляет основные API для генерации, определения инструментов, оркестрации потоков, эмбеддингов и стриминга через единый интерфейс. Включает 8+ плагинов для LLM-провайдеров (Google Gemini, Anthropic Claude, OpenAI GPT), Firebase AI, Model Context Protocol, интеграцию с браузером Chrome и хостинг HTTP-сервера через Shelf. Встроенный CLI с локальным UI для разработки, позволяющий выполнять потоки, трассировку, эксперименты с моделями и...
official
developing-genkit-go
firebase
Разрабатывайте AI-приложения с использованием Genkit на Go. Используйте, когда пользователь просит создать AI-функции, агентов, потоки или инструменты на Go с помощью Genkit, или при работе…
official
developing-genkit-js
firebase
We need to translate the given text from English to Russian, preserving the name "developing-genkit-js" if it appears, but it doesn't appear in the text. The text is a description of an agent skill. We must not add any extra commentary, labels, or formatting. Just the translation. The text: "Build AI-powered Node.js/TypeScript applications with Genkit flows, tools, and multi-model support. Genkit is provider-agnostic; supports Google AI, OpenAI, Anthropic, Ollama, and other LLM providers via plugins Define flows with type-safe schemas using Zod, execute generation requests, and compose multi-step AI workflows in TypeScript Requires Genkit CLI v1.29.0+; recent major API changes mean you must consult genkit docs:read and common-errors.md for current patterns, not prior knowledge..." We need to translate accurately, preserving technical terms like "Genkit", "Node.js", "TypeScript", "Zod", "CLI", "v1.29.0+", "docs:read",
official
developing-genkit-python
firebase
Разрабатывайте AI-приложения с помощью Genkit на Python. Используйте, когда пользователь спрашивает о Genkit, AI-агентах, потоках или инструментах на Python, или при столкновении с Genkit…
official
firebase-ai-logic
firebase
We need to translate the given English text into Russian, preserving the name "firebase-ai-logic" if it appears. The text does not contain the name, so we just translate the description. The instruction says: "Do not include the name unless it appears in the source text." It does not appear. So we translate the description. The text: "Client-side Gemini integration for web apps with multimodal inference, streaming, and on-device hybrid execution. Supports text-only and multimodal inputs (images, audio, video, PDFs); files over 20 MB route through Cloud Storage Includes chat sessions with automatic history, streaming responses for real-time display, and structured JSON output enforcement Offers hybrid on-device inference via Gemini Nano in Chrome, with automatic fallback to cloud execution Requires App Check for production" We need to translate accurately, preserving technical terms like "Gemini", "Gemini Nano", "Cloud Storage", "App Check", "JSON", "Chrome", "multimodal inference", "streaming", "on-device hybrid execution", etc. Also numbers:
official
firebase-ai-logic-basics
firebase
Официальный навык для интеграции Firebase AI Logic (Gemini API) в веб-приложения. Охватывает настройку, мультимодальный вывод, структурированный вывод и безопасность.
official
firebase-app-hosting-basics
firebase
Развёртывание и управление полнофункциональными веб-приложениями с помощью Firebase App Hosting с использованием Next.js, Angular и других поддерживаемых фреймворков. Требуется проект Firebase на тарифном плане Blaze; поддерживаются рабочие процессы серверного рендеринга (SSR) и инкрементальной статической регенерации (ISR). Развёртывание через конфигурацию firebase.json с опциональным файлом apphosting.yaml для настройки бэкенда или включение автоматического развёртывания через "git push" с интеграцией GitHub. Включает управление секретами через команды CLI для безопасного доступа к конфиденциальным ключам...
official