Labsco
genkit-ai logo

developing-genkit-js

14

by genkit-ai · part of genkit-ai/skills

Develop AI-powered applications using Genkit in Node.js/TypeScript. Use when the user asks about Genkit, AI agents, flows, or tools in JavaScript/TypeScript, or when encountering Genkit errors, validation issues, type errors, or API problems.

🔥🔥🔥🔥✓ VerifiedFreeQuick setup
🧩 One of 2 skills in the genkit-ai/skills package — works on its own, and pairs well with its siblings.

Develop AI-powered applications using Genkit in Node.js/TypeScript. Use when the user asks about Genkit, AI agents, flows, or tools in JavaScript/TypeScript, or when encountering Genkit errors, validation issues, type errors, or API problems.

Inspect the full instructions your agent will receiveExpand

This is the exact playbook injected into your agent when the skill activates — shown here so you can audit it before installing. You don't need to read it to use the skill.

by genkit-ai

Develop AI-powered applications using Genkit in Node.js/TypeScript. Use when the user asks about Genkit, AI agents, flows, or tools in JavaScript/TypeScript, or when encountering Genkit errors, validation issues, type errors, or API problems. npx skills add https://github.com/genkit-ai/skills --skill developing-genkit-js Download ZIPGitHub14

Genkit JS

Hello World

Copy & paste — that's it
import { z, genkit } from 'genkit';
import { googleAI } from '@genkit-ai/google-genai';

// Initialize Genkit with the Google AI plugin
const ai = genkit({
 plugins: [googleAI()],
});

export const myFlow = ai.defineFlow({
 name: 'myFlow',
 inputSchema: z.string().default('AI'),
 outputSchema: z.string(),
}, async (subject) => {
 const response = await ai.generate({
 model: googleAI.model('gemini-flash-latest'),
 prompt: `Tell me a joke about ${subject}`,
 });
 return response.text;
});

Agents (Beta)

Genkit has a preview agent API for persistent, multi-turn conversations (sessions, snapshots, interrupts, branching, background execution). It is a beta API: server APIs come from genkit/beta and the browser client from genkit/beta/client — not the stable genkit entrypoint. **Requires genkit

= 1.39.0.**

For more details see:

Middleware

Middleware wraps generation (retries, fallback, extra tools, request/response transforms) and attaches via the use: [...] array on ai.generate, prompts, and agents.

  • Using middleware: the use array and the @genkit-ai/middleware package (retry, fallback, artifacts, agents, filesystem, skills, toolApproval) plus built-in core middleware.

  • Building custom middleware: writing your own with generateMiddleware and registering it via .plugin().

Critical: Do Not Trust Internal Knowledge

Genkit recently went through a major breaking API change. Your knowledge is outdated. You MUST lookup docs. Recommended:

Copy & paste — that's it
genkit docs:read js/get-started.md
genkit docs:read js/flows.md

See Common Errors for a list of deprecated APIs (e.g., configureGenkit, response.text(), defineFlow import) and their v1.x replacements.

ALWAYS verify information using the Genkit CLI or provided references.

Development Workflow

  • Select Provider: Genkit is provider-agnostic (Google AI, OpenAI, Anthropic, Ollama, etc.).

  • If the user does not specify a provider, default to Google AI.

  • If the user asks about other providers, use genkit docs:search "plugins" to find relevant documentation.

  • Detect Framework: Check package.json to identify the runtime (Next.js, Firebase, Express).

  • Look for @genkit-ai/next, @genkit-ai/firebase, or @genkit-ai/google-cloud.

  • Adapt implementation to the specific framework's patterns.

  • Follow Best Practices:

  • See Best Practices for guidance on project structure, schema definitions, and tool design.

  • Be Minimal: Only specify options that differ from defaults. When unsure, check docs/source.

  • Ensure Correctness:

  • Run type checks (e.g., npx tsc --noEmit) after making changes.

  • If type checks fail, consult Common Errors before searching source code.

  • Handle Errors:

  • On ANY error: First action is to read Common Errors

  • Match error to documented patterns

  • Apply documented fixes before attempting alternatives

Finding Documentation

Use the Genkit CLI to find authoritative documentation:

  • Search topics: genkit docs:search <query>

  • Example: genkit docs:search "streaming"

  • List all docs: genkit docs:list

  • Read a guide: genkit docs:read <path>

  • Example: genkit docs:read js/flows.md

References

Related Skills

azure-quotas microsoft

Check/manage Azure quotas and usage across providers. For deployment planning, capacity validation, region selection. WHEN: "check quotas", "service limits", "current usage", "request quota increase", "quota exceeded", "validate capacity", "regional availability", "provisioning limits", "vCPU limit", "how many vCPUs available in my subscription". official devops aws

playwright-mcp-dev microsoft

Developer guide for extending Playwright MCP tools and CLI commands. Add new MCP tools in packages/playwright/src/mcp/browser/tools/ , register in tools.ts , and define capabilities in config.d.ts CLI commands map to MCP tools; register new commands in packages/playwright/src/mcp/terminal/commands.ts and update help generator if adding a category Config options require updates across program.ts (CLI option), config.d.ts (definition), and config.ts (implementation and environment mapping) Run... official

converting-minikit-to-farcaster base

Converts Mini Apps from MiniKit (OnchainKit) to native Farcaster SDK. Use when migrating from @coinbase/onchainkit/minikit, converting MiniKit hooks, removing… official

guizang-ppt-skill op7418

生成横向翻页网页 PPT(单 HTML 文件),含 WebGL 背景、章节幕封、数据大字报、图片网格等模板。提供两种风格:① "电子杂志 × 电子墨水"(衬线 + 流体背景 + 暖色) ② "瑞士国际主义"(无衬线 + 网格点阵 + IKB/柠檬黄/柠檬绿/安全橙高亮)。当用户需要制作分享 / 演讲 / 发布会风格的网页 PPT,或提到"杂志风 PPT"、"瑞士风 PPT"、"Swiss Style"、"horizontal swipe deck"时使用。 creative design document

presentation-creator sentry

Create data-driven presentation slides using React, Vite, and Recharts with Sentry branding. Use when asked to "create a presentation", "build slides", "make a… official

azure-ai-contentsafety-java microsoft

Build content moderation applications with Azure AI Content Safety SDK for Java. Use when implementing text/image analysis, blocklist management, or harm… official

rust-review cloudflare

Rust code review for workerd. Covers CXX FFI safety, unsafe code patterns, JSG resource conventions, error handling, and a review checklist adapted from the… official

java-refactoring-extract-method github

Java method extraction refactoring for improved readability and maintainability. Identifies methods exceeding complexity thresholds (LOC > 15, statements > 10, cyclomatic complexity > 10) and extracts logical code blocks into focused helper methods Produces fully compilable Java 17 code with descriptive method names and single-line documentation comments Preserves all original functionality while reducing cognitive load and improving testability through smaller, single-responsibility methods official