Skip to main content
Rules are organized into a common layer plus language-specific directories. They define standards, conventions, and checklists that apply to your codebase.

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 — no language-specific code examples.Language directories extend the common rules with framework-specific patterns, tools, and code examples.

Installation

# Install common + one or more language-specific rule sets
./install.sh typescript
./install.sh python
./install.sh golang
./install.sh swift

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

Option 2: Manual Installation

Copy entire directories — do NOT flatten with /*.Common and language-specific directories contain files with the same names. Flattening them into one directory causes language-specific files to overwrite common rules, and breaks the relative ../common/ references used by language-specific files.
# Install common rules (required for all projects)
cp -r rules/common ~/.claude/rules/common

# Install language-specific rules based on your project's 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

Rules vs Skills

Rules

Define standards, conventions, and checklists that apply broadly (e.g., “80% test coverage”, “no hardcoded secrets”)

Skills

Provide deep, actionable reference material for specific tasks (e.g., python-patterns, golang-testing)
Language-specific rule files reference relevant skills where appropriate. Rules tell you what to do; skills tell you how to do it.

Rule Priority

When language-specific rules and common rules conflict, language-specific rules take precedence (specific overrides general).
1

Common defaults

rules/common/ defines universal defaults applicable to all projects
2

Language overrides

rules/golang/, rules/python/, rules/typescript/, etc. override those defaults where language idioms differ

Example

common/coding-style.md recommends immutability as a default principle. A language-specific golang/coding-style.md can override this:
Idiomatic Go uses pointer receivers for struct mutation — see common/coding-style.md for the general principle, but Go-idiomatic mutation is preferred here.

Override Markers

Rules in rules/common/ that may be overridden by language-specific files are marked with:
Language note: This rule may be overridden by language-specific rules for languages where this pattern is not idiomatic.

Adding a New Language

To add support for a new language (e.g., rust/):
1

Create directory

Create a rules/rust/ directory
2

Add rule files

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

Reference common rules

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

Link to skills

Reference existing skills if available, or create new ones under skills/

Common Rules Categories

Coding Style

Immutability, file organization, error handling

Testing

TDD workflow, 80% coverage requirement

Security

Secret management, security checklist

Patterns

Repository pattern, API response format

Git Workflow

Commit format, PR workflow

Hooks

Hook types, TodoWrite best practices

Language-Specific Rules

TypeScript

Zod validation, Prettier, console.log warnings

Python

PEP 8, black/ruff, pytest patterns

Go

gofmt, error wrapping, table-driven tests