DEV Community

Cover image for A coding agent builds a section that compiles. Who checks it matches your site?
Chris Lojniewski for Pagepro

Posted on

A coding agent builds a section that compiles. Who checks it matches your site?

Ask Claude Code or Cursor to add a pricing section to a Next.js site and the build passes. The section renders. It can still be wrong in ways nothing reports.

The colors come from the default palette instead of your tokens. A second component draws a layout you already have. In a CMS-backed site the section can be missing from the editor's insert menu, so nobody on the content team can ever use it.

A prompt cannot carry everything that prevents this. A new developer gets it in week one: the design rules, the brand rules, the shape of the content model, and a reviewer for their first pull requests. An agent needs the same.

Here is how that looks in a repo you can clone.

Three files the agent reads first

Every skill in the repo starts from the same three files in the project root:

  • DESIGN.md says how it looks: tokens, type scale, section anatomy, do's and don'ts.
  • BRAND.md says what it says: audience, voice, messaging.
  • AGENTS.md says how to build: architecture, commands, conventions and step-by-step checklists.

In the Meridian demo theme, DESIGN.md has machine-readable front matter with the real token values: colors in OKLCH, the type scale, the fonts. The agent does not guess "a dark gray". It reads dark-card and uses it.

A skill that first asks whether anything needs building

The create-section skill does not start with code. Phase 0 is called "Do we already have it?".

The agent lists the existing sections from SECTION_META, compares the request with the two or three closest types by slots, fields and mechanics, and shows you a short table. Then it decides with you:

  • Reuse as-is. An existing type with a layout option or color theme already draws the request. Nothing gets built.
  • Extend. An existing type covers most of it. A new optional field or layout variant is added, and existing documents must render exactly as before.
  • New type. Nothing fits, so all phases run.

The skill also warns about its own failure mode. Several steps fail silently: a section can compile and typecheck while being invisible in the insert menu, blank in the gallery, or stripped from the document by a stale Studio. So no phase is skipped because the page looks right.

Reviewers that say no

The skill hands off to read-only agents in .agents/agents/. They never edit files. Each returns a verdict (PASS or ISSUES FOUND) and findings in one fixed format: severity, file and line, the rule, the fix.

  • styling-fidelity-reviewer checks changed code against DESIGN.md. It flags arbitrary Tailwind values, raw palette classes instead of semantic tokens, and a trap a build never shows: a custom text-NN size next to a text-{color} inside cn() is silently dropped by tailwind-merge.
  • sanity-schema-reviewer checks the schema.
  • groq-parity-reviewer checks that the GROQ query matches the schema.
  • content-model-architect decides whether something should be an inline object, a document-backed listing or a shared section.
  • link-reviewer checks links and CTAs when a section has them.

The loop is one a team can live with. Marketing asks an agent for a section. The skill reuses what exists, builds only what is missing, and the reviewers check the result against the design and the schema. A developer reviews the final version before anything goes live.

Try it

You need Node.js 22.12+, pnpm and a free Sanity account.

npm create sanity@latest -- --template Pagepro/nexity/base
cd <your project folder>
pnpm dev
pnpm agent:doctor
Enter fullscreen mode Exit fullscreen mode

The site runs on localhost:3000 and the Studio on localhost:3000/admin. pnpm agent:doctor checks that the agent layer is linked for Claude Code and Codex. A live demo with no setup: https://meridian.nexity.build

GitHub logo Pagepro / nexity

Nexity is an open source system for starting and growing AI-native websites on Next.js + Sanity.

Nexity

Nexity is an open source system for starting and growing AI-native websites on Next.js + Sanity.

It is for teams where every website change lands on a developer. Nexity gives coding agents (Claude Code, Codex, Cursor) the design system, the blocks and the Sanity schema, so marketing can build new sections with AI and a developer reviews the result before it goes live.

A request to add a section goes to the create-section skill, which reads AGENTS.md, DESIGN.md and BRAND.md and builds the section; styling-fidelity-reviewer then checks it against DESIGN.md

Live demo: https://meridian.nexity.build

Quick start

Requirements: Node.js 22.12 or newer, pnpm 12.15 (corepack enable picks it up), a Sanity account (the free plan works).

npm create sanity@latest -- --template Pagepro/nexity/base
cd <your project folder>
pnpm dev
Enter fullscreen mode Exit fullscreen mode

The site runs on http://localhost:3000 and the Studio on http://localhost:3000/admin.

The project comes with the agent layer: skills and reviewers in .agents/, already linked for Claude Code and Codex. Check the setup with pnpm agent:doctor. To link Cursor, take a newer version of the…

If it saves you a few hours, a star helps other developers find it.

What does your agent get wrong most often in a codebase with a design system: tokens, structure or the content model?

Top comments (0)