How to Build Modular Agent Skills in Genkit Go
Learn how to package agent capabilities into modular bundles using Genkit Go to reduce token consumption and prevent context window bloat.
Google’s new Agent Skills integration for the Genkit Go SDK lets you package standard operating procedures, reference documents, and scripts into modular bundles. By using progressive disclosure to only load specific knowledge when an agent activates a skill, you can bypass context window bloat and lower token costs. Here is how to structure your skill directories, configure the middleware, and manage capability routing.
The Agent Skills Open Standard
The Genkit Go implementation adheres to the agent skills open standard hosted at agentskills.io. This standard, adopted across ecosystems, ensures that the skills you build are portable. As of July 2026, these bundles are compatible with over 40 products, including Claude Code, Cursor, and the newly released Antigravity CLI.
Instead of stuffing an agent’s initial prompt with every conceivable instruction, the standard relies on a progressive disclosure architecture. This separation of concerns prevents the model from losing focus on the primary task and significantly reduces the per-turn token consumption.
Structuring a Skill Bundle
A skill is organized as a discrete directory. The middleware requires a specific file structure to parse the metadata and supplementary resources correctly.
At minimum, a skill directory requires a SKILL.md file. This file contains YAML frontmatter defining the metadata and a Markdown body containing the actual instructions. You can also include optional subdirectories for deeper integration:
scripts/: Contains executable code for the agent to run during the task.references/: Holds documentation, API schemas, or lookup tables.assets/: Stores templates or static resources used in formatting outputs.
Configuring the Skills Middleware
To expose these bundles to your model, you use the middleware.Skills package in Genkit Go. The exact implementation syntax requires the latest SDK release, but the architecture functions by scanning a target directory for .md files.
When you register the directory with the middleware, it automatically injects a use_skill tool into the model’s environment. The model does not see the full contents of your SKILL.md files at boot. Instead, it only “scans” the brief YAML frontmatter, loading the names and descriptions of available skills.
When the agent determines it needs specific expertise, it calls the use_skill tool. The middleware then injects the detailed Markdown instructions and supplementary files into the context window for that specific task. Research indicates that this curated, on-demand approach improves task pass rates by an average of 16.2 percentage points compared to flat, bloated prompts.
Mitigating Skill Name Hallucination
Progressive disclosure introduces a specific failure mode: “skill name hallucination.” Agents may attempt to call the use_skill tool with names of skills that do not exist, or worse, guess the names of internal tooling.
To secure your deployment, implement registry-level name reservations within your middleware configuration. This ensures that the agent can only activate explicitly registered skill bundles. If an agent calls an unregistered skill, the middleware should return a structured error prompting the model to query the available skill list again.
Building Meta-Skills
Once your infrastructure supports modular bundles, you can create “meta-skills.” A meta-skill is a bundle designed to manipulate other bundles. For example, a skill-creator bundle can instruct an agent to autonomously write, format, and save new SKILL.md files based on user interaction or repeated workflows.
If you are running evaluations on these agents, you can leverage the Agent Platform evaluation service. This service provides over 20 pre-built metrics and DeepMind-backed adaptive rubrics specifically designed to measure the performance of skill-enabled agents in complex workflows.
Keep your skill bundles narrowly scoped. A bundle that tries to cover too many edge cases defeats the purpose of the architecture. Treat each skill as a single Unix-style utility that does one thing well, and let the agent combine them as needed.
Get Insanely Good at AI
The book for developers who want to understand how AI actually works. LLMs, prompt engineering, RAG, AI agents, and production systems.
Keep Reading
Gemini 3.6 Flash Cuts Token Usage 17% for Agent Workloads
Google DeepMind released Gemini 3.6 Flash, 3.5 Flash-Lite, and a restricted Cyber model, targeting cost-efficiency and low-latency agent workflows.
How to Build Graph-Based Workflows With Google ADK Go 2.0
Learn how to migrate from rigid DAGs to dynamic, stateful AI agent graphs using Google's new ADK Go 2.0 workflow engine and Human-in-the-Loop primitives.
Claude 4.7 UI Guidelines Require Strict Screenshot Downscaling
Anthropic's new best practices for computer use identify click accuracy bottlenecks, providing precise screenshot limits and token configurations for Opus 4.7.
DeepSeek V4: 1M Tokens for Long-Running Agents
DeepSeek has launched the V4 model series, featuring a one-million-token context window and massive cost reductions for long-running AI agent workflows.
Classifier-Based Cursor Router Cuts Token Costs Up to 60%
Cursor replaced its heuristic Auto mode with a classifier that routes coding tasks based on complexity, reducing token spend by 30 to 60 percent.