.agents/skills/gradle-version-catalog/SKILL.md
Gradleプロジェクトで依存関係のバージョンを一元管理する場合に使用する。複数のサブプロジェクトで共通の依存関係を共有し、バージョンの不一致を防ぐために使用する。
npx skillsauth add ymkz/demo-monorepo gradle-version-catalogInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Gradle Version Catalogを使用して、プロジェクト全体の依存関係バージョンをgradle/libs.versions.tomlで一元管理する。
gradle/
├── libs.versions.toml # Version catalog定義
└── convention/ # Convention plugins(オプション)
settings.gradle.kts
build.gradle.kts
gradle/libs.versions.toml:
[versions]
spring-boot = "3.2.0"
junit = "5.10.0"
spotless = "6.23.0"
[libraries]
spring-boot-bom = { module = "org.springframework.boot:spring-boot-dependencies", version.ref = "spring-boot" }
junit-bom = { module = "org.junit:junit-bom", version.ref = "junit" }
spring-boot-starter-web = { module = "org.springframework.boot:spring-boot-starter-web" }
spring-boot-starter-test = { module = "org.springframework.boot:spring-boot-starter-test" }
junit-jupiter = { module = "org.junit.jupiter:junit-jupiter" }
[bundles]
unit-test = [
"spring-boot-starter-test",
"junit-jupiter"
]
[plugins]
spring-boot = { id = "org.springframework.boot", version.ref = "spring-boot" }
spotless = { id = "com.diffplug.spotless", version.ref = "spotless" }
settings.gradle.kts:
pluginManagement {
repositories {
mavenCentral()
gradlePluginPortal()
}
}
plugins {
id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0"
}
build.gradle.kts:
plugins {
alias(libs.plugins.spring.boot)
alias(libs.plugins.spotless)
}
dependencies {
// BOMによるバージョン管理
implementation(platform(libs.spring.boot.bom))
testImplementation(platform(libs.junit.bom))
// 個別ライブラリ
implementation(libs.spring.boot.starter.web)
// Bundle(複数ライブラリのまとめ)
testImplementation(libs.bundles.unit.test)
}
| 機能 | 説明 | 例 |
|------|------|-----|
| [versions] | バージョン番号の定義 | spring-boot = "3.2.0" |
| [libraries] | ライブラリの定義 | spring-boot-starter-web = { ... } |
| [bundles] | ライブラリのグループ化 | unit-test = ["junit-jupiter", ...] |
| [plugins] | Gradleプラグインの定義 | spring-boot = { id = "...", version.ref = "..." } |
# ✅ ハイフン区切り(Kebab case)
spring-boot-starter-web = { ... }
# ❌ キャメルケースやアンダースコアは避ける
springBootStarterWeb = { ... } # NG
spring_boot_starter_web = { ... } # NG
[libraries]
# BOMを定義
spring-boot-bom = { module = "org.springframework.boot:spring-boot-dependencies", version.ref = "spring-boot" }
# バージョンなしでライブラリを定義(BOMから解決)
spring-boot-starter-web = { module = "org.springframework.boot:spring-boot-starter-web" }
// build.gradle.kts
dependencies {
implementation(platform(libs.spring.boot.bom))
implementation(libs.spring.boot.starter.web) // バージョン不要
}
[versions]
spring-boot = "3.2.0" # https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-dependencies
junit = "5.10.0" # https://mvnrepository.com/artifact/org.junit/junit-bom
// gradle/convention/build.gradle.kts
dependencies {
implementation(libs.spotless) // catalogからプラグインを参照
}
// gradle/convention/src/main/kotlin/common-conventions.gradle.kts
plugins {
id("com.diffplug.spotless")
}
spotless {
java {
palantirJavaFormat()
}
}
// settings.gradle.kts
includeBuild("gradle/convention")
include(":apps:core", ":apps:api")
// apps/api/build.gradle.kts
plugins {
id("common-conventions") // convention plugin
alias(libs.plugins.spring.boot)
}
dependencies {
implementation(platform(libs.spring.boot.bom))
implementation(libs.bundles.api)
}
// build.gradle.kts
buildscript {
ext {
set("springBootVersion", "3.2.0")
set("junitVersion", "5.10.0")
}
}
dependencies {
implementation("org.springframework.boot:spring-boot-starter-web:${property("springBootVersion")}")
}
# gradle/libs.versions.toml
[versions]
spring-boot = "3.2.0"
[libraries]
spring-boot-starter-web = { module = "org.springframework.boot:spring-boot-starter-web" }
// build.gradle.kts
dependencies {
implementation(libs.spring.boot.starter.web)
}
| 問題 | 原因 | 解決策 |
|------|------|--------|
| カタログが見つからない | ファイルパスが不正 | gradle/libs.versions.tomlに配置 |
| IDEで補完が効かない | 設定の同期待ち | Gradleプロジェクトを再インポート |
| Bundleが動作しない | ライブラリ名の不一致 | toml内の名前と一致しているか確認 |
| Plugin aliasがエラー | プラグインIDの誤り | plugins { alias(...) }構文を確認 |
tools
npm/pnpmベースのモノレポでWireitを使用してビルドパイプラインの依存関係を管理し、キャッシュと並列実行を活用する場合に使用する。
tools
このプロジェクトでは1リクエストあたりの全イベントを1つのJSONログに集約する「ワイドイベントロギング」を採用している。MDCとThreadLocalを組み合わせ、リクエスト処理のトレーサビリティ向上とパフォーマンス分析を実現する。
testing
単体テストとインテグレーションテストを使い分ける場合に使用する。テストピラミッドに基づき、テストの責務、実行速度、メンテナンスコストを考慮して適切なテスト戦略を選択する。
development
Spiceflow is a super simple, fast, and type-safe API and React Server Components framework for TypeScript. Works on Node.js, Bun, and Cloudflare Workers. Use this skill whenever working with spiceflow to get the latest docs and API reference.