add-java-code-snippets-in-docs

A documentation workflow for adding Java examples beside existing Kotlin examples in MkDocs, a tool that builds documentation websites. It also covers the links needed to expose Kotlin code to Java users.

In plain words
What is it for?
Use it to add Java tabs, mirror Kotlin examples, connect Java calls to Kotlin APIs, and fix Java examples in supported documentation files.
Why use it?
Documentation can show the Kotlin example while leaving Java readers without a usable equivalent. This keeps both language versions together and compatible with the documentation build process.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/jetbrains/koog/add-java-code-snippets-in-docs
Any agent
npx skills add JetBrains/koog --skill add-java-code-snippets-in-docs
Clone the repo
git clone --depth 1 https://github.com/JetBrains/koog

Made for: Claude Code, Codex.

Per session 70 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,718 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00070 $0.01718
Opus 5 $0.00035 $0.00859
Sonnet 5 $0.00014 $0.00344
Haiku 4.5 $0.00007 $0.00172

Measured 2d ago against content hash 7252e23216f5, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

add-java-code-snippets-in-docs scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/skills/add-java-code-snippets-in-docs/SKILL.md · 144 lines

How it starts

The opening of the file, as written. The whole thing — 144 lines — stays where its author put it; the contents beside it link to each section on GitHub.

When to use

Adding Java code blocks alongside existing Kotlin blocks in mkdocs documentation (docs/docs/**.md). Typical triggers: "add Java examples to ", "add Java tabs", "complete the Java side of ", "fix the Java block in ".

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-nonjvm skill 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 — custom FeatureMessageProcessor subclass (suspend bridge methods handleMessage / handleClose).
  • docs/docs/testing.mdMockPromptExecutor builder, 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:

  1. Read the Kotlin block: INCLUDE, visible code, SUFFIX, KNIT directive.
  2. Check existing Java tab. If absent → add one. If it has empty /** */ placeholder content → replace entirely. If it has real content → update.
  3. Consider Kotlin-side alignment. If the Kotlin block uses Kotlin-only APIs (kotlinx.io, MutableStateFlow, KLogger, inline Duration), consider whether the Kotlin example should switch to a JVM create() factory (e.g., TraceFeatureMessageFileWriter.create(path)). This keeps the two examples structurally aligned. See reference/factory-classes.md.
  4. Add @JavaAPI bridge methods if missing. If the Java code needs a bridge that doesn't exist yet (e.g., a builder method on MockExecutorBuilder), 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.
  5. Write the Java tab immediately after the Kotlin tab, using the template below.
  6. If renaming Knit files (e.g., hyphenated example-feature-java-01.java → camelCase exampleFeatureJava01.java), delete the old generated files first.
  7. Generate and compile (see Verification at the bottom).
  8. Read the generated .java to confirm correctness. Fix and repeat 7–8 on failure.

Read the full file on GitHub · 144 lines

Files

What ships with it

3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 144 lines · 70 tokens per session scan A 7252e23216f5

Subscribe to this mod's changes

add-java-code-snippets-in-docs is a skill published in the GitHub repository JetBrains/koog (4,553 stars, last pushed today), licensed Apache-2.0. It adds 70 tokens to every session and 1,718 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

agent-device

Automates Apple-platform apps (iOS, tvOS, macOS), Android devices, and Amazon Vega OS TV apps in Vega Virtual Devices. Use when navigating apps, taking snapshots/screenshots where supported, driving TV remotes, tapping, typing, scrolling, extracting UI info, collecting evidence, or planning agent-device CLI commands.

callstack/agent-device · 69 tokens

android-emulator

Verify and debug native, React Native, Expo, or Flutter apps on an Android Emulator with agent-device. Use when an agent needs to launch an app, inspect its live UI, tap, type, scroll, validate a code change, collect failure evidence, or reproduce a workflow on an Android virtual device.

callstack/agent-device · 65 tokens

ios-simulator

Verify and debug native, React Native, Expo, or Flutter apps on an iOS Simulator with agent-device. Use when an agent needs to launch an app, inspect its live UI, tap, type, scroll, validate a code change, collect failure evidence, or reproduce a workflow on an iPhone or iPad Simulator.

callstack/agent-device · 69 tokens

dogfood

Systematically explore and test a mobile app on iOS/Android with agent-device to find bugs, UX issues, and other problems. Use when asked to dogfood, QA, exploratory test, find issues, bug hunt, or test this app on mobile.

callstack/agent-device · 55 tokens

rn-testing

This skill should be used when the user asks to "write a Maestro test", "create E2E flows", "add testIDs", "run UI tests", "run E2E tests", "verify a feature works", "test my screen", "set up maestro-runner", "mock network requests", "inspect store state", "write test assertions", or needs guidance on test timing…

Lykhoyda/rn-dev-agent · 106 tokens

using-rn-dev-agent

Entry point for the rn-dev-agent plugin. Maps user intent to the right command, agent, or skill. Use at the START of any React Native development conversation. Triggers on "I want to build", "build a feature", "add a feature to the app", "test this", "something is broken", "fix the crash", "help with my React Native…

Lykhoyda/rn-dev-agent · 92 tokens