Skip to content

Claude Rules

Coding standards for AI coding assistants. Auto-detect tech stack, generate project rules. Works with Claude Code, Cursor, Antigravity, GitHub Copilot.

Install

$claude plugin install init-claude-rules@claude-rules

Install command taken from the project's README or registry entry. Always review code before running it.

Claude Rules

English | 中文

Coding standards template library for AI coding assistants. Combine base + language + framework layers to generate a project-specific rules file that keeps AI-generated code clean and consistent.

The Problem

AI coding assistants tend to mimic existing code style in legacy projects — including bad habits. The core principle of this library:

Don't imitate legacy code. Refactor according to the standards.

Every rule is a concrete, actionable directive (not vague "use proper XX"), with "Bad / Good" code comparison examples.

Directory Structure

claude-rules/
├── base/                   # Universal (required)
│   ├── core.md             # Core principles: legacy code attitude, quality metrics, naming, architecture
│   └── git.md              # Git commit message conventions
│
├── languages/              # Pick by language
│   ├── typescript.md       # No any/enum/barrel exports, as const, import type
│   ├── javascript.md       # ES2022+, JSDoc type annotations, ESM only
│   ├── java.md             # Java 17+ record/sealed/pattern matching, Optional
│   ├── kotlin.md           # Null safety, structured concurrency, sealed class
│   ├── swift.md            # guard let, async/await, actor, Protocol
│   ├── python.md           # ruff, type annotations, Protocol, uv/poetry
│   ├── html.md             # Semantic tags, accessibility, no div soup
│   ├── css.md              # Custom properties, Flexbox/Grid, BEM, modern features
│   ├── go.md               # Error wrapping, small interfaces, structured concurrency
│   └── rust.md             # Ownership/borrowing, thiserror/anyhow, iterators, Clippy
│
└── frameworks/             # Pick by framework
    ├── vue.md              # script setup, ref vs reactive, composable patterns
    ├── react.md            # Hooks rules, correct useEffect, state layering
    ├── swiftui.md          # @Observable (not legacy ObservableObject), SwiftData
    ├── springboot.md       # Layered architecture, DTO, global exception handling
    └── tauri.md            # Command design, service encapsulation, security config

Three-Layer Architecture

┌─────────────────────────────────────────────┐
│              base (required)                 │  core.md + git.md
│  Legacy code attitude / Quality metrics /   │  Applies to all projects
│  Naming / Architecture                      │
├─────────────────────────────────────────────┤
│            language (pick)                   │  typescript.md / java.md / ...
│  Type system / Naming conventions /         │  Based on project language
│  Language-specific features                 │
├─────────────────────────────────────────────┤
│            framework (pick)                  │  vue.md / react.md / ...
│  Component standards / State management /   │  Based on project framework
│  Architecture patterns                      │
└─────────────────────────────────────────────┘

Rule priority: framework > language > base (specific rules override general rules)

Usage

Claude Code Plugin (Recommended)

Install

# Step 1: Add the marketplace
claude plugin marketplace add lifedever/claude-rules

# Step 2: Install the plugin
claude plugin install init-claude-rules@claude-rules

# Step 3: Restart Claude Code

Use

Open any project in Claude Code and run:

/init-rules

Similar plugs

Open-source AI job search agent and job finder: scan job boards, score each job 1-5 against your CV before you apply, tailor an ATS-friendly resume and cover letter, get…

Editorial diagram design for Claude Code, Codex, GitHub Copilot, Cursor, Factory Droid, and Pi. 44 diagram types. Self-contained HTML + SVG. No shadows. No Mermaid slop.

Secure, fast, efficient, battle-tested at Alibaba's scale. Hybrid architecture code review tool: deterministic pipelines + LLM Agent, precise line-level comments, built-in…

Persistent file-based planning for AI coding agents and long-running tasks. Crash-proof markdown plans, session recovery after /clear and compaction, per-turn re-injection…