Conversation
…, skills, and agent files Co-authored-by: afranken <763000+afranken@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR centralizes Kotlin-specific style and idiom guidance into a single canonical document (docs/KOTLIN.md) and updates contributor/agent documentation to link to it, reducing duplication and drift across the repo.
Changes:
- Added
docs/KOTLIN.mdas the authoritative Kotlin guidelines reference (idioms, anti-patterns, naming, test naming, KDoc). - Replaced duplicated Kotlin guidance in agent/skill docs with links to
docs/KOTLIN.md. - Updated testing documentation to reference
docs/KOTLIN.mdfor Kotlin test naming conventions.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
docs/TESTING.md |
Links Kotlin naming/test conventions to the new canonical Kotlin guidelines doc. |
docs/KOTLIN.md |
Introduces the centralized Kotlin guidelines (idioms, anti-patterns, naming, test naming, KDoc). |
AGENTS.md |
Condenses Kotlin guidance in Code Style to a single link to docs/KOTLIN.md. |
.claude/skills/test/SKILL.md |
Adds docs/KOTLIN.md to pre-reading for writing tests. |
.claude/skills/review/SKILL.md |
Replaces the Kotlin idioms checklist with a link to docs/KOTLIN.md. |
.claude/skills/refactor/SKILL.md |
Replaces Kotlin idioms/anti-patterns/naming/KDoc details with references to docs/KOTLIN.md. |
.claude/skills/document/SKILL.md |
Adds docs/KOTLIN.md to the documentation files table. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| ### Lambda Parameters | ||
| - Always name `it` in nested or non-trivial lambdas to avoid shadowing | ||
| - `.map { part -> ... }` instead of `.map { it.name }` |
There was a problem hiding this comment.
The lambda-parameter example doesn’t show an equivalent transformation: .map { it.name } becomes .map { part -> ... }, which changes semantics and may confuse readers. Consider using an equivalent explicit-parameter example (e.g., naming the parameter and still returning the same expression) or provide a nested-lambda example that actually demonstrates it shadowing.
| - `.map { part -> ... }` instead of `.map { it.name }` | |
| - `.map { part -> part.name }` instead of `.map { it.name }` |
| | `Collections.emptyList()` | `emptyList()` | | ||
| | `object.equals(other)` | `object == other` | | ||
| | `!(x is Foo)` / `!(list.contains(x))` | `x !is Foo` / `x !in list` | | ||
| | `for + add` loops | `.map { ... }` | |
There was a problem hiding this comment.
The anti-pattern entry “for + add loops → .map { ... }” is a bit too broad: map only fits 1:1 transforms, while many for+add loops are filtering/flattening/side-effecting (better covered by filter/mapNotNull/flatMap/forEach). Consider tightening the wording (e.g., “for loops that build a new list via add(f(x))”) or expanding the suggested alternatives to avoid misleading guidance in this canonical doc.
| | `for + add` loops | `.map { ... }` | | |
| | `for` loops that build a new list via `result.add(f(x))` | Collection ops: `.map` / `.filter` / `.mapNotNull` / `.flatMap` / `.forEach` as appropriate | |
Kotlin-specific idioms, naming conventions, anti-patterns, and KDoc guidelines were duplicated across
AGENTS.md,refactor/SKILL.md, andreview/SKILL.md. This centralizes them into a single authoritative reference.Changes
docs/KOTLIN.md— canonical Kotlin reference covering: idioms (null safety, expression bodies,when, scope functions, string templates), common anti-patterns table, naming conventions, test naming (internal, backtick names), and KDoc guidelinesAGENTS.md— Code Style section condensed to a link; rules in DO/DON'T remain as-is.claude/skills/refactor/SKILL.md— "Idiomatic Kotlin", "Common Anti-Patterns", "Meaningful Naming", and "KDoc" sections replaced with references todocs/KOTLIN.md.claude/skills/review/SKILL.md— "Kotlin Idioms" section replaced with a reference.claude/skills/test/SKILL.md—docs/KOTLIN.mdadded to the pre-reading list.claude/skills/document/SKILL.md—docs/KOTLIN.mdadded to the documentation files tabledocs/TESTING.md— Conventions section links todocs/KOTLIN.mdfor naming patternsOriginal prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.