-
Notifications
You must be signed in to change notification settings - Fork 711
add writing-doc-summaries skill #22664
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 5 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
a664f5d
ai: add writing-doc-summaries skill
Oreoxmt 281ab5b
fix
Oreoxmt 008fbde
fix
Oreoxmt 6802f36
fix
Oreoxmt 534d72c
make ci happy
Oreoxmt b333990
Apply suggestions from code review
Oreoxmt db3d381
update length and add examples
Oreoxmt 1fa8610
update Preferred patterns
Oreoxmt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,142 @@ | ||
| --- | ||
| name: writing-doc-summaries | ||
| description: Writes or updates the front matter `summary` field in pingcap/docs and pingcap/docs-cn Markdown files. The summary is an SEO-friendly sentence of 115-145 characters. Use when a document is missing a summary, when a reviewer or CI check flags a low-quality summary, or when an existing summary is outdated, inaccurate, or the wrong length. | ||
| --- | ||
|
|
||
| # Writing Doc Summaries | ||
|
|
||
| Write or improve the `summary` field in the YAML front matter of Markdown files in `pingcap/docs` and `pingcap/docs-cn`. | ||
|
|
||
| ## Front matter example | ||
|
|
||
| ```yaml | ||
| --- | ||
| title: Back up and Restore Data Using Dumpling and TiDB Lightning | ||
| summary: Learn how to use Dumpling and TiDB Lightning to back up and restore full data of TiDB. | ||
|
Oreoxmt marked this conversation as resolved.
Outdated
|
||
| --- | ||
| ``` | ||
|
|
||
| ## Summary rules | ||
|
|
||
| 1. **Length**: 115-145 characters including spaces. | ||
| 2. **Opening verb**: Start with an SEO-friendly verb phrase (see table below) that tells the reader what they will get from this document. Never start with the document title, a product name alone, or a noun phrase. | ||
|
Oreoxmt marked this conversation as resolved.
Outdated
|
||
| 3. **Perspective**: Reader-focused — tell them what they will learn or do. | ||
|
Check failure on line 23 in .ai/skills/writing-doc-summaries/SKILL.md
|
||
| 4. **No special leading characters**: Do not start with `>`, `*`, `#`, `-`, or `[`. | ||
|
Oreoxmt marked this conversation as resolved.
Outdated
|
||
| 5. **YAML quoting**: Wrap the value in double quotes if it contains `:` or other YAML special characters. | ||
| 6. **No redundancy**: Do not repeat the document title word-for-word. Rephrase to add value. | ||
| 7. **Language**: Match the document body language. Chinese body → Chinese summary. | ||
| 8. **Self-contained**: Must be understandable without the title or body — it may appear as a standalone search snippet. | ||
|
Check failure on line 28 in .ai/skills/writing-doc-summaries/SKILL.md
|
||
| 9. **Accuracy**: Must match the actual scope of the document. Do not promise content the document does not deliver. | ||
| 10. **Tone**: Conversational but professional. No marketing language. | ||
|
|
||
| ## Structure formula | ||
|
|
||
| For most document types, a reliable pattern is: | ||
|
|
||
| **[Action/Topic] + [Object] + [Outcome/Value]** | ||
|
|
||
| | Part | What it covers | Example | | ||
| |---|---|---| | ||
| | Action/Topic | Opening verb phrase | `Learn how to configure` | | ||
| | Object | What the document is about | `TLS encryption between TiDB components` | | ||
| | Outcome/Value | What the reader gains or achieves | `to secure data in transit and meet compliance requirements` | | ||
|
|
||
| Full example: `Learn how to configure TLS encryption between TiDB components to secure data in transit and meet compliance requirements.` | ||
|
|
||
| **Exceptions:** | ||
|
|
||
| - **SQL statement reference**: Use fixed template — `An overview of the usage of <STATEMENT> for the TiDB database`. No outcome clause needed. | ||
|
Check failure on line 48 in .ai/skills/writing-doc-summaries/SKILL.md
|
||
|
Oreoxmt marked this conversation as resolved.
Outdated
|
||
| - **Focused task docs**: Omit the outcome clause if the action and object already imply it and the sentence meets minimum length. | ||
|
|
||
| ## Opening verb guidance | ||
|
|
||
| Scan a few existing summaries in the same subdirectory first to match local conventions. | ||
|
|
||
| ### Preferred patterns | ||
|
Oreoxmt marked this conversation as resolved.
|
||
|
|
||
| | Document type | Preferred opening | | ||
| |---|---| | ||
| | Concept / overview | Learn what, Learn how X works, Learn about, Introduce the concept of | | ||
| | Feature introduction | Introduce, Introduce the, Learn about | | ||
| | Task / procedure | Learn how to | | ||
| | Quick start | Learn how to quickly get started with | | ||
| | Configuration | Learn all the configuration options for, Learn how to configure | | ||
| | Troubleshooting | Learn how to troubleshoot, Learn how to diagnose | | ||
| | SQL statement reference | An overview of the usage of `<STATEMENT>` for the TiDB database | | ||
| | Release notes | Learn about the new features, compatibility changes, improvements, and bug fixes in TiDB `<version>` | | ||
|
|
||
| ### Patterns to avoid | ||
|
|
||
| - Starting with the product name alone: `TiDB ...`, `TiKV ...` | ||
| - `This document`, `This guide`, `This article`, `This page` | ||
| - `Explains`, `Describes` (use `Learn` or `An overview of` instead) | ||
| - `The reference for`, `The usage of` | ||
| - Repeating the document title word-for-word | ||
|
|
||
| ## Before and after | ||
|
|
||
| **Before** (vague, filler opening, no outcome): | ||
|
|
||
| ```yaml | ||
| summary: This document explains the auto-tune feature of Backup & Restore. | ||
| ``` | ||
|
|
||
| **After** (reader-focused, specific, includes outcome): | ||
|
|
||
| ```yaml | ||
| summary: Learn how the BR auto-tune feature automatically limits backup resource usage to reduce impact on online TiDB cluster performance. | ||
| ``` | ||
|
|
||
| **Before** (generic, no user intent): | ||
|
|
||
| ```yaml | ||
| summary: An introduction to metadata lock in TiDB. | ||
| ``` | ||
|
|
||
| **After** (introduces concept and explains why it matters): | ||
|
|
||
| ```yaml | ||
| summary: Introduce the concept, principles, and implementation of metadata lock in TiDB, and learn how it prevents DDL and DML conflicts. | ||
|
Oreoxmt marked this conversation as resolved.
Outdated
|
||
| ``` | ||
|
|
||
| ## Workflow | ||
|
|
||
| 1. **Read** the target Markdown file fully. Note the title, opening paragraph, main sections, scope, and any existing `summary`. | ||
|
|
||
| 2. **Draft** 2-3 candidate sentences using the structure formula and the opening-verb table. | ||
|
|
||
| 3. **Validate** each candidate: | ||
| - Count characters. Must be 115-145. | ||
| - Confirm opening verb fits the document type. | ||
| - Confirm it does not promise content the document lacks. | ||
| - Confirm language matches the document body. | ||
| - If it contains `:`, confirm the value is wrapped in double quotes. | ||
|
|
||
| 4. **If validation fails** → revise and re-validate. Repeat until all checks pass. | ||
|
|
||
| 5. **Apply** the best candidate: | ||
| - If front matter exists, update the `summary` line in place. | ||
| - If front matter is missing, add it at the top: | ||
|
|
||
| ```yaml | ||
| --- | ||
| title: <existing H1 text, in title case> | ||
| summary: <new summary> | ||
| --- | ||
| ``` | ||
|
|
||
| - Preserve all other front matter fields. Do not change the document body. | ||
|
|
||
| 6. **Final check**: Re-count characters one more time after editing. Confirm `title` matches the H1. Confirm no special leading character without wrapping quotes. | ||
|
|
||
| ## Output expectations | ||
|
|
||
| - Apply the change directly using the Edit tool. | ||
| - Report the final summary text and its character count. | ||
| - If the existing summary is already acceptable, say so and explain why. | ||
| - Prefer a full rewrite over minor edits when the existing summary is structurally weak. | ||
| - Do not rewrite or reformat any other part of the document. | ||
|
|
||
| ## Gut check | ||
|
|
||
|
Oreoxmt marked this conversation as resolved.
|
||
| Before applying: **would this make a TiDB user want to click through from search results?** If not, rewrite. | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.