Learn · Claude Code

Claude Code Templates

The CLAUDE.md files, permission rules and prompts we use when Claude Code works on a website. Copy them and adapt them to your project.

Last verified against Anthropic's documentation: September 2026. Part of our Claude Code learning hub. eSEOspace is not affiliated with Anthropic.

These are the files and prompts we actually use when Claude Code works on a website: a CLAUDE.md for each common platform, a permissions file that keeps secrets out of reach, a reusable SEO check, and eight prompts for the jobs that come up every week. Copy them, then replace everything in <angle brackets>.

How CLAUDE.md works

CLAUDE.md is a plain Markdown file of instructions that Claude Code reads at the start of every session in that project. Put it in the project's root folder. Run /init to generate a first draft from your codebase, and use /memory to edit it later. You can pull other files in with an @path/to/file line, which is how our templates reference a company-facts file instead of repeating prices and phone numbers. Anthropic's memory documentation covers the other locations it can live in, such as your user folder for personal preferences.

What we've learned about writing them:

  • Keep it short. Anthropic suggests keeping it concise; ours stay well under 200 lines. Long files get skimmed, by people and by models.
  • Write rules you can check. "Run the build before saying you're done" works. "Write good code" does not.
  • Put the dangerous things in "Don't". Pushing, deploying, reading secrets and editing third-party code.
  • Keep facts in one file. Prices, addresses and phone numbers live in a single facts file that the CLAUDE.md imports, so there is one place to update them.

CLAUDE.md for a Next.js marketing site

For a site built with Next.js and deployed to Vercel or Netlify. The build command is the safety net, so the file makes passing it mandatory.

# Project: marketing website (Next.js)

## What this project is
- Company marketing site for <Company>. Production: https://www.example.com
- Framework: Next.js (App Router), TypeScript. Hosting: <Vercel/Netlify>.

