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

clojure-review

Review Clojure and ClojureScript code changes for compliance with Metabase coding standards, style violations, and code quality issues. Use when reviewing pull requests or diffs containing Clojure/ClojureScript code.

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

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

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

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

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して clojure-review.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → clojure-review フォルダができる
  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 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

Clojure コードレビュー スキル

Metabase Clojure スタイルガイド

このガイドでは、Metabase の Clojure および ClojureScript のコーディング規約について説明します。コミュニティの Clojure スタイルガイドについては、CLOJURE_STYLE_GUIDE.adoc も参照してください。

命名規約

一般的な命名:

  • 許容される略語: acc, i, pred, coll, n, s, k, f
  • すべての変数、関数、定数には kebab-case を使用します。

関数命名:

  • 純粋関数は、それが返す値を記述する名詞であるべきです(例: age であって calculate-ageget-age ではない)。
  • 副作用のある関数は ! で終わる必要があります。
  • 関数名に名前空間のエイリアスを繰り返さないでください。

分割代入:

  • マップの分割代入では、マップが snake_case キーを使用していても、kebab-case のローカルバインディングを使用する必要があります。

ドキュメント標準

Docstrings:

  • src または enterprise/backend/src 内のすべてのパブリックな var は docstring を持つ必要があります。
  • Markdown 規約を使用してフォーマットします。
  • 他の var を参照する場合は、バッククォートではなく [[other-var]] を使用します。

コメント:

  • TODO 形式: ;; TODO (Name M/D/YY) -- description

コード構成

可視性:

  • 他の場所で使用されない限り、すべてを ^:private にします。
  • declare を避けるように名前空間を整理するようにしてください(パブリック関数を最後の方に配置します)。

サイズと構造:

  • 20 行を超える関数は分割します。
  • 行は 120 文字以下にします。
  • 定義フォーム内には空白行を入れないでください(let/cond のペアを除く)。

スタイル規約

キーワードとメタデータ:

  • 内部使用には名前空間付きキーワードを優先します: :query-type/normal であって :normal ではない。
  • 関数であるにもかかわらず、そうでない場合には :arglists メタデータで変数をタグ付けします。

テスト

構成:

  • 論理的に分離されたテストケースのために、大きなテストは個別の deftest フォームに分割します。
  • テスト名は -test または -test-<number> で終わる必要があります。

パフォーマンス:

  • 純粋関数のテストは ^:parallel とマークします。

モジュール

OSS モジュール:

  • metabase.<module>.* パターンに従います。
  • ソースは src/metabase/<module>/ に配置します。

Enterprise モジュール:

  • metabase-enterprise.<module>.* パターンに従います。
  • ソースは enterprise/backend/src/metabase_enterprise/<module>/ に配置します。

モジュール構造:

  • REST API エンドポイントは <module>.api または <module>.api.* 名前空間に配置します。
  • モジュールのパブリック API は Potemkin インポートを使用して <module>.core に配置します。
  • Toucan モデルは <module>.models.* に配置します。
  • 設定は <module>.settings に配置します。
  • スキーマは <module>.schema に配置します。

モジュールリンター:

  • :clj-kondo/ignore [:metabase/modules] を使用してモジュールリンターをごまかさないでください。

REST API エンドポイント

必須要素:

  • すべての新しいエンドポイントはレスポンススキーマを持つ必要があります(ルート文字列の後に :- <schema>)。
  • すべてのエンドポイントはパラメータの Malli スキーマを必要とします(詳細かつ完全なもの)。
  • すべての新しい REST API エンドポイントはテストを持つ必要があります

命名規約:

  • クエリパラメータは kebab-case を使用します。
  • リクエストボディは snake_case を使用します。
  • ルートは単数形の名詞を使用します(例: /api/dashboard/:id)。

動作:

  • GET エンドポイントは副作用を持つべきではありません(分析を除く)。
  • defendpoint フォームは Toucan モデルコードの小さなラッパーであるべきです。

MBQL (Metabase Query Language)

制限:

  • lib, lib-be, または query-processor モジュール以外での生の MBQL イントロスペクションは禁止です。
  • 新しいソースコードでは Lib と MBQL 5 を使用し、レガシー MBQL は避けてください。

データベースとモデル

命名:

  • モデル名とテーブル名は単数形の名詞であるべきです。
  • アプリケーションデータベースは snake_case 識別子を使用します。

ベストプラクティス:

  • 1つの列のために行全体をフェッチする代わりに t2/select-one-fn を使用します。
  • 正しい動作は Toucan メソッドに記述し、個別のヘルパー関数には記述しません。

ドライバー

ドキュメント:

  • 新しいドライバーのマルチメソッドは docs/developers-guide/driver-changelog.md に記載する必要があります。

