claude-rules

作者 lifedever已验证

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

175
Stars
6
Forks
2026/8/23
添加时间

⚠️ 第三方软件声明

本 Skill 为第三方开源软件,独立托管于 GitHub。SkillTip 仅为信息目录,不控制或维护底层仓库。所显示的安全检查为自动化且范围有限,安装前请自行审查源码。

阅读服务条款

安装

添加到你的 Claude Code skills 目录:

# Add to your Claude Code skills
git clone https://github.com/lifedever/claude-rules

快速入门

使用 claude-rules 等 Skills 的指南。

安全报告

已验证

上次扫描:—

{
  "status": "PASSED",
  "issues": []
}

README.md

Claude Rules

License: MIT GitHub stars PRs Welcome Website

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

The plugin will:

  1. Auto-detect your project's tech stack (TypeScript, Vue, React, etc.)
  2. Ask you to confirm the detected stack
  3. Read the matching rule files from the plugin
  4. Generate CLAUDE.md in your project root

Update

When new rules are added upstream, update the local cache:

claude plugin marketplace update claude-rules

Then restart Claude Code. To apply updated rules to a project that already has CLAUDE.md, run /init-rules again — the plugin will ask before overwriting.

Uninstall

claude plugin uninstall init-claude-rules@claude-rules
claude plugin marketplace remove claude-rules

Manual Usage

Clone this repo and concatenate the rule files you need:

git clone https://github.com/lifedever/claude-rules.git
cd claude-rules

# Example: Vue 3 + TypeScript project
cat base/core.md base/git.md languages/typescript.md frameworks/vue.md > /path/to/project/CLAUDE.md

The rules are plain Markdown and work with any AI coding tool. Just place the output where your tool expects:

ToolTarget File
Claude CodeCLAUDE.md
Cursor.cursorrules or .cursor/rules/*.mdc
Antigravity.antigravity/rules.md
GitHub Copilot.github/copilot-instructions.md

Design Principles

  1. Actionable — Every rule is directly executable by AI, no vague wording
  2. Exemplified — Key rules include "Bad" and "Good" code comparisons
  3. Quantified — Functions ≤30 lines, files ≤300 lines, nesting ≤3 levels, parameters ≤4
  4. Up-to-date — Uses modern APIs for each language/framework (@Observable, record, as const, etc.)
  5. Not hollow — Instead of "handle errors properly", specifies exactly how to handle them

Contributing

PRs for new languages or frameworks are welcome. Please follow these guidelines:

  • Rules must be concrete and actionable — no "use appropriate/proper" phrasing
  • Key rules should include code examples (bad practice + good practice)
  • Recommend modern idioms — don't document outdated APIs
  • Write in English

References

License

MIT

常见问题

What is claude-rules?

claude-rules is an open-source ai agents skill for AI coding assistants such as Claude Code, Codex CLI, and ChatGPT, built by lifedever. Coding standards for AI coding assistants. Auto-detect tech stack, generate project rules. Works with Claude Code, Cursor, Antigravity, GitHub Copilot. It has 175 GitHub stars.

Is claude-rules safe to use?

Yes. claude-rules passed SkillsLLM's automated security scan — a dependency vulnerability audit plus prompt-injection heuristics — with no high-severity issues. You can read the full report in the Security Report section on this page.

How do I install claude-rules?

Clone the repository with "git clone https://github.com/lifedever/claude-rules" and add it to your Claude Code skills directory (see the Installation section above).

Are there alternatives to claude-rules?

Yes. SkillsLLM lists many other AI Agents skills you can browse and compare side by side. Open the AI Agents category from the badge at the top of this page, or use the Related Skills and comparison links further down to weigh claude-rules against similar tools.

评论 (0)

暂无评论,成为第一个分享想法的人!

ECC

by affaan-m

10

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

242,21936,702JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情
15

An agentic skills framework & software development methodology that works.

234,96620,863Shell
AI 智能体ai-agentsbrainstorming
查看详情

hermes-agent

by NousResearch

10

The agent that grows with you

234,43747,175Python
AI 智能体ai-agentsagent-orchestration
查看详情

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

185,94028,768JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情

cc-switch

by farion1231

3

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io

128,8688,826Rust
AI 智能体claude-codeai-tools
查看详情

claude-code

by anthropics

Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.

120,03119,897Shell
AI 智能体
查看详情

开发者还喜欢

基于喜欢此 Skill 的开发者投票和收藏

ECC

by affaan-m

10

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

242,21936,702JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情
15

An agentic skills framework & software development methodology that works.

234,96620,863Shell
AI 智能体ai-agentsbrainstorming
查看详情

hermes-agent

by NousResearch

10

The agent that grows with you

234,43747,175Python
AI 智能体ai-agentsagent-orchestration
查看详情

n8n

by n8n-io

12

Fair-code workflow automation platform with native AI capabilities. Combine visual building with custom code, self-host or cloud, 400+ integrations.

201,88160,308TypeScript
MCP 服务器apisai-tools
查看详情

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

185,94028,768JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情

cc-switch

by farion1231

3

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io

128,8688,826Rust
AI 智能体claude-codeai-tools
查看详情