typescript
TypeScript coding conventions, best practices, and patterns for writing clean, maintainable…
Best practices for authoring Genkit tooling, including CLI commands and MCP server tools. Covers naming conventions, architectural patterns, and consistency guidelines.
$ npx -y skills add genkit-ai/genkit --skill developing-genkit-tooling --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/developing-genkit-toolingContext preview
The summary Claude sees to decide when to auto-load this skill.
Best practices for authoring Genkit tooling, including CLI commands and MCP server tools. Covers naming conventions, architectural patterns, and consistency guidelines.
name: developing-genkit-tooling description: Best practices for authoring Genkit tooling, including CLI commands and MCP server tools. Covers naming conventions, architectural patterns, and consistency guidelines.
Consistency in naming helps users and agents navigate the tooling.
Use **kebab-case** with colon separators for subcommands.
Use **snake_case** for tool names to align with MCP standards.
Commands are implemented in `cli/src/commands/` using `commander`.
Most commands require interacting with the user's project runtime. Use the `runWithManager` utility to handle the lifecycle of the runtime process.
import { runWithManager } from '../utils/manager-utils';
// ... command definition ...
.action(async (arg, options) => {
await runWithManager(await findProjectRoot(), async (manager) => {
// Interact with manager here
const result = await manager.runAction({ key: arg });
});
});MCP tools in `cli/src/mcp/` follow two distinct patterns: **Static** and **Runtime**.
These tools do not require a running Genkit project context.
These tools interact with a specific Genkit project's runtime.
// Runtime tool definition pattern
server.registerTool(
'my_runtime_tool',
{
inputSchema: getCommonSchema(options.explicitProjectRoot, {
myArg: z.string(),
}),
},
async (opts) => {
// Resolve project root before action
const rootOrError = resolveProjectRoot(
options.explicitProjectRoot,
opts,
options.projectRoot
);
if (typeof rootOrError !== 'string') return rootOrError;
// access manager via options.manager
}
);MCP tools should generally catch errors and return them as content blocks with `isError: true` rather than throwing exceptions, which ensures the client receives a structured error response.
try {
// operation
} catch (err) {
const message = err instanceof Error ? err.message : String(err);
return {
isError: true,
content: [{ type: 'text', text: `Error: ${message}` }],
};
}Open-source framework for building agentic apps in JavaScript, Go, Dart, and Python, built and used in production by Google
Repo: firebase/genkit
TypeScript coding conventions, best practices, and patterns for writing clean, maintainable…