---
title: "Write Your Stack Into CLAUDE.md So AI Code Matches Each Project's Conventions"
description: "Put personal stack defaults in a user-level CLAUDE.md and client rules in each repository's CLAUDE.md so Claude Code writes code in your conventions."
canonical: "https://scalewithsearch.com/articles/ai-for-web-developers"
date: "2026-01-28"
modified: "2026-09-25"
---
## Site navigation

- [Scale With Search](https://scalewithsearch.com/)
- Services
  - Local
    - [All services](https://scalewithsearch.com/services)
    - [AI visibility tracking](https://scalewithsearch.com/services/ai-visibility-tracking)
    - [Google Maps rank tracking](https://scalewithsearch.com/services/google-maps-rank-tracking)
    - [Local SEO](https://scalewithsearch.com/services/local-seo)
    - [Google Business Profile management](https://scalewithsearch.com/services/google-business-profile)
  - Website and search
    - [SEO solutions](https://scalewithsearch.com/seo)
    - [Technical SEO](https://scalewithsearch.com/seo/technical-seo)
    - [On-page and content SEO](https://scalewithsearch.com/seo/on-page-and-content-seo)
    - [Semantic SEO and topical authority](https://scalewithsearch.com/seo/semantic-seo-and-topical-authority)
    - [Custom SEO tools](https://scalewithsearch.com/seo/custom-seo-tools)
    - [Site build](https://scalewithsearch.com/work#site-build)
    - [Whole website fix](https://scalewithsearch.com/work#whole-website-fix)
  - AI functions
    - [AI operations](https://scalewithsearch.com/ai-systems)
  - First step
    - [Working session](https://scalewithsearch.com/audit)
  - Start here
    - [Send your brief](https://scalewithsearch.com/work#send-your-brief)
    - [Example scope](https://scalewithsearch.com/work#review-the-example-scope)
    - [Prices and terms](https://scalewithsearch.com/work#prices-and-terms)
- Industries
  - Agencies
    - [SEO agencies and consultants](https://scalewithsearch.com/for/seo-agencies-and-consultants)
    - [Marketing agencies and freelancers](https://scalewithsearch.com/for/marketing-agencies-and-freelancers)
    - [AI visibility check for SEO agencies](https://scalewithsearch.com/check/seo-agencies-and-consultants)
    - [Marketing and SEO agencies](https://scalewithsearch.com/for/#group-agencies)
  - Browse by business
    - [Trades and field service](https://scalewithsearch.com/for/#group-trades)
    - [Real estate agents and teams](https://scalewithsearch.com/for/real-estate)
    - [Health, wellness, and animal care](https://scalewithsearch.com/for/#group-practices)
    - [Chiropractic and wellness practices](https://scalewithsearch.com/for/chiropractic-and-wellness-practices)
    - [Law, finance, and IT](https://scalewithsearch.com/for/#group-professional)
    - [Machine shops and manufacturers](https://scalewithsearch.com/for/#group-manufacturing)
    - [Restaurants, shops, studios, and nonprofits](https://scalewithsearch.com/for/#group-local-services)
  - [All industries](https://scalewithsearch.com/for/)
- Resources
  - Free tools
    - [AI visibility check](https://scalewithsearch.com/check)
    - [All free tools](https://scalewithsearch.com/tools/)
    - [Free starter kit (.zip)](https://scalewithsearch.com/kit/business-memory-starter-kit.zip)
  - Guides
    - [AI-native library](https://scalewithsearch.com/ai-native)
    - [Industry intelligence](https://scalewithsearch.com/intelligence)
    - [Office job guides](https://scalewithsearch.com/guides/)
    - [Business memory](https://scalewithsearch.com/articles/business-memory-for-ai-agents-guide)
    - [Agent governance](https://scalewithsearch.com/articles/ai-agent-governance-guide-small-business)
    - [Ownership and migration](https://scalewithsearch.com/articles/leaving-vendor-ai-memory-guide)
  - Articles
    - [All articles](https://scalewithsearch.com/articles/)
- About
  - Evidence
    - [Proof](https://scalewithsearch.com/proof)
  - Scale With Search
    - [About](https://scalewithsearch.com/about)
    - [How it works](https://scalewithsearch.com/how-it-works)

# Write Your Stack Into CLAUDE.md So AI Code Matches Each Project's Conventions.

You are three hours into a build when the AI suggests Bootstrap. You do not use Bootstrap. You use Tailwind, and you have said so five times today.

Or it writes a React class component, when you have written function components with hooks for years. It does not know your ESLint rules. It does not know you prefer Zod over Yup. It does not know that one client's API uses snake_case and another's uses camelCase.

Each session starts from zero. The first ten minutes go to an explanation of your architecture.

## Why a generic assistant guesses

A fresh chat does not carry your last session. It does not carry the talk three days ago about your component library structure either.

Ask it to "add a form component," and it guesses from what most developers do, not from what you do. The result has the wrong pieces:

- CSS framework;
- state management library;
- file structure;
- naming conventions;
- TypeScript patterns;
- API integration pattern.

You spend more time on fixes than the code would take to write. The time saver becomes a time sink.

Without instructions, a coding assistant writes code from patterns across millions of repositories, not from your repository. It does not know why you chose Zustand over Redux, or why one client's contract requires a stricter accessibility level than another's.

The more projects you run, the worse it gets. With five client projects on five stacks, you get Next.js code for a Vue project and REST examples for a GraphQL API.

## What to write down

You need the assistant to know your stack before you ask. That means a written record of:

- preferred frameworks and libraries;
- component architecture patterns;
- naming conventions and file structure;
- TypeScript configuration and type patterns;
- client-specific requirements and limits;
- testing approach and tools;
- deployment pipeline and environments.

When you switch between a React storefront, a Vue dashboard, and a WordPress plugin in one day, you cannot re-teach the assistant each time.

## Put each rule where Claude Code loads it

Claude Code loads `CLAUDE.md` files at session start from two places that matter here. A user-level file at `~/.claude/CLAUDE.md` applies to every project on your machine. A project file at the repository root applies to that repository, and you can commit it so it travels with the code.

Put your personal defaults in the user-level file:

```text
## Stack defaults
Frontend: React 18+ (function components and hooks only),
  Tailwind CSS (no inline styles; @apply rarely), TypeScript strict mode,
  Zod for validation, TanStack Query for data fetching
Backend: Node.js + Express (not NestJS), Prisma, PostgreSQL, JWT auth
Conventions: PascalCase components, camelCase functions and variables,
  kebab-case file names, one component per file, tests next to components
Build: Vite unless the project says otherwise
```

Put client rules in each project's `CLAUDE.md`:

```text
## Client project rules (synthetic example)
Stack: Vue 3 with the Composition API, Pinia for state
API: snake_case; convert to camelCase at the API boundary only
Dates: API returns ISO 8601; convert to local time with date-fns
Browser support: see the browserslist entry in package.json
Accessibility: WCAG 2.2 AA for all forms
Design system: docs/design-system.pdf; use its color and spacing tokens only
Commands: npm run typecheck, npm test, npm run lint
```

Browser support belongs in the project's own configuration, not in a line from memory. Microsoft retired the Internet Explorer 11 desktop app on June 15, 2022, so an old "support IE11" note is a stale fact to remove.

[The business CLAUDE.md template](/articles/claude-md-template-business-context) shows the same split for non-code work. [Context file or CLAUDE.md](/articles/context-file-vs-claude-md-business-project) explains which rule belongs in which file.

## Before and after for stack documentation in CLAUDE.md

A profile form. Before: you ask for a user profile form and get Material UI, which you do not use. Validation is inline instead of Zod. Data sits in local component state instead of your query layer. The API call uses fetch, not your configured axios instance with interceptors. You spend 20 minutes on a rewrite.

After: Claude Code reads both files. The form uses your Tailwind classes, your Zod schemas, your query mutations, and your axios instance. It follows your file structure and names. You run the type check and the tests, then commit.

A button in a client project. Before: you ask for a button and get generic React. You adapt it to Vue and then find it ignores the client's design tokens. After: you are in the client repository, so Claude Code reads that project's `CLAUDE.md`. The button is a Vue component that uses the design system's color variables and spacing scale.

A build error. Before: you paste an error into a chat. It suggests Webpack fixes for a Vite project, and Create React App fixes for a Next.js project. You lose 15 minutes to wrong answers. After: the project file names the build tool, so the first suggestion is for Vite.

## A week with the files for stack documentation in CLAUDE.md

Monday morning. You start a new feature for a client and ask Claude Code to scaffold the user dashboard. It reads the project file: Vue 3 with the Composition API, Pinia for state, ISO dates converted with date-fns. It generates the component, the Pinia store, the API service file, the types, and the test file, all in your conventions. You review, change two lines, run the checks, and commit.

Wednesday afternoon. A different client, the same request. This repository's `CLAUDE.md` says React with TypeScript. Claude Code produces a different structure, because your React patterns differ from your Vue patterns. One assistant, two stacks, and no mix-up.

## Test the files from a cold start

A file helps only if the assistant applies it. Test each project file the way you would test a new teammate's onboarding notes.

1. Close all Claude Code sessions.
2. Start a new session at the repository root.
3. Ask for one small component, one API call, and one test.
4. Do not add any explanation during the test.
5. Run the lint, type check, and test commands.
6. Compare each result with the rules in both files.

The test passes when the output uses the right framework, naming, validation library, and API case conversion, and the checks pass. It fails when you must restate a convention. For each failure, add or fix the rule in the right file, then run the same three requests again. Keep the three requests in the project file, so you can rerun the test after each stack change.

## Measure the time you get back

Run the arithmetic on your own numbers. If each re-explanation costs 10 minutes and you do it six times a day, you lose an hour a day. That is five hours a week, or about twenty hours a month.

Check it for one week: count the sessions where you had to restate a convention before and after the files. The count also tells you which rule a file lacks.

## Enforce what matters with tools, not prose

`CLAUDE.md` is guidance. The model reads it and usually follows it, but a sentence is not a guarantee. Enforce the rules that matter with tools: ESLint and Prettier for style, `strict` in `tsconfig.json`, and tests and type checks in CI. Then put the check commands in the project file, and ask Claude Code to run them before it reports a task as done.

Other assistants have their own instruction files. GitHub Copilot reads `.github/copilot-instructions.md` in a repository, and Cursor reads project rules. The content can be the same; only the file location changes. [Claude Code versus Cursor project memory](/articles/claude-code-vs-cursor-project-memory) compares the two approaches.

Keep secrets out of every instruction file. API keys belong in environment variables and your secret manager. Claude Code sends the code and files it reads to Anthropic's servers during a session. Retention and training terms depend on your plan. Check each client contract for rules on third-party AI tools before you open that client's repository.

For large repositories, [Claude Code versus ChatGPT on a large codebase](/articles/claude-code-vs-chatgpt-large-codebase) shows how instruction files and discovery work on one bounded change.

----

```text
                  .|########||.                                       .|########||.                                       .|########||.
               |##||.      .||##|.                                 |##||.      .||##|.                                 |##||.      .||##|.
             |#|.              .|#|.                             |#|.              .|#|.                             |#|.              .|#|.
           |#|                    |#|                          |#|                    |#|                          |#|                    |#|
         .#|                        |#.                      .#|                        |#.                      .#|                        |#.
        .#.                          .#|                    .#.                          .#|                    .#.                          .#|
       |#.                            .#|                  |#.                            .#|                  |#.                            .#|
      |#             ......             #|                |#             ......             #|                |#             ......             #|
     .#           ||#########|           #|              .#           ||#########|           #|              .#           ||#########|           #|
    .#.         |######||######|.        .#.            .#.         |######||######|.        .#.            .#.         |######||######|.        .#.
    #.        .##|###|##|#|######|        .#            #.        .##|###|##|#|######|        .#            #.        .##|###|##|#|######|        .#
   ||        |##|#||||||||||||#||#|        ||          ||        |##|#||||||||||||#||#|        ||          ||        |##|#||||||||||||#||#|        ||
   #        |#||||||||||||||||||||#|        #.         #        |#||||||||||||||||||||#|        #.         #        |#||||||||||||||||||||#|        #.
  ||       |#||||||||||||||||||||||#|       ||        ||       |#||||||||||||||||||||||#|       ||        ||       |#||||||||||||||||||||||#|       ||
  #       .#||||||||||||||||||||||||#|       #        #       .#||||||||||||||||||||||||#|       #        #       .#||||||||||||||||||||||||#|       #
 ||   ....|||#||||||##|#|||#|#||##||||....|. ||      ||   ....|||#||||||##|#|||#|#||##||||....|. ||      ||   ....|||#||||||##|#|||#|#||##||||....|. ||
 #.  .  ....|#  ....#|||   ||| .#|||  ....#. .#      #.  .  ....|#  ....#|||   ||| .#|||  ....#. .#      #.  .  ....|#  ....#|||   ||| .#|||  ....#. .#
 #   .  ||||#| .#####||  . .#| .#|||  ||||#   #.     #   .  ||||#| .#####||  . .#| .#|||  ||||#   #.     #   .  ||||#| .#####||  . .#| .#|||  ||||#   #.
.|   |||||  #. |#|||||. ||  #. |#||. .|||||   ||    .|   |||||  #. |#|||||. ||  #. |#||. .|||||   ||    .|   |||||  #. |#|||||. ||  #. |#||. .|||||   ||
||   |....  #. ....|#.      |. ...|. ....||   ||    ||   |....  #. ....|#.      |. ...|. ....||   ||    ||   |....  #. ....|#.      |. ...|. ....||   ||
#.  .||||||##||||||##||####|||||||#||||||#|   .#    #.  .||||||##||||||##||####|||||||#||||||#|   .#    #.  .||||||##||||||##||####|||||||#||||||#|   .#
#    .||####|###########################|.     #    #    .||####|###########################|.     #    #    .||####|###########################|.     #
#      .#||||||.#.|| # |. ..# #| #|||||#|      #    #      .#||||||.#.|| # |. ..# #| #|||||#|      #    #      .#||||||.#.|| # |. ..# #| #|||||#|      #
#      .#|||||| ..  |# ## |#| ...#|#|||#|      #    #      .#|||||| ..  |# ## |#| ...#|#|||#|      #    #      .#|||||| ..  |# ## |#| ...#|#|||#|      #
#      .#|||#|# .# .#| #| ##|.#..#|||||#|      #    #      .#|||#|# .# .#| #| ##|.#..#|||||#|      #    #      .#|||#|# .# .#| #| ##|.#..#|||||#|      #
#      .#||||||############|######|||||#|      #    #      .#||||||############|######|||||#|      #    #      .#||||||############|######|||||#|      #
#   |...||#||||||#||||#|#||||||#|||||#||| |.|  #    #   |...||#||||||#||||#|#||||||#|||||#||| |.|  #    #   |...||#||||||#||||#|#||||||#|||||#||| |.|  #
#. .. ||||# .|||##|.  |#| .|| || .|||#. #|  # .#    #. .. ||||# .|||##|.  |#| .|| || .|||#. #|  # .#    #. .. ||||# .|||##|.  |#| .|| || .|||#. #|  # .#
|| |  ...||  ...##| |  #| .|. |. #####  .. .| ||    || |  ...||  ...##| |  #| .|. |. #####  .. .| ||    || |  ...||  ...##| |  #| .|. |. #####  .. .| ||
|| ||||| || ||||#|  .  |. |. |#. ||||| |#| || ||    || ||||| || ||||#|  .  |. |. |#. ||||| |#| || ||    || ||||| || ||||#|  .  |. |. |#. ||||| |#| || ||
.# |.....#|....|#.||||.|||##.|#|....||.#||.#. #.    .# |.....#|....|#.||||.|||##.|#|....||.#||.#. #.    .# |.....#|....|#.||||.|||##.|#|....||.#||.#. #.
 #.|||||||#############################| ||| .#      #.|||||||#############################| ||| .#      #.|||||||#############################| ||| .#
 ||       ##||#||#||||||#||#||#||#||##.      ||      ||       ##||#||#||||||#||#||#||#||##.      ||      ||       ##||#||#||||||#||#||#||#||##.      ||
  #       .#|||||||||#||#|||||||||||#|       #        #       .#|||||||||#||#|||||||||||#|       #        #       .#|||||||||#||#|||||||||||#|       #
  ||       |#||||||||||||||||||||||#|       ||        ||       |#||||||||||||||||||||||#|       ||        ||       |#||||||||||||||||||||||#|       ||
  .#        |#||||||||||||||||||||#|        #.        .#        |#||||||||||||||||||||#|        #.        .#        |#||||||||||||||||||||#|        #.
   ||        |#||||||||||||||||||#|        ||          ||        |#||||||||||||||||||#|        ||          ||        |#||||||||||||||||||#|        ||
    #.        .######|#|#########|        .#            #.        .######|#|#########|        .#            #.        .######|#|#########|        .#
    .#.         |#####||||#####|         .#.            .#.         |#####||||#####|         .#.            .#.         |#####||||#####|         .#.
     |#           ||########||           #.              |#           ||########||           #.              |#           ||########||           #.
      |#             ......             #|                |#             ......             #|                |#             ......             #|
       |#.                            .#|                  |#.                            .#|                  |#.                            .#|
        |#.                          .#.                    |#.                          .#.                    |#.                          .#.
         .#|                        |#.                      .#|                        |#.                      .#|                        |#.
           |#|                    |#|                          |#|                    |#|                          |#|                    |#|
            .|#|.              .|#|.                            .|#|.              .|#|.                            .|#|.              .|#|.
               |##||.      .||##|                                  |##||.      .||##|                                  |##||.      .||##|
                 .||########||.                                      .||########||.                                      .||########||.

Scale With Search  2026  [scalewithsearch.com](https://scalewithsearch.com)
```
