developing-genkit-dart
它能做什么
这个技能帮助开发者使用 Genkit SDK 在 Dart 和 Flutter 中构建 AI 功能。它适用于想在 Dart 应用中加入智能体或模型调用的人。
适用场景
- ✓当你想使用 Genkit 在 Dart 中构建 AI 智能体或流程的时候。
- ✓当你想在 Dart 或 Flutter 应用中添加语言模型调用的时候。
- ✓当你要把 Genkit Dart 代码从旧版本更新到 1.0 API 的时候。
技能链接
https://github.com/google/skills/blob/main/skills/cloud/developing-genkit-dart/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请用 Genkit 在 Dart 中构建一个流程:接收一个主题,并从语言模型返回一个简短的笑话。”
每周 5 个新技能,1 分钟读完。
工作原理
它使用当前 1.0 API 的名称和模式编写 Genkit Dart 代码,并为每个功能指向参考指南。它帮助完成设置、生成、工具和流程。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Genkit Dart
Genkit Dart is an AI SDK for Dart that provides a unified interface for code generation, structured outputs, tools, flows, and AI agents.
Core Features and Usage
If you need help with initializing Genkit (Genkit()), Generation (ai.generate), Tooling (ai.defineTool), Flows (ai.defineFlow), Embeddings (ai.embed), streaming, or calling remote flow endpoints, please load the core framework reference:
references/genkit.md
1.0 vs pre-1.0 APIs
This skill targets Genkit Dart 1.0 (genkit: ^1.0.0). Older code and
training data use pre-1.0 names that no longer compile; the common ones:
- HTTP:
startFlowServer/ per-routeshelfHandler/shelf_cors_headersare nowGenkitRouter+serve()orasShelfHandler(), withCorsOptions; context providers takeRequestData(genkit_shelf.md). StatusCodes.UNAUTHENTICATEDisStatusCode.unauthenticated(lowerCamelCase, same forEvalStatus.pass,ToolChoice.required).- No
RetryPlugin;retry()is built in and takesDurations (initialDelay,maxDelay, alsocacheTtlelsewhere). - Renames:
GenerateResponseHelper->GenerateResult(modelResponse,chunk.modelChunk),ExecutablePrompt->Prompt<Input, Output>,embedMany->embed,ToolFnArgs->ToolFnArg,toolOutputSchema->outputSchema,underlyingException->cause,modelInfo:->info:,RemoteAction.dispose()->close(),prompt(input, PromptGenerateOptions(config: ...))->prompt(input, config: ...)(named options, likegenerate),defineMiddleware->ai.defineGenerateMiddleware(app) /generateMiddleware(plugins). - Provider config types are prefixed:
GeminiThinkingConfig,GeminiSafetySettings,GeminiGoogleSearch,GeminiSpeechConfig,GoogleGenAiEmbedderOptions,AnthropicThinkingConfig. - Removed:
ToolInterruptException/ctx.interrupt()(return.interrupt(...)),GoogleAiModels/OpenAIModelsconstants (usegoogleAI.gemini('...'),openAI.model('...')). Simulated constrained output is opt-in viasimulateConstrainedGeneration(). .promptPicoschema is spec-compliant:name: type, description, nevername(description): type(dotprompt.md).
Prompts (Dotprompt)
.prompt files keep prompt content out of Dart code with YAML frontmatter plus a
Handlebars template. See references/dotprompt.md:
promptDir, ai.prompt() (call/stream/render), variants, partials, named
schemas via defineSchema, and the tools/maxTurns/returnToolRequests/use
(middleware) frontmatter fields. A .prompt file can also back an agent directly
via definePromptAgent.
Agents
Genkit Dart has an agent API for persistent, multi-turn conversations
(sessions, snapshots, interrupts, branching, background execution, custom state,
artifacts, and multi-agent delegation). The agent/session/snapshot APIs are
experimental and live behind opt-in imports: server APIs come from
package:genkit/experimental.dart (alongside package:genkit/genkit.dart), the
browser/HTTP client from package:genkit/experimental_client.dart (alongside
package:genkit/client.dart), and dart:io extras like FileSessionStore from
package:genkit/experimental_io.dart. These entry points are @experimental, so
importing them raises an experimental_member_use analyzer warning you can
silence in analysis_options.yaml. The remoteAgent client works from any Dart
app, including Flutter, and the backend is fully interchangeable — it can talk
to a Genkit agent implemented in Dart, JS/TypeScript, or Go over the same HTTP
protocol. A few Dart specifics: interrupts are ai.defineInterrupt(...) or
tools that return .interrupt(...) (there is no ctx.interrupt()), sub-agent delegation uses
the agents() middleware from package:genkit_middleware, and there is no
artifacts() middleware yet (define artifact tools directly).
For more details see:
- Agents: defining/serving an agent and client-managed state (start here).
- Sessions & persistence: session stores (
InMemorySessionStore/FileSessionStore/FirestoreSessionStore). - Human-in-the-loop / interrupts: pausing for approval/input via
.interrupt(...)and resuming. - Branching: forking a conversati
常见问题
它支持旧版 Genkit 吗?
它以 Genkit Dart 1.0 为目标,并列出了相比早期版本改名的内容。
它涵盖 Flutter 应用吗?
涵盖。它帮助在 Dart 和 Flutter 应用中集成语言模型。
它涵盖哪些功能?
设置、生成、工具、流程、嵌入、流式传输,以及调用远程流程端点。
详情
作者的原始描述
Generates code and provides documentation for the Genkit Dart SDK. Use when the user asks to build AI agents in Dart, use Genkit flows, or integrate LLMs into Dart/Flutter applications.
repo: google/skills
热度
- GitHub 星标
- 22k
- 排名
- #10255
- 许可证
- Apache-2.0
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
finding-google-skills
22k帮你的智能体为某项设置任务找到合适的 Google 指南,例如托管、数据库、存储、登录或 AI 模型服务。
gcloud
22k帮你的智能体编写并检查 Google Cloud gcloud 命令,在运行任何内容之前查阅准确的语法,避免猜测参数。
google-cloud-recipe-auth
22k引导你的智能体了解 Google Cloud 的身份与访问管理,包括人员和服务如何登录,以及它们各自获得哪些权限。
google-cloud-recipe-onboarding
22k带领新开发者完成在 Google Cloud 上的第一步,包括选择项目、关联计费,以及部署第一个资源。