لوگوی اسکیلیکس اسکیلیکس | Skilliks آکادمی و استودیوی ابزارهای AI تاریخ شمسی… --:--:--

Kompreni: write a walkthrough of the changes

آزاد تازه‌وارد تاییدشده امن

کارهای تکراری ترمینال، مدیریت شاخه‌ها، نوشتن پیام کامیت استاندارد و ساخت اسکریپت‌های کمکی را سریع و یکدست انجام می‌دهد. (شامل ۴۴ گام عملی · سازگار با Claude Code).

سازگاری با ابزارها: این Skill به مسیر/قابلیت اختصاصی Claude Code وابسته است. مشاهدهٔ جدول سازگاری

متن دستورالعمل (SKILL.md)

دسترسی کامل فعال است
---
name: walkthrough
description: Write a structured, persistent walkthrough document (Quarto .qmd, or Markdown) that teaches how and why code changed, for substantial changes worth keeping a record of. Works on the changes an AI agent made in this session, or on a git branch, a commit, or the commits since a ref. Use when the user asks for a walkthrough, write-up or document of changes ("write a walkthrough of this", "document what changed on this branch as a qmd"). For a quick explanation in the chat, use kompreni:explain instead. Never run it automatically after a task.
argument-hint: "[depth=standard|deep] [level=new-to-programming|new-to-language|intermediate|advanced|<free text>] [branch=<name> [onto=<ref>] | since=<ref> | commit=<ref>] [focus=<path or topic>] [scope=all|new] [code=key|all] [format=qmd|md] [out=<dir>] [render=auto|yes|no] [quiz=on|off] [title=\"...\"]"
---

# Kompreni: write a walkthrough of the changes

Write a document that someone who wasn't in this conversation can read, months later, to understand how and why this part of the codebase changed. It is a guided explanation, not a change report and not a restated diff.

This skill shares its change collection, grouping, evidence rules, levels and checker with the explain skill. `<explain>` below is the explain skill's folder: `${CLAUDE_PLUGIN_ROOT}/skills/explain` in a plugin install, otherwise the `explain` folder next to this skill's folder. `<skill>` is this skill's folder.

## 1. Parse arguments

`$ARGUMENTS` is optional `key=value` pairs.

| Arg | Default | Notes |
|---|---|---|
| `depth` | auto | `standard` (a short walkthrough) or `deep` (a full one). See step 4 |
| `level` | auto | As in explain: see `<explain>/references/levels.md` |
| `branch`, `onto`, `since`, `commit` | none | History mode, as in explain. At most one of `branch`, `since` and `commit` |
| `focus` | none | A path or topic. Cover only the changes relevant to it |
| `scope` | `all` | Session mode only. `all`: everything this conversation changed. `new`: only what changed since the last Kompreni explanation, walkthrough or `/kompreni:checkpoint` in this conversation |
| `code` | `key` | `key`: one to three key excerpts, as in `references/structure.md`. `all`: a **code tour** showing all the substantive changed code with a little context, explained line by line with Quarto code annotations. See `references/code-tour.md`. Implies `format=qmd` |
| `format` | auto | `qmd` or `md`. Auto: `qmd` if `quarto --version` works or a `_quarto.yml` exists in the repo root or a parent folder, otherwise `md` |
| `out` | `kompreni/walkthroughs` | The folder to write into, relative to the repo root |
| `render` | `auto` | `qmd` only. `auto`: render to HTML if Quarto is installed and the file isn't inside an existing Quarto project. `yes`: render anyway. `no`: don't render |
| `quiz` | `on` | `off` leaves out "Check your understanding" |
| `title` | from the changes | The document's title |

