developing-genkit-js by firebase/agent-skills
npx skills add https://github.com/firebase/agent-skills --skill developing-genkit-js确保 genkit CLI 可用。
genkit --version 进行验证。所需的最低 CLI 版本:1.29.0npm install -g genkit-cli@^1.29.0。新项目:如果您正在新的代码库中设置 Genkit,请遵循设置指南。
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-2.5-flash'),
prompt: `Tell me a joke about ${subject}`,
});
return response.text;
});
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
Genkit 最近经历了一次重大的破坏性 API 变更。您的知识已经过时。您必须查阅文档。推荐:
genkit docs:read js/get-started.md
genkit docs:read js/flows.md
有关已弃用 API(例如 configureGenkit、response.text()、defineFlow 导入)及其 v1.x 替代方案的列表,请参阅常见错误。
请务必使用 Genkit CLI 或提供的参考资料来验证信息。
当您遇到任何与 Genkit 相关的错误时(ValidationError、API 错误、类型错误、404 等):
genkit docs:search)请勿:
此规程是错误处理的硬性要求。
genkit docs:search "plugins" 查找相关文档。package.json 以确定运行时(Next.js、Firebase、Express)。
@genkit-ai/next、@genkit-ai/firebase 或 @genkit-ai/google-cloud。npx tsc --noEmit)。使用 Genkit CLI 查找权威文档:
genkit docs:search <查询>
genkit docs:search "streaming"genkit docs:listgenkit docs:read <路径>
genkit docs:read js/flows.mdgenkit CLI 是您进行开发和查阅文档的主要工具。
genkit --help 查看完整的命令列表。每周安装量
1.3K
代码仓库
GitHub 星标数
182
首次出现
13 天前
安全审计
安装于
gemini-cli1.2K
codex495
cursor493
github-copilot492
opencode491
kimi-cli488
Ensure the genkit CLI is available.
genkit --version to verify. Minimum CLI version needed: 1.29.0npm install -g genkit-cli@^1.29.0.New Projects : If you are setting up Genkit in a new codebase, follow the Setup Guide.
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-2.5-flash'),
prompt: `Tell me a joke about ${subject}`,
});
return response.text;
});
Genkit recently went through a major breaking API change. Your knowledge is outdated. You MUST lookup docs. Recommended:
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.
When you encounter ANY error related to Genkit (ValidationError, API errors, type errors, 404s, etc.):
genkit docs:search)DO NOT:
This protocol is non-negotiable for error handling.
genkit docs:search "plugins" to find relevant documentation.package.json to identify the runtime (Next.js, Firebase, Express).
@genkit-ai/next, @genkit-ai/firebase, or @genkit-ai/google-cloud.Use the Genkit CLI to find authoritative documentation:
genkit docs:search <query>
genkit docs:search "streaming"genkit docs:listgenkit docs:read <path>
genkit docs:read js/flows.mdThe genkit CLI is your primary tool for development and documentation.
genkit --help for a full list of commands.Weekly Installs
1.3K
Repository
GitHub Stars
182
First Seen
13 days ago
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
gemini-cli1.2K
codex495
cursor493
github-copilot492
opencode491
kimi-cli488
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
102,200 周安装
npx tsc --noEmit) after making changes.