Why You Need CLAUDE.md

Vibe coding focuses on “getting this single page done,” but a personal website is a long-term project. Every time you open a new chat, the AI starts with amnesia: it doesn’t know where my articles go, how to name files, who translates the English version, or which folders are off-limits.

My previous approach was to explain everything from scratch each time. If I missed a detail, things broke. For instance, the AI would kindly hand-write an English version, which then conflicted with my automated translation pipeline.

CLAUDE.md is the “handover document” placed in the project root: Claude Code automatically reads it upon launch (other tools typically read AGENTS.md; the concept is identical and content can be shared). You write the rules once, and every subsequent conversation starts from the exact same baseline.

What This Website Is

datafox.tw is my personal website, built with Hugo + PaperMod theme and deployed on GitHub Pages. It features technical notes, a portfolio, a podcast, and weekly auto-generated GitHub AI trends. The complete source code is available at datafox-tw/datafox.github.io, and this site’s CLAUDE.md is located right in the repo root: CLAUDE.md.

How I Designed My CLAUDE.md

I broke it down into eight sections, each answering a question the AI will inevitably face:

SectionQuestion AnsweredWhat Happens If Omitted
Project PurposeWho is this site for?AI generates off-brand content
Tech StackWhat tools are used? How to preview & build?AI guesses randomly (e.g., trying npm or Jekyll)
Directory StructureWhere does everything go?Files end up scattered everywhere
Bilingual RulesWho writes Chinese? Who writes English?Handwritten English clashes with the translation pipeline
Post Creation SOPFilenames, front matter, formattingInconsistent formatting across posts
Other Section RulesCan news/ be edited manually?Auto-generated content gets broken
Style & DesignCan new packages/libraries be introduced?The project becomes increasingly bloated and messy
AI Code of ConductWhat’s allowed, forbidden, and checked before completion?AI oversteps boundaries, leaks keys, or pushes without permission

Key Sections

1. Make the “implicit” project rules explicit. The AI can discern the Hugo structure by reading code, but it cannot guess implicit conventions like “.zh-tw.md is the original source, and .md is translated by Gemini.” These are the most critical rules to document:

| File | Language | Responsible Party |
|---|---|---|
| `name.zh-tw.md` | Traditional Chinese | Written by Human / AI (Source Draft) |
| `name.md` | English | Auto-generated by scripts/auto_translate.py |

When adding content, only write .zh-tw.md. Never hand-write English files unless explicitly requested by the user.

2. Replace adjectives with templates. Instead of saying “front matter must be complete,” directly provide a copy-pasteable template detailing required fields and the slug format. AI mimics examples far more reliably than it interprets descriptive instructions.

3. Clearly state forbidden actions and the reasons behind them. For example:

DO NOT (unless explicitly requested by user):
- Modify themes/PaperMod, public/, resources/
- Read, print, or commit .env, .env.local
- Manually edit content/news/ (auto-generated by weekly workflow)
- Alter existing article slugs (breaks legacy URLs)
- git commit / git push: Provide a diff summary first and await user confirmation

4. Include a checklist at the end. Having the AI run through a checklist before declaring “done” catches most low-level mistakes:

- [ ] Filename matches YYMMDD_HHMM.zh-tw.md
- [ ] All front matter fields complete; slug is unique
- [ ] `hugo --gc --minify` passes successfully
- [ ] No restricted areas were modified

In Action: Writing This Very Post

This post itself was generated using CLAUDE.md. I gave just one single instruction:

Write an article introducing how to use CLAUDE.md to maintain a personal website.

Because CLAUDE.md already laid down the rules, the AI accomplished all of this autonomously:

  1. Grabbed the current timestamp and created content/posts/261111_2030.zh-tw.md according to naming conventions.
  2. Generated complete front matter: title, slug (English kebab-case), description, and tags.
  3. Authored only the Chinese original draft and did not touch the English file, adhering to the rule that English is handled by the automated pipeline.
  4. Structured sections with ## and tagged code block languages, adhering to formatting standards.
  5. Executed hugo --gc --minify for verification and reported which files were modified.
  6. Did not run commit/push, waiting for my confirmation.

Once pushed to main, GitHub Actions automatically translates it into English and deploys it live. Throughout the entire process, I only needed to provide the idea—no repeated rule explanations required.

How to Scale: Adding an Entirely New Section

The true value of rules lies in their scalability. Suppose I want to add a reading/ book list section. Since Section 6 of my CLAUDE.md already states:

Adding a new section: You must update both zh-tw and en menu.main and permalinks in hugo.yaml, and create both _index.md and _index.zh-tw.md.

The AI immediately knows which files to edit without leaving out the English menu items. Once that’s set up, I add the “book list front matter format” into CLAUDE.md. Next time I want to add a book, it’s just a single sentence prompt. CLAUDE.md is a living document; add a rule every time you hit an edge case.

Key Takeaways & Lessons Learned

  • Concise and specific beats long and exhaustive. Every extra sentence dilutes focus; only document what the AI cannot guess on its own.
  • Explain the “why.” “Do not edit news/ because it is auto-generated by a workflow” enables the AI to make sound judgment calls in edge cases far better than a bare “Do not edit news/.”
  • Draft with AI, refine with real project experience. I first had Claude Code scan the repo to generate an initial draft (/init), then layered in the hard-learned lessons (bilingual conflicts, immutable slugs, protected keys).
  • Treat it as version-controlled code. Commit CLAUDE.md alongside your repository. Rule changes are tracked in git history, and if you switch tools (Cursor, Codex, etc.), you can simply rename it or symlink AGENTS.md.

Once the rules are established, your mindset around site maintenance shifts: it’s no longer about “telling the AI to do a task each time,” but curating an environment where the AI can do things right on its own.