jpskill.com
🛠️ 開発・MCP コミュニティ 🔴 エンジニア向け 👤 エンジニア・AI開発者

🛠️ Uncle Bob Craft

uncle-bob-craft

コードレビューや設計に関する議論、コード作成・リファクタリング時に、可読性・保守性の高いコードを目指す「Clean Code」の原則を適用し、プロジェクトのLinter/Formatterと連携してコード品質を高めるSkill。

⏱ MCPサーバー実装 1日 → 2時間

📺 まず動画で見る(YouTube)

▶ 【衝撃】最強のAIエージェント「Claude Code」の最新機能・使い方・プログラミングをAIで効率化する超実践術を解説! ↗

※ jpskill.com 編集部が参考用に選んだ動画です。動画の内容と Skill の挙動は厳密には一致しないことがあります。

📜 元の英語説明(参考)

Use when performing code review, writing or refactoring code, or discussing architecture; complements clean-code and does not replace project linter/formatter.

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

一言でいうと

コードレビューや設計に関する議論、コード作成・リファクタリング時に、可読性・保守性の高いコードを目指す「Clean Code」の原則を適用し、プロジェクトのLinter/Formatterと連携してコード品質を高めるSkill。

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

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

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

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

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

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して uncle-bob-craft.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → uncle-bob-craft フォルダができる
  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-17
取得日時
2026-05-17
同梱ファイル
6

💬 こう話しかけるだけ — サンプルプロンプト

  • Uncle Bob Craft を使って、最小構成のサンプルコードを示して
  • Uncle Bob Craft の主な使い方と注意点を教えて
  • Uncle Bob Craft を既存プロジェクトに組み込む方法を教えて

これをClaude Code に貼るだけで、このSkillが自動発動します。

📖 Skill本文(日本語訳)

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

Uncle Bob Craft

Robert C. Martin (Uncle Bob)のコードレビューとプロダクションに関する基準を適用します。具体的には、Clean Code、Clean Architecture、The Clean Coder、Clean Agile、およびデザインパターンの規律です。このスキルは、既存の@clean-codeスキル(Clean Codeの本に焦点を当てています)やプロジェクトのリンター/フォーマッターを補完するものであり、それらに取って代わるものではありません。

概要

このスキルは、Uncle Bobの著作群からコードのレビュー記述に関する原則を集約したものです。具体的には、命名と関数(@clean-code経由)、アーキテクチャと境界(Clean Architecture)、プロフェッショナリズムと見積もり(The Clean Coder)、アジャイルの価値と実践(Clean Agile)、そしてデザインパターンの適切な使用と誤用です。構造、依存関係、文脈におけるSOLID、コードの臭い、プロフェッショナルな実践を評価するために使用してください。構文やスタイルの強制ではなく、クラフトと設計の基準のみを提供します。これらは引き続きリンターとフォーマッターの責任です。

このスキルを使用するタイミング

  • コードレビュー: 依存関係ルール、境界、SOLID、および臭いのヒューリスティックを適用し、具体的なリファクタリングを提案します。
  • リファクタリング: 何を抽出するか、どこに境界を引くか、デザインパターンが正当化されるかどうかを決定します。
  • アーキテクチャの議論: レイヤーの境界、依存関係の方向、関心の分離を確認します。
  • デザインパターン: パターンを導入する前に、正しい使用法とカーゴカルト的または過剰な使用を評価します。
  • 見積もりとプロフェッショナリズム: Clean Coderのアイデア(ノーと言うこと、持続可能なペース、3点見積もり)を適用します。
  • アジャイルプラクティス: プロセスを議論する際にClean Agile(Iron Cross、TDD、リファクタリング、ペアプログラミング)を参照します。
  • プロジェクトのリンター、フォーマッター、または自動テストを置き換えたり、上書きしたりするために使用しないでください

ソース別アグリゲーター