実装:

  • ドライバーの実装は、他のドライバーのマルチメソッドに driver 引数を渡す必要があります。
  • 実装内でドライバー名をハードコードしないでください。
  • JDBC ベースのドライバーでは read-column-thunk 内のロジックを最小限に抑えます。

その他

例:

  • 例のデータは可能であれば鳥をテーマにしてください。

リンターの抑制:

  • kondo の抑制には適切な形式を使用します。
  • #_:clj-kondo/ignore (キーワード形式) は使用しません。

設定可能なオプション:

  • 環境変数でのみ設定できる設定可能なオプションは定義しないでください。
  • 代わりに :internal defsetting を使用します。

Linting とフォーマット

  • PR の Lint: ./bin/mage kondo-updated master (またはターゲットブランチ)
    • コマンドを最初に1回呼び出し、結果を記録し、問題を1つずつ解決していきます。
    • 解決策が明らかな場合は、修正を適用してください。そうでない場合はスキップします。
    • すべての問題を修正した場合(そして kondo-updated コマンドを再実行して検証した場合):
      • 簡潔で分かりやすいコミットメッセージで変更をコミットします。
  • ファイルの Lint: ./bin/mage kondo <file or files>
    • リンターを、コードベースに存在する規約を遵守していることを確認する手段として使用します。
  • 変更の Lint: ./bin/mage kondo-updated HEAD
  • フォーマット: ./bin/mage cljfmt-files [path]

テスト

  • テストの実行: ./bin/mage run-tests namespace/test-name
  • 名前空間内のすべてのテストの実行: ./bin/mage run-tests namespace
  • モジュール内のすべてのテストの実行: ./bin/mage run-tests test/metabase/notification (モジュールがそのディレクトリにあるため)

注: ./bin/mage run-tests コマンドは複数の引数を受け入れるため、 ./bin/mage run-tests namespace/test-name namespace/other-test namespace/third-test を渡して3つのテストを実行したり、 ./bin/mage run-tests test/metabase/module1 test/metabase/module2 を渡して2つのモジュールを実行したりできます。

コードの可読性

  • コードの可読性の確認: ./bin/mage -check-readable <file> [line-number]
    • Clojure コードを変更するたびに実行します。
    • まず特定の行を確認し、その後、可読性があればファイル全体を確認します。

REPL の使用

注: clojure-mcp ツールが利用可能な場合(clojure_eval のようなツールを確認してください)、 常に ./bin/mage -repl よりもそれらを優先してください。MCP ツールはより優れた統合、 豊富なフィードバックを提供し、シェルエスケープの問題を回避します。./bin/mage -repl は、 clojure-mcp が利用できない場合のフォールバックとしてのみ使用してください。

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

Clojure Code Review Skill

Metabase Clojure Style Guide

This guide covers Clojure and ClojureScript coding conventions for Metabase. See also: CLOJURE_STYLE_GUIDE.adoc for the Community Clojure Style Guide.

Naming Conventions

General Naming:

  • Acceptable abbreviations: acc, i, pred, coll, n, s, k, f
  • Use kebab-case for all variables, functions, and constants

Function Naming:

  • Pure functions should be nouns describing the value they return (e.g., age not calculate-age or get-age)
  • Functions with side effects must end with !
  • Don't repeat namespace alias in function names

Destructuring:

  • Map destructuring should use kebab-case local bindings even if the map uses snake_case keys

Documentation Standards

Docstrings:

  • Every public var in src or enterprise/backend/src must have docstring
  • Format using Markdown conventions
  • Reference other vars with [[other-var]] not backticks

Comments:

  • TODO format: ;; TODO (Name M/D/YY) -- description

Code Organization

Visibility:

  • Make everything ^:private unless it is used elsewhere
  • Try to organize namespaces to avoid declare (put public functions near the end)

Size and Structure:

  • Break up functions > 20 lines
  • Lines ≤ 120 characters
  • No blank lines within definition forms (except pairwise let/cond)

Style Conventions

Keywords and Metadata:

  • Prefer namespaced keywords for internal use: :query-type/normal not :normal
  • Tag variables with :arglists metadata if they're functions but wouldn't otherwise have it

Tests

Organization:

  • Break large tests into separate deftest forms for logically separate test cases
  • Test names should end in -test or -test-<number>

Performance:

  • Mark pure function tests ^:parallel

Modules

OSS Modules:

  • Follow metabase.<module>.* pattern
  • Source in src/metabase/<module>/

Enterprise Modules:

  • Follow metabase-enterprise.<module>.* pattern
  • Source in enterprise/backend/src/metabase_enterprise/<module>/

