create-claude-rules
Claude Rulesファイルを.claude/rules/ディレクトリに作成・管理する。プロジェクト固有のルール、コーディング規約、ワークフロー設定を追加したい場合に使用。
When & Why to Use This Skill
This Claude skill automates the creation and management of project-specific instruction files within the `.claude/rules/` directory. It enables developers to systematically define coding standards, architectural guidelines, and workflow preferences, ensuring that Claude remains aligned with the unique requirements and conventions of any given codebase.
Use Cases
- Standardizing Coding Conventions: Automatically generate and manage rule files for linting, naming conventions, and file structures to maintain high code quality across a project.
- Defining Path-Specific Logic: Create specialized instructions for specific directories, such as enforcing API design patterns in the 'src/api' folder or specific testing requirements in the 'tests/' directory.
- Workflow Automation: Document and enforce Git branching strategies, commit message formats, and PR review checklists for the AI to follow during the development lifecycle.
- Project Onboarding: Quickly set up a comprehensive set of 'Do's and Don'ts' for a new repository to minimize AI hallucinations and ensure architectural consistency from the start.
| name | create-claude-rules |
|---|---|
| description | Claude Rulesファイルを.claude/rules/ディレクトリに作成・管理する。プロジェクト固有のルール、コーディング規約、ワークフロー設定を追加したい場合に使用。 |
| allowed-tools | Read, Write, Glob, Bash(mkdir:*) |
Claude Rules 作成
概要
.claude/rules/ ディレクトリにClaude Rulesファイルを作成・管理するSkill。
Claude Rulesはプロジェクト固有の指示をClaudeに与えるためのMarkdownファイル。
ディレクトリ構造
.claude/
├── CLAUDE.md # メインプロジェクト指示
├── settings.local.json # ローカル設定
└── rules/
├── code-style.md # コードスタイル
├── testing.md # テスト規約
└── github.md # GitHub操作ルール
ルールファイルの作成手順
.claude/rules/ディレクトリが存在するか確認(なければ作成)- ルールの目的に応じたファイル名を決定(kebab-case)
- Markdownファイルを作成
ファイル命名規則
- kebab-case を使用:
code-style.md,api-design.md - 内容を表す具体的な名前にする
- 拡張子は
.md
ルールファイルの書式
基本形式
# ルールのタイトル
## 目的
このルールが適用される状況を説明。
## ガイドライン
- 具体的な指示1
- 具体的な指示2
## 例
具体的なコード例やパターン。
パス固有ルール(特定のファイルにのみ適用)
---
paths: src/**/*.swift
---
# Swiftコードスタイル
## ガイドライン
- SwiftLintに従う
- ...
ルールの種類例
| ファイル名 | 用途 |
|---|---|
code-style.md |
コーディング規約 |
testing.md |
テスト方針 |
git-workflow.md |
Gitワークフロー |
api-design.md |
API設計規約 |
security.md |
セキュリティ要件 |
github-issues.md |
GitHub Issue管理 |
ベストプラクティス
- 1ファイル1トピックに集中する
- 具体的な例を含める
- Do's / Don'ts を明確にする
- チームで共有するためgitにコミットする