ソース 焦点 参照先
Clean Code 名前、関数、コメント、フォーマット、テスト、クラス、臭い 詳細については@clean-codeを使用してください。このスキルはレビュー/プロダクションのためにそれを参照します。
Clean Architecture 依存関係ルール、レイヤー、境界、アーキテクチャにおけるSOLID reference.mdおよびreferences/clean-architecture.mdを参照してください。
The Clean Coder プロフェッショナリズム、見積もり、ノーと言うこと、持続可能なペース reference.mdおよびreferences/clean-coder.mdを参照してください。
Clean Agile 価値、Iron Cross、TDD、リファクタリング、ペアプログラミング reference.mdおよびreferences/clean-agile.mdを参照してください。
デザインパターン 使用するタイミング、誤用、カーゴカルト reference.mdおよびreferences/design-patterns.mdを参照してください。

デザインパターン:使用と誤用

  • パターンを使用するのは、実際の設計上の問題(例:振る舞い、ライフサイクル、横断的関心のバリエーション)を解決する場合であり、「エンタープライズ」に見せるためではありません。
  • カーゴカルトを避ける: コードベースにFactory/Strategy/Repositoryが「あるべき」だからといって追加しないでください。重複や硬直性が抽象化を正当化する場合にのみ追加してください。
  • 誤用の兆候: すべてのクラス名にパターン名が含まれている、ロジックなしで委譲するだけのレイヤー、単純なコードを理解しにくくするパターン。
  • 経験則: 3回目の重複または2回目の変更理由を感じたときにパターンを導入し、意図が明確になるようにコードまたはドキュメントでパターンに名前を付けてください。

臭いとヒューリスティック(概要)

臭い / ヒューリスティック 意味
硬直性 (Rigidity) 小さな変更が多くの編集を強制する。
脆さ (Fragility) 変更が関連のない領域を破壊する。
不動性 (Immobility) 別のコンテキストで再利用するのが難しい。
粘性 (Viscosity) ハックは簡単だが、正しいことをするのは難しい。
不必要な複雑さ (Needless complexity) 推測的または未使用の抽象化。
不必要な繰り返し (Needless repetition) DRY原則違反。同じアイデアが複数の場所にある。
不透明性 (Opacity) コードが理解しにくい。

完全なリスト(C1–T9スタイルのヒューリスティックを含む)はreference.mdにあります。これらをレビューで使用して、問題を特定し、リファクタリング(抽出、依存関係の移動、境界の導入)を提案してください。

レビューとプロダクション

コンテキスト 適用
コードレビュー 依存関係ルールと境界。文脈におけるSOLID。臭いをリストアップ。1つまたは2つの具体的なリファクタリング(例:関数の抽出、依存関係の反転)を提案。テストとプロフェッショナリズム(テストの存在、明らかなプレッシャーハックがないか)を確認。
新しいコードの記述 小さな関数と単一責任を優先。内向きに依存(Clean Architecture)。TDDを行う場合は最初にテストを記述。重複またはバリエーションが正当化されるまでパターンを避ける。
リファクタリング 一度に1つの臭いを特定。テストがグリーンな状態で小さなステップでリファクタリング。振る舞いを追加する前に名前と構造を改善。

仕組み

コードレビュー時

  1. 境界と依存関係ルール: 依存関係が内向きを指しているか(例:ユースケースがUIやDBの詳細に依存していないか)を確認します。references/clean-architecture.mdを参照してください。
  2. 文脈におけるSOLID: 変更されたコードに適用される箇所で、単一責任、オープン/クローズド、リスコフ、インターフェース分離、依存関係逆転の原則を確認します。
  3. 臭い: 硬直性、脆さ、不動性、粘性、不必要な複雑さ/繰り返し、不透明性をスキャンし、ファイル/領域とともにリストアップします。
  4. 具体的な提案: 1つまたは2つのリファクタリングを提案します(例:「これをXという名前の関数に抽出してください」、「このレイヤーが具体的なDBクライアントに依存しないようにインターフェースを導入してください」)。
  5. テストとクラフト: テストが存在するか、変更が持続可能なペースを尊重しているか(プロフェッショナリズムに反する明らかな「後で修正する」コメントがないか)をメモします。

コードの記述またはリファクタリング時

  1. 小さく、単一目的の関数とクラスを優先します。命名と構造には@clean-codeを使用します。
  2. 依存関係は内向きを指すようにします。ビジネスルールを中央に置き、アダプターを端に置きます。
  3. デザインパターンは、重複またはバリエーションが正当化される場合にのみ導入します。
  4. テストがグリーンな状態で小さなステップでリファクタリングします。

