Draft or polish Kedro documentation. Writes a first draft from source code or a branch, or polishes an existing draft the user provides. Follows the Kedro style
复制下面这句话,粘贴给 Claude Code、Codex、Cursor 等 AI 编程工具,它会读取安装说明并在你确认后完成安装。
请阅读 https://ai.atlankj.com/install/asset/gh-kedro-docs-draft-writer-aa3f7d0d12ee ,按照其中的说明把「kedro-docs-draft-writer」安装到你(当前 AI 工具)中。执行前先告诉我将运行的命令和写入的位置,等我确认。
查看 AI 将读取的安装说明正在读取 GitHub 原文…
内容来自 GitHub 原始文件,由原作者维护。在 GitHub 查看
Write a first draft of a Kedro documentation page, or polish a draft the user already has. The output is always a starting point for human review — not a finished document.
The user can supply any combination of:
| Input | Example |
|---|---|
| Topic only | "draft docs for the new llm_context_node" |
| Topic + doc type | "write a how-to for streaming nodes" |
| PR / branch context | "draft docs for the changes on this branch" |
| Nothing (infer from branch) | "draft docs" |
| Existing draft to polish | "polish this draft", "clean up my docs", "check my draft against the style guide" |
If the user provides an existing draft to polish, skip straight to Polish mode below.
Otherwise, work out what's missing from context. Before generating anything, confirm with the user: topic, doc type, and proposed target file path in a single message. Don't ask three separate questions, and don't ask again in Step 3.
If the user supplied a topic, use it directly.
If no topic was supplied, infer from the current branch:
DEFAULT=$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's|refs/remotes/origin/||')
DEFAULT=${DEFAULT:-main}
git diff origin/${DEFAULT}...HEAD --name-only
gh pr view --json title,body 2>/dev/null
Read changed files under kedro/ to understand what the branch adds or changes. Summarise in one sentence for the user before continuing.
Use the Diátaxis framework. Pick one:
| Type | Purpose | Signals |
|---|---|---|
| How-to | Guide a practitioner through a specific task | "How to X", task-oriented, assumes prior knowledge |
| Tutorial | Teach by doing — complete worked example | Sequential learning, beginner-oriented, has a "by the end" goal |
| Explanation | Build understanding of a concept or design decision | "What is X", "Why does Kedro do X this way", no steps |
| Reference | Precise, complete technical information | Config keys, CLI flags, API parameters |
If the user specified a doc type, use that. Otherwise infer from the topic. When ambiguous, ask.
Use the directory map in reference.md section "Directory map" to pick the right folder. Then propose a filename:
how_to_<verb>_<noun>.md (e.g. how_to_create_a_custom_dataset.md)add_another_pipeline.md)pipeline_introduction.md)configuration_basics.md)Include the proposed path in the single confirmation message from Step 1. Do not ask a second time here.
Read the following before drafting. This is the most important step — the draft quality depends on accurate source material.
Always:
docs/ subdirectory that covers a similar topic. Use it as a structural model for heading hierarchy and section order. To find candidates: ls docs/<subdir>/.kedro/ for accurate class names, method signatures, parameter names, and default values. Read docstrings first — they are the primary source of truth for how a feature behaves.For how-tos and tutorials:
For explanations and reference:
Read multiple files in parallel where possible. Take notes on: key classes/functions, important parameters, any caveats or version constraints, and related docs pages to cross-link.
Gap rule: If source material is missing, ambiguous, or contradictory, do not fill the gap with plausible-sounding content. Insert a <!-- TODO: verify — <what's unclear> --> comment in the draft and list the gap in Step 8. Gaps are expected in a first draft; invented facts are not.
Write the draft directly. Follow the structural template from the page you found in Step 4.
Apply all style rules from reference.md section "Style rules" as you write — do not draft first and fix later.
Scope discipline: Stay specific to the feature being documented. Don't add background context the reader didn't ask for — if broader context is needed, link to an existing explanation page instead of writing it inline. A draft that says too much about the wrong thing is harder to fix than a tight draft with gaps.
Tone guard: Write for a practitioner. Don't over-explain, don't state things obvious from the code, and don't soften instructions with hedges like "you might want to" or "it's worth noting that". Assume the reader is competent. Condescension and sycophancy in docs erode trust.
Required elements by doc type:
How-to:
python, bash, yaml).# replace with your value.Tutorial:
Explanation:
## subsections to group related ideas.Reference:
Write the draft to the confirmed path using the Write tool.
Check whether Vale is installed:
vale --version 2>/dev/null || echo "NOT_INSTALLED"
If Vale is installed, run it from the repo root (where .vale.ini lives) and fix every finding:
vale <path/to/draft.md>
Apply the fix rules from reference.md section "Common Vale fixes". Re-run Vale after fixing until it reports zero findings. Only skip a finding if it is a false positive — tell the user why.
If Vale is not installed, apply the manual style checklist from reference.md section "Manual style checklist" as a substitute pass, then warn the user: "Vale is not installed — install it with brew install vale (macOS) or snap install vale (Linux) and run vale <path> to verify the draft."
Tell the user:
<!-- TODO: verify --> gap — list them explicitly so the user can resolve them before opening a PR.mkdocs.yml before the docs build will include it.Be direct about what the draft is: a starting point. The user should read it, fill the gaps, and do a final review before it goes anywhere. Don't present it as ready to ship.
Use this when the user provides an existing draft and wants it improved, not rewritten. The goal is to make their text cleaner and more consistent — not to replace their decisions about what the doc should say.
Read the file or text the user provides. Do not rewrite it yet.
Follow the same Vale / manual checklist process as Step 7 in the main workflow. Collect all findings before making changes.
Fix anything that is clearly wrong and has no judgment involved: Vale rule violations, spelling, sentence length, passive voice, banned terms (see reference.md "Common Vale fixes").
Do not:
For anything that would require a decision — restructuring, missing information, ambiguous scope — add an inline comment (<!-- SUGGESTION: … -->) and list it in your report. Let the user decide.
Tell the user:
<!-- SUGGESTION: … --> item, with a one-line explanation of why you flagged it.mkdocs for that.make build-docs) — that's kedro-babysit's job.