Building Silverprose with Agents
How one engineer runs a production platform with 7,800+ users by treating coding agents as the default way to build — and engineering the checks that keep their output trustworthy.
- Role
- Full-stack Engineer & Product Designer
- Timeline
- 2026 → present
- Focus
- Next.jsTypeScriptPostgreSQLPrismaRedisStripeVercelVitestClaude CodeAgent Workflows
Overview
Silverprose is the product story. This is the engineering one: how I built and now operate, as the only engineer, a platform with 7,800+ registered users and nearly a million collected cards — stories, a collectible card economy, real-time trading, community events, subscriptions, and moderation — with coding agents writing most of the first drafts. That’s about 1,750 commits since the first one in March 2026.
Agents aren’t an occasional assist here. They plan features, write the code and tests, review each other’s work, triage player bug reports, and run an unattended cleanup pass every night. My job moved up a level: I design the system the agents work inside, decide what they’re allowed to do on their own, and build the checks that catch them when they’re wrong.
The system
Silverprose is a Next.js App Router application with partial prerendering, running on Vercel.
- Data. PostgreSQL on Neon through Prisma — 260+ models and 1,000+ hand-written migrations, each of which must replay cleanly from an empty database.
- Mutations. Every write is a server action that follows one skeleton: auth guard → rate limit → server-side validation → business checks → the write → side effects → cache invalidation. User errors come back as plain values, never thrown.
- Caching. Reads go through tag-based cached functions, with a small in-process layer for hot, viewer-neutral data and Redis for per-user entries that change often. Every cache tag comes from one registry, so a reader and the write that expires it can’t drift apart.
- Concurrency. Trades, card upgrades, and moderation decisions all change a row’s status, and two requests can race. Each lifecycle is a declared state machine, and every status change is a compare-and-set, so only one caller can win.
- Everything else. Stripe subscriptions and one-time purchases, web push, email, scheduled jobs, an AI content scanner built on Claude, and a cookieless, fully static version of every story page for guests and search engines.
// Cancelling a trade offer. The status write is a compare-and-set:
// an accept or decline that lands after the read above must win.
const { count } = await prisma.tradeOffer.updateMany({
where: { id: offerId, status: tradeOfferStatus.guard("CANCELLED", "PENDING") },
data: { status: "CANCELLED" },
});
if (count === 0) return { error: OFFER_NO_LONGER_PENDING };
Context is infrastructure
An agent is only as good as what it knows about the codebase. The repo
carries a short root CLAUDE.md — about 120 lines of architecture, rules,
and gotchas — and 25 custom skills that load on demand:
- Domain references for the data model, the UI design language, and each feature area, so an agent touching trading reads how trading works first.
- Workflows that turn conventions into steps: planning (with a mandatory reuse scan, a complexity rating, and a second model cross-checking the plan), adding a migration, building a feature end to end.
- Audits that run after a change: server-action conformance, query
cost and N+1 checks, duplication against existing helpers, design-token
compliance, and visual regression against
main.
The root file stays small on purpose. Detail lives in skills an agent pulls in when the task needs it, so context goes to the problem at hand rather than to everything at once.
Review when an agent writes the first draft
I still read and merge every pull request myself. But line-by-line human review doesn’t keep up with agent output, so the mechanical checking happens in a pipeline first, and my review goes to the decisions:
- Simplify. One pass strips duplication and dead weight before any reviewer reads the diff.
- Three reviewers in parallel. CodeRabbit, a second model (Codex), and Claude’s own code review each read the diff independently.
- Auto-fix only the confident findings. Uncertain ones come to me with a recommendation; the rest arrive as one merged, deduplicated list.
- Log everything. Every finding is written to a log, tagged with the kind of mistake it is — 1,500+ findings so far.
That log is the part I’m proudest of. A second skill reads it, finds mistakes that keep recurring (three or more hits across two or more runs), and proposes the cheapest check that would catch them for good — an ESLint selector, a check script, or a unit test. Twelve patterns have been promoted this way, including unguarded status writes, inline rate-limit values, raw role comparisons, and unescaped wildcards in search queries. When I correct an agent myself, that correction goes into the same log.
The result is a codebase that gets harder to break over time: a mistake an agent makes three times becomes a mistake no agent can make again.
Agents that run on their own
Two scheduled cloud routines work without me in the loop:
- Nightly housekeeping. The codebase is split into about 40 features. Each night the routine audits the one most in need — stale patterns, duplication, dead code, performance — plus a bug hunt. It builds every fix that needs no product decision, runs the full review pipeline, and pushes to a rolling pull request with a checklist of anything it left for me.
- Bug-report triage. Players file reports in an in-app forum. Every few hours a routine pulls new reports, checks each against the code, fixes the safe bugs onto one pull request and small tweaks onto another, and writes up feature requests for me to decide on.
Both have hard limits. Each run is a fresh cloud clone of the repo with no
environment file and no database credentials, so it can’t touch production
data at all. Their instructions add the rest: they never push to main,
never merge, and never deploy. I review and ship their pull requests
myself. Player reports are treated as untrusted
input — a report that asks for a permission change, a reward, or anything
that doesn’t follow from a genuine bug is flagged as suspicious, not acted
on.
Where agents fail, and how I catch it
A lint rule that never fired. An agent wrote a rule to block unguarded status writes. It passed lint, and the codebase showed zero violations — which looked like success. A later audit tested the rule against a deliberately broken file and found the selector matched nothing at all. Repaired, it flagged 13 writes. Nine were already protected by row locks, but four weren’t, including two Stripe webhook paths that could mark a payment refunded twice. The lesson I took: a check that reports zero problems needs a known-bad case before you trust it.
The flaky build nobody could explain. Production deploys failed at random, and earlier agent sessions never pinned down why. It only reproduced on Vercel’s parallel build workers, so instead of guessing I had an agent trace a local build and record what every page actually read. The trace showed 275 of 290 settings reads during prerendering skipping the cache because an in-process memo was sharing work across pages. Scoping the memo to live requests fixed it, and correctly tagged static pages went from 0 of 149 to 143 of 149.
Requests that hung for five minutes. A small share of form submissions timed out at 300 seconds. A watchdog that logged slow outbound calls traced every one to the framework forwarding an action to another route with no timeout. We shipped a 20-second abort for forwarded actions, so a stuck request now fails fast with a retry instead of hanging, and kept the watchdog in place to watch for any recurrence.
The everyday failures are smaller and more common: an agent forgets to expire a cache tag after a write, reaches for a new helper when one already exists, or reports a task as verified when it only ran lint. The answer to each is the same — make the expectation explicit in a skill, then make it mechanical where possible. Builds, type checks, and tests are scaled to the risk of each change, and nothing counts as done on an agent’s word alone.
LLM features in production
Claude isn’t only how the code gets written; it’s also inside the product, with cost treated as a first-class constraint:
- Story cards. Every story gets a structured read written in a fixed vocabulary, then embedded for similarity search. Cards are generated nightly through the Batch API at half the price, and only for stories whose chapters changed.
- Suggest for authors. While writing, an author can ask for tags and characters. An embedding search over similar stories and a model read of the draft run side by side and merge, and either one can fail without breaking the feature. Prompt caching covers the shared context, and per-user hourly and daily limits plus a monthly dollar budget cap the spend.
- Moderation. New text and images are scanned for rule-breaking content, with a small model reading small thumbnails to keep it fast and cheap. The scan writes a report; a moderator makes the call.
- One structured-output helper that every feature goes through, so schema validation, truncated replies, and per-call cost tracking are handled once.
Testing
- Unit tests for pure logic: drop rates, state machines, permissions, and formatting. The agent’s verify step runs them, scaled to the change, before anything counts as done; CI’s job is applying migrations on deploy.
- Integration tests run against a local Docker Postgres that is wiped and rebuilt from every migration on each run, so tests never touch the real databases and migrations are proven to replay.
- A dev-only UI gallery renders every variant of every component from typed fixtures, so an agent’s UI change can be checked visually without seeding data.
Operating it
Running the platform is part of the job. A health-check skill pulls usage and cost from Vercel, Neon, Redis, and the CDN, compares against recent days, and flags anything irregular. Read-only production queries are a standing permission for agents investigating a report; any production write needs my explicit sign-off. Fourteen rounds of cost work — moving hot reads behind cheaper cache layers, offloading media to a CDN, and rebuilding how card inventories sync — came out of those reports. One round alone cut the daily hosting bill from $16.87 to $10.84.
Reflection
The hardest part of building with agents isn’t getting code written. It’s deciding what “done” means, writing that down where an agent will read it, and building the checks that hold the line when it’s wrong. Design systems taught me the same lesson years ago: standards only work when they’re written down, shared, and enforced by the tools people already use. That turned out to apply just as well when the people writing the code are agents.