Optimize Claude Code context by separating Rules and Skills
mainTo prevent context window bloat and improve Claude's reasoning capabilities, distinguish between Rules and Skills:
- Rules (
.claude/rules/): Use these for high-level, declarative standards that Claude needs to know for literally every task (e.g., "Use conventional commits" or "Never usegit add -A"). Keep these short and avoid code examples. - Skills (
.claude/commands/): Use these for detailed, implementation-heavy guides that are only relevant during specific tasks (e.g., "How to configure Playwright" or "k6 load testing templates"). These are invoked on-demand using a command (e.g.,/test) and can contain extensive code examples and checklists.
The Goal: Minimize the lines in .claude/rules/ (aim for ~300 lines) to leave maximum space for your actual code and reasoning.
# Example of how a skill is invoked in a conversation
/test