Skip to content

Commit a6cf943

Browse files
authored
skills: move GitHub issue and PR metadata workflows into skills (#66945)
close #66944
1 parent 5adafaf commit a6cf943

4 files changed

Lines changed: 105 additions & 26 deletions

File tree

.agents/skills/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ Current operational workflow skills:
1515
- `tidb-realtikv-runner`: run RealTiKV tests with startup/cleanup discipline.
1616
- `tidb-test-diff-triage`: triage unexpected test diffs (failpoint vs upstream vs local regression).
1717
- `tidb-test-guidelines`: test placement, naming, writing conventions, and shard_count guidance.
18+
- `tidb-issue-metadata-guard`: create or update TiDB issues without breaking required templates, labels, or issue metadata conventions.
19+
- `tidb-pr-metadata-guard`: create or update TiDB PR descriptions without breaking PR title scope conventions, required templates, HTML comments, or bot-parsed checklist sections.
1820

1921
Use `AGENTS.md` for repository policy, validation/reporting requirements, and the pre-flight checklist.
2022
Use `docs/agents/testing-flow.md` for canonical build/test command playbooks.
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
---
2+
name: tidb-issue-metadata-guard
3+
description: Use when creating or editing TiDB GitHub issues so issue templates, labels, issue titles, and issue descriptions stay consistent with repository workflow. Trigger on tasks involving issue creation, bug reports, enhancement tracking issues, label selection, or searching for existing issues and PRs before filing a new one.
4+
---
5+
6+
# TiDB Issue Metadata Guard
7+
8+
## Overview
9+
10+
Use this skill for TiDB GitHub issue metadata updates.
11+
The goal is to preserve issue-template structure, label hygiene, and searchable issue descriptions.
12+
13+
Before creating or editing an issue, read the matching file under `.github/ISSUE_TEMPLATE/`.
14+
15+
## Workflow
16+
17+
1. Write issue titles and descriptions in English.
18+
2. Search existing issues and PRs first when the task is bug reporting or tracking an existing change.
19+
3. When creating a new issue, start from the matching issue template instead of writing the body from scratch.
20+
- Follow the template and fill the required sections.
21+
- For bug reports, include minimal reproduction, expected behavior, actual behavior, and TiDB version information when available.
22+
- Fill issue fields with concrete values from the available artifacts instead of generic placeholders.
23+
- Keep the first screen readable: show the top-level repro summary, expected result, actual result, and version directly in the section body.
24+
- If a field is long, keep a short visible summary and put the full content in a `<details>` block.
25+
- Good candidates: full repro SQL, full schema, long logs, checksum diffs, execution plans, and plan replayer notes.
26+
- Do not hide the only reproduction steps or the top-level expected/actual conclusion inside `<details>`.
27+
- If supporting artifacts exist, mention them explicitly in the repro steps or attachments summary.
28+
- When adding an analysis section, keep it short and evidence-backed:
29+
- 1–3 likely causes at most
30+
- prefer evidence from SQL shape, plans, errors, or result diffs
31+
4. When editing an existing issue, start from the current issue body instead of rewriting it from scratch.
32+
- Fetch the current title, body, and labels first.
33+
- Patch only the intended template sections and preserve untouched sections, metadata, and still-valid context.
34+
- Re-apply the same content rules used for new issues: concrete values, visible top-level summary, `<details>` for long raw artifacts, and short evidence-backed analysis when needed.
35+
5. When applying labels, do it explicitly instead of assuming the UI or template will fill them in.
36+
- For new issues created with `gh issue create`, add labels explicitly when the GitHub UI would normally auto-apply them.
37+
- For existing issues, prefer `gh issue edit` so labels reflect the current state after the body update.
38+
- Add at least one `component/*` label.
39+
- For bug or regression issues, add `severity/*` and affected-version labels when appropriate.
40+
- Severity labeling rule:
41+
- Wrong-result bugs: use `severity/major`.
42+
- Query fails to execute on valid SQL, for example an internal planner or runtime error: use `severity/major`.
43+
- Complex-query or compatibility issues that are not confirmed wrong-result and are not execution-blocking: use `severity/moderate`.
44+
- If label permissions are missing, first add labels by commenting `/label <label name>`.
45+
- If label comments still do not work, add a separate comment with `Suggested labels: ...`.
46+
6. Prefer file-based edits for GitHub metadata.
47+
- Materialize the intended issue body in a local Markdown file.
48+
- For new issues, review that file against the matching issue template before calling `gh`.
49+
- For existing issues, diff the patched body against the current issue body before calling `gh`.
50+
51+
## Quick Checks
52+
53+
- The issue title and body are in English.
54+
- The issue still follows the matching template structure.
55+
- Long raw artifacts are folded with `<details>` when needed, while the top-level summary remains visible.
56+
- Existing issue edits preserve untouched sections and metadata outside the intended patch.
57+
- The issue carries the expected labels, or a follow-up label comment / `Suggested labels: ...` comment is present when label permissions are missing.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
name: tidb-pr-metadata-guard
3+
description: Use when creating or editing TiDB pull requests so PR title scope, PR template fields, hidden HTML comments, and bot-parsed checklist sections stay intact. Trigger on tasks involving PR creation, PR body updates, issue linking from a PR, test checklist updates, or investigating labels like do-not-merge/needs-tests-checked.
4+
---
5+
6+
# TiDB PR Metadata Guard
7+
8+
## Overview
9+
10+
Use this skill for TiDB GitHub pull request metadata updates.
11+
The goal is to preserve repository-required PR structure while editing only the mutable fields.
12+
13+
Before changing a PR body, read `.github/pull_request_template.md`.
14+
15+
## Workflow
16+
17+
1. Write PR titles and descriptions in English.
18+
2. For a new PR, start from `.github/pull_request_template.md` instead of writing the body from scratch.
19+
- Use a title in the form `pkg [, pkg2, pkg3]: what is changed` or `*: what is changed`.
20+
- In that title format, `pkg` means the TiDB module area, not a literal Go package path. For example, changes under `pkg/planner/core` usually map to `planner`, not `pkg/planner/core`.
21+
- Use `gh pr create -T .github/pull_request_template.md`.
22+
- Fill in the template in a Markdown file first, then submit it.
23+
3. For an existing PR, update only the mutable sections.
24+
- Safe targets: `Issue Number:`, `Problem Summary:`, the content under `### What changed and how does it work?`, test checkbox states and concrete commands, and the `release-note` block.
25+
- Do not rename headings, reorder checklist sections, or rewrite the template wholesale.
26+
4. Preserve hidden HTML comments exactly.
27+
- Keep `Tests <!-- At least one of them must be included. -->` unchanged.
28+
- Keep the `No need to test` nested block and its HTML comment unchanged.
29+
- Do not delete or rewrite template comments that explain issue linking or release-note behavior.
30+
5. If a PR needs a new linked issue, use `tidb-issue-metadata-guard` to create or identify the issue first, then patch only the `Issue Number:` line in the PR body.
31+
6. Prefer file-based edits for GitHub metadata.
32+
- Materialize the intended issue body or PR body into a local Markdown file.
33+
- Review that file against the PR template before calling `gh`.
34+
7. After any PR body update, re-read the PR and check whether bot-gated labels changed as expected.
35+
- `do-not-merge/needs-linked-issue`
36+
- `do-not-merge/needs-tests-checked`
37+
- If a label remains unexpectedly, diff the current body against `.github/pull_request_template.md` before changing anything else.
38+
39+
## Quick Checks
40+
41+
- The PR body still contains an `Issue Number:` line, and that line can reference one or more related issues with full keyword syntax such as `close #<id>` and `ref #<id>`.
42+
- The PR title uses module-oriented scope names such as `planner`, `executor`, or `*:`, not raw Go package paths such as `pkg/planner/core`.
43+
- The `Tests` line still includes the template HTML comment verbatim.
44+
- At least one test checkbox is checked, or `No need to test` is checked with a reason.

AGENTS.md

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ When writing complex features or significant refactors, use an ExecPlan from des
4545
| Fmt-only PR | MUST NOT run costly `realtikvtest`; local compilation is enough. |
4646
| During local coding iterations (not claiming completion) | SHOULD use the `WIP` verification profile from `.agents/skills/tidb-verify-profile` to run only scoped checks. |
4747
| Claiming task completion / PR readiness | MUST use the `Ready` verification profile from `.agents/skills/tidb-verify-profile`; if there are code changes, this includes `make lint`. `Ready` is mandatory before making final-status claims such as "fixed", "done", "all tests pass", "ready for review", or "ready for PR". |
48+
| Creating or updating a GitHub issue | SHOULD use `.agents/skills/tidb-issue-metadata-guard` to preserve issue templates and label hygiene. |
49+
| Creating a PR or editing PR metadata | SHOULD use `.agents/skills/tidb-pr-metadata-guard` to preserve PR templates, title scope, and bot-parsed checklist sections. |
4850
| Before finishing | SHOULD self-review diff quality before finishing. |
4951
| Expensive optional sweeps (for example `make bazel_lint_changed`, broad package runs) | MUST run only when required by change scope, CI reproduction, or explicit user request. |
5052

@@ -170,32 +172,6 @@ Command details for package, integration-test, and RealTiKV surfaces live in `do
170172
- Use explicit placeholders such as `<package_name>`, `<TestName>`, and `<dir>`.
171173
- Documentation updates SHOULD keep terminology, policy wording, and command conventions consistent across related docs.
172174
- Keep guidance executable and concrete; avoid ambiguous phrasing.
173-
- Issues and PRs MUST be written in English (title and description).
174-
175-
## Issue and PR Rules
176-
177-
### Issue rules
178-
179-
- Follow templates under `.github/ISSUE_TEMPLATE/` and fill all required fields.
180-
- Bug reports should include minimal reproduction, expected/actual behavior, and TiDB version (for example `SELECT tidb_version()` output).
181-
- Search existing issues/PRs first (for example `gh search issues --repo pingcap/tidb --include-prs "<keywords>"`), then add relevant logs/configuration/SQL plans.
182-
- Labeling requirements:
183-
- `type/*` is usually applied by the issue template (GitHub UI); if creating issues via `gh issue create`, add it explicitly via `--label` (or follow up with `gh issue edit --add-label`).
184-
- Add at least one `component/*` label.
185-
- For bug/regression, include `severity/*` and affected-version labels (for example `affects-8.5`, or `may-affects-*` if unsure).
186-
- If label permissions are missing, include `Suggested labels: ...` in issue body.
187-
188-
### PR requirements
189-
190-
- PR title MUST use one of:
191-
- `pkg [, pkg2, pkg3]: what is changed`
192-
- `*: what is changed`
193-
- PR description MUST follow `.github/pull_request_template.md`.
194-
- PR description MUST contain one line starting with `Issue Number:` and reference related issue(s) using `close #<id>` or `ref #<id>`.
195-
- If you create PRs via GitHub CLI, start from the template to avoid breaking required HTML comments: `gh pr create -T .github/pull_request_template.md` (then fill in the fields; do not delete/alter the HTML comment markers).
196-
- Keep HTML comments unchanged, including `Tests <!-- At least one of them must be included. -->`, because CI tooling depends on them.
197-
- Avoid force-push when possible; prefer follow-up commits and squash merge.
198-
- If force-push is unavoidable, use `--force-with-lease` and coordinate with reviewers.
199175

200176
## Agent Output Contract
201177

0 commit comments

Comments
 (0)