write-pr
GitHub指导如何为代码仓库创建或更新Pull Request,包括填写模板、收集上下文及生成结构化变更描述。
Trigger Scenarios
Install
npx skills add MoonshotAI/kimi-code --skill write-pr -g -y
SKILL.md
Frontmatter
{
"name": "write-pr",
"description": "Use when creating a pull request in the kimi-code repository — how to fill in each section of the PR template with concise, reviewer-friendly content."
}
Write PR Description
Create or update the pull request for the current branch with a description that helps the reviewer understand why the change exists and the shape of the implementation.
Workflow
-
Read the PR template:
Read(.github/pull_request_template.md) -
Identify or create the pull request:
- Check the current branch for an existing PR:
gh pr view --json url,number,title,state 2>/dev/null. - If no PR exists, inspect
git status --short --branchand the commits on the current branch. - Commit remaining changes, push the branch with an upstream, and create the PR with
gh pr create. - Follow the repository's git safety protocol.
- Check the current branch for an existing PR:
-
Gather the context needed to explain the change:
- Read the linked issue and any relevant task artifacts.
- Read the complete diff (
git diff main...HEAD) and enough surrounding code to understand behavior and ownership. - Use
gh pr viewto collect PR metadata and changed files if the PR already exists.
-
Write the PR description following the template sections:
- Requirement or Bug — one sentence or
Resolve #<number>. Nothing more. - Bug Reproduction Steps — bug PRs only;
N/Afor features. WriteSee linked issuewhen steps are already there. - Root Cause — bug PRs only;
N/Afor features. State the cause and whether this is a fundamental fix or a workaround. - Code Changes — use visual outline views (see below) instead of prose whenever they explain the change better.
- Impact Scope — list affected modules and test coverage.
- Checklist — check every box that applies.
- Requirement or Bug — one sentence or
-
Publish the description:
- Save to a temp file, then
gh pr edit <number> --body-file <path>orgh pr create --body-file <path>. - Confirm the update succeeded.
- Save to a temp file, then
Visual Outline for Code Changes
Prefer structural views over prose. Use the smallest combination that explains the implementation. Omit categories that did not change.
Show logic or algorithm changes as pseudocode diff:
on(save)
- write content
+ if content is unchanged
+ return cached result
+ write new content
+ invalidate cache
Show runtime control flow as a call tree diff:
submitForm
createSession
persistPrompt
+ expandSkillMention
launchAgent
- navigateToSession
+ navigateToSession
+ subscribeToEvents
Show file responsibility changes as a shallow file tree diff:
src/
├── commands/
+│ └── show-me.ts # expands the slash command
├── sessions/
-└── transport.ts
+└── transport/
+ ├── client.ts
+ └── stream.ts
Show component or UI structure changes as a tree diff:
<SessionPage>
useSessionEvents()
<SessionToolbar>
+ <RunSkillButton />
<SessionTimeline>
+ <SkillResultCard />
Show component interaction, control flow, or data flow with Mermaid (especially useful for explaining bug mechanics):
sequenceDiagram
participant User
participant UI
participant Daemon
User->>UI: choose command
UI->>Daemon: send expanded prompt
Daemon-->>UI: stream result
Show key data structure or type changes in a language-specific block:
interface SessionEvents {
onTurnStart(cb: (turn: Turn) => void): void;
onTurnEnd(cb: (turn: Turn) => void): void;
}
Rules for visual outlines:
- Use
diffblocks when the point is what changes and the surrounding shape already exists. - Show the complete target shape in a language-specific or
textblock when most of it is new or diff notation would obscure ownership or order. - Tell the story in the order that makes it easiest to understand — files first, or data structures first, whichever fits.
- Write as one human talking to another: simple, coherent, concise language.
Version History
- be7d5f5 Current 2026-09-27 18:03


