Menu

Prefer fixture JSON over “sample data” comments when prompting UI agents
📰

Prefer fixture JSON over “sample data” comments when prompting UI agents

DEV Community: frontend·Sherotree·1 day ago
#dcut1fn1
#devtofrontend#devto#dev#fixture#json
Reading 0:00
15s threshold

“Use some sample data” in a prompt is an invitation to invent. The agent fabricates a user shape that almost matches production, hard-codes three pretty rows, and skips the nullables your API actually returns. Reviewers only notice when the real payload hits the page.

I’ve stopped describing sample data in prose. I point the agent at a fixture JSON file (or paste a trimmed fixture) and require the UI to consume that shape.

Why comments lose to fixtures

Prose samples drift:

Field names get camelCased “for React” while the API is snake_case

Optional fields disappear because the happy path didn’t need them

Dates become "yesterday" strings instead of ISO timestamps

Empty arrays and nulls never appear, so empty states stay theoretical

A fixture checked into src/fixtures/ or testdata/ is greppable, reviewable, and reusable in Storybook / Playwright.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.