jpskill.com
🛠️ 開発・MCP コミュニティ

ruler-rules-init

RulerというAIルールを様々なプロジェクトに適用しやすくするため、必要なファイルや設定を自動で作成・調整し、安全かつ確実にルールを導入・標準化するSkill。

📜 元の英語説明(参考)

Migrate and bootstrap Ruler-based AI rules across repositories with English-first templates, preset-based project detection, and safe, idempotent setup. Use when creating or standardizing `.ruler/*` files, generating `AGENTS.md`/`CLAUDE.md`, wiring `ruler:apply` into `package.json`, adding generated-file ignores in `.gitignore`, and designing `applyTo` scoping patterns such as `**` and `web/**`.

🇯🇵 日本人クリエイター向け解説

一言でいうと

RulerというAIルールを様々なプロジェクトに適用しやすくするため、必要なファイルや設定を自動で作成・調整し、安全かつ確実にルールを導入・標準化するSkill。

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o ruler-rules-init.zip https://jpskill.com/download/9718.zip && unzip -o ruler-rules-init.zip && rm ruler-rules-init.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/9718.zip -OutFile "$d\ruler-rules-init.zip"; Expand-Archive "$d\ruler-rules-init.zip" -DestinationPath $d -Force; ri "$d\ruler-rules-init.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して ruler-rules-init.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → ruler-rules-init フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

Ruler Rules の移行

概要

リポジトリを、安全な監査/適用ワークフローを備えた再利用可能な Ruler rules 構造に移行します。 デフォルトのテンプレートは英語で保持し、明示的に強制されない限り、既存のリポジトリ固有のコンテンツを上書きすることは避けてください。 プリセットベースのテンプレート選択を通じて、さまざまなプロジェクトタイプをサポートします。

入力

変更を適用する前に、以下の入力を収集してください。

  • ターゲットリポジトリのルートパス。
  • audit モードまたは apply モードのどちらで実行するか。
  • テンプレートプリセット: autobasenextjsmonorepo、または node-lib (デフォルト: auto)。
  • オプションの skills:sync:claude 統合を含めるかどうか。
  • ファイルが異なる場合に上書きを許可するかどうか (--force)。

プリセット

プリセットは、プロジェクト固有のテンプレートファイル (10-project-context.md20-dev-commands.md30-coding-conventions.md) の内容を制御します。ユニバーサルファイル (ruler.tomlAGENTS.md00-core-principles.md) は常にベースディレクトリから取得されます。

プリセット 自動検出シグナル ユースケース
base フォールバック あらゆるプロジェクト、プレースホルダー付きの最小限のもの
nextjs next.config.* が存在する Next.js App Router プロジェクト
monorepo turbo.json または pnpm-workspace.yaml が存在する Turborepo / pnpm ワークスペース
node-lib package.jsonmain または exports があり、next.config.* がない Node.js ライブラリ

プリセット選択の優先順位

  1. 明示的な --preset <name> フラグ (最優先)。
  2. ターゲットリポジトリファイルからの自動検出 (--preset auto または省略時)。
  3. 一致するシグナルがない場合は base にフォールバック。

ワークフロー

  1. audit モードでブートストラップスクリプトを実行します。
  2. 不足しているファイル、差異、および手動アクションを確認します。
  3. apply モードで実行して、不足しているファイルと安全なデフォルトを作成します。
  4. apply を再実行して、冪等性を確認します。
  5. ターゲットリポジトリで ruler:apply を実行して、ルートルールの出力を生成します。

決定木

  1. Ruler 統合のみが必要な場合: デフォルトの動作を使用します (--with-optional-sync を渡さないでください)。

  2. オプションの Claude skills sync も必要な場合: --with-optional-sync を渡して、skills:sync:claude の提案を含めます。

  3. 特定のプロジェクトタイプをターゲットにする場合: --preset nextjs--preset monorepo、または --preset node-lib を渡します。 または、自動検出に適切なプリセットを選択させます。

  4. 既存のファイルがテンプレートと異なる場合:

  • デフォルトを安全に保つ: --force なしで上書きしないでください。
  • 意図的なテンプレートの置き換えが必要な場合にのみ --force を使用してください。

コマンド

このスキルディレクトリから以下のコマンドを使用します。

# 監査 (デフォルトのプリセット自動検出)
node ./scripts/bootstrap-ruler.mjs --target /path/to/repo --mode audit

# 自動検出されたプリセットで適用
node ./scripts/bootstrap-ruler.mjs --target /path/to/repo --mode apply

# 明示的なプリセットで適用
node ./scripts/bootstrap-ruler.mjs --target /path/to/repo --mode apply --preset nextjs
node ./scripts/bootstrap-ruler.mjs --target /path/to/repo --mode apply --preset monorepo
node ./scripts/bootstrap-ruler.mjs --target /path/to/repo --mode apply --preset node-lib
node ./scripts/bootstrap-ruler.mjs --target /path/to/repo --mode apply --preset base

# オプションの sync と force を使用
node ./scripts/bootstrap-ruler.mjs --target /path/to/repo --mode apply --preset nextjs --with-optional-sync
node ./scripts/bootstrap-ruler.mjs --target /path/to/repo --mode apply --force