(原文がここで切り詰められています)

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

Uncle Bob Craft

Apply Robert C. Martin (Uncle Bob) criteria for code review and production: Clean Code, Clean Architecture, The Clean Coder, Clean Agile, and design-pattern discipline. This skill is complementary to the existing @clean-code skill (which focuses on the Clean Code book) and to your project's linter/formatter—it does not replace them.

Overview

This skill aggregates principles from Uncle Bob's body of work for reviewing and writing code: naming and functions (via @clean-code), architecture and boundaries (Clean Architecture), professionalism and estimation (The Clean Coder), agile values and practices (Clean Agile), and design-pattern use vs misuse. Use it to evaluate structure, dependencies, SOLID in context, code smells, and professional practices. It provides craft and design criteria only—not syntax or style enforcement, which remain the responsibility of your linter and formatter.

When to Use This Skill

  • Code review: Apply Dependency Rule, boundaries, SOLID, and smell heuristics; suggest concrete refactors.
  • Refactoring: Decide what to extract, where to draw boundaries, and whether a design pattern is justified.
  • Architecture discussion: Check layer boundaries, dependency direction, and separation of concerns.
  • Design patterns: Assess correct use vs cargo-cult or overuse before introducing a pattern.
  • Estimation and professionalism: Apply Clean Coder ideas (saying no, sustainable pace, three-point estimates).
  • Agile practices: Reference Clean Agile (Iron Cross, TDD, refactoring, pair programming) when discussing process.
  • Do not use to replace or override the project's linter, formatter, or automated tests.

Aggregators by Source

Source Focus Where to go
Clean Code Names, functions, comments, formatting, tests, classes, smells Use @clean-code for detail; this skill references it for review/production.
Clean Architecture Dependency Rule, layers, boundaries, SOLID in architecture See reference.md and references/clean-architecture.md.
The Clean Coder Professionalism, estimation, saying no, sustainable pace See reference.md and references/clean-coder.md.
Clean Agile Values, Iron Cross, TDD, refactoring, pair programming See reference.md and references/clean-agile.md.
Design patterns When to use, misuse, cargo cult See reference.md and references/design-patterns.md.

Design Patterns: Use vs Misuse

  • Use patterns when they solve a real design problem (e.g., variation in behavior, lifecycle, or cross-cutting concern), not to look "enterprise."
  • Avoid cargo cult: Do not add Factory/Strategy/Repository just because the codebase "should" have them; add them when duplication or rigidity justifies the abstraction.
  • Signs of misuse: Pattern name in every class name, layers that only delegate without logic, patterns that make simple code harder to follow.
  • Rule of thumb: Introduce a pattern when you feel the third duplication or the second reason to change; name the pattern in code or docs so intent is clear.

Smells and Heuristics (Summary)

Smell / Heuristic Meaning
Rigidity Small change forces many edits.
Fragility Changes break unrelated areas.
Immobility Hard to reuse in another context.
Viscosity Easy to hack, hard to do the right thing.
Needless complexity Speculative or unused abstraction.
Needless repetition DRY violated; same idea in multiple places.
Opacity Code is hard to understand.

Full lists (including heuristics C1–T9-style) are in reference.md. Use these in review to name issues and suggest refactors (extract, move dependency, introduce boundary).

Review vs Production

Context Apply
Code review Dependency Rule and boundaries; SOLID in context; list smells; suggest one or two concrete refactors (e.g., extract function, invert dependency); check tests and professionalism (tests present, no obvious pressure hacks).
Writing new code Prefer small functions and single responsibility; depend inward (Clean Architecture); write tests first when doing TDD; avoid patterns until duplication or variation justifies them.
Refactoring Identify one smell at a time; refactor in small steps with tests green; improve names and structure before adding behavior.

How It Works

When reviewing code

  1. Boundaries and Dependency Rule: Check that dependencies point inward (e.g., use cases do not depend on UI or DB details). See references/clean-architecture.md.
  2. SOLID in context: Check Single Responsibility, Open/Closed, Liskov, Interface Segregation, Dependency Inversion where they apply to the changed code.
  3. Smells: Scan for rigidity, fragility, immobility, viscosity, needless complexity/repetition, opacity; list them with file/area.
  4. Concrete suggestions: Propose one or two refactors (e.g., "Extract this into a function named X," "Introduce an interface so this layer does not depend on the concrete DB client").
  5. Tests and craft: Note if tests exist and if the change respects sustainable pace (no obvious "we'll fix it later" comments that violate professionalism).

