add-java-code-snippets-in-docs
Skill4.6k starsChanged 7 months agoApache-2.0View on GitHub
Use when the user asks to add Java tabs/examples to mkdocs docs that already have Kotlin examples (files under docs/docs/**.md using === "Kotlin" / Knit INCLUDE+SUFFIX blocks). Handles mkdocs-material tabs, Knit directives, @JavaAPI bridge methods, and JVM factory classes.
Trending
More talk lately.about the whole repository
Who's talking about JetBrains/koog
- A Hacker News story“Koog, a Kotlin-based framework to build and run Al agents in idiomatic Kotlin”Hacker News · May 22, 2025 · 79 points
- @johnoreilly.dev“Yay, just created my first (very basic) AI Agent using the new Koog framework (github.com/JetBrains/koog) …”Bluesky · Jun 10, 2025 · 21 likes
- @vadim-briliantov.bsky.social“If for some reason you haven’t seen it yet, we released Koog — one of the most advanced frameworks for …”Bluesky · Sep 7, 2025 · 19 likes
- @johnoreilly.dev“Koog: a Kotlin-based framework designed to build and run AI agents entirely in idiomatic Kotlin (just …”Bluesky · May 22, 2025 · 17 likes
- @johnoreilly.dev“Inspired by proandroiddev.com/building-age... I updated the Koog agent (github.com/JetBrains/koog) in …”Bluesky · Aug 17, 2025 · 6 likes
The biggest 5 of 59 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 59
Talked about on GitHub, Bluesky and Hacker News (59 times).
On GitHub · 46
- Jul 31, 2025Adding missing watchos targets — oshai/kotlin-logging2 reactions · 5 comments
- Sep 7, 2026build(deps): bump the koog group with 2 updates — edjchapman/HelloDave1 reaction · 1 comment
- Jul 27, 2026build(deps): bump the koog group with 2 updates — edjchapman/HelloDave1 reaction · 1 comment
- Jul 20, 2026build(deps): bump ai.koog:koog-agents from 1.0.0 to 1.1.1 — Yuonsa/CommitGenius1 reaction · 1 comment
- Dec 23, 2025Bump ai.koog:koog-agents from 0.5.4 to 0.6.0 — Marko-Veljovic/Memoriori1 reaction · 1 comment
41 more on GitHub
- Oct 29, 2025Refactoring to Multiplatform Protocol with KMP — phodal/auto-dev1 reaction
- Sep 15, 2025Duplicate LibVersionKt causing Android build failure — modelcontextprotocol/kotlin-sdk1 reaction · 2 comments
- Oct 5, 2026build(deps): Bump ai.koog:koog-agents from 0.8.0 to 1.3.0 — geoknoesis/kastor0 reactions
- Oct 3, 2026agent-skills.github.jetbrains.koog: 1.2.0 → 1.3.0 — sudosubin/agents.nix0 reactions
- Oct 3, 2026build(deps): bump the all-dependencies group with 14 updates — storytellerF/A0 reactions
- Oct 3, 2026Bump ai.koog:agents-tools from 1.2.0 to 1.3.0 in the koog group — T45K/koog-google-search-tool0 reactions · 1 comment
- Oct 1, 2026Bump the gradle group with 2 updates — siarhei-luskanau/koog-models0 reactions
- Sep 28, 2026agent-skills.github.jetbrains.koog: init at 1.2.0 — sudosubin/agents.nix0 reactions
- Sep 28, 2026Bump ai.koog:koog-agents from 1.2.0 to 1.3.0 — myda-chi/frictionless0 reactions
- Sep 28, 2026chore(deps): bump ai.koog:koog-agents from 1.2.0 to 1.3.0 in /android — kaeawc/auto-mobile0 reactions · 1 comment
- Sep 26, 2026Bump ai.koog:http-client-ktor from 1.2.0 to 1.3.0 — UgaiSoftwares/ACPSample0 reactions
- Sep 26, 2026Bump ai.koog:agents-features-trace from 1.2.0 to 1.3.0 — UgaiSoftwares/ACPSample0 reactions · 1 comment
- Sep 24, 2026release: update Package.swift for 1.3.0 — JetBrains/koog-spm0 reactions
- Sep 5, 2026Bump ai.koog:agents-features-trace from 1.1.1 to 1.2.0 — UgaiSoftwares/ACPSample0 reactions · 1 comment
- Sep 5, 2026Bump ai.koog:http-client-ktor from 1.1.1 to 1.2.0 — UgaiSoftwares/ACPSample0 reactions
- Sep 5, 2026Bump ai.koog:agents-tools from 1.1.1 to 1.2.0 in the koog group — T45K/koog-google-search-tool0 reactions · 1 comment
- Sep 1, 2026build(deps): bump ai.koog:koog-agents from 0.8.0 to 1.2.0 in /examples/demo-compose-app — secure-workflows/koog0 reactions · 1 comment
- Aug 31, 2026chore(deps): bump koogVersion from 1.1.1 to 1.2.0 — elenavanengelenmaslova/mocknest-serverless0 reactions · 2 comments
- Aug 27, 2026build(deps): bump ai.koog:koog-agents from 0.6.0 to 1.1.1 in /app — rishabhpandey139/Summora-AI0 reactions
- Jul 24, 2026Koog MkDocs Material icons and nested content tabs are rendered as raw Markdown — BinaryTape/Open-AIDoc0 reactions
- Jul 20, 2026release: update Package.swift for 1.1.1 — JetBrains/koog-spm0 reactions
- May 25, 2026chore: update skills for koog 1.0.0 — javiergbravo/koog-skills-mcp0 reactions
- May 22, 2026Bump ai.koog:koog-agents from 0.7.1 to 1.0.0 — Valentine-456/AICodePlugin0 reactions
- Apr 23, 2026chore: update skills for koog 0.8.0 — javiergbravo/koog-skills-mcp0 reactions
- Apr 7, 2026build(deps): bump ai.koog:koog-agents from 0.6.0 to 0.7.3 in /examples/demo-compose-app — xfqwdsj/koog-fixed-llm-provider0 reactions · 1 comment
- Mar 31, 2026Bump ai.koog:koog-agents-jvm from 0.7.2 to 0.7.3 — Iarylkin/auto-issue0 reactions · 1 comment
- Mar 23, 2026Bump ai.koog:koog-agents-jvm from 0.7.1-rc3 to 0.7.2 — Iarylkin/auto-issue0 reactions · 1 comment
- Mar 23, 2026fix(koog-ktor): parsing timeouts configuration — BLannoo/koog0 reactions
- Mar 13, 2026Add Java API to Koog documentation — BLannoo/koog0 reactions · 2 comments
- Mar 9, 2026build(deps): bump ai.koog:koog-agents from 0.6.0 to 0.6.4 in /app — talosross/SummaryYou0 reactions
- Feb 26, 2026chore(deps): bump koog from 0.6.2 to 0.6.3 — phodal/routa.kt0 reactions
- Feb 13, 2026add multi executor and history compression strategy — hernandazevedo/kotlin-ai-agent-koog0 reactions
- Oct 30, 2025Bump ai.koog:koog-agents from 0.4.1 to 0.5.2 — iammohdzaki/Starter-Project-Ktor0 reactions
- Sep 4, 2025Check trending repo: JetBrains/koog — uibm/trending-watcher0 reactions · 1 comment
- Sep 4, 2025Check trending repo: JetBrains/koog — uibm/trending-watcher0 reactions · 1 comment
- Sep 3, 2025Check trending repo: JetBrains/koog — uibm/trending-watcher0 reactions · 1 comment
- Sep 3, 2025Check trending repo: JetBrains/koog — uibm/trending-watcher0 reactions · 1 comment
- Sep 2, 2025Check trending repo: JetBrains/koog — uibm/trending-watcher0 reactions · 1 comment
- Sep 1, 2025Check trending repo: JetBrains/koog — uibm/trending-watcher0 reactions · 1 comment
- Aug 6, 2025[FEAT] Introduce Koog for full agentic capabilities — Open-Distributed-Edge-Agents/EdgeGenAI0 reactions
- Jun 20, 2025Interesting Projects — PenumbraOS/mabl0 reactions
On Bluesky · 12
- Jun 10, 2025Yay, just created my first (very basic) AI Agent using the new Koog framework (github.com/JetBrains/koog) from @jetbrains.com . Agent… — @johnoreilly.dev21 likes and reposts · 1 reply
- Sep 7, 2025If for some reason you haven’t seen it yet, we released Koog — one of the most advanced frameworks for building AI agents! Targeting… — @vadim-briliantov.bsky.social19 likes and reposts
- May 22, 2025Koog: a Kotlin-based framework designed to build and run AI agents entirely in idiomatic Kotlin (just announced at #KotlinConf keynote)… — @johnoreilly.dev17 likes and reposts · 1 reply
- Aug 17, 2025Inspired by proandroiddev.com/building-age... I updated the Koog agent (github.com/JetBrains/koog) in ClimateTraceKMP sample… — @johnoreilly.dev6 likes and reposts
- Jul 3, 2025Did you know that a lot of Kotlin AI libraries are built on top of Ktor? The new Koog library for building agents is doing all its… — @vergauwensimon.bsky.social4 likes and reposts
7 more on Bluesky
- Sep 23, 2026https://github.com/JetBrains/koog more like this: https://agentwire.thecompound.tech/aw/1f6ane — @agentwire.thecompound.tech2 likes and reposts
- Aug 11, 2026Does anyone have experience with this #Kotlin library for building agents? Thoughts? I need Kotlin as it'd like to build an Android app.… — @alexn.org2 likes and reposts · 3 replies
- Oct 4, 2025Trying out new Functional Agents support in Koog 0.5.0 (github.com/JetBrains/koog) ....also have set things up now to invoke population and… — @johnoreilly.dev2 likes and reposts · 1 reply
- Sep 30, 2025More information about Koog here github.com/JetBrains/koog. @vadim-briliantov.bsky.social (Koog Technical Lead) has also been writing a… — @johnoreilly.dev2 likes and reposts · 1 reply
- Sep 10, 2025JetBrains Koog : « We didn’t just port Python concepts to Kotlin. We reimagined what an AI agent framework could be »… — @nfonrose.bsky.social1 likes and repost · 1 reply
- May 26, 2025https://github.com/JetBrains/koog KoogはKotlinでAIエージェントを構築・実行するためのフレームワークです。 自然なKotlinでAIエージェントを構築できます。 外部システムやAPIにアクセスするツールでエージェントを拡張可能です。 — @topickapp.bsky.social1 likes and repost
- May 25, 2025Koog, a Kotlin-based framework to build and run Al agents in idiomatic Kotlin | Discussion — @hackernewsbot.bsky.social1 likes and repost
On Hacker News · 1
- May 22, 2025Koog, a Kotlin-based framework to build and run Al agents in idiomatic Kotlin79 points · 2 comments
In this repository7 other files it gives its agents.
- AGENTS.mdAGENTS.md
- a2a/CLAUDE.mdCLAUDE.md
- CLAUDE.mdCLAUDE.md
- examples/simple-examples/CLAUDE.mdCLAUDE.md
- split-jvm-nonjvmSkill
- arithmetic-evaluatorSkill
- weather-retrievalSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
13 rules. About 0 are common, 7 are distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈7
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 23
Read one reference doc to anchor on the established pattern:
- Very specific: line 37
Check existing Java tab: If absent → add one. If it has empty / */ placeholder content → replace entirely.
- Very specific: line 38
Consider Kotlin-side alignment: If the Kotlin block uses Kotlin-only APIs (kotlinx.io, MutableStateFlow, KLogger, inline Duration), …
- Distinctive: line 89
Always import in INCLUDE; never use FQNs in visible code.
- Very specific: line 90
Never use file-level annotations (@file:Suppress, @file:OptIn) — scope to specific declarations.
- Very specific: line 96
If Kotlin shows no main(), Java must hide main() in INCLUDE/SUFFIX.
- Very specific: line 97
If Kotlin shows install(Feature) { ...
- Distinctive: line 98
If Kotlin creates a writer before the agent, Java must too.
- Very specific: line 99
If Kotlin shows agent.run(input), Java must too.
- Distinctive: line 101
Read both visible blocks side-by-side after writing.
- Distinctive: line 107
When the Kotlin block uses an entirely Kotlin-only API:
- Distinctive: line 109
Do NOT leave the Java tab empty: Write a compilable Java class with explanatory comments.
- Distinctive: line 132
After each Java block:
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 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
When to use
Adding Java code blocks alongside existing Kotlin blocks in mkdocs documentation (docs/docs/**.md). Typical triggers: "add Java examples to <file>", "add Java tabs", "complete the Java side of <doc>", "fix the Java block in <doc>".
Do NOT use this skill for:
- Writing brand-new Kotlin docs (no precursor Kotlin block to mirror).
- Splitting source files between JVM and non-JVM source sets — use the
split-jvm-nonjvmskill instead. - Java examples outside the mkdocs/Knit pipeline.
Prerequisites
JDK 17. Gradle 8.x fails cryptically on newer JDKs. If the default JDK is newer, prefix every ./gradlew command in this workflow with JAVA_HOME=/path/to/jdk-17.
Before starting
Read one reference doc to anchor on the established pattern:
docs/docs/features/tracing.md— full Tracing feature (blocks 1–6).docs/docs/agent-events.md— customFeatureMessageProcessorsubclass (suspend bridge methodshandleMessage/handleClose).docs/docs/testing.md—MockPromptExecutorbuilder, tool mocking, comment-only blocks for Kotlin-only DSL.docs/docs/features/open-telemetry/index.md— OpenTelemetry examples.docs/docs/features/open-telemetry/opentelemetry-langfuse-exporter.md— Langfuse exporter.docs/docs/features/open-telemetry/opentelemetry-weave-exporter.md— Weave exporter.
Workflow
For each Kotlin code block in the target .md:
- Read the Kotlin block: INCLUDE, visible code, SUFFIX, KNIT directive.
- Check existing Java tab. If absent → add one. If it has empty
/** */placeholder content → replace entirely. If it has real content → update. - Consider Kotlin-side alignment. If the Kotlin block uses Kotlin-only APIs (
kotlinx.io,MutableStateFlow,KLogger, inlineDuration), consider whether the Kotlin example should switch to a JVMcreate()factory (e.g.,TraceFeatureMessageFileWriter.create(path)). This keeps the two examples structurally aligned. Seereference/factory-classes.md. - Add
@JavaAPIbridge methods if missing. If the Java code needs a bridge that doesn't exist yet (e.g., a builder method onMockExecutorBuilder), add it before writing the Java tab. This may pause the doc work for a source-code change — flag it to the user before proceeding. - Write the Java tab immediately after the Kotlin tab, using the template below.
- If renaming Knit files (e.g., hyphenated
example-feature-java-01.java→ camelCaseexampleFeatureJava01.java), delete the old generated files first. - Generate and compile (see Verification at the bottom).
- Read the generated
.javato confirm correctness. Fix and repeat 7–8 on failure.
Mkdocs / Knit tab structure
Java tabs go immediately after the Kotlin tab. All content inside a tab is indented 4 spaces. <!--- INCLUDE -->, <!--- SUFFIX -->, <!--- KNIT --> are Knit directives (HTML comments — invisible when rendered), not mkdocs syntax.
=== "Kotlin"
<!--- INCLUDE
import ...
-->
```kotlin
// visible code
```
<!--- KNIT example-feature-01.kt -->
=== "Java"
<!--- INCLUDE
import ...;
public class exampleFeatureJava01 {
public static void main(String[] args) {
-->
<!--- SUFFIX
}
}
-->
```java
// visible code
```
<!--- KNIT exampleFeatureJava01.java -->KNIT naming — capital "Java" matters
docs/knit.code.include has the check <#if !knit.name?contains("Java")>package .... Files with capital "Java" in the name skip the package declaration; lowercase "java" or hyphenated names emit a package line that breaks compilation.
- ✅
exampleFeatureJava01.java,exampleTestingJava13.java - ❌
example-feature-java-01.java,examplefeaturejava01.java
Knit rules
- INCLUDE + visible code + SUFFIX must concatenate into a valid Java file.
- Hidden variables in Kotlin INCLUDE (
outputPath,input, etc.) must also appear in Java INCLUDE. - Visible-code indentation in
.mdis 4 spaces (tab content). Knit strips that when generating. - Always import in INCLUDE; never use FQNs in visible code.
- Never use file-level annotations (
@file:Suppress,@file:OptIn) — scope to specific declarations.
Structural matching (the most important rule)
The Java visible code must match the Kotlin visible code in scope and structure.
- If Kotlin shows no
main(), Java must hidemain()in INCLUDE/SUFFIX. - If Kotlin shows
install(Feature) { ... }, Java must show.install(Feature.Feature, config -> { }). - If Kotlin creates a writer before the agent, Java must too.
- If Kotlin shows
agent.run(input), Java must too.
Read both visible blocks side-by-side after writing. They should read as equivalent code in their respective languages.
When Kotlin uses APIs with no Java bridge
Some Kotlin DSLs (graph testing: testGraph, assertSubgraphByName, assertNodes, assertEdges, verifySubgraph, assertReachable) have no @JavaAPI bridges. To check: grep for @JavaAPI in the source file — if absent, treat as Kotlin-only.
When the Kotlin block uses an entirely Kotlin-only API:
- Do NOT leave the Java tab empty. Write a compilable Java class with explanatory comments.
- The class must have a valid
mainso it compiles. - Comments explain what the Kotlin DSL does and the recommended Java alternative.
// Graph structure testing (testGraph, assertSubgraphByName, assertEdges,
// verifySubgraph, assertReachable) is available through the Kotlin testing DSL.
//
// In Java, test agent behavior by running and asserting on the result:
// String result = agent.run("test input");
// assert "expected".equals(result);Deep references
Load these only when you need them:
reference/interop-tables.md— Kotlin↔Java mapping table, suspend bridges (@JvmName("run"),handleMessage,handleClose), abstract-property rules, key source files to grep for@JavaAPI.reference/factory-classes.md— JVMcreate()factory pattern, two-overload skeleton, type-conversion cheat sheet, when needed vs not, anti-patterns. Cross-references thesplit-jvm-nonjvmskill.reference/pitfalls.md—var-vs-field, brace-counting in SUFFIX,is-prefixed property getters,@JvmOverloadsrequirement, docs classpath limits (no JUnit), legacy/** */placeholder,MockExecutorBuilderAPI.
Verification
After each Java block:
./gradlew :docs:knit
./gradlew :docs:compileJavaOn failure, read the generated file to diagnose:
cat docs/src/main/kotlin/exampleFeatureJavaNN.javaDoes 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.