Module Structure:

  • REST API endpoints go in <module>.api or <module>.api.* namespaces
  • Put module public API in <module>.core using Potemkin imports
  • Put Toucan models in <module>.models.*
  • Put settings in <module>.settings
  • Put schemas in <module>.schema

Module Linters:

  • Do not cheat module linters with :clj-kondo/ignore [:metabase/modules]

REST API Endpoints

Required Elements:

  • All new endpoints must have response schemas (:- <schema> after route string)
  • All endpoints need Malli schemas for parameters (detailed and complete)
  • All new REST API endpoints MUST HAVE TESTS

Naming Conventions:

  • Query parameters use kebab-case
  • Request bodies use snake_case
  • Routes use singular nouns (e.g., /api/dashboard/:id)

Behavior:

  • GET endpoints should not have side effects (except analytics)
  • defendpoint forms should be small wrappers around Toucan model code

MBQL (Metabase Query Language)

Restrictions:

  • No raw MBQL introspection outside of lib, lib-be, or query-processor modules
  • Use Lib and MBQL 5 in new source code; avoid legacy MBQL

Database and Models

Naming:

  • Model names and table names should be singular nouns
  • Application database uses snake_case identifiers

Best Practices:

  • Use t2/select-one-fn instead of fetching entire rows for one column
  • Put correct behavior in Toucan methods, not separate helper functions

Drivers

Documentation:

  • New driver multimethods must be mentioned in docs/developers-guide/driver-changelog.md

Implementation:

  • Driver implementations should pass driver argument to other driver multimethods
  • Don't hardcode driver names in implementations
  • Minimize logic inside read-column-thunk in JDBC-based drivers

Miscellaneous

Examples:

  • Example data should be bird-themed if possible

Linter Suppressions:

  • Use proper format for kondo suppressions
  • No #_:clj-kondo/ignore (keyword form)

Configurable Options:

  • Don't define configurable options that can only be set with environment variables

  • Use :internal defsetting instead

    Linting and Formatting

  • Lint PR: ./bin/mage kondo-updated master (or whatever target branch)

    • Call the command one time at the beginning, record the results, then work through the problems one at a time.
    • If the solution is obvious, then please apply the fix. Otherwise skip it.
    • If you fix all the issues (and verify by rerunning the kondo-updated command):
      • commit the change with a succinct and descriptive commit message
  • Lint File: ./bin/mage kondo <file or files>

    • Use the linter as a way to know that you are adhering to conventions in place in the codebase
  • Lint Changes: ./bin/mage kondo-updated HEAD

  • Format: ./bin/mage cljfmt-files [path]

Testing

  • Run a test: ./bin/mage run-tests namespace/test-name
  • Run all tests in a namespace: ./bin/mage run-tests namespace
  • Run all tests for a module: ./bin/mage run-tests test/metabase/notification Because the module lives in that directory.

Note: the ./bin/mage run-tests command accepts multiple args, so you can pass ./bin/mage run-tests namespace/test-name namespace/other-test namespace/third-test to run 3 tests, or ./bin/mage run-tests test/metabase/module1 test/metabase/module2 to run 2 modules.

Code Readability

  • Check Code Readability: ./bin/mage -check-readable <file> [line-number]
    • Run after every change to Clojure code
    • Check specific line first, then entire file if readable

REPL Usage

Note: If you have clojure-mcp tools available (check for tools like clojure_eval), always prefer those over ./bin/mage -repl. The MCP tools provide better integration, richer feedback, and avoid shell escaping issues. Only use ./bin/mage -repl as a fallback when clojure-mcp is not available.

  • Evaluating Clojure Code: ./bin/mage -repl '<code>'
    • See "Sending Code to the REPL" section for more details

Sending Code to the REPL

  • Send code to the metabase process REPL using: ./bin/mage -repl '(+ 1 1)' where (+ 1 1) is your Clojure code.
    • See ./bin/mage -repl -h for more details.
    • If the Metabase backend is not running, you'll see an error message with instructions on how to start it.

Working with Files and Namespaces

  1. Load a file and call functions with fully qualified names:

To call your.namespace/your-function on arg1 and arg2:

./bin/mage -repl --namespace your.namespace '(your-function arg1 arg2)'

DO NOT use "require", "load-file" etc in the code string argument.

Understanding the Response

The ./bin/mage -repl command returns three separate, independent outputs:

  • value: The return value of the last expression (best for data structures)
  • stdout: Any printed output from println etc. (best for messages)
  • stderr: Any error messages (best for warnings and errors)

Example call:

./bin/mage -repl '(println "Hello, world!") '\''({0 1, 1 3, 2 0, 3 2} {0 2, 1 0, 2 3, 3 1})'

