惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Security Latest
Security Latest
Jina AI
Jina AI
爱范儿
爱范儿
Attack and Defense Labs
Attack and Defense Labs
Recent Commits to openclaw:main
Recent Commits to openclaw:main
GbyAI
GbyAI
N
News | PayPal Newsroom
Last Week in AI
Last Week in AI
V
Visual Studio Blog
SecWiki News
SecWiki News
H
Heimdal Security Blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
腾讯CDC
L
LINUX DO - 热门话题
I
InfoQ
罗磊的独立博客
博客园_首页
Know Your Adversary
Know Your Adversary
T
The Exploit Database - CXSecurity.com
博客园 - 【当耐特】
阮一峰的网络日志
阮一峰的网络日志
Hacker News - Newest:
Hacker News - Newest: "LLM"
T
Threat Research - Cisco Blogs
美团技术团队
IT之家
IT之家
AWS News Blog
AWS News Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
N
Netflix TechBlog - Medium
Help Net Security
Help Net Security
S
Secure Thoughts
Microsoft Security Blog
Microsoft Security Blog
Schneier on Security
Schneier on Security
Spread Privacy
Spread Privacy
B
Blog RSS Feed
N
News and Events Feed by Topic
L
Lohrmann on Cybersecurity
Google Online Security Blog
Google Online Security Blog
Microsoft Azure Blog
Microsoft Azure Blog
N
News and Events Feed by Topic
I
Intezer
Blog — PlanetScale
Blog — PlanetScale
云风的 BLOG
云风的 BLOG
A
Arctic Wolf
C
Cyber Attacks, Cyber Crime and Cyber Security
G
Google Developers Blog
The Register - Security
The Register - Security
The GitHub Blog
The GitHub Blog
MyScale Blog
MyScale Blog
F
Full Disclosure

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
How to Actually Write a CLAUDE.md — A Solo Indie Dev's Guide From Running 16 Apps
LazyDev_OH · 2026-04-30 · via DEV Community

Every time I opened a new session, I was repeating the same things. "Reply in Korean." "Use the App Router, not Pages Router." "Explain in one line before throwing code at me." I'm running 16 apps as a solo indie, and every session felt like a new-hire interview.

I put up with this for a month, then drew a conclusion. Stop teaching inside the session — pin it outside the session. That's what CLAUDE.md does. It's an internal wiki you hand to the AI.

This is my guide to writing CLAUDE.md, distilled from a year of running it across 16 iOS apps and SaaS projects as a one-person operation. Bottom line: written well, it eliminates 30 minutes of context-setting per session. Written poorly, it gets ignored.

TL;DR

  • CLAUDE.md is a markdown file Claude Code auto-injects at session start. It's read from two locations: global and project.
  • A well-written 80-line page kills 30 minutes of context-setting per session.
  • The 5 core patterns: identity / tone / prohibitions / workflow / danger. Split into five zones.
  • "Use App Router" is weak. "No Pages Router → use App Router" is strong. Pin prohibition + alternative on one line.
  • Cap length at 60–300 lines. Karpathy's public CLAUDE.md is 65 lines. Past that, priorities collapse.
  • Don't mix rules with different scopes (Web vs iOS) in one global file.
  • Use @import to break up long rule files. Past 200 lines in one file, the model loses priority signal.

What CLAUDE.md actually is

CLAUDE.md is a markdown file Anthropic's Claude Code auto-injects when work starts. It's read from two locations.

~/.claude/CLAUDE.md is the global rules file. It applies to every project. This is where I pin my identity, my tone preferences, and my safety rules. <project-root>/CLAUDE.md is the project rules file. It only applies inside that folder. This is where I pin codebase structure, conventions, and domain knowledge.

I use both. Identity and tone go global. Codebase-specific structure and risks go in the project file. Combined, every session starts already knowing me.

The analogy: instead of giving every new hire a fresh company tour, you hand them a wiki link. If the wiki is good, they're productive on day one. If it's not, they keep walking over to the founder's desk to ask questions.

How it differs from other config files