When writing or refactoring code

  1. Prefer small, single-purpose functions and classes; use @clean-code for naming and structure.
  2. Keep dependencies pointing inward; put business rules in the center, adapters at the edges.
  3. Introduce design patterns only when duplication or variation justifies them.
  4. Refactor in small steps with tests staying green.

Examples

Example 1: Code review prompt (copy-pasteable)

Use this to ask for an Uncle Bob–oriented review:

Please review this change using Uncle Bob craft criteria (@uncle-bob-craft):
1. Dependency Rule and boundaries — do dependencies point inward?
2. SOLID in context — any violations in the touched code?
3. Smells — list rigidity, fragility, immobility, viscosity, needless complexity/repetition, or opacity.
4. Suggest one or two concrete refactors (e.g., extract function, invert dependency).
Do not duplicate lint/format; focus on structure and design.

Example 2: Before/after (extract and name)

Before (opacity, does more than one thing):

def process(d):
    if d.get("t") == 1:
        d["x"] = d["a"] * 1.1
    elif d.get("t") == 2:
        d["x"] = d["a"] * 1.2
    return d

After (clear intent, single level of abstraction):

def apply_discount(amount: float, discount_type: int) -> float:
    if discount_type == 1:
        return amount * 1.1
    if discount_type == 2:
        return amount * 1.2
    return amount

def process(order: dict) -> dict:
    order["x"] = apply_discount(order["a"], order.get("t", 0))
    return order

Best Practices

  • ✅ Use @clean-code for naming, functions, comments, and formatting; use this skill for architecture, boundaries, SOLID, smells, and process.
  • ✅ In review, name the smell or principle (e.g., "Dependency Rule violation: use case imports from the web framework").
  • ✅ Suggest at least one concrete refactor per review (extract, rename, invert dependency).
  • ✅ Run the project linter and formatter separately; this skill does not replace them.
  • ❌ Do not use this skill to enforce syntax or style; that is the linter's job.
  • ❌ Do not add design patterns without a clear duplication or variation reason.

Common Pitfalls

  • Problem: Treating every class as needing a Factory or Strategy.
    Solution: Introduce patterns only when you have a real design need (third duplication, second axis of change).

  • Problem: Review only listing "violates SOLID" without saying where or how.
    Solution: Point to the file/function and which principle (e.g., "SRP: this function parses and persists; split into parse and persist").

  • Problem: Skipping the project linter because "we applied Uncle Bob."
    Solution: This skill is about craft and design; always run the project's lint and format.

Related Skills

  • @clean-code — Detailed Clean Code book material (names, functions, comments, formatting, tests, classes, smells). Use for day-to-day code quality; use uncle-bob-craft for architecture and cross-book criteria.
  • @architecture — General architecture decisions and trade-offs. Use when choosing high-level structure; use uncle-bob-craft for Dependency Rule and boundaries.
  • @code-review-excellence — Code review practices. Combine with uncle-bob-craft for principle-based review.
  • @refactor-clean-code — Refactoring toward clean code. Use with uncle-bob-craft when refactoring for boundaries and SOLID.
  • @test-driven-development — TDD workflow. Aligns with Clean Agile and Clean Coder (tests as requirement, sustainable pace).

Limitations

  • Does not replace the project linter or formatter. Run lint and format separately; this skill gives design and craft criteria only.
  • Does not replace automated tests. It can remind you to write tests (Clean Coder, Clean Agile) but does not run or generate them.
  • Complementary to tooling. Use it alongside existing CI, lint, and test suites.
  • No syntax or style enforcement. It focuses on structure, dependencies, smells, and professional practice, not on brace style or line length.
  • Summaries, not the books. Full Clean Code heuristics, component principles (REP/CCP/CRP, ADP/SDP/SAP), and detailed stories are in the books; we reference the most used parts. See reference.md "Scope and attribution."

同梱ファイル

※ ZIPに含まれるファイル一覧。`SKILL.md` 本体に加え、参考資料・サンプル・スクリプトが入っている場合があります。