Agent skill

Write Doc Examples

by ClickHouse in ClickHouse/clickhouse-java

Write, rewrite, and format documentation code snippets into reusable, production-ready methods with necessary library imports and clean linting.

Apache-2.0Auto-check passedDevelopment

Install Write Doc Examples

skills CLI
$ npx skills add ClickHouse/clickhouse-java --skill write-doc-examples -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install ClickHouse/clickhouse-java write-doc-examples --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/ClickHouse/clickhouse-java.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.cursor/skills/write-doc-examples .claude/skills/write-doc-examples && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
write-doc-examples
GitHub stars
1.6k
Token cost
~3.1k tokens
SKILL.md length
782 words
Files
1
Skills in repo
4
Repo updated
First seen
Licence
Apache-2.0

At a glance

Write, rewrite, and format documentation code snippets into reusable, production-ready methods with necessary library imports and clean linting.

  • Works in 5 steps: Preserve Document Context and Style… → Wrap Code with Methods → Include Only Relevant Library Imports → …
  • Formatting Java code examples in integration guides and documentation (such as docs/integration-client.md
  • SKILL.md covers Core Principles, Transformation Workflow, Transformation Examples and Validation Checklist
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Write Doc Examples is an agent skill from ClickHouse/clickhouse-java. Write, rewrite, and format documentation code snippets into reusable, production-ready methods with necessary library imports and clean linting. Use when writing, updating, or formatting Java code examples in integration guides and documentation (such as docs/integration-client.md or docs/integration-jdbc.md).

Its SKILL.md is about 3.1k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Development, covering Linting and formatting and Data warehousing. It works with Java and ClickHouse. The repository describes itself as: ClickHouse Java Clients & JDBC Driver. The licence is Apache-2.0.

When your agent uses it

  • Formatting Java code examples in integration guides and documentation (such as docs/integration-client.md
  • Docs/integration-jdbc.md)

Example prompts

  • “/write-doc-examples”

Workflow steps

5 steps, taken from the step headings in SKILL.md.

  1. Preserve Document Context and Style Consistency
  2. Wrap Code with Methods
  3. Include Only Relevant Library Imports
  4. Allow Partial Code (Omit Obvious Definitions)
  5. Ensure Code is Linted and Production-Grade

What it can do on your machine

Read from SKILL.md and the folder at commit 67a6b9e. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are java).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Write Doc Examples loads about 3.1k tokens when it runs. Until then it costs about 83 tokens; SKILL.md has 782 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~83
When it runs · the whole SKILL.md, loaded when a task matches
~3.1k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from ClickHouse/clickhouse-java at commit 67a6b9e, republished under its Apache-2.0 licence (© ClickHouse). 782 words, ~3,119 tokens.

