From zaksak
Guidelines for writing effective CLAUDE.md files and .claude/rules/ — invoke when creating or editing CLAUDE.md or rule files
How this skill is triggered — by the user, by Claude, or both
Slash command
/zaksak:writing-claude-mdThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
---
Less is more - Keep root CLAUDE.md under 100 lines. Claude Code's system prompt uses ~50 instructions; models reliably follow ~150-200 total. Every instruction in CLAUDE.md competes for that budget.
Universal applicability - If it only applies sometimes, make it a scoped rule. As instruction count increases, quality degrades uniformly across ALL instructions.
Map, not territory - Point to docs with @path/to/file, don't embed them. Prefer file:line references over code snippets.
Be specific - "Use bun not npm" not "use the right tool"
Claude learns from codebase - Skip code style rules. Claude is an in-context learner and will follow existing patterns in the codebase.
# Project Name
One-line description.
## Stack
- Runtime, framework, database
## Structure
- `src/` - what it contains
- `tests/` - what it contains
## Commands
- Build: `command`
- Test: `command`
- Lint: `command`
## Key Patterns
- [2-3 max, universally applicable]
## See Also
- @docs/topic.md for details
| Root CLAUDE.md | .claude/rules/ |
|---|---|
| Universal context | Topic-specific |
| Essential commands | File-type conventions |
| Project structure | Conditional instructions |
.claude/rules/
├── api-design.md # No paths = always loaded
├── testing.md
└── frontend/
└── react.md # Subdirectories supported
api-design.md, database-migrations.md---
paths:
- "src/api/**/*.ts"
---
Use often to properly scope rules to specific directories or file types. This leads to shorter rule files (less context bloat) and pinpoint accurate guidance.
| Pattern | Matches |
|---|---|
**/*.ts | All .ts files |
src/**/* | Everything under src/ |
src/**/*.{ts,tsx} | .ts and .tsx in src/ |
See @README for overview.
For API work: @docs/api.md
Limitations:
@file#section anchors are NOT supportedfile:line refs instead)@imports or file:line refs instead of embedding contentnpx claudepluginhub zakattack9/agentic-coding --plugin zaksakCreates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.