**`code=all` with `format=md`** conflict: GitHub-flavoured Markdown has no code annotations. Say so and ask which the user wants. With `code=all` and no Quarto installed, still write `.qmd` (it's readable as text) and skip rendering.

## 2. Collect the changes

Read `<explain>/SKILL.md` and follow its step 2 (session mode) or, in history mode, `<explain>/references/history-mode.md` sections 1-4. That includes taking the snapshot in session mode. Differences:

- The default scope is `all`. With `scope=new`, a previous walkthrough's or checkpoint's `Kompreni snapshot:` line counts as a baseline like an explanation's.
- **Uncommitted changes** (session mode with a dirty tree, or `since=` with uncommitted work you are including): write the walkthrough anyway, without asking first. References point at the working tree as it is now. Record `dirty: true` (see `references/front-matter.md`) and put the drift note from `references/formats.md` at the top of the document. Committing and sealing come after, if the user wants them (steps 8 and 9).
- **Fingerprint.** Record `kompreni.blobs` for every walkthrough, committed or not, with a script, never from memory: `python <explain>/scripts/seal.py fingerprint --repo . [--ref <tree-or-commit>] <files>...` prints the `blobs:` line for the front matter. Use `--ref <snapshot tree>` in session mode (the hashes are then exactly what was explained), `--ref <tip>` in history mode, and no `--ref` for `since=` with uncommitted work. It lets `/kompreni:seal` and recall find the commit where this code landed, even after a squash or rebase.

<!-- ‹guest · 2026-12-02› -->
Then read for context and group by purpose, as in explain's steps 3 and 4.

**Earlier walkthroughs.** Look for walkthroughs that already covered any of the changed files:

```
python <explain>/scripts/recall.py --repo . --json --file <path> [--file <path>]...
```

Use one `--file` per changed file. Leave out entries whose `freshness.status` is `foreign` (written for another repository). Read each remaining entry's summary, and the parts of the document about the code this change touches. They have three uses:
- **Links.** List up to five, newest first, in `kompreni.related` (`references/front-matter.md`) and in the Overview (`references/structure.md`). This includes a walkthrough of the same range, such as the key-excerpt walkthrough when you are writing a code tour.
- **Earlier reasoning.** One may explain why the code being changed was written the way it was. Cite it *(walkthrough `path`)*. It is a claim as of its tip, so check it against the code at `base`.
- **Superseded claims.** If this change makes something an earlier walkthrough says untrue, say so in "What changed", under the group concerned, with a link. Don't leave the two silently disagreeing. Never edit the earlier walkthrough.

If nothing matches, or Python isn't available, skip this silently.

## 3. Nothing to write

If nothing changed, say so and stop. Write no file.

## 4. Before writing: size, and committing first

### Size

Decide the size by explain's rules in `<explain>/references/output-guide.md` ("Choosing the depth"), unless `depth` was given.

- **brief-sized** (one small group, no interface change): a walkthrough isn't worth it. Say so in one line, give the explain command that would cover it, and ask whether to write one anyway. Write it only if the user says yes, then as a short walkthrough.
- **standard**: a short walkthrough.
- **deep**: a full walkthrough.

Length bands and which sections merge in a short walkthrough are in `references/structure.md`.

### If the request already asked to commit first

If the user's request says to commit the changes first ("commit it, then write it up"), do that as step 9 describes, then write against the commit: `dirty: false`, `tip` = the new commit, which is listed in `commits`, and no drift note. Run the checker in step 7 with `--ref HEAD`.

## 5. Choose the file

- **Format**: from `format`, or detected as in the table.
- **Name**: `<out>/<YYYY-MM-DD>-<slug>.<qmd|md>`. Use today's date. The slug is 3-6 lowercase words, hyphenated, naming the purpose ("retry-failed-uploads"), not the files.
- **Never overwrite.** If the file exists, add `-2`, `-3` and so on.
<!-- ‹guest · 2026-12-02› -->
- **.gitignore**: when writing `qmd` into a folder with no `.gitignore`, create one there containing `*.html` and `*_files/`, so rendered output isn't committed by accident. Don't edit an existing `.gitignore`.
- Create no other files.

## 6. Write

Read these before writing:
- `references/structure.md`: the sections, the teaching devices, the length bands and the questions.
- `references/formats.md`: the exact syntax for `qmd` and `md`, code snippets and references.
- `references/front-matter.md`: the metadata block at the top.
- `references/code-tour.md`, **only with `code=all`**: it replaces "What changed" and "How it works now" with an annotated code tour, and changes the front matter.
- `<explain>/references/levels.md`: how much language background to give.
- `<explain>/references/useful-elsewhere.md`: the "Useful elsewhere" section.
- `<explain>/references/output-guide.md`, "Evidence labels" and "Code snippets and references".

Non-negotiable rules, as in explain:
- **Label rationale by evidence**: *(code)*, *(stated)*, *(commit `sha`)*, *(PR #n)*, *(observed)*, *(walkthrough `path`)* or *(inferred)*. Never invent motives or history.
- **Verification is honest.** Report only tests actually run, with their real results. Name untested parts as gaps.
- **Quote real code only.** Verbatim excerpts carry their location; anything else is marked illustrative.
- **The document stands alone.** The reader doesn't have this conversation. Never copy the user's chat messages into the document, and never include personal details: it is likely to be committed.

## 7. Verify

Never present a walkthrough with unchecked references, snippets or answers.

1. Re-read each cited `file:line` and each quoted snippet against the code. In history mode, read files at the tip with `git show <tip>:<path>`.
2. Run the checker on the file:
   ```
   python <explain>/scripts/check_refs.py --repo . --file <the walkthrough>
   ```
   Add `--ref <tip>` in history mode (`HEAD` for `since=`), and `--ref HEAD` if the changes were committed first (step 4 or 9). Fix every `ERROR` and every `warning`, and re-run until it passes. If Python isn't available, check by hand and say so in the reply.

   In a `.qmd`, the checker also checks code annotations: every marker has its list item, nothing comes between a block and its list, and no item has a second paragraph. Quarto gets these wrong silently. It also checks Before/After tabsets (the tab names, `@<ref>` only in Before, no `group`) and line marks (`changed=`, `added=`, `removed=`).

   With `code=all`, also pass `--coverage <base>..<tip>`. In history mode, `<tip>` is the tip ref. In session mode, use the snapshot's tree as `<tip>`, so untracked files count. Then deal with every `note:` as `references/code-tour.md` says ("Checking coverage"). The Before ranges and line marks come from `<explain>/scripts/before_range.py` while writing (`code-tour.md`, "Finding the Before range").
3. Re-check every answer in "Check your understanding" against the code it relies on. If the code doesn't determine an answer, drop the question.
4. **Render** (`qmd` only, unless `render=no`):
   - If a `_quarto.yml` exists in the walkthrough's folder or any parent, the file belongs to that Quarto project, and rendering sends the HTML to the project's output folder. With `render=auto`, don't render; say why in the reply. With `render=yes`, render and report where the HTML went.
   - Otherwise run `quarto render <file> --to html` from the repo root. The front matter makes the HTML a single self-contained file next to the `.qmd`. Fix anything Quarto warns about and render again until it is clean.
   - If Quarto isn't installed, skip this and say so.
   - **Diagrams**, if the document has any and Chrome or Edge is installed: mermaid errors appear only in the browser, so `quarto render` can't report them. Load the page headless and look for `class="error-text"`, then fix the diagram and re-render. Skip this silently if there's no browser.
<!-- ‹guest · 2026-12-02› -->
     ```
     <chrome or msedge> --headless=new --virtual-time-budget=15000 --dump-dom file:///<absolute path>.html
     ```

The checker confirms only that quoted code and references exist and match. It can't tell whether your explanation of them is right. Re-read your claims about behaviour against the code you cite.

## 8. Reply in the chat

Keep it short:
- the path of the walkthrough, and of the HTML if rendered (or why it wasn't);
- its depth and level, and two or three sentences on what it covers;
- the commit made first (short SHA and summary line), if any, or the drift note, if `dirty: true`;
- the checker result, in one line;
- in session mode, end with the line `Kompreni snapshot: tree=<sha> head=<sha>` (the snapshot you took), so that a later explanation or walkthrough covers only what changed after this one.

- if `dirty: true`, end with **one** line offering to commit, naming the files and a draft message, for example: "When you're happy with the changes, I can commit `src/upload.py` and `tests/test_upload.py` as "Retry failed uploads with backoff" and seal this walkthrough to that commit." If the user's own uncommitted work is excluded, say so in the same line. Don't repeat the offer in later turns.

Don't paste the document into the chat. Don't commit the walkthrough itself; the user decides that.

## 9. If the user asks you to commit

Only when the user asks, whether in the request or in answer to step 8's offer:

- **What to commit**: only the changes this walkthrough covers that this session made. Name the user's own uncommitted work (explain's attribution check) separately, and leave it out unless the user asks for it. Stage the named paths only, never `git add -A` or `git add .`.
- **The message**: follow the repository's conventions (recent `git log`, and any rules in CLAUDE.md or contributing docs, such as required trailers or committing on a branch). The summary line says what the change does.
- Don't push. Never skip hooks (`--no-verify`).
- If the commit fails, for example because a hook rejects it, report the error in a line or two and ask whether to fix it or leave it uncommitted.
- Then seal: `python <explain>/scripts/seal.py seal --repo . <the walkthrough>` (what `/kompreni:seal` does). It sets `dirty: false` and `tip`, removes the drift note and checks the references at the commit. If it refuses, report why. Re-render a `.qmd` (step 7.4), and take a fresh snapshot for the reply's snapshot line.

این نسخه با نشانه‌گذاری اختصاصی حساب شما نمایش داده می‌شود. برای نصب سریع، به تب نصب و راه‌اندازی بروید.

مهارت‌های مشابه و پیشنهادی

مشاهدهٔ همه ←
مستندسازی
✦ Pro

REA changelog update

«REA changelog update» یک مهارت آماده در حوزهٔ مستندسازی است؛ به دستیار هوش مصنوعی شما یاد می‌دهد «مستندسازی فنی و راهن…

⚡ /rea-changelog-update SKILL.md
Claude / Claude CodeOpenAI Codex +۳
۹۴/۱۰۰ ★ ۴۷۴,۰۸۴
مستندسازی
✦ Pro

Writing Skills

«Writing Skills» دستورالعمل دقیقی برای «خودکارسازی جریان کار و گیت (Git / CLI)» در اختیار دستیار هوش مصنوعی می‌گذارد تا…

⚡ /writing-skills SKILL.md
Claude / Claude CodeOpenAI Codex +۲
۹۴/۱۰۰ ★ ۳۲۴,۲۹۰
مستندسازی
✦ Pro

Discernment nudge

اگر روی مستندسازی کار می‌کنید، «Discernment nudge» بخشی از کار را از دوش شما برمی‌دارد: «دستورالعمل تخصصی استاندارد (SK…

⚡ /discernment-nudge SKILL.md
Claude / Claude Code
۹۶/۱۰۰ ★ ۱۹۸,۷۹۴
مستندسازی
✦ Pro

Translate Repository Documentation

برای کدها، APIها و تغییرات پروژه مستندات تمیز، README کاربردی و گزارش تغییرات (Changelog) قابل فهم می‌نویسد. (شامل ۴ گا…

⚡ /translate-docs SKILL.md
MCP
۹۶/۱۰۰ ★ ۵۳,۹۱۶
مستندسازی
✦ Pro

Documentation Governance

برای کدها، APIها و تغییرات پروژه مستندات تمیز، README کاربردی و گزارش تغییرات (Changelog) قابل فهم می‌نویسد. (شامل ۵ گا…

⚡ /docs-governance SKILL.md
OpenAI CodexMCP
۹۳/۱۰۰ ★ ۵۳,۹۱۶
مستندسازی
✦ Pro

Label a skills CLI pull request

«Label a skills CLI pull request» یک مهارت آماده در حوزهٔ مستندسازی است؛ به دستیار هوش مصنوعی شما یاد می‌دهد «خودکارساز…

⚡ /pr-labeling SKILL.md
Claude / Claude Code
۹۰/۱۰۰ ★ ۴۰,۵۰۹