{"id":"7af07f9f-2779-4235-862c-cc8971d47b28","shortId":"ZvN9Kq","kind":"skill","title":"developing-genkit-js","tagline":"Develop AI-powered applications using Genkit in Node.js/TypeScript. Use when the user asks about Genkit, AI agents, flows, or tools in JavaScript/TypeScript, or when encountering Genkit errors, validation issues, type errors, or API problems.","description":"# Genkit JS\n\n## Prerequisites\n\nEnsure the `genkit` CLI is available.\n-   Run `genkit --version` to verify. Minimum CLI version needed: **1.29.0**\n-   If not found or if an older version (1.x < 1.29.0) is present, install/upgrade it: `npm install -g genkit-cli@^1.29.0`.\n\n**New Projects**: If you are setting up Genkit in a new codebase, follow the [Setup Guide](references/setup.md).\n\n## Hello World\n\n```ts\nimport { z, genkit } from 'genkit';\nimport { googleAI } from '@genkit-ai/google-genai';\n\n// Initialize Genkit with the Google AI plugin\nconst ai = genkit({\n  plugins: [googleAI()],\n});\n\nexport const myFlow = ai.defineFlow({\n  name: 'myFlow',\n  inputSchema: z.string().default('AI'),\n  outputSchema: z.string(),\n}, async (subject) => {\n  const response = await ai.generate({\n    model: googleAI.model('gemini-2.5-flash'),\n    prompt: `Tell me a joke about ${subject}`,\n  });\n  return response.text;\n});\n```\n\n## Critical: Do Not Trust Internal Knowledge\n\nGenkit recently went through a major breaking API change. Your knowledge is outdated. You MUST lookup docs. Recommended:\n\n```sh\ngenkit docs:read js/get-started.md\ngenkit docs:read js/flows.md\n```\n\nSee [Common Errors](references/common-errors.md) for a list of deprecated APIs (e.g., `configureGenkit`, `response.text()`, `defineFlow` import) and their v1.x replacements.\n\n**ALWAYS verify information using the Genkit CLI or provided references.**\n\n## Error Troubleshooting Protocol\n\n**When you encounter ANY error related to Genkit (ValidationError, API errors, type errors, 404s, etc.):**\n\n1. **MANDATORY FIRST STEP**: Read [Common Errors](references/common-errors.md)\n2. Identify if the error matches a known pattern\n3. Apply the documented solution\n4. Only if not found in common-errors.md, then consult other sources (e.g. `genkit docs:search`)\n\n**DO NOT:**\n- Attempt fixes based on assumptions or internal knowledge\n- Skip reading common-errors.md \"because you think you know the fix\"\n- Rely on patterns from pre-1.0 Genkit\n\n**This protocol is non-negotiable for error handling.**\n\n## Development Workflow\n\n1.  **Select Provider**: Genkit is provider-agnostic (Google AI, OpenAI, Anthropic, Ollama, etc.).\n    -   If the user does not specify a provider, default to **Google AI**.\n    -   If the user asks about other providers, use `genkit docs:search \"plugins\"` to find relevant documentation.\n2.  **Detect Framework**: Check `package.json` to identify the runtime (Next.js, Firebase, Express).\n    -   Look for `@genkit-ai/next`, `@genkit-ai/firebase`, or `@genkit-ai/google-cloud`.\n    -   Adapt implementation to the specific framework's patterns.\n3.  **Follow Best Practices**:\n    -   See [Best Practices](references/best-practices.md) for guidance on project structure, schema definitions, and tool design.\n    -   **Be Minimal**: Only specify options that differ from defaults. When unsure, check docs/source.\n4.  **Ensure Correctness**:\n    -   Run type checks (e.g., `npx tsc --noEmit`) after making changes.\n    -   If type checks fail, consult [Common Errors](references/common-errors.md) before searching source code.\n5.  **Handle Errors**:\n    -   On ANY error: **First action is to read [Common Errors](references/common-errors.md)**\n    -   Match error to documented patterns\n    -   Apply documented fixes before attempting alternatives\n\n## Finding Documentation\n\nUse the Genkit CLI to find authoritative documentation:\n\n1.  **Search topics**: `genkit docs:search <query>`\n    -   Example: `genkit docs:search \"streaming\"`\n2.  **List all docs**: `genkit docs:list`\n3.  **Read a guide**: `genkit docs:read <path>`\n    -   Example: `genkit docs:read js/flows.md`\n\n## CLI Usage\n\nThe `genkit` CLI is your primary tool for development and documentation.\n-   See [CLI Reference](references/docs-and-cli.md) for common tasks, workflows, and command usage.\n-   Use `genkit --help` for a full list of commands.\n\n## References\n\n-   [Best Practices](references/best-practices.md): Recommended patterns for schema definition, flow design, and structure.\n-   [Docs & CLI Reference](references/docs-and-cli.md): Documentation search, CLI tasks, and workflows.\n-   [Common Errors](references/common-errors.md): Critical \"gotchas\", migration guide, and troubleshooting.\n-   [Setup Guide](references/setup.md): Manual setup instructions for new projects.\n-   [Examples](references/examples.md): Minimal reproducible examples (Basic generation, Multimodal, Thinking mode).","tags":["developing","genkit","skills","genkit-ai","agent-skills"],"capabilities":["skill","source-genkit-ai","skill-developing-genkit-js","topic-agent-skills"],"categories":["skills"],"synonyms":[],"warnings":[],"endpointUrl":"https://skills.sh/genkit-ai/skills/developing-genkit-js","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 (4,437 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:25.557Z","embedding":null,"createdAt":"2026-04-19T00:41:25.557Z","updatedAt":"2026-04-19T00:41:25.557Z","lastSeenAt":"2026-04-19T00:41:25.557Z","tsv":"'-1.0':301 '-2.5':148 '/firebase':377 '/google-cloud':382 '/google-genai':114 '/next':373 '/typescript.':15 '1':69,239,314,482 '1.29.0':60,71,82 '2':247,356,493 '3':256,391,500 '4':261,422 '404s':237 '5':447 'action':454 'adapt':383 'agent':24 'agnost':321 'ai':7,23,113,120,123,136,323,339,372,376,381 'ai-pow':6 'ai.defineflow':130 'ai.generate':144 'altern':471 'alway':211 'anthrop':325 'api':40,172,201,233 'appli':257,466 'applic':9 'ask':20,343 'assumpt':282 'async':139 'attempt':278,470 'authorit':480 'avail':50 'await':143 'base':280 'basic':591 'best':393,396,546 'break':171 'chang':173,434 'check':359,420,427,437 'cli':48,57,81,217,477,512,516,526,559,564 'code':446 'codebas':94 'command':534,544 'common':193,244,440,458,530,568 'common-errors.md':267,288 'configuregenkit':203 'const':122,128,141 'consult':269,439 'correct':424 'critic':159,571 'default':135,336,417 'defineflow':205 'definit':405,553 'deprec':200 'design':408,555 'detect':357 'develop':2,5,312,522 'developing-genkit-j':1 'differ':415 'doc':181,185,189,274,349,486,490,496,498,505,509,558 'docs/source':421 'document':259,355,464,467,473,481,524,562 'e.g':202,272,428 'encount':32,226 'ensur':45,423 'error':34,38,194,221,228,234,236,245,251,310,441,449,452,459,462,569 'etc':238,327 'exampl':488,507,586,590 'export':127 'express':367 'fail':438 'find':353,472,479 'firebas':366 'first':241,453 'fix':279,295,468 'flash':149 'flow':25,554 'follow':95,392 'found':63,265 'framework':358,388 'full':541 'g':78 'gemini':147 'generat':592 'genkit':3,11,22,33,42,47,52,80,90,105,107,112,116,124,165,184,188,216,231,273,302,317,348,371,375,380,476,485,489,497,504,508,515,537 'genkit-ai':111,370,374,379 'genkit-c':79 'googl':119,322,338 'googleai':109,126 'googleai.model':146 'gotcha':572 'guid':98,503,574,578 'guidanc':400 'handl':311,448 'hello':100 'help':538 'identifi':248,362 'implement':384 'import':103,108,206 'inform':213 'initi':115 'inputschema':133 'instal':77 'install/upgrade':74 'instruct':582 'intern':163,284 'issu':36 'javascript/typescript':29 'joke':154 'js':4,43 'js/flows.md':191,511 'js/get-started.md':187 'know':293 'knowledg':164,175,285 'known':254 'list':198,494,499,542 'look':368 'lookup':180 'major':170 'make':433 'mandatori':240 'manual':580 'match':252,461 'migrat':573 'minim':410,588 'minimum':56 'mode':595 'model':145 'multimod':593 'must':179 'myflow':129,132 'name':131 'need':59 'negoti':308 'new':83,93,584 'next.js':365 'node.js':14 'node.js/typescript.':13 'noemit':431 'non':307 'non-negoti':306 'npm':76 'npx':429 'older':67 'ollama':326 'openai':324 'option':413 'outdat':177 'outputschema':137 'package.json':360 'pattern':255,298,390,465,550 'plugin':121,125,351 'power':8 'practic':394,397,547 'pre':300 'prerequisit':44 'present':73 'primari':519 'problem':41 'project':84,402,585 'prompt':150 'protocol':223,304 'provid':219,316,320,335,346 'provider-agnost':319 'read':186,190,243,287,457,501,506,510 'recent':166 'recommend':182,549 'refer':220,527,545,560 'references/best-practices.md':398,548 'references/common-errors.md':195,246,442,460,570 'references/docs-and-cli.md':528,561 'references/examples.md':587 'references/setup.md':99,579 'relat':229 'relev':354 'reli':296 'replac':210 'reproduc':589 'respons':142 'response.text':158,204 'return':157 'run':51,425 'runtim':364 'schema':404,552 'search':275,350,444,483,487,491,563 'see':192,395,525 'select':315 'set':88 'setup':97,577,581 'sh':183 'skill' 'skill-developing-genkit-js' 'skip':286 'solut':260 'sourc':271,445 'source-genkit-ai' 'specif':387 'specifi':333,412 'step':242 'stream':492 'structur':403,557 'subject':140,156 'task':531,565 'tell':151 'think':291,594 'tool':27,407,520 'topic':484 'topic-agent-skills' 'troubleshoot':222,576 'trust':162 'ts':102 'tsc':430 'type':37,235,426,436 'unsur':419 'usag':513,535 'use':10,16,214,347,474,536 'user':19,330,342 'v1.x':209 'valid':35 'validationerror':232 'verifi':55,212 'version':53,58,68 'went':167 'workflow':313,532,567 'world':101 'x':70 'z':104 'z.string':134,138","prices":[{"id":"9370e8cf-5d18-4161-9dc3-5f4c42a9f419","listingId":"7af07f9f-2779-4235-862c-cc8971d47b28","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:25.557Z"}],"sources":[{"listingId":"7af07f9f-2779-4235-862c-cc8971d47b28","source":"github","sourceId":"genkit-ai/skills/developing-genkit-js","sourceUrl":"https://github.com/genkit-ai/skills/tree/main/skills/developing-genkit-js","isPrimary":false,"firstSeenAt":"2026-04-19T00:41:25.557Z","lastSeenAt":"2026-04-19T00:41:25.557Z"}],"details":{"listingId":"7af07f9f-2779-4235-862c-cc8971d47b28","quickStartSnippet":null,"exampleRequest":null,"exampleResponse":null,"schema":null,"openapiUrl":null,"agentsTxtUrl":null,"citations":[],"useCases":[],"bestFor":[],"notFor":[],"kindDetails":{"org":"genkit-ai","slug":"developing-genkit-js","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":"cf6f678df34d0a29438473382c5777a650cef5ff","skill_md_path":"skills/developing-genkit-js/SKILL.md","default_branch":"main","skill_tree_url":"https://github.com/genkit-ai/skills/tree/main/skills/developing-genkit-js"},"layout":"multi","source":"github","category":"skills","frontmatter":{"name":"developing-genkit-js","description":"Develop AI-powered applications using Genkit in Node.js/TypeScript. Use when the user asks about Genkit, AI agents, flows, or tools in JavaScript/TypeScript, or when encountering Genkit errors, validation issues, type errors, or API problems."},"skills_sh_url":"https://skills.sh/genkit-ai/skills/developing-genkit-js"},"updatedAt":"2026-04-19T00:41:25.557Z"}}