File Tool Location How it applies
CLAUDE.md Claude Code global + project auto-injected at session start
.cursorrules Cursor (legacy) project root injected as system prompt every chat
.cursor/rules/*.mdc Cursor (new) folder inside project conditional injection via globs
AGENTS.md Codex CLI etc. project root injected at session start
GEMINI.md Gemini CLI global + project nearly identical to CLAUDE.md

The two I use most are CLAUDE.md and .cursor/rules/*.mdc. I do inline edits in Cursor and run bigger jobs in Claude Code, so the same rules end up scattered across two files. I covered how to keep that in sync separately in Cursor Rules vs CLAUDE.md compared.

The short version: CLAUDE.md is always in. .cursor/rules/*.mdc can be conditionally injected via globs. So the token cost of CLAUDE.md is higher. But it's simpler — one file to look at.

How to split global vs project

My rule is simple. If it doesn't change with the human, global. If it changes per codebase, project.

Global gets the fact that I'm a solo dev, the "reply in Korean" tone, and the "never touch .env" safety rule. These are the same whether I'm building a SaaS or an iOS app. Project gets that codebase's folder structure, conventions, and domain vocabulary. The MVVM layout of a SwiftUI project and the App Router layout of a Next.js project have no reason to live in the same file.

Pin zone Global Project
My identity O X
Reply language / tone O X
Safety / prohibition rules O reinforce
High-level stack O X
Folder structure X O
Domain vocabulary X O
Frequently used npm scripts X O

Without this split, the global file bloats. My global is 80 lines and I never let it grow past that. There was a phase where it ballooned to 200 lines, and at some point the model stopped picking up priorities. I cut it back to 80 and rule adherence climbed again.

For reference, Andrej Karpathy's public CLAUDE.md is 65 lines. Operations-heavy companies like HumanLayer recommend keeping global under 60 lines and splitting overflow into agent_docs/. 80–300 lines is a safe ceiling.

Don't mix differently-scoped rules in one global file. I keep only my reply language and the "solo indie" identity in global. Web code conventions and iOS code conventions both moved into their respective project CLAUDE.md files. If both stacks' rules sit in the global file, iOS rules get pinned into the context even during Web work, and the model gets confused.

Pattern 1 — Pin identity and stack on the first line

The first line should say who you are and what you use. The most common AI question is "what stack are you on?" Answer it ahead of time and it doesn't ask.

My first line: "Solo indie dev (iOS + Web SaaS)". That single line locks in a lot of assumptions. Say "build me a sign-up flow" and Claude automatically assumes a one-person operation. It doesn't recommend pricey services like Auth0.

For the stack, a noun list works best. "Supabase, Vercel, Tailwind." Now PostgreSQL, edge functions, and App Router are all default assumptions. It stops asking "is this Firebase?".

One caveat. Don't pin versions. If you write "Next.js 16", you'll forget to update it when 17 ships. Just write "Next.js" and let the model assume current.

Pattern 2 — Pin tone rules with detail

This is where I got the most leverage. Everyone writes "reply in Korean", but what comes after that matters more.

One important distinction. Pinning tone is not the same as pinning code style. Indentation, semicolons, quote style — that's ESLint and Prettier territory, not CLAUDE.md territory. Telling an LLM to enforce linter rules just burns tokens with weak results. Tone-pinning should stay limited to actually-human stuff: reply language, first-person, greeting patterns, banned words.

I pinned "Keep explanations concise, skip unnecessary preamble." That one line killed translated-from-English greetings like "Of course! Great question." I also pinned "Explain in one line before changing code." So instead of dumping code, it now writes "I'm going to extract this function — for reuse" first.

Tone responds to detail. "Be friendly" is vague, but "no emojis" is concrete. Tone is the easy thing to forget. Code violations are obvious; tone violations sneak past you for a while. That's exactly why pinning matters.

Pattern 3 — Write coding rules as "prohibition + alternative"

This one I learned the hard way. "Use the App Router" is weak. "No Pages Router" is stronger. But the truly strong form combines both. "No Pages Router → use App Router", on a single line.

There's a reason the difference is large. Training data has way more Pages Router examples than App Router. If you only say "use App Router", the model defaults to majority-class Pages Router under pressure. If you pin "No Pages Router", that phrase enters the context and the model token-by-token avoids it. But pure negative rules aren't enough — sometimes the model halts at "okay then what" and slips into a different legacy pattern. So always attach the alternative right after the prohibition. Anthropic's official guidance also recommends "constructive rules over purely negative ones" for consistency.

My global has five negative + alternative rules: "No Pages Router → App Router", "No class components → functional components", "No completion handlers → async/await" (iOS), "No git push --force", and "Minimize separate CSS files → Tailwind utilities first". Each one was added after I got bitten.

Negative rules also protect me from myself. At 3 a.m., Pages Router can start to look faster. Claude steps in: "this is Pages Router, but CLAUDE.md prohibits it." It's a pin for future me.

Pattern 4 — Write workflow as steps

"Plan → approve → implement → verify." I pinned that 4-step flow globally. Without it, "build me a sign-up flow" will get you 5 files dumped at once.

My pinned phrasing: "For complex tasks, present a plan before coding" and "Wait for plan approval before starting implementation." With those two lines, Claude now writes "1) add the route, 2) add the Supabase table, 3) UI. Should I proceed?" first.

Verification is pinned too. "After writing code, run the build/typecheck if possible." That single line means it doesn't drop code and walk away — it builds its own code, sees the type error, and fixes it.

I also pin the commands I use frequently:

# Commands I use

## Web (Next.js + Supabase)
npm run dev          # dev server (localhost:3000)
npm run build        # production build
npm run typecheck    # TypeScript type check
npx supabase db push # apply Supabase migration

## iOS (Xcode + Swift)
xcodebuild -scheme MyApp -destination 'platform=iOS Simulator,name=iPhone 15' build

Enter fullscreen mode Exit fullscreen mode

With this pinned, Claude doesn't guess which npm script to run. The point is to pre-authorize what the AI can do autonomously. When permissions are vague, it goes conservative and keeps asking. Pinned permissions, it just goes.

Pattern 5 — Pin dangers explicitly

The last pattern matters most. Pin the things the AI must never do, separately.

I have three danger pins. "Never read or modify .env files", "Always ask before modifying production files", "No git push --force". These are the worst-case patterns for a solo dev.

The .env rule was added after I got burned directly. Mid-debug, Claude printed a chunk of .env and it ended up in the session log. It was a dev key, thankfully — if it had been production I'd have had to rotate everything. Pinned it globally the next day.

The "ask before production" rule was added after I almost shipped a production migration via a two-line PR. Solo operations often skip staging. "Obviously dangerous" isn't enough — you need to pin "this is dangerous" explicitly.

Use @import to break up long rules

When rules cross 80 lines, I switch to @import. Claude Code supports this officially. Write @docs/conventions.md inside CLAUDE.md and it pulls that file in and merges it.

# Project conventions

@docs/db-schema.md
@docs/api-conventions.md
@docs/danger-rules.md

## Extra rules
- Billing-related code can only be modified inside `lib/billing/`
- Supabase RLS policies must only change via migrations

Enter fullscreen mode Exit fullscreen mode

Two upsides. First, splitting rules by topic looks better on GitHub. Second, when multiple projects share rules, I only edit one file. My two SaaS projects both import docs/danger-rules.md.

The downside: imported files still hit the context. This isn't a token-saving feature. Use it for organization only.

A small script to keep CLAUDE.md updated

At the end of a session, I tell Claude "if you learned a new rule today, add it to global." But I forget to type that every time, so I keep a tiny helper around.

#!/usr/bin/env bash
# scripts/append-claude-rule.sh — safely append a new rule to ~/.claude/CLAUDE.md

set -euo pipefail

CLAUDE_MD="${HOME}/.claude/CLAUDE.md"
TODAY=$(date +%Y-%m-%d)

if [ -z "${1:-}" ]; then
  echo "Usage: ./append-claude-rule.sh \"new rule on one line\""
  exit 1
fi

# Auto-backup, then append
cp "$CLAUDE_MD" "${CLAUDE_MD}.bak.${TODAY}"
printf "\n- %s  # added %s\n" "$1" "$TODAY" >> "$CLAUDE_MD"

echo "added → $CLAUDE_MD"
echo "backup → ${CLAUDE_MD}.bak.${TODAY}"

Enter fullscreen mode Exit fullscreen mode

No more opening vim, and the auto-backup means if I delete something accidentally I can restore it. Lower the friction of pinning. The closer friction gets to zero, the more pins accumulate.

Limitations — what pinning can't fix

CLAUDE.md isn't magic. After a year of running it, three real limitations:

First, long contexts start to override it. If you code for hours in one session, the accumulated context outweighs CLAUDE.md. Late in the session it might suddenly answer in English or suggest Pages Router. When this happens, just open a new session.

Second, write too much and the details get drowned. My global is 80 lines. Early on it ballooned to 200 and the longer the rules got, the worse the model's prioritization became. Even human employees don't follow 200 rules.

Third, if I break my own rule, the AI won't stop me. If I explicitly say "do this with Pages Router", Claude does it. Pinning sets defaults, not guardrails on the human. At the end of the day, controlling myself is still my job.

What to pin first, by situation

Situation First pin Why
Writing CLAUDE.md for the first time reply language + identity effect lands on the very first response
You've nagged the same thing 3+ times that nag itself you already know it's a rule
Right after an incident danger rules pin it or it happens again
Just joined a project folder structure stop file-location guessing
Blog/docs writing tone + banned words output tone stabilizes immediately

This single table is a year's worth of trial-and-error. The two highest-leverage pins were always the top two: "reply in Korean" and "the rule I've now repeated three times". The latter is the strongest one.

Wrapping up

CLAUDE.md takes 5 minutes to start. 3 lines of identity, 3 lines of tone, 5 lines of coding rules, 4 lines of workflow, 3 lines of danger. An 18-line v1 is enough. Add what bites you over the next month. A year in, 80% of how you work will be pinned.

One tip when you write the first version. Don't just freestyle it — do a quick retrospective first. When I wrote my v1, I first listed "the 5 things I nagged Claude about most this past week." That list became my global rules verbatim. Whatever I keep telling it is exactly what should be pinned first.

CLAUDE.md is the wiki you hand to the AI. Written well, it works like a coworker from day one. Written poorly, you remain founder, new hire, and everything in between. Running 16 apps as a solo, the latter doesn't scale. Better to start today.

Official sources