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

推荐订阅源

Y
Y Combinator Blog
S
SegmentFault 最新的问题
Engineering at Meta
Engineering at Meta
量子位
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Google DeepMind News
Google DeepMind News
博客园_首页
云风的 BLOG
云风的 BLOG
月光博客
月光博客
I
InfoQ
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Vercel News
Vercel News
美团技术团队
Microsoft Security Blog
Microsoft Security Blog
P
Proofpoint News Feed
D
Docker
F
Fortinet All Blogs
N
Netflix TechBlog - Medium
博客园 - 叶小钗
Martin Fowler
Martin Fowler
雷峰网
雷峰网
酷 壳 – CoolShell
酷 壳 – CoolShell
J
Java Code Geeks
Microsoft Azure Blog
Microsoft Azure Blog

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
4 CLAUDE.md Mistakes That Are Killing Your AI Coding Sess...
BLNCraft · 2026-05-18 · via DEV Community

BLNCraft

Why your CLAUDE.md is hurting your AI coding sessions

After reviewing dozens of codebases where developers use Cursor and Claude Code, I kept seeing the same CLAUDE.md mistakes over and over. Here is what I found — and how to fix it.


The 4 mistakes that burn your token budget

1. Too long — burns context before actual code

Most CLAUDE.md files I see are 3,000+ tokens of aspirational rules. The AI reads them before every response. That is expensive and often ignored.

Fix: Keep your CLAUDE.md under 800 tokens for the main prelude. Move framework-specific context into separate files using @include.

# CLAUDE.md (under 800 tokens)
You are a TypeScript developer. Prefer functional patterns. No default exports.

@include .claude/rules/nextjs.md
@include .claude/rules/testing.md

Enter fullscreen mode Exit fullscreen mode

Only the relevant includes load for each file.


2. Missing glob patterns — rules do not auto-attach

Generic rules like "always write tests" do nothing if your AI does not know when to apply them.

Fix: Use file-scoped rules with globs:

# .cursor/rules/testing.mdc
---
globs: ["**/*.test.ts", "**/__tests__/**"]
---
Use describe/it structure. Always mock external dependencies. Coverage threshold: 80%.

Enter fullscreen mode Exit fullscreen mode

This rule only fires when you are editing test files. Everything else is unaffected.


3. No framework-specific sections — same rules for Next.js and Go

A monolith CLAUDE.md that covers everything ends up covering nothing. Your Go service does not need React patterns in context.

Fix: Separate rule files per domain, composable via includes:

.claude/
  rules/
    nextjs.md      # App Router, RSC, data fetching
    go.md          # error handling, context propagation
    db.md          # migrations, query patterns
    auth.md        # JWT, session, RBAC patterns
    testing.md     # framework-specific testing

Enter fullscreen mode Exit fullscreen mode


4. One-file-fits-all rules — multi-rule files get ignored

Long rule files with many concerns get treated as background noise. The AI picks what it thinks is relevant and skips the rest.

Fix: One rule = one concern. Smaller, focused files that auto-attach by glob outperform long catch-all files every time.


The patterns that actually work

Here is the structure I use across projects:

.claude/
  main.md              # ≤800 tokens — team conventions, tech choices
  rules/
    auth/              # 14 rules for auth patterns
    db/                # 18 rules for query + migration patterns
    testing/           # 22 rules for TDD + coverage
    ui/                # 31 rules for component patterns
    deploy/            # 15 rules for CI/CD + deployment
    observability/     # 12 rules for logging + tracing
.cursor/
  rules/
    *.mdc              # glob-scoped, auto-attach

Enter fullscreen mode Exit fullscreen mode


What changed when I applied this

  • Token usage per session dropped by ~40% (shorter main context)
  • Rules actually fired at the right time (glob-scoped)
  • New team members could understand the AI setup in under 10 minutes
  • No more "the AI keeps ignoring X" — because X was finally scoped correctly

TL;DR

  1. Keep CLAUDE.md under 800 tokens, use @include for the rest
  2. Glob-scope every Cursor rule so it fires on the right files
  3. One concern per rules file — no catch-alls
  4. Separate by domain, not by project

I packaged up 162 rules files organized by domain (auth, db, testing, ui, deploy, observability) with 9 CLAUDE.md presets for major frameworks. If you want to skip the iteration: Cursor Rules Pack on Gumroad — use code **BLNCRAFT20* for 20% off launch week.*