## Commands
- Install: npm install
- Dev server: npm run dev (http://localhost:3000)
- Build (must pass before any commit): npm run build
- Lint: npm run lint

## How we work
- Always start in plan mode for anything touching more than one page.
- Work on a branch. Never commit to main, never push, never deploy.
- After edits, run the build and fix every error before saying you're done.
- Show me the diff and a one-paragraph summary of what changed and why.

## SEO rules (do not break)
- Every page keeps a unique <title> (under 60 chars) and meta description (under 158).
- Never change a URL without adding a 301 redirect in next.config.* redirects().
- Keep one <h1> per page. Images need descriptive alt text.
- Canonical URLs are absolute and use https://www.example.com.

## Content rules
- US English. Plain, specific sentences. No invented statistics or client results.
- Prices, phone numbers and addresses come only from @docs/company-facts.md.

## Don't
- Don't read or print .env files or any secrets.
- Don't add new dependencies without asking.
- Don't edit files under /public/legal/ (legal review required).

CLAUDE.md for a WordPress site

For a WordPress site worked on locally or on staging. The key rule is scope: only your own theme and plugin, never third-party plugins, core or the production database.

# Project: WordPress site (theme + custom plugin)

## What this project is
- WordPress site for <Company>, run locally with <Local/wp-env/Docker>.
- Custom theme: wp-content/themes/<theme>. Custom plugin: wp-content/plugins/<plugin>.
- Everything else under wp-content/plugins/ is third-party: never edit it.

## Commands
- Start local site: <command>
- PHP lint: find wp-content/themes/<theme> -name "*.php" -exec php -l {} \;
- WP-CLI (local only): wp <command> --path=<path>

## How we work
- Plan first. Edit only files in our theme or plugin.
- Use WordPress functions and hooks; escape output (esc_html, esc_attr, esc_url)
  and sanitize input. Prefix all functions with <prefix>_.
- Test on the local site and describe what you checked.
- Never run database-changing WP-CLI commands (search-replace, db import) without asking.
- Never touch the production site or production database.

## SEO rules
- The SEO plugin (<Yoast/Rank Math>) owns titles, metas and schema. Don't hardcode them in templates.
- Don't change permalinks. New redirects go in the redirect plugin, listed for me to add.

## Don't
- Don't read wp-config.php or .env files.
- Don't update WordPress core, themes or plugins.

CLAUDE.md for a Shopify theme

For a theme pulled down with Shopify CLI. Publishing stays with a person: Claude previews, you push to an unpublished theme and review it.

# Project: Shopify theme

## What this project is
- Online store theme for <Store>, based on <Dawn/other>, pulled with Shopify CLI.
- Local preview: shopify theme dev --store <store>.myshopify.com

## How we work
- Work only in this theme's files (sections/, snippets/, templates/, assets/, locales/).
- Plan first and list the files you'll touch.
- Never run shopify theme push or publish. I push to an unpublished theme and review it.
- Keep Liquid readable; reuse existing snippets before creating new ones.
- Check the change on mobile and desktop widths in the preview and describe what you saw.

## SEO rules
- Product and collection titles and descriptions come from the Shopify admin, not the theme.
- Keep the theme's existing structured data unless I ask; if you change it,
  validate it at https://validator.schema.org/.
- Don't remove the canonical tag or change how URLs are generated.

## Don't
- Don't add third-party app scripts to theme.liquid.
- Don't store API tokens or passwords in the theme.

CLAUDE.md for a content and SEO pipeline

This is close to how eseospace.com itself is run, described in our rebuild case study. The rules about bulk edits and structured data came from mistakes we made.

# Project: content and SEO pipeline

## What this project is
- Static site built from source files. Articles live in content/posts/*.md (or .html).
- Build: npm run build (writes /out). Link check: npm run check-links.

## Publishing a new article
1. Add the source file. Front matter: title, meta description (140-158 chars), slug, date, author.
2. Add internal links from the approved link map in @docs/link-map.md. Use absolute URLs.
3. Run the build and the link checker. Zero broken internal links.
4. Confirm the new URL appears in the sitemap.

## Editing existing content
- Bulk edits go through a script, not by hand. Run it on a copy first,
  then twice on the real files: the second run must change nothing.
- When you change a sentence, also update any copy of it in structured data (JSON-LD).
- Never delete a page. Retiring a page means a 301 redirect plus removing it from the index.

## Accuracy rules
- Every statistic needs a named, linked source. If you can't find one, remove the number.
- Dates, laws and platform rules must be checked against the official source before publishing.
- Flag anything you're unsure about instead of guessing.

A safe permissions file

Instructions in CLAUDE.md are guidance. Permission rules are enforced. Save this as .claude/settings.json in the project: it lets Claude run the build, lint and read-only git commands without asking each time, and blocks it from reading environment files or pushing code. Adjust the commands to your project, and check the exact rule syntax in Anthropic's settings documentation, since it is updated often.

{
  "permissions": {
    "allow": [
      "Bash(npm run build)",
      "Bash(npm run lint)",
      "Bash(git status)",
      "Bash(git diff *)"
    ],
    "deny": [
      "Read(./.env)",
      "Read(./.env.*)",
      "Read(./secrets/**)",
      "Bash(git push *)"
    ]
  }
}

Deny rules protect you from accidents, not from everything. Keep real secrets out of the project folder entirely where you can, and read Anthropic's security guidance before giving Claude Code access to anything connected to production.

A reusable SEO check

Skills are reusable instructions that Claude Code loads when they are relevant or when you call them by name. Save this as .claude/skills/seo-check/SKILL.md and run it with /seo-check before committing page changes. See Anthropic's skills documentation for the full format.

---
name: seo-check
description: Check changed pages for SEO problems before a commit. Use when I ask for an SEO check or before committing page changes.
---

For every page changed on this branch (use git diff --name-only against main):

1. Title tag: present, unique, under 60 characters.
2. Meta description: present, 140-158 characters, matches the page content.
3. Exactly one <h1>.
4. Canonical tag: absolute URL pointing to the page itself.
5. Internal links: every link resolves in the built site (no 404s).
6. Images: descriptive alt text; no alt text stuffed with keywords.
7. Structured data: valid JSON; no ratings the business gives itself.

Report a table: page, check, pass/fail, fix. Don't change files unless I ask.

Eight prompts for website work

Each prompt asks for a plan or a list before any file changes. That single habit prevents most of the damage an AI tool can do to a live site. Replace the file names with your own; the @ prefix points Claude at a file in your project.

Audit titles and meta descriptions

Plan mode. Read every page template and content file in this project and list pages whose <title> is missing, duplicated or over 60 characters, or whose meta description is missing, duplicated or outside 140-158 characters. Output a table: URL, current title, current description, problem, suggested replacement. Don't edit any files yet.

Build a redirect map after a redesign

I'm changing URLs. The old URL list is in @old-urls.txt and the new site's pages are in this project. Map every old URL to the closest new page by topic, not just by slug. Flag any old URL with no good match instead of sending it to the homepage. Output a CSV with old_url, new_url, confidence and reason. Don't write redirect rules until I approve the map.

Find broken internal links

Run the build, then check every internal link in the built pages. List each broken link with the page it's on, the link text and the target. Suggest the correct target where one exists. Don't fix anything yet; I'll approve the list first.

Add structured data to service pages

For the pages in /services/, propose JSON-LD for each: Organization (referenced by @id), Service with provider pointing at the Organization, and BreadcrumbList. Use only facts that appear on the page or in @docs/company-facts.md. No AggregateRating or reviews of our own business. Show one example for my approval before doing the rest, then validate every block as JSON.

Update a fact everywhere

Our phone number changed from <old> to <new>. Find every occurrence in the project, including structured data, footer templates, and alternate formats such as dashes, dots and a tel: link. List them first. After I approve, update them all, rebuild, and confirm the old number no longer appears anywhere in the built site.

Write alt text for images

List every <img> in the built site with empty or generic alt text (for example "image", a file name, or the same text on many images). For each, suggest alt text that describes what the image shows in its context on that page, in under 125 characters. Decorative images should get alt="". Show the list before editing.

Check a page's claims before publishing

Read @drafts/<article>.html. List every factual claim: numbers, dates, laws, prices and statements about what Google or another platform does. For each, find the primary source and say whether the claim is correct, outdated or unsupported, with the URL. Suggest corrected wording. Don't edit the draft.

Pre-deploy check

Before I deploy: run the build, run the link checker, confirm every changed page has a title, a meta description and one <h1>, check that no page accidentally has noindex, and confirm the sitemap includes every new URL. Also run git log and tell me about any commits on this branch I didn't make. Report pass or fail for each check.

Frequently asked questions

Where exactly does CLAUDE.md go?

In the root folder of the project, next to files like package.json. Claude Code also reads other locations, such as a personal file in your user folder; Anthropic's memory documentation lists them.

Do these templates work with other AI coding tools?

The rules themselves are plain Markdown and translate to other tools' instruction files, but file names, permission syntax and skills are specific to Claude Code.

Why does every prompt ask for a list first?

Because reviewing a list takes a minute and undoing a bad site-wide edit can take a day. Once you trust a task, you can let it run with fewer checkpoints.

Can you set this up for our team?

Yes. We write project instructions, permission files and review workflows for teams starting with Claude Code. Get in touch.

See these templates in action

Read how we rebuilt a 2,200-page site with the same rules.

Read the case study