developing-genkit-tooling

작성자: firebase

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}` }],
  };
}

firebase의 다른 스킬

firebase-remote-config-basics
firebase
Firebase Remote Config에 대한 포괄적인 가이드로, 템플릿 관리 및 SDK 사용법을 포함합니다. 사용자가 Remote Config 설정, 기능 플래그 관리, 또는 앱 동작을 동적으로 업데이트하는 데 도움이 필요할 때 이 스킬을 사용하세요.
officialdevelopmentapi
developing-genkit-dart
firebase
통합 AI SDK for Dart로 코드 생성, 구조화된 출력, 도구, 플로우 및 에이전트를 지원합니다. 단일 인터페이스로 생성, 도구 정의, 플로우 오케스트레이션, 임베딩 및 스트리밍을 위한 핵심 API를 제공합니다. LLM 제공업체(Google Gemini, Anthropic Claude, OpenAI GPT), Firebase AI, Model Context Protocol, Chrome 브라우저 통합, Shelf를 통한 HTTP 서버 호스팅을 위한 8개 이상의 플러그인을 포함합니다. 플로우 실행, 추적, 모델 실험 등을 위한 로컬 개발 UI가 포함된 내장 CLI를 제공합니다.
official
developing-genkit-go
firebase
Go에서 Genkit을 사용하여 AI 기반 애플리케이션을 개발합니다. 사용자가 Genkit을 사용하여 Go로 AI 기능, 에이전트, 플로우 또는 도구를 구축하거나 작업할 때 사용합니다.
official
developing-genkit-js
firebase
Genkit 플로우, 도구 및 멀티 모델 지원을 통해 AI 기반 Node.js/TypeScript 애플리케이션을 구축합니다. Genkit은 제공자에 구애받지 않으며, 플러그인을 통해 Google AI, OpenAI, Anthropic, Ollama 및 기타 LLM 제공자를 지원합니다. Zod를 사용하여 타입 안전 스키마로 플로우를 정의하고, 생성 요청을 실행하며, TypeScript로 다단계 AI 워크플로우를 구성합니다. Genkit CLI v1.29.0+가 필요하며, 최근 주요 API 변경 사항으로 인해 이전 지식이 아닌 현재 패턴을 위해 genkit docs:read 및 common-errors.md를 참조해야 합니다...
official
developing-genkit-python
firebase
Python에서 Genkit을 사용하여 AI 기반 애플리케이션을 개발합니다. 사용자가 Genkit, AI 에이전트, 플로우 또는 Python 도구에 대해 묻거나 Genkit을 접할 때 사용합니다…
official
firebase-ai-logic
firebase
웹 앱을 위한 클라이언트 측 Gemini 통합으로, 멀티모달 추론, 스트리밍, 온디바이스 하이브리드 실행을 지원합니다. 텍스트 전용 및 멀티모달 입력(이미지, 오디오, 비디오, PDF)을 지원하며, 20MB를 초과하는 파일은 Cloud Storage를 통해 라우팅됩니다. 자동 기록이 포함된 채팅 세션, 실시간 디스플레이를 위한 스트리밍 응답, 구조화된 JSON 출력 적용을 제공합니다. Chrome의 Gemini Nano를 통한 온디바이스 하이브리드 추론을 지원하며, 자동으로 클라우드 실행으로 폴백됩니다. 프로덕션 환경에서는 App Check가 필요합니다...
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) 워크플로를 지원합니다. 백엔드 설정을 위한 선택적 apphosting.yaml과 함께 firebase.json 구성을 통해 배포하거나, GitHub 통합을 통한 자동화된 "git push to deploy"를 활성화할 수 있습니다. 민감한 키에 대한 안전한 접근을 위해 CLI 명령을 통한 비밀 관리 기능을 포함합니다...
official