Download SKILL.mdSave it as .claude/skills/write-doc-examples/SKILL.md (or your agent's skills folder).
name
write-doc-examples
description
Write, rewrite, and format documentation code snippets into reusable, production-ready methods with necessary library imports and clean linting. Use when writing, updating, or formatting Java code examples in integration guides and documentation (such as docs/integration-client.md or docs/integration-jdbc.md).

Write Documentation Code Examples for Production Readiness

This skill guides writing, rewriting, and formatting code snippets in documentation so they can be directly reused or integrated into production Java applications while maintaining stylistic consistency across the document.

Core Principles

1. Preserve Document Context and Style Consistency

Always align with patterns and conventions established earlier in the same document:

  • Consistent Builder / Factory Pattern: If early sections establish building a client via a method returning Client.Builder (e.g., public Client.Builder createBaseClient()), subsequent configuration options (auth schemes, TLS, proxy, timeouts) must follow the same pattern rather than reverting to creating full Client instances from scratch.
  • Incremental Context: Sub-sections and options should build consistently on preceding examples (e.g., public Client createAnalyticsDBClient(Client.Builder baseClient)).
  • Naming Conventions: Maintain consistent method, variable, and parameter names (createBaseClient, client, schema, settings, events) across all snippets in the document.
2. Wrap Code with Methods

Never present bare, loose statements floating outside a method. Encapsulate every snippet into a realistic, reusable method:

  • Use factory methods or builder helpers for client instantiation (e.g., public Client.Builder createBaseClient(), public Client createAnalyticsDBClient(Client.Builder baseClient)).
  • Use action-specific methods for queries, inserts, and updates (e.g., public List<Event> readEvents(Client client, TableSchema schema), public void writeEvents(Client client, List<Event> events)).
  • Use clear parameter lists (Client client, TableSchema schema, InsertSettings settings, etc.) and meaningful return types instead of writing top-level procedural scripts.
3. Include Only Relevant Library Imports

At the top of the code block, list only the imports that belong to the library:

  • Include: Classes and interfaces from com.clickhouse.client.api.*, com.clickhouse.data.*, com.clickhouse.jdbc.*, etc.
  • Exclude: Common standard JDK classes (e.g., java.util.List, java.util.Map, java.io.InputStream, java.util.concurrent.TimeUnit) unless needed to avoid ambiguity.
  • Keep the import list compact and directly relevant to the snippet.
4. Allow Partial Code (Omit Obvious Definitions)

Keep examples focused on library usage:

  • Omit obvious custom classes: Auxiliary classes, configuration containers, or DTOs (e.g., AppConfiguration) do not need full definitions.
  • Include definitions only when structurally important: Provide the class definition only when its internal fields or annotations are essential to demonstrating the library feature (e.g., showing how POJO fields map to ClickHouse column types).
5. Ensure Code is Linted and Production-Grade
  • Resource Management: Always use try-with-resources for closable resources such as QueryResponse, InsertResponse, and streams.
  • Compatibility: Ensure code is valid Java 8+ and follows repository patterns.
  • Error & Edge-Case Handling: Guard against empty inputs, handle or propagate checked exceptions properly, and include comments at extension points (e.g., // add db specific configuration).
  • Formatting: Maintain consistent indentation (4 spaces), balanced braces, and valid Java syntax.

Show full SKILL.md (375 more words)Show less

Transformation Workflow

When updating documentation examples:

  1. Scan Prior Context in the Document: Check how earlier sections structure their examples (e.g., whether client configuration uses Client.Builder factory methods).
  2. Identify the Intent: Determine whether the example demonstrates configuration, querying, inserting, streaming, or error handling.
  3. Encapsulate in a Reusable Method Matching the Document Style:
    • For client creation/options: Return Client.Builder or take Client.Builder baseClient if established earlier in the guide.
    • For operations: Accept Client (and any required schemas or options) as parameters.
    • For callbacks/streaming: Pass inputs and manage the response lifecycle properly.
  4. Collect Library Imports: Add all com.clickhouse.* imports required by the snippet at the top.
  5. Prune Unnecessary Boilerplate: Strip out trivial DTO class definitions, keeping only structural POJO models where column mapping is highlighted.
  6. Lint and Format: Check method signatures, variable types, semicolons, and try-with-resources blocks.

Transformation Examples

Example 1: Client Configuration & Instantiation

Before (Loose snippet):

java
Client client = new Client.Builder()
    .addEndpoint("http://localhost:8123")
    .setUsername("default")
    .setPassword("secret")
    .setDefaultDatabase("analytics")
    .build();

After (Reusable production methods with library imports):

java
import com.clickhouse.client.api.Client;

public Client.Builder createBaseClient() {
    return new Client.Builder()
        .addEndpoint("http://localhost:8123")
        .setUsername("default")
        .setPassword("secret")
        // set common configuration
        ;
}

public Client createAnalyticsDBClient(Client.Builder baseClient) {
    return baseClient
        .setDefaultDatabase("analytics")
        // add db specific configuration
        .build();
}

Example 2: Following Established Document Style in Configuration Variants

When earlier sections establish createBaseClient() returning Client.Builder, all variant auth/network options maintain that same style:

Option B (Bearer Auth):

java
import com.clickhouse.client.api.Client;

public Client.Builder createBaseClient() {
    return new Client.Builder()
        .addEndpoint("http://localhost:8123")
        .useBearerTokenAuth("my_access_token");
}

Option C (Mutual TLS):

java
import com.clickhouse.client.api.Client;
import com.clickhouse.client.api.enums.SSLMode;

public Client.Builder createBaseClient() {
    return new Client.Builder()
        .addEndpoint("https://localhost:8443")
        .useSSLAuthentication(true)
        .setClientCertificate("/path/to/client.crt")
        .setClientKey("/path/to/client.key")
        .setRootCertificate("/path/to/ca.crt")
        .setSSLMode(SSLMode.STRICT);
}

Example 3: Runtime Operations with External Configuration

Before (Loose statement):

java
client.updateUserAndPassword("new_user", "new_password");

After (Wrapped method; obvious custom config class omitted):

java
void updateClientCredentials(Client client, AppConfiguration appConf) {
    client.updateUserAndPassword(appConf.db_username, appConf.db_password);
}

Example 4: POJO Mapping (Registration, Read, Write)

Before (Script-like sequence):

java
TableSchema schema = client.getTableSchema("events");
client.register(Event.class, schema);

List<Event> events = client.queryAll("SELECT * FROM events", Event.class, schema);
client.insert("events", events).get();

After (Structured into definition, registration, read, and write methods):

  1. Structural POJO definition (included because field structure matters for column mapping):
java
public static class Event {
    public long id;
    public String name;
    public long timestamp;
}
  1. Registration helper:
java
import com.clickhouse.client.api.Client;
import com.clickhouse.client.api.metadata.TableSchema;

void registerPojoMappings(Client client, Map<Class<?>, String> pojoTables) {
    for (Map.Entry<Class<?>, String> entry : pojoTables.entrySet()) {
        TableSchema schema = client.getTableSchema(entry.getValue());
        client.register(entry.getKey(), schema);
    }
}
  1. Read method:
java
import com.clickhouse.client.api.Client;
import com.clickhouse.client.api.metadata.TableSchema;

public List<Event> readEvents(Client client, TableSchema schema) {
    return client.queryAll(
        "SELECT id, name, timestamp FROM events",
        Event.class,
        schema);
}
  1. Write method with response cleanup:
java
import com.clickhouse.client.api.Client;
import com.clickhouse.client.api.insert.InsertResponse;

public void writeEvents(Client client, List<Event> events) throws Exception {
    if (events.isEmpty()) {
        return;
    }

    try (InsertResponse response = client.insert("events", events).get()) {
        // handle response metrics or confirmation
    }
}

Example 5: Streaming Query with Binary Format Reader

Before (Procedural script):

java
QuerySettings settings = new QuerySettings()
    .setFormat(ClickHouseFormat.RowBinaryWithNamesAndTypes);

QueryResponse response = client.query("SELECT * FROM events", settings).get();
ClickHouseBinaryFormatReader reader = client.newBinaryFormatReader(response);
while (reader.hasNext()) {
    reader.next();
    long id = reader.getLong("id");
}

After (Encapsulated method with try-with-resources and library imports):

java
import com.clickhouse.client.api.Client;
import com.clickhouse.client.api.data_formats.ClickHouseBinaryFormatReader;
import com.clickhouse.client.api.query.QueryResponse;
import com.clickhouse.client.api.query.QuerySettings;
import com.clickhouse.data.ClickHouseFormat;

public void streamEvents(Client client) throws Exception {
    QuerySettings settings = new QuerySettings()
        .setFormat(ClickHouseFormat.RowBinaryWithNamesAndTypes);

    try (QueryResponse response = client.query("SELECT * FROM events", settings)
            .get(30, TimeUnit.SECONDS)) {

        ClickHouseBinaryFormatReader reader = client.newBinaryFormatReader(response);
        while (reader.hasNext()) {
            reader.next();
            long id = reader.getLong("id");
            String name = reader.getString("name");
            // process row data
        }
    }
}

Example 6: Streaming Insert with Callback Writer

Before (Loose insert callback):

java
TableSchema schema = client.getTableSchema("events");
ClickHouseFormat format = ClickHouseFormat.RowBinary;

client.insert("events", out -> {
    RowBinaryFormatWriter writer = new RowBinaryFormatWriter(out, schema, format);
    for (Event event : events) {
        writer.setValue("id", event.getId());
        writer.commitRow();
    }
}, format, new InsertSettings()).get();

After (Encapsulated write method with proper response closure):

java
import com.clickhouse.client.api.Client;
import com.clickhouse.client.api.data_formats.RowBinaryFormatWriter;
import com.clickhouse.client.api.insert.InsertResponse;
import com.clickhouse.client.api.insert.InsertSettings;
import com.clickhouse.client.api.metadata.TableSchema;
import com.clickhouse.data.ClickHouseFormat;

public void writeEventsStream(Client client, TableSchema schema, List<Event> events) throws Exception {
    ClickHouseFormat format = ClickHouseFormat.RowBinary;

    try (InsertResponse response = client.insert("events", out -> {
        RowBinaryFormatWriter writer = new RowBinaryFormatWriter(out, schema, format);
        for (Event event : events) {
            writer.setValue("id", event.id);
            writer.setValue("name", event.name);
            writer.commitRow();
        }
    }, format, new InsertSettings()).get()) {
        // handle response metrics
    }
}

Validation Checklist

Before finalizing any rewritten documentation example:

  • Does the example follow the structural and naming style established in earlier sections of the document (e.g. Client.Builder return type)?
  • Is every code snippet wrapped in a meaningful method (or a builder helper)?
  • Are all library imports (com.clickhouse.*) present and accurate?
  • Are redundant JDK imports omitted unless strictly helpful?
  • Are trivial custom classes omitted and only essential structures (e.g. POJO schema mappings) defined?
  • Are closable resources (QueryResponse, InsertResponse, etc.) properly handled with try-with-resources?
  • Is the code syntactically valid and lint-clean?

© ClickHouse, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .cursor/skills/write-doc-examples of ClickHouse/clickhouse-java.

Open the folder on GitHubat commit 67a6b9e

Compare with similar skills

Write Doc Examples next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Write Doc Examples compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Write Doc Examples this skillClickHouse/clickhouse-java1.6k—~3.1kAutomated safety check: PassApache-2.0
Databuddy Internaldatabuddy-analytics/Databuddy1.2k—~11kAutomated safety check: NotesAGPL-3.0
Adapter Alignmentevloghq/evlog1.9k—~1.3kAutomated safety check: PassMIT
Android Code Quality Checkerwordpress-mobile/WordPress-Android3.2k—~587Automated safety check: PassGPL-2.0
Version Upgrade Advisorchmonitor/chmonitor298—~1.6kAutomated safety check: PassGPL-3.0
Adversarial Rustpproenca/dot-skills214—~2.8kAutomated safety check: PassMIT

Similar skills

  • Databuddy Internal

    databuddy-analytics/Databuddy

    Work inside the Databuddy monorepo for internal implementation, debugging, review, and refactoring.

    1.2k GitHub stars~11k tokensUpdated today
    DevelopmentAuto-check: notes
  • Adapter Alignment

    evloghq/evlog

    Twice-monthly check that evlog's drain adapters still send what each provider's own client sends.

    1.9k GitHub stars~1.3k tokensUpdated today
    DevelopmentAuto-check passed
  • Android Code Quality Checker

    wordpress-mobile/WordPress-Android

    Runs detekt, checkstyle, and Android lint together, reads their reports, and proposes approved fixes grouped by file.

    3.2k GitHub stars~587 tokensUpdated today
    DevelopmentAuto-check passed
  • Version Upgrade Advisor

    chmonitor/chmonitor

    Advises whether and how to upgrade ClickHouse — versioning scheme, upgrade path, what you gain, pre/post-upgrade checklist.

    298 GitHub stars~1.6k tokensUpdated yesterday
    DatabasesAuto-check passed
  • Adversarial Rust

    pproenca/dot-skills

    A skill your agent uses when reviewing or refactoring existing Rust code that carries an alien mental model — OO/enterprise ceremony from Java/C, garbage-collected object graphs, exception-style…

    214 GitHub stars~2.8k tokensUpdated 1 mo ago
    DevelopmentAuto-check passed
  • Backend Dev Guidelines

    langfuse/langfuse

    Build or review Langfuse backend code. An agent skill from langfuse/langfuse.

    35k GitHub stars~1.9k tokensUpdated today
    Backend & APIsAuto-check passed

More from ClickHouse/clickhouse-java

  • Triage Issues

    ClickHouse/clickhouse-java

    Analyzes a single GitHub issue at a time. An agent skill from ClickHouse/clickhouse-java.

    1.6k GitHub stars~904 tokensUpdated yesterday
    Auto-check passed
  • Update Keyword Engine Lists

    ClickHouse/clickhouse-java

    Update ALLOWEDKEYWORDALIASES in ClickHouseSqlUtils.java and ENGINETOTABLETYPE in DatabaseMetaDataImpl.java from failing test output.

    1.6k GitHub stars~457 tokensUpdated yesterday
    Auto-check passed
  • Code Review

    ClickHouse/clickhouse-java

    Review changes in clickhouse-java for correctness, compatibility, API stability, and missing tests.

    1.6k GitHub stars~290 tokensUpdated yesterday
    Auto-check passed

Works with

Questions about Write Doc Examples

What does Write Doc Examples do?

Write, rewrite, and format documentation code snippets into reusable, production-ready methods with necessary library imports and clean linting. Write Doc Examples is an agent skill from ClickHouse/clickhouse-java. Write, rewrite, and format documentation code snippets into reusable, production-ready methods with necessary library imports and clean linting.

When should I use Write Doc Examples?

Write Doc Examples fits situations like: formatting Java code examples in integration guides and documentation (such as docs/integration-client.md; docs/integration-jdbc.md).

How do I install Write Doc Examples in Claude Code?

Run `npx skills add ClickHouse/clickhouse-java --skill write-doc-examples -a claude-code`. Or copy the skill folder (.cursor/skills/write-doc-examples in ClickHouse/clickhouse-java) into .claude/skills/write-doc-examples in your project. Claude Code loads it when a task matches its description.

How do I install Write Doc Examples in Codex?

Run `npx skills add ClickHouse/clickhouse-java --skill write-doc-examples -a codex`. Or copy the skill folder (.cursor/skills/write-doc-examples in ClickHouse/clickhouse-java) into .agents/skills/write-doc-examples in your project. Codex loads it when a task matches its description.

Can I use Write Doc Examples in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add ClickHouse/clickhouse-java --skill write-doc-examples -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/write-doc-examples, .gemini/skills/write-doc-examples, .github/skills/write-doc-examples and .opencode/skills/write-doc-examples in your project.

What does Write Doc Examples need to run?

SKILL.md names no scripts, command-line tools or credentials: Write Doc Examples is instructions for the agent only.

Does Write Doc Examples access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Write Doc Examples safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Write Doc Examples use?

Write Doc Examples is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Write Doc Examples use?

About 3.1k tokens (SKILL.md is roughly 12k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Write Doc Examples?

Skills that share tags, products or a category with Write Doc Examples: Databuddy Internal (databuddy-analytics/Databuddy, 1.2k stars), Adapter Alignment (evloghq/evlog, 1.9k stars), Android Code Quality Checker (wordpress-mobile/WordPress-Android, 3.2k stars) and Version Upgrade Advisor (chmonitor/chmonitor, 298 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Write Doc Examples?

ClickHouse (a GitHub organization) maintains it in ClickHouse/clickhouse-java, which has 1,620 GitHub stars. The repository holds 4 skills in this directory. The repository was last updated on October 6, 2026.

Source: ClickHouse/clickhouse-java on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.