{"id":"453c35c7-630e-48a8-a8dc-a95f8c8fb792","shortId":"zvAYrL","kind":"skill","title":"developing-genkit-go","tagline":"Develop AI-powered applications using Genkit in Go. Use when the user asks to build AI features, agents, flows, or tools in Go using Genkit, or when working with Genkit Go code involving generation, prompts, streaming, tool calling, or model providers.","description":"# Genkit Go\n\nGenkit Go is an AI SDK for Go that provides generation, structured output, streaming, tool calling, prompts, and flows with a unified interface across model providers.\n\n## Hello World\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"log\"\n\t\"net/http\"\n\n\t\"github.com/genkit-ai/genkit/go/ai\"\n\t\"github.com/genkit-ai/genkit/go/genkit\"\n\t\"github.com/genkit-ai/genkit/go/plugins/googlegenai\"\n\t\"github.com/genkit-ai/genkit/go/plugins/server\"\n)\n\nfunc main() {\n\tctx := context.Background()\n\tg := genkit.Init(ctx, genkit.WithPlugins(&googlegenai.GoogleAI{}))\n\n\tgenkit.DefineFlow(g, \"jokeFlow\", func(ctx context.Context, topic string) (string, error) {\n\t\treturn genkit.GenerateText(ctx, g,\n\t\t\tai.WithModelName(\"googleai/gemini-flash-latest\"),\n\t\t\tai.WithPrompt(\"Tell me a joke about %s\", topic),\n\t\t)\n\t})\n\n\tmux := http.NewServeMux()\n\tfor _, f := range genkit.ListFlows(g) {\n\t\tmux.HandleFunc(\"POST /\"+f.Name(), genkit.Handler(f))\n\t}\n\tlog.Fatal(server.Start(ctx, \"127.0.0.1:8080\", mux))\n}\n```\n\n## Core Features\n\nLoad the appropriate reference based on what you need:\n\n| Feature | Reference | When to load |\n| --- | --- | --- |\n| Initialization | [references/getting-started.md](references/getting-started.md) | Setting up `genkit.Init`, plugins, the `*Genkit` instance pattern |\n| Generation | [references/generation.md](references/generation.md) | `Generate`, `GenerateText`, `GenerateData`, streaming, output formats |\n| Prompts | [references/prompts.md](references/prompts.md) | `DefinePrompt`, `DefineDataPrompt`, `.prompt` files, schemas |\n| Tools | [references/tools.md](references/tools.md) | `DefineTool`, tool interrupts, `RestartWith`/`RespondWith` |\n| Flows & HTTP | [references/flows-and-http.md](references/flows-and-http.md) | `DefineFlow`, `DefineStreamingFlow`, `genkit.Handler`, HTTP serving |\n| Model Providers | [references/providers.md](references/providers.md) | Google AI, Vertex AI, Anthropic, OpenAI-compatible, Ollama setup |\n\n## Genkit CLI\n\nCheck if installed: `genkit --version`\n\n**Installation:**\n```bash\ncurl -sL cli.genkit.dev | bash\n```\n\n**Key commands:**\n\n```bash\n# Start app with Developer UI (tracing, flow testing) at http://localhost:4000\ngenkit start -- go run .\ngenkit start -o -- go run .   # also opens browser\n\n# Run a flow directly from the CLI\ngenkit flow:run myFlow '{\"data\": \"input\"}'\ngenkit flow:run myFlow '{\"data\": \"input\"}' --stream   # with streaming\ngenkit flow:run myFlow '{\"data\": \"input\"}' --wait      # wait for completion\n\n# Look up Genkit documentation\ngenkit docs:search \"streaming\" go\ngenkit docs:list go\ngenkit docs:read go/flows.md\n```\n\nSee [references/getting-started.md](references/getting-started.md) for full CLI and Developer UI details.\n\n## Key Guidance\n\n- **Pass `g` explicitly.** The `*Genkit` instance returned by `genkit.Init` is the central registry. Pass it to all Genkit functions rather than storing it as a global. This is a core pattern throughout the SDK.\n- **Wrap AI logic in flows.** Flows give you tracing, observability, HTTP deployment via `genkit.Handler`, and the ability to test from the Developer UI and CLI. Any generation call worth keeping should live in a flow.\n- **Use `jsonschema:\"description=...\"` struct tags on output types.** The model uses these descriptions to understand what each field should contain. Without them, structured output quality drops significantly.\n- **Write good tool descriptions.** The model decides which tools to call based on their description string. Vague descriptions lead to missed or incorrect tool calls.\n- **Use `.prompt` files for complex prompts.** They separate prompt content from Go code, support Handlebars templating, and can be iterated on without recompilation. Code-defined prompts are better for simple, single-line cases.\n- **Look up the latest model IDs.** Model names change frequently. Check provider documentation for current model IDs rather than relying on hardcoded names. See [references/providers.md](references/providers.md).","tags":["developing","genkit","skills","genkit-ai","agent-skills"],"capabilities":["skill","source-genkit-ai","skill-developing-genkit-go","topic-agent-skills"],"categories":["skills"],"synonyms":[],"warnings":[],"endpointUrl":"https://skills.sh/genkit-ai/skills/developing-genkit-go","protocol":"skill","transport":"skills-sh","auth":{"type":"none","details":{"cli":"npx skills add genkit-ai/skills","source_repo":"https://github.com/genkit-ai/skills","install_from":"skills.sh"}},"qualityScore":"0.456","qualityRationale":"deterministic score 0.46 from registry signals: · indexed on github topic:agent-skills · 12 github stars · SKILL.md body (3,971 chars)","verified":false,"liveness":"unknown","lastLivenessCheck":null,"agentReviews":{"count":0,"score_avg":null,"cost_usd_avg":null,"success_rate":null,"latency_p50_ms":null,"narrative_summary":null,"summary_updated_at":null},"enrichmentModel":"deterministic:skill-github:v1","enrichmentVersion":1,"enrichedAt":"2026-04-19T00:41:24.786Z","embedding":null,"createdAt":"2026-04-19T00:41:24.786Z","updatedAt":"2026-04-19T00:41:24.786Z","lastSeenAt":"2026-04-19T00:41:24.786Z","tsv":"'/genkit-ai/genkit/go/ai':87 '/genkit-ai/genkit/go/genkit':90 '/genkit-ai/genkit/go/plugins/googlegenai':93 '/genkit-ai/genkit/go/plugins/server':96 '127.0.0.1':145 '4000':249 '8080':146 'abil':373 'across':72 'agent':23 'ai':7,21,53,214,216,358 'ai-pow':6 'ai.withmodelname':120 'ai.withprompt':122 'also':259 'anthrop':217 'app':240 'applic':9 'appropri':152 'ask':18 'base':154,430 'bash':231,235,238 'better':472 'browser':261 'build':20 'call':43,64,384,429,443 'case':478 'central':334 'chang':487 'check':225,489 'cli':224,268,316,381 'cli.genkit.dev':234 'code':37,456,468 'code-defin':467 'command':237 'compat':220 'complet':293 'complex':448 'contain':411 'content':453 'context':81 'context.background':100 'context.context':111 'core':148,352 'ctx':99,103,110,118,144 'curl':232 'current':493 'data':273,279,288 'decid':425 'defin':469 'definedataprompt':188 'defineflow':204 'defineprompt':187 'definestreamingflow':205 'definetool':195 'deploy':368 'descript':394,404,422,433,436 'detail':320 'develop':2,5,242,318,378 'developing-genkit-go':1 'direct':265 'doc':299,304,308 'document':297,491 'drop':417 'error':115 'explicit':325 'f':133,141 'f.name':139 'featur':22,149,159 'field':409 'file':190,446 'flow':24,67,200,245,264,270,276,285,361,362,391 'fmt':82 'format':183 'frequent':488 'full':315 'func':97,109 'function':341 'g':101,107,119,136,324 'generat':39,59,175,178,383 'generatedata':180 'generatetext':179 'genkit':3,11,30,35,47,49,172,223,228,250,254,269,275,284,296,298,303,307,327,340 'genkit.defineflow':106 'genkit.generatetext':117 'genkit.handler':140,206,370 'genkit.init':102,169,331 'genkit.listflows':135 'genkit.withplugins':104 'github.com':86,89,92,95 'github.com/genkit-ai/genkit/go/ai':85 'github.com/genkit-ai/genkit/go/genkit':88 'github.com/genkit-ai/genkit/go/plugins/googlegenai':91 'github.com/genkit-ai/genkit/go/plugins/server':94 'give':363 'global':348 'go':4,13,28,36,48,50,56,77,252,257,302,306,455 'go/flows.md':310 'good':420 'googl':213 'googleai/gemini-flash-latest':121 'googlegenai.googleai':105 'guidanc':322 'handlebar':458 'hardcod':500 'hello':75 'http':201,207,367 'http.newservemux':131 'id':484,495 'import':80 'incorrect':441 'initi':164 'input':274,280,289 'instal':227,230 'instanc':173,328 'interfac':71 'interrupt':197 'involv':38 'iter':463 'joke':126 'jokeflow':108 'jsonschema':393 'keep':386 'key':236,321 'latest':482 'lead':437 'line':477 'list':305 'live':388 'load':150,163 'localhost':248 'log':83 'log.fatal':142 'logic':359 'look':294,479 'main':79,98 'miss':439 'model':45,73,209,401,424,483,485,494 'mux':130,147 'mux.handlefunc':137 'myflow':272,278,287 'name':486,501 'need':158 'net/http':84 'o':256 'observ':366 'ollama':221 'open':260 'openai':219 'openai-compat':218 'output':61,182,398,415 'packag':78 'pass':323,336 'pattern':174,353 'plugin':170 'post':138 'power':8 'prompt':40,65,184,189,445,449,452,470 'provid':46,58,74,210,490 'qualiti':416 'rang':134 'rather':342,496 'read':309 'recompil':466 'refer':153,160 'references/flows-and-http.md':202,203 'references/generation.md':176,177 'references/getting-started.md':165,166,312,313 'references/prompts.md':185,186 'references/providers.md':211,212,503,504 'references/tools.md':193,194 'registri':335 'reli':498 'respondwith':199 'restartwith':198 'return':116,329 'run':253,258,262,271,277,286 'schema':191 'sdk':54,356 'search':300 'see':311,502 'separ':451 'serv':208 'server.start':143 'set':167 'setup':222 'signific':418 'simpl':474 'singl':476 'single-lin':475 'skill' 'skill-developing-genkit-go' 'sl':233 'source-genkit-ai' 'start':239,251,255 'store':344 'stream':41,62,181,281,283,301 'string':113,114,434 'struct':395 'structur':60,414 'support':457 'tag':396 'tell':123 'templat':459 'test':246,375 'throughout':354 'tool':26,42,63,192,196,421,427,442 'topic':112,129 'topic-agent-skills' 'trace':244,365 'type':399 'ui':243,319,379 'understand':406 'unifi':70 'use':10,14,29,392,402,444 'user':17 'vagu':435 'version':229 'vertex':215 'via':369 'wait':290,291 'without':412,465 'work':33 'world':76 'worth':385 'wrap':357 'write':419","prices":[{"id":"ba75a56c-cfce-47ba-9db0-8ff84933d614","listingId":"453c35c7-630e-48a8-a8dc-a95f8c8fb792","amountUsd":"0","unit":"free","nativeCurrency":null,"nativeAmount":null,"chain":null,"payTo":null,"paymentMethod":"skill-free","isPrimary":true,"details":{"org":"genkit-ai","category":"skills","install_from":"skills.sh"},"createdAt":"2026-04-19T00:41:24.786Z"}],"sources":[{"listingId":"453c35c7-630e-48a8-a8dc-a95f8c8fb792","source":"github","sourceId":"genkit-ai/skills/developing-genkit-go","sourceUrl":"https://github.com/genkit-ai/skills/tree/main/skills/developing-genkit-go","isPrimary":false,"firstSeenAt":"2026-04-19T00:41:24.786Z","lastSeenAt":"2026-04-19T00:41:24.786Z"}],"details":{"listingId":"453c35c7-630e-48a8-a8dc-a95f8c8fb792","quickStartSnippet":null,"exampleRequest":null,"exampleResponse":null,"schema":null,"openapiUrl":null,"agentsTxtUrl":null,"citations":[],"useCases":[],"bestFor":[],"notFor":[],"kindDetails":{"org":"genkit-ai","slug":"developing-genkit-go","github":{"repo":"genkit-ai/skills","stars":12,"topics":["agent-skills","ai"],"license":null,"html_url":"https://github.com/genkit-ai/skills","pushed_at":"2026-04-17T19:57:58Z","description":"Agent Skills that teach AI coding agents how to build applications with the Genkit framework (JS/TS, Go, Dart).","skill_md_sha":"d32ea56d2c60efb54b779b4b6d057e9266c26fe4","skill_md_path":"skills/developing-genkit-go/SKILL.md","default_branch":"main","skill_tree_url":"https://github.com/genkit-ai/skills/tree/main/skills/developing-genkit-go"},"layout":"multi","source":"github","category":"skills","frontmatter":{"name":"developing-genkit-go","description":"Develop AI-powered applications using Genkit in Go. Use when the user asks to build AI features, agents, flows, or tools in Go using Genkit, or when working with Genkit Go code involving generation, prompts, streaming, tool calling, or model providers."},"skills_sh_url":"https://skills.sh/genkit-ai/skills/developing-genkit-go"},"updatedAt":"2026-04-19T00:41:24.786Z"}}