agentleFS
PostHogKnown publisherPostHog/posthog-foss/.agents/skills/authenticating-to-clickhouse/SKILL.md

authenticating-to-clickhouse

Skill727 starsChanged yesterdayMITView on GitHub

Authenticate a new or changed service to ClickHouse with the rotating ch-podauth ServiceAccount token instead of a static password. Use when adding a service, sidecar, or container that reads or writes ClickHouse, adding a new ClickHouseUser, or hand-building a ClickHouse pool or client for a custom timeout or setting. Covers the token-aware default path (sync_execute, get_client), the rule that a custom pool must pass credential_provider or it silently stays on the static password, wiring the username so the user does not fall back to the pod's CLICKHOUSE_USER, and the deploy-side companion in the charts repo. Not for converting an already-deployed user off a static password.

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 2 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    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
  1. Distinctive:

    Use it when adding a new service or ClickHouse user, or when building or changing a ClickHouse pool or client by hand.

    line 10
  2. Very specific:

    Use the token-aware default paths: sync_execute(..., ch_user=...) for pooled queries, or the async get_client in …

    line 14
  3. Distinctive:

    Read the credential once at startup, in any language.

    line 21

≈ “Common” is an estimate: at least 1 in 5 of the 308,232 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Authenticating to ClickHouse

A service authenticates to ClickHouse with a short-lived ServiceAccount token, validated by the ch-podauth bridge, not a static password. The token rotates, so the client reads it on each use. Read posthog/clickhouse/client/AGENTS.md for the full recipe and the traps. This skill is the entry point.

Use it when adding a new service or ClickHouse user, or when building or changing a ClickHouse pool or client by hand. Converting an already-deployed user off a static password is a ClickHouse-team operation and is out of scope.

Do

  • Use the token-aware default paths: sync_execute(..., ch_user=...) for pooled queries, or the async get_client in posthog/temporal/common/clickhouse.py for HTTP. Both read the token on each use.
  • Choose the user shape: deployment-default (the pod's CLICKHOUSE_USER is the service's own user) or a new ClickHouseUser enum member. Wire the username env, or the queries silently authenticate as the pod's CLICKHOUSE_USER.
  • Wire the deploy side in the charts repo. The connect-app-to-clickhouse skill mounts the token and sets CLICKHOUSE_<USER>_PASSWORD_FILE.

Do not

  • Pass your own sync_client to sync_execute, or build a pool or client by hand, without keeping it token-aware. A native pool must carry credential_provider; an HTTP or one-shot client resolves the token per call instead. A pool that skips this silently stays on the static password. posthog/clickhouse/client/AGENTS.md has both shapes.
  • Read the credential once at startup, in any language. The token rotates, so read the token file on each connection or request.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.