# Claude Code Built Your Website? What Breaks First

*Originally published at* [*techpotions.com*](https://techpotions.com/lab/claude-code-built-website-what-breaks-first)*.*

If you're searching how to Claude Code a website, you've probably already shipped something that works locally and looks decent in a demo. Vibe-coding with Claude Code turns a prompt into a live prototype in minutes, no command line, no config hell (the internet is full of step-by-step walkthroughs, like [this hands-on guide](https://ruben.substack.com/p/the-claude-code-bible)). That speed is intoxicating. But the moment that prototype goes anywhere near real users, the cracks open fast.

We've audited enough AI-built codebases to recognize the same handful of silent failures. Below is the triage order a senior team actually follows, not a rewriting pitch, just the sequence that turns a vibe-coded site into something you can keep.

## How to Claude Code a website (and then fix it)

Claude Code builds in a linear, optimistic flow. It assumes all data exists, all credentials are safe to inline, and every database table is already there. That's why the same gaps show up every time. After the initial "wow," here's the repair sequence.

## 1\. Purge secrets from the client bundle

Vibe-coded front ends love to leak API keys. Claude Code will drop a `NEXT_PUBLIC_SUPABASE_ANON_KEY` or a Stripe publishable key straight into a React component because nothing in the prompt told it otherwise. The result: anyone inspecting the browser can grab those values.

**Fix:** move every secret to server-side environment variables. For frameworks like Next.js, that means removing the `NEXT_PUBLIC_` prefix and exposing only what the client genuinely needs. Use a `.env.local` file that never touches git. Run a quick grep:

```bash
grep -r "NEXT_PUBLIC\|sk-" src/
```

If anything returns a long hex string, you've got a leak.

## 2\. Lock down authentication and authorization

Claude Code can scaffold a login form, but the code behind it is usually open-house. It might store tokens in `localStorage` without validation, skip refresh logic, or, worse, check roles only on the client. A single `if (user.role === 'admin')` in a React component is not authorization.

**Fix:** move token validation to the server (middleware, edge functions). Validate the session on every request. Then add a real role-based guard at the API layer. An [audit walkthrough](https://medium.com/design-bootcamp/how-to-audit-a-vibe-coded-app-with-claude-code-like-an-ai-product-manager-1845284aa2e9) with Claude Code itself can flag client-side checks, but a human senior engineer still needs to restructure the flow.

## 3\. Add database migrations and seed data

Claude Code typically generates queries that assume tables already exist. There's no migration history, no schema versioning, and no way to replicate the database on a coworker's machine. This is where prototypes rot: the schema lives only in the developer's head.

**Fix:** write a proper migration system, Prisma, Drizzle, or Knex. Turn every `CREATE TABLE` into a versioned file. Add a seed script so the app can boot from scratch. If your project didn't start with one, [vibe coding cleanup services](https://www.bitsandletters.com/vibe-code-cleanup) typically tackle this as a foundational step.

## 4\. Surround every state the AI skipped

Claude Code optimizes for the happy path. It won't add loading skeletons, empty views, or error boundaries unless you explicitly ask. The result: a white screen while a slow endpoint resolves, and a crash when a fetch fails.

**Fix:** audit every `useEffect` and every `await`. Add:

- Suspense boundaries or manual loading states
- Friendly error messages (not just `console.error`)
- Fallback UI for empty lists (No results yet.)

Table of states to cover for each async section:

| State | Common AI omission | What a senior engineer adds |
| --- | --- | --- |
| Loading | Missing entirely, leading to layout jump | Skeleton or spinner matched to component shape |
| Empty | Assumes data exists; renders broken layout | "No items" placeholder with a call to action |
| Error | Uncaught promise, white crash screen | Error boundary + retry/fallback message |
| Edge-case data | Expects uniform payloads; breaks on null | Graceful null checks and default values |

## 5\. Wire SEO fundamentals

Claude Code pays zero attention to `<title>` tags, meta descriptions, or `h1` hierarchy unless guided explicitly. Site launches with every page titled "React App", invisible to search engines.

**Fix:** for a Next.js site, create a shared `Metadata` component. For SPAs, add `react-helmet-async`. Then generate unique titles and descriptions per route. Even a simple server-rendered sitemap will outperform the default output.

## From prototype to product without a rewrite

Fixing these layers doesn't require throwing away the AI-generated code. It's closer to refactoring from the security perimeter outward. That's what our [vibe coding cleanup](https://techpotions.com/solutions/vibe-coding-cleanup) process is built for, addressing the same ordered list so founders can go from demo to real users quickly. When the auth layer holds, the database is reproducible, and the client bundle is clean, a team can iterate on the AI-built skeleton with confidence. If you're ready to hand it off, our [prototype-to-production service](https://techpotions.com/solutions/prototype-to-production) picks up exactly where Claude Code left off.

## FAQ

### How long does it take to get an AI-built site production-ready?

Count on at least 1 to 2 weeks of senior dev cleanup, assuming the AI built something that runs locally. Auth, secrets, migrations, error states, and SEO basics are usually missing, and each layer forces a round of validation.

### Can I use Claude Code again to fix the site it built?

You can, but it's risky without human oversight. Claude Code can find obvious tokens and suggest migrations, but it can't context-switch like a senior engineer. The safest path is to use Claude Code as an auditor, then hand the plan to a human team for implementation.

### What's the most common security flaw in Claude Code sites?

API keys and secrets embedded in the client bundle. Claude Code will happily drop a `NEXT_PUBLIC_` prefixed key into a React component because the prompt never told it otherwise. That leaked credential is the first thing a senior team scans for.

## Free Claude Code packs

The setup we run ourselves, packaged. MIT licensed, free to download.

- [**Claude Code skills pack**](https://techpotions.com/products/claude-code-skills), ten ready-made skills, plus the install and activation guide people actually search for.
- [**Claude Code hooks pack**](https://techpotions.com/products/claude-code-hooks), eight production-grade hooks with the missing documentation: events, stdin payloads, exit codes.
- [**Claude Code subagents pack**](https://techpotions.com/products/claude-code-subagents), six specialist subagents, with the frontmatter reference and delegation patterns explained.
- [**CLAUDE.md templates**](https://techpotions.com/products/claude-md-templates), five battle-tested [CLAUDE.md](http://CLAUDE.md) files: Next.js, Python, monorepo, API service, and a lean starter.
- [**Claude Code statusline**](https://techpotions.com/products/claude-code-statusline), a one-file statusline showing model, git branch, context left and session cost. Paste, done.