検証チェックリスト

適用後、以下を確認してください。

  1. .ruler/ruler.toml が存在し、codex + claude の出力を定義している。
  2. 必要な .ruler/*.md テンプレートが存在する。
  3. .gitignore に Ruler によって生成されたファイルのブロックが含まれている。
  4. package.jsonruler:apply が含まれている。
  5. is-ci スタイルのガードが使用されている場合、is-ci がインストールされている (pnpm add -D is-ci)。
  6. postinstall が CI スキップの推奨事項または明示的なローカルの代替手段に従っている (既存のセットアップコマンドを && (...) で連結して保持)。
  7. ターゲットリポジトリで ruler:apply の実行が成功する。

リソース

  • スクリプト: scripts/bootstrap-ruler.mjs

  • 参考文献: references/migration-playbook.md references/applyto-patterns.md

  • テンプレート: assets/templates/base/.ruler/ (ユニバーサル + フォールバック) assets/templates/presets/nextjs/.ruler/ (Next.js オーバーレイ) assets/templates/presets/monorepo/.ruler/ (monorepo オーバーレイ) assets/templates/presets/node-lib/.ruler/ (Node.js ライブラリ オーバーレイ)

📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Ruler Rules Migration

Overview

Migrate a repository to a reusable Ruler rules structure with a safe audit/apply workflow. Keep default templates in English and avoid overwriting existing repository-specific content unless explicitly forced. Support different project types through preset-based template selection.

Inputs

Collect these inputs before applying changes:

  • Target repository root path.
  • Whether to run in audit or apply mode.
  • Template preset: auto, base, nextjs, monorepo, or node-lib (default: auto).
  • Whether to include optional skills:sync:claude integration.
  • Whether overwrite is allowed for differing files (--force).

Presets

Presets control the content of project-specific template files (10-project-context.md, 20-dev-commands.md, 30-coding-conventions.md). Universal files (ruler.toml, AGENTS.md, 00-core-principles.md) are always sourced from the base directory.

Preset Auto-detect Signal Use Case
base Fallback Any project, minimal with placeholders
nextjs next.config.* exists Next.js App Router projects
monorepo turbo.json or pnpm-workspace.yaml exists Turborepo / pnpm workspace
node-lib package.json has main or exports, no next.config.* Node.js libraries

Preset Selection Priority

  1. Explicit --preset <name> flag (highest priority).
  2. Auto-detection from target repo files (when --preset auto or omitted).
  3. Falls back to base if no signals match.

Workflow

  1. Run the bootstrap script in audit mode.
  2. Review missing files, differences, and manual actions.
  3. Run in apply mode to create missing files and safe defaults.
  4. Re-run apply to confirm idempotency.
  5. Run ruler:apply in the target repo to generate root rule outputs.

Decision Tree

  1. Need only Ruler integration: Use default behavior (do not pass --with-optional-sync).

  2. Need optional Claude skills sync as well: Pass --with-optional-sync to include skills:sync:claude suggestions.

  3. Targeting a specific project type: Pass --preset nextjs, --preset monorepo, or --preset node-lib. Or let auto-detection choose the right preset.

  4. Existing files differ from templates:

  • Keep defaults safe: do not override without --force.
  • Use --force only when intentional template replacement is required.

Commands

Use these commands from this skill directory:

# Audit (default preset auto-detection)
node ./scripts/bootstrap-ruler.mjs --target /path/to/repo --mode audit

# Apply with auto-detected preset
node ./scripts/bootstrap-ruler.mjs --target /path/to/repo --mode apply

# Apply with explicit preset
node ./scripts/bootstrap-ruler.mjs --target /path/to/repo --mode apply --preset nextjs
node ./scripts/bootstrap-ruler.mjs --target /path/to/repo --mode apply --preset monorepo
node ./scripts/bootstrap-ruler.mjs --target /path/to/repo --mode apply --preset node-lib
node ./scripts/bootstrap-ruler.mjs --target /path/to/repo --mode apply --preset base

# With optional sync and force
node ./scripts/bootstrap-ruler.mjs --target /path/to/repo --mode apply --preset nextjs --with-optional-sync
node ./scripts/bootstrap-ruler.mjs --target /path/to/repo --mode apply --force

Validation Checklist

After applying, verify:

  1. .ruler/ruler.toml exists and defines codex + claude outputs.
  2. Required .ruler/*.md templates exist.
  3. .gitignore contains the Ruler generated-files block.
  4. package.json contains ruler:apply.
  5. If is-ci style guard is used, is-ci is installed (pnpm add -D is-ci).
  6. postinstall follows the CI-skip recommendation or an explicit local alternative (preserve existing setup commands by chaining with && (...)).
  7. Running ruler:apply succeeds in the target repository.

Resources

  • Script: scripts/bootstrap-ruler.mjs

  • References: references/migration-playbook.md references/applyto-patterns.md

  • Templates: assets/templates/base/.ruler/ (universal + fallback) assets/templates/presets/nextjs/.ruler/ (Next.js overlay) assets/templates/presets/monorepo/.ruler/ (monorepo overlay) assets/templates/presets/node-lib/.ruler/ (Node.js library overlay)