Example response:

ns: user
session: 32a35206-871c-4553-9bc9-f49491173d1c
value:  ({0 1, 1 3, 2 0, 3 2} {0 2, 1 0, 2 3, 3 1})
stdout:  Hello, world!
stderr:

For effective REPL usage:

  • Return data structures as function return values
  • Use println for human-readable messages
  • Print errors to stderr

Review guidelines

What to flag:

  • Check compliance with the Metabase Clojure style guide (included above)
  • If CLOJURE_STYLE_GUIDE.adoc exists in the working directory, also check compliance with the community Clojure style guide
  • Flag all style guide violations

What NOT to post:

  • Do not post comments congratulating someone for trivial changes or for following style guidelines
  • Do not post comments confirming things "look good" or telling them they did something correctly
  • Only post comments about style violations or potential issues

Example bad code review comments to avoid:

This TODO comment is properly formatted with author and date - nice work!

Good addition of limit 1 to the query - this makes the test more efficient without changing its behavior.

The kondo ignore comment is appropriately placed here

Test name properly ends with -test as required by the style guide.

Special cases:

  • Do not post comments about missing parentheses (these will be caught by the linter)

Quick review checklist

Use this to scan through changes efficiently:

Naming

  • [ ] Descriptive names (no tbl, zs')
  • [ ] Pure functions named as nouns describing their return value
  • [ ] kebab-case for all variables and functions
  • [ ] Side-effect functions end with !
  • [ ] No namespace-alias repetition in function names

Documentation

  • [ ] Public vars in src or enterprise/backend/src have useful docstrings
  • [ ] Docstrings use Markdown conventions
  • [ ] References use [[other-var]] not backticks
  • [ ] TODO comments include author and date: ;; TODO (Name 1/1/25) -- description

Code Organization

  • [ ] Everything ^:private unless used elsewhere
  • [ ] No declare when avoidable (public functions near end)
  • [ ] Functions under 20 lines when possible
  • [ ] No blank lines within definition forms (except pairwise constructs in let/cond)
  • [ ] Lines ≤ 120 characters

Tests

  • [ ] Separate deftest forms for distinct test cases
  • [ ] Pure tests marked ^:parallel
  • [ ] Test names end in -test or -test-<number>

Modules

  • [ ] Correct module patterns (OSS: metabase.<module>.*, EE: metabase-enterprise.<module>.*)
  • [ ] API endpoints in <module>.api namespaces
  • [ ] Public API in <module>.core with Potemkin
  • [ ] No cheating module linters with :clj-kondo/ignore [:metabase/modules]

REST API

  • [ ] Response schemas present (:- <schema>)
  • [ ] Query params use kebab-case, bodies use snake_case
  • [ ] Routes use singular nouns (e.g., /api/dashboard/:id)
  • [ ] GET has no side effects (except analytics)
  • [ ] Malli schemas detailed and complete
  • [ ] All new endpoints have tests

MBQL

  • [ ] No raw MBQL manipulation outside lib, lib-be, or query-processor modules
  • [ ] Uses Lib and MBQL 5, not legacy MBQL

Database

  • [ ] Model and table names are singular nouns
  • [ ] Uses t2/select-one-fn instead of selecting full rows for one column
  • [ ] Logic in Toucan methods, not helper functions

Drivers

  • [ ] New multimethods documented in docs/developers-guide/driver-changelog.md
  • [ ] Passes driver argument to other driver methods (no hardcoded driver names)
  • [ ] Minimal logic in read-column-thunk

Miscellaneous

  • [ ] Example data is bird-themed when possible
  • [ ] Kondo linter suppressions use proper format (not #_:clj-kondo/ignore keyword form)

Pattern matching table

Quick scan for common issues:

Pattern Issue
calculate-age, get-user Pure functions should be nouns: age, user
update-db, save-model Missing ! for side effects: update-db!, save-model!
snake_case_var Should use kebab-case
Public var without docstring Add docstring explaining purpose
;; TODO fix this Missing author/date: ;; TODO (Name 1/1/25) -- description
(defn foo ...) in namespace used elsewhere Should be (defn ^:private foo ...)
Function > 20 lines Consider breaking up into smaller functions
/api/dashboards/:id Use singular: /api/dashboard/:id
Query params with snake_case Use kebab-case for query params
New API endpoint without tests Add tests for the endpoint

Feedback format examples

For style violations:

This pure function should be named as a noun describing its return value. Consider user instead of get-user.

For missing documentation:

This public var needs a docstring explaining its purpose, inputs, and outputs.

For organization issues:

This function is only used in this namespace, so it should be marked ^:private.

For API conventions:

Query parameters should use kebab-case. Change user_id to user-id.