‹ 首页

init-rules

@lifedever · 收录于 1 周前

Initialize or update CLAUDE.md coding standards for any project by auto-detecting tech stack and assembling rules from the claude-rules template library. Use when user says "init rules", "初始化规范", "生成 CLAUDE.md", or wants to set up coding standards.

适合你,如果每次新项目都要手动配置编码规范

/ 下载安装
init-rules.skill双击,或拖进 Claude 桌面版 / Cowork,即完成安装↓ .skill↓ .zip
用别的 agent?下载 .zip 解压,把文件夹放进它的技能目录
Claude Code~/.claude/skills/(项目级 .claude/skills/)
Codex CLI~/.codex/skills/
Cursor自动读取上面两处目录
其他工具见其文档的「skills」目录;两个下载是同一份文件,只是名字不同
/ 通过 npx 安装 校验哈希
npx oh-my-skill add lifedever/claude-rules/init-rules
/ 通过 bash 安装
curl -fsSL https://oh-my-skill.com/install.sh | bash -s -- lifedever/claude-rules/init-rules
/ 已经装过?验证本机副本,不用重装
npx oh-my-skill verify lifedever/claude-rules/init-rules
安装目标可用 --agent / --scope 或 --to 明确指定;省略时只会在唯一已存在的 agent 目录上自动选择,零命中或多命中会停止并提示。content_hash 缺失或不一致均拒装。
187GitHub stars
~610最小装载
~12.5K含声明引用
~12.5K文本包总量
镜像托管

怎么用

技能原文 SKILL.md作者撰写 · MIT · 6d5f8bd

Init Claude Rules

IMPORTANT: You MUST read rule files from this skill's bundled files. Do NOT generate rules from your own knowledge.

Rule files are bundled in this skill's directory. Use ${CLAUDE_SKILL_DIR} to reference them.

Workflow
Step 1: Detect Tech Stack

Scan the current working directory to identify languages and frameworks:

| Signal | Rule File | |--------|-----------| | tsconfig.json or *.ts files | languages/typescript.md | | package.json with "vue" dependency | frameworks/vue.md | | package.json with "react" dependency | frameworks/react.md | | src-tauri/ directory | frameworks/tauri.md | | *.js files without tsconfig.json | languages/javascript.md | | *.java files or pom.xml | languages/java.md | | build.gradle.kts or *.kt files | languages/kotlin.md | | pom.xml/build.gradle with spring-boot | frameworks/springboot.md | | Package.swift or *.swift files | languages/swift.md | | Swift files with import SwiftUI | frameworks/swiftui.md | | pyproject.toml or requirements.txt | languages/python.md | | *.html files | languages/html.md | | *.css/*.scss files | languages/css.md | | go.mod or *.go files | languages/go.md | | Cargo.toml or *.rs files | languages/rust.md |

Present detection results and ask user to confirm or adjust before proceeding.

Step 2: Read Rule Files

Read files from this skill's bundled directory using the Read tool.

Always read:

  1. ${CLAUDE_SKILL_DIR}/base/core.md
  2. ${CLAUDE_SKILL_DIR}/base/git.md

Then read each detected language and framework file, e.g.:

  • ${CLAUDE_SKILL_DIR}/languages/typescript.md
  • ${CLAUDE_SKILL_DIR}/frameworks/vue.md
Step 3: Assemble & Write CLAUDE.md

Concatenate ALL fetched content in this exact order:

  1. <!-- Generated by init-claude-rules | https://github.com/lifedever/claude-rules -->
  2. Empty line
  3. Content of base/core.md
  4. Content of base/git.md
  5. Each detected language file
  6. Each detected framework file

Write to CLAUDE.md in the current working directory.

If CLAUDE.md already exists, warn user and ask before overwriting.

Step 4: Report
  • List included rule files
  • Total line count
  • Remind user to run claude plugin marketplace update claude-rules to get latest rules
按 MIT 许可原样转载,未经改动 · 在 GitHub 查看 →

评论

登录即可评论;带「已验证安装」的,是发布者名下有本店的安装或持有记录。