Persistent state turns a chat model into an agent. Modular Skills turn that state into something you can version, review, and reuse across repos.
Agent Skills for Storybook 8 and Next.js App Router
How SKILL.md files encode Storybook setup checks, next/navigation mocks, and Radix portal pitfalls for Next.js 15+ projects.
Mike Henken
AI Platform Architect
Agent Skills are structured, file-based instructions that load when context matches. They work better than dumping stack docs into every prompt because the agent pulls depth only when the task needs it.
Google AntiGravity, Claude, and Cursor all converge on SKILL.md files, but they discover and execute them differently. This article compares those paths, then walks through a Storybook 8 skill for Next.js App Router + Shadcn UI, with doc links you can verify.
From Autocomplete to Orchestration
To grasp the necessity of "Agent Skills," we must map the trajectory of AI in the development environment.
- First Generation: Stochastic CompletionTools like initial Copilot versions used "fill-in-the-middle" (FIM). They predicted tokens but lacked "intent awareness."
- Second Generation: Contextual Chat (RAG)Systems like Cursor and Copilot Chat allowed Q&A with the codebase context. However, the interaction remained synchronous and human-initiated.
- Third Generation: Agent-First EnvironmentsExemplified by Google AntiGravity. The IDE becomes an orchestration layer. Agents possessPlanning, Tool Use, and State Persistence.
Capability Evolution
Comparing Standard Completion vs AntiGravity Agents
Skill Efficiency Metrics
The Economics of Context
Modern frontend stacks (Next.js App Router, Shadcn, Tailwind) generate massive context requirements. Feeding tens of thousands of tokens of documentation into every request is prohibitively expensive and degrades model reasoning ("Needle in a Haystack" problem).
Progressive Disclosure
This constraint necessitates Progressive Disclosure. Instead of dumping the entire knowledge base, the agent maintains a lightweight index. It loads the heavy procedural knowledge - the "Skill" - only when triggered. This mimics human experts "loading" knowledge from documentation only when needed.
Anatomy of an Agent Skill
The SKILL.md standard is not merely a prompt; it is a structured program for the agent's cognitive process. Explore the layers of a production-ready skill below.
// 1. HEADER & ROLE DEFINITION
// Establishes authority and tech stack context immediately.
Act as an expert Senior Frontend Engineer.
Stack: Next.js 14 (App Router), TypeScript, Tailwind CSS, Shadcn UI.
Tool: Storybook 8.
Goal: Create self-contained, interactive stories.
Rules:
- Prefer functional components.
- Use strict TypeScript types.
- Avoid 'any'.Ecosystem Analysis
| Feature | Google AntiGravity | Anthropic Claude | Cursor |
|---|---|---|---|
| Primary Unit | SKILL.md in .agent/skills | SKILL.md in .claude/skills | .cursor/rules/*.mdc |
| Execution Scope | Project-wide orchestration | Chat Session | Editor Window |
| Browser Access | Native "Antigravity Browser" | Via MCP Tool | Limited / Extension based |
| Context Strategy | Progressive Disclosure | Progressive Disclosure | Embeddings + Rules |
The Next.js + Storybook 8 Friction Points
Storybook 8 with the @storybook/nextjs framework is the usual setup for App Router projects. It is also where teams hit the same three bugs: navigation mocks, font variables, and Radix portals.
The next/navigation Mocking Problem
App Router replaces next/router with next/navigation. Components using useRouter will crash in Storybook unless you set parameters.nextjs.navigation per theNext.js framework options. Legacy navigation-mock addons are deprecated in Storybook 8+.
The Font Loading Disconnect
Shadcn utilizes next/font for CSS variables. Storybook runs in an iframe that doesn't inherit the Root Layout. Without manual injection via decorators or preview-head.html, components look generic (Times New Roman fallback), breaking visual fidelity.
The Portal/Dialog Trap
Radix UI primitives render Portals to document.body. In Storybook, the theme class (e.g., .dark) is often on a wrapper div. Portals escape this wrapper, resulting in unstyled/white Dialogs in Dark Mode contexts. The skill must enforce decorators that wrap the Story body or apply classes globally.
The Master Skill
The complete construction of the standard-compliant skill, formatted for Google AntiGravity. Copy this into .agent/skills/storybook-architect/SKILL.md.