Skip to main content
Everything Claude Code uses a layered rules architecture: common principles + language-specific extensions.

Rules Structure

rules/
├── common/          # Language-agnostic principles (always install)
│   ├── coding-style.md
│   ├── git-workflow.md
│   ├── testing.md
│   ├── performance.md
│   ├── patterns.md
│   ├── hooks.md
│   ├── agents.md
│   └── security.md
├── typescript/      # TypeScript/JavaScript specific
├── python/          # Python specific
├── golang/          # Go specific
└── swift/           # Swift specific
common/ contains universal principles with no language-specific code. Language directories extend common rules with framework patterns, tools, and examples.

Installation Options

1

Clone Repository

git clone https://github.com/affaan-m/everything-claude-code.git
cd everything-claude-code
2

Run Installer

# Install common + one or more languages
./install.sh typescript
./install.sh python
./install.sh golang
./install.sh swift

# Install multiple languages at once
./install.sh typescript python golang
3

Verify Installation

ls ~/.claude/rules/
# Should show: common/ typescript/ python/ golang/ swift/

Option 2: Manual Installation

Important: Copy entire directories — do NOT flatten with /*.Common and language-specific directories contain files with the same names. Flattening causes language-specific files to overwrite common rules and breaks relative ../common/ references.
1

Install Common Rules (Required)

cp -r rules/common ~/.claude/rules/common
2

Install Language-Specific Rules

# Choose based on your tech stack
cp -r rules/typescript ~/.claude/rules/typescript
cp -r rules/python ~/.claude/rules/python
cp -r rules/golang ~/.claude/rules/golang
cp -r rules/swift ~/.claude/rules/swift

Common Rules Overview

coding-style.md

Coding Style

Core Principles:
  • Immutability (CRITICAL) — never mutate, always return new copies
  • Many small files > few large files (200-400 lines typical, 800 max)
  • Comprehensive error handling
  • Input validation at system boundaries
  • Code quality checklist

testing.md

Testing Requirements

Minimum 80% Coverage:
  • Unit tests (functions, utilities, components)
  • Integration tests (API endpoints, database)
  • E2E tests (critical user flows)
TDD Workflow:
  1. Write test first (RED)
  2. Implement (GREEN)
  3. Refactor (IMPROVE)
  4. Verify 80%+ coverage

security.md

Security Guidelines

Mandatory Checks:
  • No hardcoded secrets
  • All user inputs validated
  • SQL injection prevention
  • XSS/CSRF protection
  • Rate limiting on endpoints
  • Authorization checks
Protocol: If security issue found → STOP → use security-reviewer agent → fix CRITICAL → rotate secrets → review entire codebase

git-workflow.md

Git Workflow

Commit Format:
<type>: <description>
Types: feat, fix, refactor, docs, test, chore, perf, ciPR Workflow: Analyze full commit history → draft comprehensive summary → include test plan → push with -u flag

performance.md

Performance

Context Management:
  • Avoid last 20% of context window for large refactoring
  • Lower-sensitivity tasks tolerate higher utilization
Build Troubleshooting: Use build-error-resolver agent → analyze → fix incrementally → verify

patterns.md

Architecture Patterns

  • API response format (consistent envelope)
  • Repository pattern (encapsulate data access)
  • Skeleton projects (battle-tested templates)

hooks.md

Hook Usage

  • When to use PreToolUse/PostToolUse hooks
  • Memory persistence patterns
  • Strategic compaction triggers

agents.md

Agent Orchestration

  • When to delegate to specialized agents
  • Parallel vs sequential execution
  • Agent selection guide

Language-Specific Rules

TypeScript/JavaScript

> Extends [common/coding-style.md](../common/coding-style.md)

## TypeScript Specific

- **Strict mode enabled:** `"strict": true`
- **Type everything:** No `any` types
- **Immutability:** Use `as const`, `readonly`
- **Formatting:** Prettier + ESLint
- **File naming:** kebab-case for files

Python

> Extends [common/coding-style.md](../common/coding-style.md)

## Python Specific

- **PEP 8 compliance:** Use `black` for formatting
- **Type hints:** Use for all functions
- **Docstrings:** All public functions
- **Imports:** Sorted with `isort`

Go

> Extends [common/coding-style.md](../common/coding-style.md)

## Go Specific

- **Idiomatic Go:** Follow Effective Go
- **Error handling:** Explicit error returns
- **Formatting:** `gofmt` and `goimports`
- **Mutation:** Pointer receivers are idiomatic

Swift

> Extends [common/coding-style.md](../common/coding-style.md)

## Swift Specific

- **Swift 6.2 concurrency:** Use actors for thread-safety
- **Protocol-oriented:** Use protocols for DI
- **Error handling:** Use `Result` type
- **Formatting:** SwiftFormat

Rules vs Skills

Rules (rules/)

Define what to do:
  • Standards and conventions
  • Checklists
  • Broad applicability
Example: “80% test coverage”, “No hardcoded secrets”

Skills (skills/)

Provide how to do it:
  • Deep reference material
  • Specific task workflows
  • Actionable patterns
Example: python-patterns, golang-testing, tdd-workflow
Language-specific rule files reference relevant skills where appropriate.

Rule Priority

When language-specific rules and common rules conflict, language-specific rules take precedence.
This follows the standard layered configuration pattern (similar to CSS specificity or .gitignore precedence).

Example

common/coding-style.md recommends immutability. golang/coding-style.md overrides:
Idiomatic Go uses pointer receivers for struct mutation — see common/coding-style.md for the general principle, but Go-idiomatic mutation is preferred here.

Adding a New Language

1

Create Language Directory

mkdir rules/rust
2

Add Extension Files

Create files that extend common rules:
  • coding-style.md — formatting tools, idioms, error handling
  • testing.md — test framework, coverage tools
  • patterns.md — language-specific design patterns
  • hooks.md — PostToolUse hooks for formatters, linters
  • security.md — secret management, security tools
3

Reference Common Rules

Each file should start with:
> This file extends [common/xxx.md](../common/xxx.md) with Rust specific content.
4

Reference or Create Skills

  • Reference existing skills if available
  • Create new ones under skills/ for deep patterns

Verification

Check Installed Rules

ls -la ~/.claude/rules/
Expected output:
common/
typescript/
python/
golang/
swift/

Verify Common Rules

ls ~/.claude/rules/common/
Expected output:
coding-style.md
git-workflow.md
testing.md
performance.md
patterns.md
hooks.md
agents.md
security.md

Verify Language-Specific Rules

ls ~/.claude/rules/typescript/
Expected output:
coding-style.md
testing.md
patterns.md
hooks.md
security.md

Installation Checklist

  • Common rules installed (~/.claude/rules/common/)
  • Language-specific rules installed (TypeScript, Python, Go, Swift)
  • Directory structure preserved (not flattened)
  • Relative references intact (../common/ links work)
  • Verified with ls ~/.claude/rules/

Best Practices

Start with Common

Always install common rules first. They provide the foundation.

Install Only What You Use

Only install language rules for your project’s tech stack.

Keep Directory Structure

Never flatten. Common and language-specific rules must stay separate.

Update Regularly

Pull latest rules from the repo periodically for improvements.

Pro Tip: Use the install script (./install.sh) for safe, automated installation. It handles directory structure and prevents common mistakes.