compilation
Skill67 starsChanged 45 days agoApache-2.0View on GitHub
Validates compilation of generated Fakt fakes and diagnoses build failures — where fakes are generated, which path produced them, error classification, and root cause analysis. Use when compilation fails, generated code has errors, no fakes were generated, validating changes compile before committing, or checking if generated code is valid. Make sure to use this skill whenever a build error mentions generated fakes or the Fakt plugin — even if the root cause might be elsewhere, this skill's error classification pinpoints the actual source.
In this repository10 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- bdd-test-runnerSkill
- codegenSkill
- commitSkill
- feature-optionSkill
- issue-creatorSkill
- kotlin-api-consultantSkill
- prSkill
- sample-scaffolderSkill
- skill-creatorSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 76
Before filing a limitation as a bug, check docs/user-guide/known-issues.md.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Compilation Validator & Error Analyzer
Validates that generated fakes compile and diagnoses failures when they don't.
Instructions
1. Publish the Plugin First
Samples consume the plugin from Maven Local, so a stale publish is the most common cause of "my change had no effect":
make publish-local2. Build and Capture Output
Samples are separate Gradle builds, not subprojects of the root build:
./gradlew -p samples/jvm-single-module build 2>&1 | tee compilation.log
./gradlew -p samples/android-single-module build 2>&1 | tee -a compilation.log
./gradlew -p samples/kmp-single-module compileKotlinJvm --no-build-cache 2>&1 | tee -a compilation.log
./gradlew -p samples/kmp-multi-module build 2>&1 | tee -a compilation.logmake test-sample runs the KMP single-module sample end to end.
3. Know Which Path Generated the Fakes
- Default (cache-correct):
faktGenerate<Target><Compilation>tasks (FaktGenerateTask) run an embedded K2 compiler in a Gradle worker; FIR checkers emit the fakes (compiler/.../fir/generation/). - Legacy in-process: compilations the task can't drive (
LEGACY), or any build with-Pfakt.useExperimentalGenerateTask=false. Generation runs insidecompileKotlin*viaUnifiedFaktIrGenerationExtension.
Routing lives in FaktGradleSubplugin.kt (CacheCorrectDecision). If a failure only reproduces on one path, compare with the other by toggling the property above.
4. Validate Generated Files
Generated sources land in each sample's own build directory:
find samples/<name>/build/generated/fakt -name "Fake*.kt"Per @Fake type, expect FakeXxxImpl, the fakeXxx {} factory, and FakeXxxConfig.
If nothing was generated, check:
- The plugin is applied and
fakt { enabled }isn't set tofalse - The type is annotated with
@Fakein a main source set (main/commonMain) - The
faktGenerate*task ran:./gradlew -p samples/<name> tasks --all | grep faktGenerate - Logs: set
fakt { logLevel.set(LogLevel.DEBUG) }, or runmake debug
5. Check Generated Code Against the Source
- Parameter, return, nullable and generic types (class-level, method-level, bounded) match the source; all are supported, so a mismatch is a bug
suspendis preserved on overrides and behavior lambdas- Defaults follow
codegen/strategy/: primitives0/""/false, nullablenull, collectionsempty*(),Flow→emptyFlow(),Result<T>→Result.success(default),Unit→Unit; any other type gets a behavior that throws "requires explicit configuration" FakeXxxConfigholds behaviors as nullableinternal vars; the fake is immutable after construction unless mutable fakes are enabled
6. Classify the Error
| Category | Indicators | Where to look |
| Plugin loading | CompilerPluginRegistrar / ServiceLoader errors | make publish-local; compiler/src/main/resources/META-INF/services/ |
| FIR emission (default) | faktGenerate* task or worker failure, fake missing | compiler/.../fir/generation/ (FirFakeEmitter, FirToFakeDeclarationTranslator) |
| IR generation (legacy) | IrGenerationExtension stack traces | ir/generation/UnifiedFaktIrGenerationExtension.kt |
| FIR detection | @Fake validation diagnostics | fir/FaktFirExtensionRegistrar.kt, fir/checkers/ |
| Generated code | Errors in build/generated/fakt/... | Read the file; fix the generator in codegen-runtime/ |
| Imports / cross-module | Unresolved reference in generated code | compiler/.../core/context/ImportResolver.kt; type must be visible to the test source set |
| Kotlin version | NoSuchMethodError / NoClassDefFoundError on compiler classes | A compiler API missing in an older supported Kotlin — see kotlin-api-consultant |
Before filing a limitation as a bug, check docs/user-guide/known-issues.md.
7. Report
COMPILATION VALIDATION REPORT
Path: {default FaktGenerateTask | legacy in-process}
Generation: {count} files generated
Compilation: {Success/Failed} ({error_count} errors)
ERRORS:
1. [{category}] {description} — File: {path}:{line} — Fix: {solution}Related Skills
bdd-test-runner— Run tests after successful validationkotlin-api-consultant— Compiler API differences across supported Kotlin versionscodegen— Fix the generator behind a bad generated file
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

