SuperAPI AI Directory

kotlin-compiler-plugin-dev

Coding & development

View repository

Updated 10-16 08:46

About this skill

Kotlin Compiler Plugin Dev

Support the development and review of Kotlin Compiler Plugins based on survey data of existing plugins.

Step 0: Check whether deepwiki MCP is available

When the skill starts, first check whether deepwiki MCP is available.

ToolSearch で mcp__deepwiki__ask_question を検索
  • If available: Use deepwiki MCP for detailed investigation in the subsequent steps
  • If not available: Inform the user of the following:

deepwiki MCP is not available. By configuring deepwiki MCP, you can dig deep into the source code of existing plugins in real time. Configuration method: https://deepwiki.com Please refer to the documentation. Even without deepwiki, the survey data in references/ provides sufficient information, so we will continue as is.

Even without deepwiki, continue the work using the data in references/.

Step 1: Understand the user's requirements

Identify one of the following:

  1. Development mode: Want to create a new compiler plugin / want to add functionality to an existing plugin
  2. Review mode: Want to review/evaluate an existing compiler plugin implementation
  3. Investigation mode: Want to find precedents for what you want to do

Step 2: Search for precedents in overview.md

references/overview.md and search for precedents that match the user's requirements.

Search perspectives

  • Desired functionality → Look for matches in the "Implemented functionality" column of the table
  • Extension Point you want to use → Filter by the "FIR or IR" column of the table
  • Plugins with the same pattern → references/patterns.md Refer to the pattern classification

Once a matching plugin is found, present the list of precedents to the user.

Step 3: Check the details in details/

For the precedents found in Step 2,references/details/ read the corresponding file inside

Target plugin File to read
noarg, allopen, sam-with-receiver references/details/01-noarg-allopen-sam-with-receiver.md
KSP, atomicfu references/details/02-ksp-atomicfu.md
kotlinx.serialization references/details/03-kotlinx-serialization.md
Koin, Anvil, Metro, MoshiX, Redacted references/details/04-koin-anvil-metro-moshix-redacted.md
DebugLog, Zipline, Arrow Optics, back-in-time, Kondition, suspend-kontext, AspectK references/details/05-debuglog-zipline-arrow-kitakkun.md
assign-plugin, jvm-abi-gen, kotlin-dataframe, scripting references/details/06-assign-jvm-abi-gen-dataframe-scripting.md
lombok, compose references/details/07-lombok-compose.md
parcelize, power-assert, kapt, js-plain-objects references/details/08-parcelize-power-assert-kapt-js-plain-objects.md

The details file includes the following:

  • Registration contents of CompilerPluginRegistrar
  • Inherited classes and overridden methods of each Extension
  • Details of specific behavior
  • List of diagnostic messages

Step 4: Dig deep into the latest source code with deepwiki MCP (optional)

If deepwiki MCP is available and the information in details/ is not sufficient, check the latest source code with deepwiki.

How to use

Ask deepwiki questions based on the GitHub repository information in the Source code url column of overview.md:

mcp__deepwiki__ask_question
  repo_name: "JetBrains/kotlin"  (または "google/ksp" 等)
  question: "How does FirNoArgConstructorGenerator implement getCallableNamesForClass and generateConstructors?"

Cases where deepwiki should be used

  • When the information contained in details/ may be outdated
  • When you want to accurately check the latest implementation of a specific method
  • When you want to check surrounding code not in details/ (tests, utilities, etc.)

Cases where deepwiki does not need to be used

  • Selecting Extension Points or judging design patterns → references/ is sufficient
  • Identifying which plugins are useful as references → overview.md is sufficient

Step 5: Outputting the results

Output according to the mode.

Output in development mode

## Compiler Plugin 設計提案

### やりたいこと
- ...

### 推奨する Extension Point
| Extension Point | 役割 | 前例 |
|---|---|---|

### 推奨する設計パターン
- パターン: (1〜4 のいずれか)
- 理由: ...

### 最も参考にすべきプラグイン
- プラグイン名: ...
- 類似度: ...
- 参考ファイル: ... (URL)

### 実装ステップ
1. ...
2. ...

Output in review mode

## Compiler Plugin レビューレポート

### 概要
- プラグイン名: ...
- 使用 Extension Point: ...
- K2 対応: Yes/No

### Extension Point の選択
- [適切/要改善] FIR Extension: ...
- [適切/要改善] IR Extension: ...

### 設計パターン
- 採用パターン: パターン 1/2/3/4
- 前例との類似度: ... (最も近いプラグイン名)

### チェックリスト結果
(references/review-checklist.md のチェックリストの結果。複数バージョン対応セクションも含める)

### 複数 Kotlin バージョン対応
- バージョニング戦略: タンデム / 独立
- アーキテクチャ: compat module layer / source set separation / 未対応
- 問題点 (minVersion 設定ミス、mergeServiceFiles 漏れ、fail-fast 設定等):

### 問題点・改善提案
1. ...
2. ...

### 前例参照
- 類似プラグイン: ... (URL)
- 参考にすべきファイル: ... (URL)

Output in investigation mode

Present a list of precedents, along with an overview and source code URL for each precedent.