|
| 1 | +# Repo Conventions |
| 2 | + |
| 3 | +This file captures the repository-specific rules that agents should follow in `pingcap/docs`. |
| 4 | + |
| 5 | +## Repository scope |
| 6 | + |
| 7 | +- `pingcap/docs` stores the English TiDB documentation source. |
| 8 | +- `pingcap/docs-cn` stores the Chinese documentation source. |
| 9 | +- This repository is the source for the English TiDB documentation published on the PingCAP documentation website. |
| 10 | +- TiDB documentation and TiDB Cloud documentation do not always follow the same maintenance model. Do not assume they use the same branch, scope, or publication rules. |
| 11 | + |
| 12 | +## Repository versions and branches |
| 13 | + |
| 14 | +- The `master` branch tracks the latest development version of TiDB documentation. |
| 15 | +- Published TiDB documentation is maintained in the corresponding `release-<version>` branches. |
| 16 | +- Archived documentation is no longer maintained and should not receive normal documentation updates. |
| 17 | +- By default, target `master` unless the change clearly belongs to a maintained release branch. |
| 18 | +- Preserve branch intent. Do not treat release-branch behavior as the default development behavior, and do not move dev-only content into release branches. |
| 19 | + |
| 20 | +## Choosing affected versions |
| 21 | + |
| 22 | +Follow the repository's affected-version model when proposing or reviewing changes. |
| 23 | + |
| 24 | +- By default, affected versions should be `master` only for documentation enhancements, missing-content additions, wording fixes, refactors within a topic, and general corrections that are not tied to a specific released behavior. |
| 25 | +- Choose the affected release branch or branches together with `master` when the change involves version-specific behavior, compatibility changes, changed default values, changed system variable behavior, display fixes, or broken-link fixes in published docs. |
| 26 | +- If a change applies to multiple maintained versions, prefer the latest applicable branch and use cherry-pick labels instead of opening parallel PRs by default. |
| 27 | +- If most of the change can be cherry-picked but some branches require different wording or follow-up edits, account for version-specific follow-up work and the relevant reminder labels. |
| 28 | + |
| 29 | +## Cherry-pick and branch-follow-up conventions |
| 30 | + |
| 31 | +- Use the repository's cherry-pick label workflow instead of inventing a custom multi-branch process. |
| 32 | +- If a change applies only to one documentation version, use that branch directly and do not add unnecessary cherry-pick labels. |
| 33 | +- If a change applies to multiple documentation versions, prefer a single PR on the latest applicable branch and rely on cherry-pick labels for the remaining maintained versions. |
| 34 | +- If branch-specific differences are expected, flag that clearly so reviewers know follow-up edits are required in the cherry-picked PRs. |
| 35 | + |
| 36 | +## Repository layout and navigation |
| 37 | + |
| 38 | +- Use the existing repository structure and nearby documents as the primary guide for where new content should live. |
| 39 | +- New navigable documents usually require a matching update in the appropriate `TOC.md` file. |
| 40 | +- When a document is added, removed, moved, or renamed, check whether related TOC files, aliases, links, and cross-document references also need updates. |
| 41 | +- Reuse existing document patterns in the same area before introducing a new structure. |
| 42 | + |
| 43 | +## TiDB Cloud conventions |
| 44 | + |
| 45 | +- In this repository, TiDB Cloud documentation is maintained in the `release-8.5` branch for content reuse. |
| 46 | +- To contribute to TiDB Cloud documentation, make sure the PR is based on `release-8.5`. |
| 47 | +- Use `TOC-tidb-cloud.md` and `TOC-tidb-cloud-*.md` to understand which documents are TiDB Cloud-only and which TiDB documents are reused by TiDB Cloud. |
| 48 | +- If a path in `TOC-tidb-cloud.md` or `TOC-tidb-cloud-*.md` starts with `/tidb-cloud/`, it is TiDB Cloud-only content. |
| 49 | +- If a path in `TOC-tidb-cloud.md` or `TOC-tidb-cloud-*.md` does not start with `/tidb-cloud/`, it is reused from TiDB documentation. |
| 50 | +- Be careful with `CustomContent` tags such as `<CustomContent platform="tidb">` and `<CustomContent platform="tidb-cloud">`. Do not change, remove, or expand them casually, because they control platform-specific rendering behavior. |
| 51 | +- When editing shared TiDB and TiDB Cloud content, verify whether the change applies to both platforms or only one. |
| 52 | + |
| 53 | +## Contribution model |
| 54 | + |
| 55 | +- New documents should follow the templates in `resources/doc-templates/` when applicable. |
| 56 | +- Keep PR descriptions compatible with `.github/pull_request_template.md`. |
| 57 | +- Keep changes scoped to the requested task. Do not broaden a focused doc update into unrelated cleanup. |
| 58 | +- Prefer existing repository workflows, labels, and conventions over ad hoc alternatives. |
| 59 | +- When contributing diagrams, follow the existing diagram-style guidance rather than introducing a new visual style. |
| 60 | + |
| 61 | +## File naming rules |
| 62 | + |
| 63 | +- Use file names that briefly describe the document content, for example, `destroy-tidb-cluster.md`. |
| 64 | +- Keep file names concise and general. Avoid overly specific wording that might require frequent renaming and cause unnecessary URL changes. |
| 65 | +- Except for special files such as `TOC.md`, `CONTRIBUTING.md`, and `README.md`, use lowercase letters only in file names. |
| 66 | +- If a file name contains multiple English words, separate them with hyphens (`-`). |
| 67 | +- Do not use underscores (`_`) in file names. |
| 68 | +- Use lowercase file extensions only. |
| 69 | +- Markdown files must use the `.md` extension. |
| 70 | + |
| 71 | +## Content boundaries |
| 72 | + |
| 73 | +- Preserve product behavior, version numbers, links, anchors, file intent, and branch intent unless the task explicitly requires changing them. |
| 74 | +- Do not silently change technical meaning while improving wording. |
| 75 | +- Avoid changing commands, code samples, UI strings, configuration names, API fields, JSON, EBNF content, or generated helper files unless the task directly requires it or they are factually wrong. |
| 76 | +- When editing syntax-related content, be careful not to break EBNF or other structured source formats. |
| 77 | +- Keep cross-repo translation traceability when work maps between `docs` and `docs-cn`. |
| 78 | +- When a translation-related task maps content across repositories, preserve the source PR relationship, terminology intent, and affected-file mapping. |
| 79 | + |
| 80 | +## Front matter and document metadata |
| 81 | + |
| 82 | +- Preserve existing front matter structure unless the task requires a metadata change. |
| 83 | +- When front matter is present, keep `title`, `summary`, `aliases`, and other metadata aligned with the document content. |
| 84 | +- If a file is moved or renamed, check whether `aliases` should be updated to preserve inbound links. |
| 85 | +- Do not add or remove metadata fields casually. Follow existing patterns in nearby documents. |
| 86 | + |
| 87 | +## Linking and cross-document consistency |
| 88 | + |
| 89 | +- Preserve repository-relative absolute links when that is the repository convention. |
| 90 | +- When editing a document that summarizes or references other docs, check whether those related docs also need updates. |
| 91 | +- If a term, version statement, feature behavior, workflow, or compatibility note changes in one place, check nearby overview, task, reference, and release-note content for possible follow-up updates. |
| 92 | +- When changing headings, verify whether anchors, intra-repo links, TOC entries, or external references might be affected. |
| 93 | + |
| 94 | +## Validation habits |
| 95 | + |
| 96 | +Use existing repository checks instead of inventing new ones. |
| 97 | + |
| 98 | +- `./scripts/markdownlint <files>` for Markdown formatting |
| 99 | +- `./scripts/verify-links.sh` for link validation when links, anchors, moved files, or renamed files are involved |
| 100 | +- targeted repository scripts when the task touches glossary terms, keywords, anchor conflicts, or other specialized checks |
| 101 | + |
| 102 | +If a full check is too expensive for the task, validate the files you changed and any directly affected TOC or link targets. |
| 103 | + |
| 104 | +## Existing helpers |
| 105 | + |
| 106 | +Look for established scripts and workflows before automating from scratch. |
| 107 | + |
| 108 | +Use them as references for expected behavior, even when local credentials, permissions, or secrets prevent direct execution. |
| 109 | + |
| 110 | +## Agent behavior in this repository |
| 111 | + |
| 112 | +- Read the shared guidance in `.ai/shared/` before making non-trivial changes. |
| 113 | +- Use a matching skill in `.ai/skills/` when the task is workflow-specific. |
| 114 | +- Prefer minimal, targeted edits over broad rewrites. |
| 115 | +- Reuse existing wording, terminology, and document structure when they are already correct. |
| 116 | +- When unsure, check nearby docs, templates, and repository patterns before introducing a new approach. |
0 commit comments