用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/JetBrains/intellij-community --skill pseudo-kmp命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
| name | pseudo-kmp |
| description | Create or modify IntelliJ pseudo-KMP modules using expect/actual emulation. |
The monorepo is compiled by JPS, which does not support Kotlin Multiplatform. To emulate KMP expect/actual declarations, the Fleet team created the expects-compiler-plugin. This skill covers how to set up and work with modules that use this mechanism.
linkToActual() and @Actual API docsWhen creating or migrating a pseudo-KMP module:
Register in the structure test. Add your module name to the multiplatformModules list in com.intellij.ideaProjectStructure.fast.MultiplatformModuleStructureTest (tests/ideaProjectStructure/testSrc/com/intellij/ideaProjectStructure/fast/MultiplatformModuleStructureTest.kt).
Use only allowed library dependencies. The test enforces a closed set:
kotlin-stdlibkotlinx-coroutines-corekotlinx-coroutines-debugjetbrains-annotationskotlinx-serialization-corekotlinx-serialization-jsonkotlin-reflectkotlinx-collections-immutableIf you need a new library, add it to allowedMultiplatformLibraryDependencies in the test. Dependencies on other multiplatform modules (those in multiplatformModules) are also allowed.
Set up source folders:
src/ — common codesrcJvm/ or srcJvmMain/ — JVM-specific code (Java code can live here too)srcWasmJs/ or srcWasmJsMain/ — WasmJs-specific codesrcJsMain/ — JS-specific codesrcNativeMain/ — Native-specific codeImportant: Do NOT add srcWasmJs/srcWasmJsMain as a source root in the .iml file. The IDE would try to compile it in JVM mode.
Add the .pseudoCommonKotlinSourceSet marker file to the common source root (e.g., src/.pseudoCommonKotlinSourceSet). This empty file tells the Kotlin plugin that the source set is common code, preventing Optimize Imports from removing imports that are unnecessary on JVM but mandatory in common code (e.g., @JvmStatic, @JvmField).
Your .iml file needs two things: the multiplatformSupport dependency and the compiler plugin registration.
Use community/platform/util/multiplatform/intellij.platform.util.multiplatform.iml as a reference. To find the current plugin version, check that file rather than hardcoding.
<orderEntry type="module" module-name="intellij.platform.multiplatformSupport" scope="PROVIDED" />
<facet type="kotlin-language" name="Kotlin">
<configuration version="5" platform="JVM 1.8" allPlatforms="JVM [1.8]" useProjectSettings="false">
<compilerSettings>
<option name="additionalArguments" value="-Xjvm-default=all ..." />
</compilerSettings>
<compilerArguments>
<stringArguments>
<stringArg name="jvmTarget" arg="1.8" />
<stringArg name="apiVersion" arg="2.3" />
<stringArg name="languageVersion" arg="2.3" />
</stringArguments>
<arrayArguments>
<arrayArg name="pluginClasspaths">
<args>$MAVEN_REPOSITORY$/jetbrains/fleet/expects-compiler-plugin/{VERSION}/expects-compiler-plugin-{VERSION}.jar
Replace {VERSION} with the version from the reference IML.
Only top-level functions are supported. Both the expect and actual declarations must be in the same module.
src/)Use linkToActual() as the function body:
import fleet.util.multiplatform.linkToActual
internal fun myFunction(param1: String, param2: Int): Boolean = linkToActual()
srcJvm/, srcWasmJs/, etc.)Annotate with @Actual. The function name must be the expect function name + platform suffix:
import fleet.util.multiplatform.Actual
@Actual
internal fun myFunctionJvm(param1: String, param2: Int): Boolean {
// JVM implementation
}
| Platform | Suffix | Source folder |
|---|---|---|
| JVM | Jvm | srcJvm/ or srcJvmMain/ |
| WasmJs | WasmJs | srcWasmJs/ or srcWasmJsMain/ |
| JS | Js | srcJsMain/ |
| Native | Native | srcNativeMain/ |
| Multi-platform build | Impl | (rare) |
Common (community/platform/util/base/multiplatform/src/com/intellij/util/text/CharArrayUtilKmp.kt):
internal fun getCharsPlatformSpecific(
sequence: CharSequence, srcOffset: Int, dst: CharArray, dstOffset: Int, len: Int
): Boolean = linkToActual()
JVM actual (community/platform/util/base/multiplatform/srcJvmMain/com/intellij/util/text/jvm.kt):
@Actual
internal fun getCharsPlatformSpecificJvm(
string: CharSequence, srcOffset: Int, dst: CharArray, dstOffset: Int, len: Int
): Boolean {
if (string is CharBuffer) { /* ... */ }
return false
}
@JvmStatic, @JvmField, and similar annotations are not auto-imported in common code. Import them manually. The .pseudoCommonKotlinSourceSet marker prevents the IDE from removing these imports.srcJvm/)../build/jpsModelToBazel.cmd after modifying any .iml files.MultiplatformModuleStructureTest to validate module structure:
./tests.cmd --module tests.ideaProjectStructure --test com.intellij.ideaProjectStructure.fast.MultiplatformModuleStructureTest
mcp__ijproxy__lint_files.The monorepo does not publish multiplatform artifacts to Maven Central directly. Separate repositories with Gradle infrastructure extract module sources, compile with true KMP, and publish. See fleet-multiplatform-deps and fleet-parser-collection in JetBrains Space.
Convert Product DSL module sets into bundled wrapper plugins.
Convert Product DSL module sets into bundled wrapper plugins.
Migrate IntelliJ JPS module tests to Bazel and debug Bazel-only test/runtime/plugin dependency failures.