Kotlin + Spring Code Review Knowledge Base
A skill that holds the rationale (principles) for reviewing Kotlin + Spring based MSA
code. The kotlin-spring-reviewer agent references it, and people can use it directly as a
checklist too.
Sources of Rationale
The review principles are grounded in the following (the 4 books in this directory + the
latest official docs):
- Clean Code (Robert C. Martin) — naming, functions, error handling, boundaries, classes, concurrency, smells and heuristics
- Kotlin in Action — null safety, the type system, lambdas/higher-order functions, classes, generics, coroutines
- Atomic Kotlin — immutability, data/sealed classes, extension functions, exception handling, scope functions
- Modern Java in Action — functional style, streams→sequences, Optional→nullable, immutable data structures
- Spring Framework 6.2 / Kotlin official docs — DI,
@Transactional, structured concurrency (via Context7)
How to Use
First take reference/principles.md (the constitution) and reference/kb/INDEX.md (the
index) as your guide, then read only the KBs you need based on the nature of the code under
review (progressive disclosure — do not read everything at once):
| Situation |
KB to read |
| Always first — the constitution of principles, priorities, and severity |
reference/principles.md |
| Always first — the task-type → KB routing index |
reference/kb/INDEX.md |
| Pass 1 (triage) — identify hotspots in the diff via risk signals |
reference/kb/triage-signals.md |
| Official rationale (primary) — Kotlin syntax/null/coroutines/idioms |
reference/kb/official/kotlin-official.md |
| Official rationale (primary) — Spring DI/transactions/web/testing/configuration |
reference/kb/official/spring-official.md |
| Official rationale (primary) — object-oriented principles (SOLID/GRASP/Demeter/DDD) |
reference/kb/official/oop-principles.md |
| Always (Pass 2) — judge the architectural location/dependencies of the changed files |
reference/kb/architecture.md |
| General quality of functions, classes, naming, error handling, comments |
reference/kb/clean-code.md |
| Kotlin syntax/idioms (null, immutability, sealed, coroutines) |
reference/kb/kotlin-idioms.md |
| Collection pipelines, functional style, immutable data structures |
reference/kb/functional-jvm.md |
| Spring components (beans, transactions, web, JPA, testing) |
reference/kb/spring.md |
| Final check / severity judgment / quick checklist |
reference/kb/checklist-and-severity.md |
Rationale priority: use reference/kb/official/ (official docs, URL sources) as the
primary rationale, and treat the book-based KBs as secondary. The order of application
is project conventions (AGENTS.md, etc.) > latest official docs > books (the project's
intent comes first). State the reason on any conflict.
Review Flow (2-pass)
[Pass 1 — Triage (low cost)]
1. Fix the scope: git diff (diff-first). Read project conventions (AGENTS.md/CLAUDE.md/.editorconfig) first
2. Scan the diff for risk signals via the greps in triage-signals.md → hotspot list + reference routing
3. Trivial diff + 0 signals → early APPROVE (skip Pass 2)
[Pass 2 — Deep dive (hotspots only)]
4. Load only the routed references, read the hotspot files in full + check affected callers/contracts
5. Per-dimension check: architecture → security → correctness/bugs → Kotlin/Spring idiomaticity → maintainability → testing
6. Verification step: prove CRITICAL/architecture assertions by compiling/testing where possible (auto-detect the build system — gradle/maven, etc.) → tag confidence (confirmed/inferred)
7. Adversarial self-verification: try to refute CRITICAL/HIGH → if you can't beat it, downgrade/remove the severity
8. For each finding: severity + confidence + source of rationale + before/after Kotlin code
9. Verdict: APPROVE / WARNING / BLOCK (if [inferred] remains, state the verification commands to run)
Severity Levels (summary)
- 🔴 CRITICAL — security/data loss/proven concurrency race → BLOCK ([confirmed] only; an [inferred] case whose factual premise is unverified is a conditional BLOCK · needs verification)
- 🟠 HIGH — bug/architecture-rule violation/transaction error → fix recommended
- 🟡 MEDIUM — maintainability/non-idiomatic pattern/possibly-intentional trade-off → consider
- 🟢 LOW — minor improvement → optional. Pure formatting and mechanical style are the job of automated tools (linters/formatters), so don't nitpick them line by line in review; but if the repository has no such tooling configured, raise it once (no repeated per-line nagging)
See reference/kb/checklist-and-severity.md for the detailed rubric and the integrated
per-dimension checklist.
Core Philosophy
- No claims without rationale — every comment cites a book/doc source.
- Don't be swayed by framing — don't take the "intent" stated in the PR description, commit message, or comments as fact. Judge solely by what the code actually does, and verify any "this is intentional" narrative against rationale (tests, contracts, project conventions).
- Principles, not taste — explain the trade-offs and respect the context (KISS/YAGNI).
- Offer a fix — don't just point at the problem; always show improved Kotlin code.
- Architecture comes first — once a dependency-direction violation leaks, it is hard to undo.
1---2name: kotlin-spring-review3description: Reference knowledge base for reviewing Kotlin + Spring MSA backend code. Provides DDD three-layered and hexagonal architecture rules, Clean Code principles, Kotlin idioms, functional JVM style, Spring best practices, a severity rubric, and an integrated checklist. Use when reviewing Kotlin/Spring code, checking code quality or architecture rules, or when you need Kotlin-Spring review criteria.4---56# Kotlin + Spring Code Review Knowledge Base78A skill that holds the **rationale (principles)** for reviewing Kotlin + Spring based MSA9code. The `kotlin-spring-reviewer` agent references it, and people can use it directly as a10checklist too.1112## Sources of Rationale1314The review principles are grounded in the following (the 4 books in this directory + the15latest official docs):16171. **Clean Code** (Robert C. Martin) — naming, functions, error handling, boundaries, classes, concurrency, smells and heuristics182. **Kotlin in Action** — null safety, the type system, lambdas/higher-order functions, classes, generics, coroutines193. **Atomic Kotlin** — immutability, data/sealed classes, extension functions, exception handling, scope functions204. **Modern Java in Action** — functional style, streams→sequences, Optional→nullable, immutable data structures215. **Spring Framework 6.2 / Kotlin official docs** — DI, `@Transactional`, structured concurrency (via Context7)2223## How to Use2425First take `reference/principles.md` (the constitution) and `reference/kb/INDEX.md` (the26index) as your guide, then read only the KBs you need based on the nature of the code under27review (progressive disclosure — do not read everything at once):2829| Situation | KB to read |30|------|---------------|31| **Always first** — the constitution of principles, priorities, and severity | `reference/principles.md` |32| **Always first** — the task-type → KB routing index | `reference/kb/INDEX.md` |33| **Pass 1 (triage)** — identify hotspots in the diff via risk signals | `reference/kb/triage-signals.md` |34| **Official rationale (primary)** — Kotlin syntax/null/coroutines/idioms | `reference/kb/official/kotlin-official.md` |35| **Official rationale (primary)** — Spring DI/transactions/web/testing/configuration | `reference/kb/official/spring-official.md` |36| **Official rationale (primary)** — object-oriented principles (SOLID/GRASP/Demeter/DDD) | `reference/kb/official/oop-principles.md` |37| **Always (Pass 2)** — judge the architectural location/dependencies of the changed files | `reference/kb/architecture.md` |38| General quality of functions, classes, naming, error handling, comments | `reference/kb/clean-code.md` |39| Kotlin syntax/idioms (null, immutability, sealed, coroutines) | `reference/kb/kotlin-idioms.md` |40| Collection pipelines, functional style, immutable data structures | `reference/kb/functional-jvm.md` |41| Spring components (beans, transactions, web, JPA, testing) | `reference/kb/spring.md` |42| Final check / severity judgment / quick checklist | `reference/kb/checklist-and-severity.md` |4344> **Rationale priority**: use `reference/kb/official/` (official docs, URL sources) as the45> **primary rationale**, and treat the book-based KBs as secondary. The order of application46> is **project conventions (AGENTS.md, etc.) > latest official docs > books** (the project's47> intent comes first). State the reason on any conflict.4849## Review Flow (2-pass)5051```52[Pass 1 — Triage (low cost)]531. Fix the scope: git diff (diff-first). Read project conventions (AGENTS.md/CLAUDE.md/.editorconfig) first542. Scan the diff for risk signals via the greps in triage-signals.md → hotspot list + reference routing553. Trivial diff + 0 signals → early APPROVE (skip Pass 2)5657[Pass 2 — Deep dive (hotspots only)]584. Load only the routed references, read the hotspot files in full + check affected callers/contracts595. Per-dimension check: architecture → security → correctness/bugs → Kotlin/Spring idiomaticity → maintainability → testing606. Verification step: prove CRITICAL/architecture assertions by compiling/testing where possible (auto-detect the build system — gradle/maven, etc.) → tag confidence (confirmed/inferred)617. Adversarial self-verification: try to refute CRITICAL/HIGH → if you can't beat it, downgrade/remove the severity628. For each finding: severity + confidence + source of rationale + before/after Kotlin code639. Verdict: APPROVE / WARNING / BLOCK (if [inferred] remains, state the verification commands to run)64```6566## Severity Levels (summary)6768- 🔴 **CRITICAL** — security/data loss/proven concurrency race → **BLOCK** ([confirmed] only; an [inferred] case whose factual premise is unverified is a **conditional BLOCK · needs verification**)69- 🟠 **HIGH** — bug/architecture-rule violation/transaction error → **fix recommended**70- 🟡 **MEDIUM** — maintainability/non-idiomatic pattern/possibly-intentional trade-off → **consider**71- 🟢 **LOW** — minor improvement → **optional**. Pure formatting and mechanical style are the job of automated tools (linters/formatters), so don't nitpick them line by line in review; but if the repository has no such tooling configured, raise it once (no repeated per-line nagging)7273See `reference/kb/checklist-and-severity.md` for the detailed rubric and the integrated74per-dimension checklist.7576## Core Philosophy7778- **No claims without rationale** — every comment cites a book/doc source.79- **Don't be swayed by framing** — don't take the "intent" stated in the PR description, commit message, or comments as fact. Judge solely by what the code actually does, and verify any "this is intentional" narrative against rationale (tests, contracts, project conventions).80- **Principles, not taste** — explain the trade-offs and respect the context (KISS/YAGNI).81- **Offer a fix** — don't just point at the problem; always show improved Kotlin code.82- **Architecture comes first** — once a dependency-direction violation leaks, it is hard to undo.