技能 developing-genkit-js
📦

developing-genkit-js

低风险

Build AI apps with Genkit in JavaScript

也可从以下获取: genkit-ai

Developers need guidance to use the Genkit framework correctly in Node.js and TypeScript projects. This skill provides reference documentation, common error solutions, and code patterns for building AI-powered applications with Genkit.

支持: Claude Codex Code(CC)
📊 70 充足
1

下载技能 ZIP

2

在 Claude 中上传

前往 设置 → 功能 → 技能 → 上传技能

3

开启并开始使用

测试它

正在使用“developing-genkit-js”。 Set up a new Genkit project with Google AI provider

预期结果:

  • Create the ai directory in your source folder
  • Install genkit and @genkit-ai/google-genai packages
  • Create genkit.ts with genkit() initialization and googleAI plugin
  • Create flows and tools subdirectories for organization
  • Add genkit:ui script to package.json for Dev UI access
  • Set the GEMINI_API_KEY environment variable

正在使用“developing-genkit-js”。 Fix ValidationError when using defineFlow with pre-1.0 imports

预期结果:

  • Replace `import { defineFlow } from "@genkit-ai/flow"` with defining flows on the ai instance
  • Replace `import { genkit } from "@genkit-ai/core"` with `import { genkit } from "genkit"`
  • Replace `configureGenkit()` with `const ai = genkit({ plugins: [...] })`
  • Access response text via `response.text` property instead of `response.text()` method
  • Run type check with `npx tsc --noEmit` to verify the migration is complete

安全审计

低风险
v1 • 4/13/2026

All 194 static analyzer findings are false positives. The skill consists entirely of markdown documentation and code examples for the Genkit JS framework. The 176 'external_commands' detections are markdown inline code spans (backtick formatting) showing CLI commands like `genkit --version` and `npx tsc --noEmit`, not actual shell execution. The 'weak cryptographic algorithm' findings have no corresponding crypto operations in the source. The 'hardcoded URL' findings are documentation references (localhost dev UI and example.com placeholder). The 'env_access' finding is documentation instructing users to set API keys. No executable code exists in this skill. Safe to publish.

6
已扫描文件
545
分析行数
4
发现项
1
审计总数
低风险问题 (4)
False Positive: Markdown Backtick Code Examples
Static analyzer flagged 176 instances of 'Ruby/shell backtick execution' across all markdown files. These are all markdown inline code formatting (e.g., `genkit --version`, `npx tsc --noEmit`, `npm install -g genkit-cli`). No actual shell execution or code injection exists. The skill contains only documentation text.
False Positive: Hardcoded URLs in Documentation
Static analyzer flagged hardcoded URLs at references/docs-and-cli.md:21 (http://localhost:4000, the Genkit Dev UI localhost address) and references/examples.md:128 (https://example.com/photo.jpg, a placeholder example URL). These are documentation references, not actual network requests.
False Positive: Environment Variable Documentation
Static analyzer flagged 'Generic API/secret keys' at references/setup.md:40. This line instructs users to set environment variables like GEMINI_API_KEY. It is documentation guidance, not actual credential access or exfiltration.
False Positive: Weak Cryptographic Algorithm
Static analyzer flagged 'weak cryptographic algorithm' at multiple locations in SKILL.md, references/best-practices.md, references/common-errors.md, and references/examples.md. No cryptographic operations exist in any file. These are likely false matches on model names or configuration strings in documentation text.
审计者: claude

质量评分

45
架构
100
可维护性
87
内容
31
社区
82
安全
91
规范符合性

你能构建什么

Set up a new Genkit project

A developer wants to add AI features to an existing Node.js application using Genkit. The skill guides directory structure, package installation, plugin configuration, and initial flow creation.

Migrate from Genkit pre-1.0 to v1.x

A team maintains a Genkit application built before the v1.0 release. The skill identifies deprecated APIs, provides migration patterns for imports, model references, and flow definitions.

Build multimodal AI features

A product team wants to add image generation or text-to-speech to their application. The skill provides working examples for Gemini multimodal models with correct configuration.

试试这些提示

Set up Genkit in a new project
I want to add AI features to my Node.js project using Genkit. Help me set up the project structure, install the required packages, and create a simple flow that generates text.
Fix Genkit type errors
I am getting TypeScript errors in my Genkit flow. Check the common errors reference and help me identify if this is a deprecated API issue or an import problem.
Create a structured output flow
I need a Genkit flow that returns structured JSON output using Zod schemas. Show me how to define the schema, create the flow, and access the typed output.
Add image generation with streaming
I want to build a Genkit flow that generates images using Gemini 2.5 Flash Image model and streams partial results. Include the correct responseModalities configuration and explain how to handle the media output.

最佳实践

  • Always use the Genkit CLI (`genkit docs:search`, `genkit docs:read`) to look up current documentation rather than relying on internal knowledge, as Genkit APIs change frequently between versions.
  • Store API keys and sensitive configuration in environment variables or .env files. Never hardcode credentials in source files or commit them to version control.
  • Use Zod schemas from the `genkit` package (not the standalone `zod` package) for all input and output definitions. Add `.describe()` annotations to guide the LLM in populating schema fields correctly.

避免

  • Do not import from deprecated packages like `@genkit-ai/core`, `@genkit-ai/ai`, or `@genkit-ai/flow`. Import core functionality directly from the `genkit` package instead.
  • Do not skip reading the common errors reference when troubleshooting. Many errors are caused by deprecated API usage that has documented solutions.
  • Do not use decommissioned model versions like `gemini-2.0-*` or `gemini-1.5-*`. Always use the latest generation models specified in the best practices reference.

常见问题

What is Genkit and what does this skill do?
Genkit is a framework for building AI-powered applications in JavaScript and TypeScript. This skill provides reference documentation, common error solutions, and code patterns to help you develop with Genkit correctly.
Which AI model providers does Genkit support?
Genkit supports multiple providers including Google AI, OpenAI, Anthropic, and Ollama. This skill defaults to Google AI examples, but you can search the docs with `genkit docs:search plugins` to find configuration for other providers.
What is the minimum Genkit CLI version required?
The minimum required CLI version is 1.29.0. You can verify your version with `genkit --version` and install or upgrade with `npm install -g genkit-cli@^1.29.0`.
How do I troubleshoot Genkit errors?
Always read the common errors reference first. Most errors are caused by deprecated pre-1.0 API usage. Match your error to the documented patterns and apply the solutions before searching external sources.
How do I enable the Genkit Developer UI?
Run your application with `genkit start -- <your-start-command>`. This enables the Developer UI, typically available at http://localhost:4000, where you can test flows and monitor execution.
Can I use this skill with Next.js or Firebase projects?
Yes. Genkit integrates with Next.js (via @genkit-ai/next) and Firebase (via @genkit-ai/firebase). The skill detects your framework from package.json and adapts its guidance accordingly.