本文へ移動
cccskills
無料GitHub で公開

kotlin-best-practices

Kotlin coding standards including null safety, Either error handling, coroutines, and Exposed ORM patterns. Use when writing Kotlin code, reviewing code quality, or learning project patterns.

インストール方法を見る

含まれるファイル(2)

  • SKILL.md1.7 KB
  • code-patterns.md3.2 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

Kotlin Best Practices — Quick Reference

Null Safety

!! is banned. Use ?., ?:, or null check for smart cast.

See code-patterns.md for all null safety examples.

Either Error Handling

Managers return Either<ClientException, T> -- never throw. Controllers unwrap with .throwOrValue().

See code-patterns.md for manager + controller examples.

Enum Usage

Never hardcode strings when an enum exists. Use EnumName.VALUE.value everywhere.

See code-patterns.md for enum definition and usage patterns.

Exposed ORM Patterns

Extend UUIDTable, use text() not varchar(). Always filter deletedAt.isNull(). Soft delete via timestamp update, never hard delete.

See code-patterns.md for table, query, and soft delete examples.

Transaction Rules

Reads use db.replica, writes use db.primary. Multi-table writes go in one transaction block -- all succeed or all rollback.

See code-patterns.md for transaction examples.

Conversion Pattern

Put companion object { fun from(entity) } inside Response DTOs. Never create separate mapper files.

See code-patterns.md for the full pattern.

What to Avoid

  • !! -- always use ?., ?:, or null check
  • @Suppress -- fix the root cause
  • Throwing exceptions -- return Either.left() instead
  • VARCHAR in SQL -- use TEXT
  • Hardcoded strings for enum values
  • Table base class -- use UUIDTable
  • Field injection -- use constructor injection

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

Creates RPC-style endpoint following layered architecture (Controller → Manager → Repository). Use when creating new API endpoints or CRUD operations.

日本語の概要は準備中です。原文の説明を表示しています。

c0x12c/ai-toolkit1082026年6月18日 更新

Write blog posts, guides, tutorials, and long-form content. Sounds like a real person, not AI. Use when the user wants polished written content.

日本語の概要は準備中です。原文の説明を表示しています。

c0x12c/ai-toolkit1082026年6月18日 更新

Design RPC-style APIs with layered architecture (Controller → Manager → Repository). Use when creating new API endpoints, designing API contracts, or reviewing API patterns.

日本語の概要は準備中です。原文の説明を表示しています。

c0x12c/ai-toolkit1082026年6月18日 更新

Run a structured brainstorm session for startup ideas. Takes a theme or problem and generates ideas with quick gut-checks. Use when the user wants to explore a space or generate new ideas.

日本語の概要は準備中です。原文の説明を表示しています。

c0x12c/ai-toolkit1082026年6月18日 更新

Run real browser QA with Playwright. Use when testing a frontend feature, verifying UI before PR, smoke testing after deploy, or investigating reported visual bugs.

日本語の概要は準備中です。原文の説明を表示しています。

c0x12c/ai-toolkit1082026年6月18日 更新

CI/CD pipeline patterns for GitHub Actions, PR automation, and deployment workflows. Use when setting up CI, fixing broken pipelines, automating PR checks, or configuring deployment.

日本語の概要は準備中です。原文の説明を表示しています。

c0x12c/ai-toolkit1082026年6月18日 更新

c0x12c のスキルをすべて見る

このスキルの問題を報告する