diff --git a/.claude/skills/altinity-kb-article-writer/SKILL.md b/.claude/skills/altinity-kb-article-writer/SKILL.md new file mode 100644 index 0000000000..53172550fc --- /dev/null +++ b/.claude/skills/altinity-kb-article-writer/SKILL.md @@ -0,0 +1,55 @@ +--- +name: altinity-kb-article-writer +description: Write new Altinity Knowledge Base articles in the repository's established style, including section selection, target markdown file path, Hugo frontmatter, and full draft content. Use when asked to create or draft KB articles for ClickHouse topics in this repository. +--- + +# Altinity KB Article Writer + +Write a complete KB-ready draft that matches this repository's style. + +## Use this workflow + +1. Identify article intent from the prompt: +- Problem statement or topic +- Target audience (operator, developer, data engineer, mixed) +- Desired depth (`quick how-to`, `troubleshooting`, `deep explanation`) +- Environment constraints (Cloud, Kubernetes, replication, version constraints) + +2. Select the best section using `references/section-map.md`. + +3. Propose the destination path in this format: +- `content/en/
/.md` + +4. Build frontmatter using the defaults in `references/kb-style-guide.md`: +- Required: `title`, `linkTitle`, `description` +- Optional: `keywords`, `weight` (only when explicitly needed for ordering) + +5. Draft the article using `references/article-template.md` and style rules: +- Short practical intro +- Clear `##` and `###` headings +- Language-tagged code fences (`sql`, `bash`, `yaml`, `xml`, etc.) +- Actionable examples and caveats +- Related resources at the end + +6. Run a self-review using `references/qa-checklist.md`. + +7. Return output in this order: +- Suggested path +- Full markdown (frontmatter + body) +- QA checklist result (pass/fail bullets) +- If section routing is ambiguous, include one alternative path + +## Authoring rules + +- Prefer practical, operator-useful guidance over theory. +- Use concise technical English. +- Preserve ClickHouse naming and SQL syntax exactly. +- Do not add uncommon frontmatter fields (`alias`, `manualLink`, redirects) unless explicitly requested. +- Avoid unsupported claims; if unsure, state assumptions. + +## File and slug rules + +- Use lowercase kebab-case slugs. +- Prefer `altinity-kb-.md` in sections where that convention is common. +- If a likely collision exists, append a disambiguator (for example `-v2` or `-on-kubernetes`). + diff --git a/.claude/skills/altinity-kb-article-writer/agents/openai.yaml b/.claude/skills/altinity-kb-article-writer/agents/openai.yaml new file mode 100644 index 0000000000..72745d3cec --- /dev/null +++ b/.claude/skills/altinity-kb-article-writer/agents/openai.yaml @@ -0,0 +1,4 @@ +interface: + display_name: "Altinity KB Article Writer" + short_description: "Draft KB articles in local Altinity style" + default_prompt: "Use $altinity-kb-article-writer to draft a new KB article with section path, frontmatter, and full markdown in this repository style." diff --git a/.claude/skills/altinity-kb-article-writer/references/article-template.md b/.claude/skills/altinity-kb-article-writer/references/article-template.md new file mode 100644 index 0000000000..5536a928bc --- /dev/null +++ b/.claude/skills/altinity-kb-article-writer/references/article-template.md @@ -0,0 +1,65 @@ +# KB Article Template + +Use this template as the baseline shape, then adjust to topic. + +```markdown +--- +title: "" +linkTitle: "" +description: > + +keywords: + - + - +--- + + + +## Problem + + + +## Solution + + + +### Step 1: + +```sql +-- or bash/yaml/etc +``` + + + +### Step 2: + +```sql +-- or bash/yaml/etc +``` + + + +## Validation + + + +## Caveats + +- +- +- + +## Related resources + +- []() +- [](https://clickhouse.com/docs/) +``` + +## Minimal variant + +For short pages (for example function or setting notes), keep: +- frontmatter +- short intro +- one or two focused sections +- at least one example block + diff --git a/.claude/skills/altinity-kb-article-writer/references/kb-style-guide.md b/.claude/skills/altinity-kb-article-writer/references/kb-style-guide.md new file mode 100644 index 0000000000..5cd45a53e0 --- /dev/null +++ b/.claude/skills/altinity-kb-article-writer/references/kb-style-guide.md @@ -0,0 +1,71 @@ +# Altinity KB Style Guide (Repository Baseline) + +This guide captures the dominant style used under `content/en/**` in this repository. + +## Frontmatter defaults for normal KB pages + +Use: + +```yaml +--- +title: "Page title" +linkTitle: "Left nav title" +description: > + One-sentence summary. +--- +``` + +Optional: +- `keywords`: list of 2-5 useful search terms +- `weight`: only if explicit ordering in section navigation is needed + +Avoid unless explicitly requested: +- `manualLink`, `alias`/`aliases`, redirect `type`/`target`, `draft` + +## Content structure + +- Start with a short practical intro (1-3 paragraphs). +- Use `##` for major sections and `###` for subsections. +- Keep sections task-oriented: + - Context/problem + - Steps or examples + - Validation or expected outcome + - Caveats / edge cases + +## Code and command blocks + +- Use fenced blocks with language tags: + - `sql`, `bash`, `yaml`, `xml`, `json`, `text` +- Keep runnable snippets minimal and focused. +- Prefer realistic table/settings names. + +## Length + +KB articles are short. Median is ~430 words; 90% are under 1100. + +- Target under 1000 words; over 1500 needs a clear reason. +- Cut mechanism write-ups, source-code walkthroughs, stack traces, and evidence + tables — those belong in the PR description. Give the operational rule and its + version scope, not the derivation. + +See the length budget in `AGENTS.md` for the authoritative wording. + +## Writing tone + +- Technical and direct. +- Emphasize actionable guidance for operators and engineers. +- Prefer concrete examples over abstract descriptions. +- Use concise English; avoid marketing wording. + +## Links + +- Add internal KB links when relevant. +- Add official external links for docs/blog/release notes. +- End with a "Related resources" section when useful. + +## Filename and slug + +- Lowercase kebab-case filename. +- Prefer `altinity-kb-.md` where section convention suggests it. +- Place in best-fit section under `content/en`. + diff --git a/.claude/skills/altinity-kb-article-writer/references/qa-checklist.md b/.claude/skills/altinity-kb-article-writer/references/qa-checklist.md new file mode 100644 index 0000000000..5b339bceed --- /dev/null +++ b/.claude/skills/altinity-kb-article-writer/references/qa-checklist.md @@ -0,0 +1,43 @@ +# QA Checklist for Generated KB Articles + +Run this checklist before returning output. + +This checklist covers mechanical correctness only. Also answer the **Review +questions** in `AGENTS.md` — they cover whether the reader needs the content, how +you know the examples work, and whether the article actually solves the problem +end-to-end. A draft can pass every box below and still be the wrong article. + +## Metadata + +- [ ] Path is under `content/en/
/`. +- [ ] Filename uses lowercase kebab-case. +- [ ] Frontmatter has `title`, `linkTitle`, `description`. +- [ ] Optional fields are justified (`keywords`, `weight`). +- [ ] Uncommon fields are not present unless requested. + +## Structure and readability + +- [ ] Intro clearly states problem and scope. +- [ ] Headings are logical (`##` then `###`). +- [ ] Steps or examples are easy to follow. +- [ ] Caveats or assumptions are explicit. + +## Technical quality + +- [ ] SQL/commands are syntactically plausible. +- [ ] Code fences include language tags. +- [ ] Version-sensitive behavior is called out if relevant. +- [ ] No unsupported claims are presented as facts. + +## Linking + +- [ ] Includes relevant internal KB links when possible. +- [ ] Includes high-quality official external references when useful. + +## Final output contract + +- [ ] Output includes suggested path. +- [ ] Output includes full markdown draft. +- [ ] Output includes brief QA result (`PASS` or `FAIL` with reasons). +- [ ] If routing was ambiguous, one alternative path is included. + diff --git a/.claude/skills/altinity-kb-article-writer/references/section-map.md b/.claude/skills/altinity-kb-article-writer/references/section-map.md new file mode 100644 index 0000000000..8a62268a5e --- /dev/null +++ b/.claude/skills/altinity-kb-article-writer/references/section-map.md @@ -0,0 +1,48 @@ +# Section Map for `content/en` + +Select the section that best matches the user topic. + +## Primary routing rules + +- `altinity-kb-queries-and-syntax` + - SQL syntax, query behavior, joins, window functions, TTL syntax, query semantics +- `altinity-kb-setup-and-maintenance` + - Operational troubleshooting, replication operations, backup/restore, upgrades in practice, cluster setup +- `altinity-kb-schema-design` + - `ORDER BY`, `PARTITION BY`, materialized views, table modeling, codecs, LowCardinality design +- `altinity-kb-integrations` + - Kafka, MySQL, Spark, BI tools, external systems and connectors +- `altinity-kb-useful-queries` + - Reusable diagnostics queries against `system.*` and operational SQL snippets +- `altinity-kb-dictionaries` + - External dictionaries, layouts, dictionary performance and configuration +- `altinity-kb-functions` + - Function behavior, function-specific examples, expression patterns +- `engines` + - Engine internals and engine-specific behavior (MergeTree family, Atomic, etc.) +- `altinity-kb-kubernetes` + - Altinity Operator, Kubernetes deployment and networking issues +- `upgrade` + - Upgrade strategy, compatibility notes, known upgrade pitfalls + +## Tie-break rules + +1. If article is mostly query text and reusable snippets, prefer `altinity-kb-useful-queries`. +2. If article is mostly conceptual SQL behavior, prefer `altinity-kb-queries-and-syntax`. +3. If topic is schema/key design, prefer `altinity-kb-schema-design`. +4. If issue is runtime operations and incidents, prefer `altinity-kb-setup-and-maintenance`. +5. If still ambiguous, choose the section with the highest overlap and provide one alternative path. + +## Path format + +Use: +- `content/en/
/.md` + +Where: +- `` is lowercase kebab-case +- Prefix with `altinity-kb-` when it fits section naming patterns + +Examples: +- `content/en/altinity-kb-useful-queries/altinity-kb-find-heavy-merges.md` +- `content/en/altinity-kb-schema-design/altinity-kb-choosing-order-by-for-events.md` + diff --git a/AGENTS.md b/AGENTS.md index 67e8c09fe0..83b0cadef1 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -2,6 +2,25 @@ This repository contains overall-facing ClickHouse knowledge base articles. Optimize for correctness, safety, and reviewability. Do not optimize for large rewrites, cosmetic churn, or generic prose improvement. +## Start here: read the style guide before writing + +Before drafting or substantially rewriting an article, read these. They are short — +under 300 lines in total — and they encode the house style that this file only +summarizes: + +| File | What it gives you | +|---|---| +| `.claude/skills/altinity-kb-article-writer/SKILL.md` | The authoring workflow, start to finish | +| `.claude/skills/altinity-kb-article-writer/references/kb-style-guide.md` | Frontmatter defaults, structure, tone | +| `.claude/skills/altinity-kb-article-writer/references/article-template.md` | The baseline article shape, plus a minimal variant | +| `.claude/skills/altinity-kb-article-writer/references/section-map.md` | Which section an article belongs in | +| `.claude/skills/altinity-kb-article-writer/references/qa-checklist.md` | Self-review before you hand the work back | + +Claude Code loads this directory as a skill automatically. Codex and other tools do +not — read the files directly. Do not rely on inspecting neighbouring articles +instead: sampling nearby files tells you the frontmatter shape but not the tone or +length norms, which is where drafts most often go wrong. + ## Mission When modifying an article, do all of the following: @@ -157,6 +176,27 @@ Review generated commands carefully before executing them. Destructive actions c - Use tables only when they compress real information. - Keep appendix/reference links readable; avoid dumping long raw URLs into the body when a shorter reference style works. +### Length budget + +KB articles are short by design. Across the 250 articles in `content/en`, the median +is about 430 words and 90% are under 1100. + +- **Target: under 1000 words.** +- **Over 1500 words needs a clear reason.** Only 13 of 250 articles are that long. +- One closing `## Related resources` section. Do not also add a separate references list. + +Check before you finish: + +```bash +wc -w content/en/
/.md +``` + +If an article runs long, the cause is usually explanation that belongs in a commit +message or a PR description rather than in the KB: mechanism write-ups, source-code +walkthroughs, stack traces, or evidence tables justifying a claim. State the +operational rule and the version it applies to; leave out the derivation. A reader +needs to know what to do and when it breaks, not why the internals behave that way. + ## Specific guidlines from other reviews (human add here) These are repository-specific lessons and should guide similar edits: @@ -218,6 +258,42 @@ Choose the lightest valid outcome. Default to smaller. +## Review questions + +The checklist below catches mechanical problems. These questions catch the ones that +matter more. Answer them against the actual draft, not from memory, before handing +work back. + +**Does the reader need this?** + +- Is it simple enough, but not simpler? +- Does this detail change what the user should do? +- Can this be explained with a simple example instead of implementation internals? +- Is there anything here the reader simply doesn't need to know? + +Mechanism write-ups, source-code walkthroughs, and evidence tables almost always +fail these. Being able to explain *why* the internals behave a certain way is not a +reason to put it in the article. Put it in the pull request instead, where a +reviewer wants it. + +**Is it true?** + +- How do you know this example actually works? Name the version and environment you + ran it on. "It should work" is not an answer. +- Is every example copy-pasteable and tested? If you reformatted a tested example, + it is no longer tested — run it again. + +**Is it enough?** + +- Does it solve the user's problem end-to-end? + +This last question is the counterweight, and it carries as much weight as the other +six combined. Everything above pushes toward cutting; only this one pushes toward +keeping. Applied without it, the questions will happily strip an article down past +useful. A warning that looks like an internals digression but changes what an +operator configures is not a digression — it is the article. Cut derivations, not +decisions. + ## Final checklist Before finishing, verify all of the following: @@ -232,5 +308,8 @@ Before finishing, verify all of the following: - Useful existing detail was not accidentally removed. - The diff is reviewable. - A human can verify each important claim quickly. +- The style guide was read before drafting. +- The article is within the length budget, or the reason it is not is stated. +- The review questions above were answered against the draft. If any item above fails, reduce scope or stop at findings instead of forcing a patch. diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000000..d00a0276a5 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,37 @@ +# CLAUDE.md + +**[`AGENTS.md`](AGENTS.md) is the source of truth for working in this repository.** +Read it before making any change. This file only points at it and repeats the few +rules that are most often broken, so keep additions here to a minimum — anything +substantive belongs in `AGENTS.md`, which every agent tool reads. + +## Before writing or rewriting an article + +Read `.claude/skills/altinity-kb-article-writer/` — the `SKILL.md` workflow and all +four files under `references/`. Under 300 lines in total. Claude Code loads this +directory as a skill automatically, but read the files directly if it has not been +surfaced to you; do not assume it fired. + +Do not calibrate style by grepping neighbouring articles. That gives you the +frontmatter shape and none of the tone or length norms. + +## The three rules most often broken + +1. **Keep it short.** Target under 1000 words; over 1500 needs a clear reason. The + median article is ~430 words. Mechanism write-ups, source-code walkthroughs, + stack traces, and evidence tables belong in the PR description, not the article. + State the operational rule and its version scope; leave out the derivation. + +2. **Every recipe must be tested.** Untested queries and commands do not belong in + the KB. If you cannot test one, version-gate it or leave it out. + +3. **Prefer point fixes over rewrites.** Keep diffs narrow enough to review quickly. + +## Repository specifics + +- Content lives in `content/en/
/`; Hugo's `contentDir` is `content/en`, so + root-level files like this one are not published. +- The site builds only with the CI-pinned Hugo version in + `.github/workflows/gh-pages.yml`. Newer Hugo fails on pre-existing config issues. +- Contributors must sign the CLA before a PR can merge. +- Keep `ClickHouse®` on first use in title, description, and body.