Chuyển đến nội dung
Skillpedia
API và máy chủ (backend)22k · #10255

developing-genkit-dart

Skill này làm gì

Skill này giúp lập trình viên xây dựng tính năng AI trong Dart và Flutter bằng Genkit SDK. Skill dành cho những người muốn thêm agent AI hoặc lệnh gọi mô hình vào một ứng dụng Dart.

Khi nào nên dùng

  • ✓Khi bạn muốn xây một agent hoặc flow AI bằng Dart với Genkit.
  • ✓Khi bạn muốn thêm lệnh gọi mô hình ngôn ngữ vào ứng dụng Dart hoặc Flutter.
  • ✓Khi bạn đang cập nhật mã Genkit Dart từ phiên bản cũ sang API 1.0.

Liên kết skill

https://github.com/google/skills/blob/main/skills/cloud/developing-genkit-dart/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/google/skills/blob/main/skills/cloud/developing-genkit-dart/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Xây một flow Genkit bằng Dart nhận một chủ đề và trả về một câu đùa ngắn từ mô hình ngôn ngữ.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Skill viết mã Genkit Dart theo tên và mẫu API hiện tại 1.0, và chỉ đến các hướng dẫn tham chiếu cho từng tính năng. Skill giúp thiết lập, sinh nội dung, công cụ và flow.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

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-route shelfHandler / shelf_cors_headers are now GenkitRouter + serve() or asShelfHandler(), with CorsOptions; context providers take RequestData (genkit_shelf.md).
  • StatusCodes.UNAUTHENTICATED is StatusCode.unauthenticated (lowerCamelCase, same for EvalStatus.pass, ToolChoice.required).
  • No RetryPlugin; retry() is built in and takes Durations (initialDelay, maxDelay, also cacheTtl elsewhere).
  • 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, like generate), defineMiddleware -> ai.defineGenerateMiddleware (app) / generateMiddleware (plugins).
  • Provider config types are prefixed: GeminiThinkingConfig, GeminiSafetySettings, GeminiGoogleSearch, GeminiSpeechConfig, GoogleGenAiEmbedderOptions, AnthropicThinkingConfig.
  • Removed: ToolInterruptException / ctx.interrupt() (return .interrupt(...)), GoogleAiModels / OpenAIModels constants (use googleAI.gemini('...'), openAI.model('...')). Simulated constrained output is opt-in via simulateConstrainedGeneration().
  • .prompt Picoschema is spec-compliant: name: type, description, never name(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:

Câu hỏi thường gặp

Skill có hỗ trợ phiên bản Genkit cũ không?

Skill nhắm đến Genkit Dart 1.0 và liệt kê những tên nào đã thay đổi so với phiên bản trước.

Skill có bao gồm ứng dụng Flutter không?

Có. Skill giúp tích hợp mô hình ngôn ngữ vào cả ứng dụng Dart lẫn Flutter.

Skill bao gồm những tính năng nào?

Thiết lập, sinh nội dung, công cụ, flow, embedding, streaming và gọi các endpoint flow từ xa.

Chi tiết

Mô tả gốc của tác giả

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

Độ phổ biến

Sao GitHub
22k
Vị trí xếp hạng
#10255
Giấy phép
Apache-2.0
Cập nhật
2/11/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự