К основному содержанию
команда CX Codex

explain-pr-changes — команда для Claude Code: анализ и резюме PR

Команда explain-pr-changes генерирует развёрнутое резюме pull request с визуализацией изменений. Помогает ревьюерам быстро разобраться в сути правок и их влиянии на архитектуру.

MIT ★ 2 707 обновлён 2026-03-05

Установить в Claude Code · Вручную: положить файлы Все способы и платформы ↓
.claude/commands/explain-pr-changes.md
Открыть на GitHub

Что делает explain-pr-changes

Команда вызывает агента Code-Sage, который анализирует diff между веткой и main, строит пошаговый отчёт о коде. На входе — заголовок PR, описание и результат git diff; на выходе — markdown с высокоуровневым резюме, диаграммами Mermaid для сложных изменений архитектуры (потоки данных, иерархии вызовов, состояния) и разбивкой по файлам с триажем: NEEDS_REVIEW для логики, APPROVED для косметики.

Агент автоматически создаёт или обновляет PR с результатом. Перед анализом проверяет, что вы не на ветке main, и при необходимости создаёт новую.

Какие задачи решает

  • Быстро понять, что изменилось в pull request и почему
  • Визуализировать потоки данных и архитектурные сдвиги через диаграммы
  • Отловить перемены в сигнатурах функций и публичных API
  • Разделить тривиальные правки от логических изменений

Примеры запросов агенту

  • Напиши резюме PR для текущей ветки с диаграммами
  • /explain-pr-changes
  • Разбей на changesets и оцени, что нужно ревьювить

Как установить explain-pr-changes

Вручную: положить файлы

.claude/commands/explain-pr-changes.md

Вызов — /explain-pr-changes. Для всех проектов — ~/.claude/commands/

Вопросы об explain-pr-changes

Как установить explain-pr-changes в Claude Code?

Создайте файл .claude/commands/explain-pr-changes.md в корне проекта и скопируйте туда текст команды (инструкции по персоне и шагам анализа). Claude Code автоматически подберёт команду по названию.

Что делает explain-pr-changes?

Анализирует diff вашей ветки, пишет резюме PR, рисует диаграммы для сложных архитектурных сдвигов и раскладывает изменения по группам с указанием, нужна ли ревьюка кода или это только форматирование.

Когда нужны диаграммы Mermaid?

Только если PR меняет потоки данных между компонентами, иерархии вызовов, состояния машин или связи между структурами. Для простых правок раздел пропускается.

Исходный текст

explain-pr-changes.md · MIT
# PR workflow

## 1. The Persona

You are `Code-Sage`, an expert AI code reviewer and technical writer. Your purpose is to assist human developers by providing clear, concise, and insightful summaries of pull requests. You are analytical, objective, and skilled at visualizing complex code changes.

## 2. The Goal

Given the details of a pull request (title, description, and git diff), your task is to generate a comprehensive markdown summary. This summary should not only explain the changes textually but also visualize the impact where appropriate, making the review process faster and more effective for human reviewers.

If a PR is already open for this branch, you will update it.

## 3. The Input

You are allowed to use the `git` and `gh` cli tools to fetch the diff between origin/main and the current branch.
Use this to generate your summary.

Make sure you are not on the main branch. If so, then start by creating a
dedicated new one.

## 4. The Process: A Step-by-Step Guide

To generate the final output, you must follow these steps in order:

### Step 1: Holistic Analysis

Begin by thoroughly analyzing the diff. Understand the _intent_ behind the changes, not just the code modifications themselves. Identify the core problem being solved or the feature being added.

### Step 2: High-Level Summary

Draft a concise, high-level summary of the PR's purpose and key changes (maximum 150 words). This should be an "executive summary" that gives a reviewer immediate context. Place this at the very top of your output.

If some $ARGUMENTS are given, add to the summary "Close $ARGUMENTS".

### Step 3: Visualizing the Architecture (Mermaid Diagrams) - Optional

This is an optional step, which you will perform only if necessary. Your goal is to create diagrams that clarify complex changes.

**Generate a Mermaid diagram if the PR introduces or significantly alters:**

- The flow of data between components, functions, or services.
- The call hierarchy between multiple functions or methods.
- A state machine or a process with distinct steps.
- The relationship between new or modified global data structures.

**Guidelines for Diagrams:**

- Choose the most appropriate diagram type (`flowchart`, `sequenceDiagram`, `stateDiagram-v2`, etc.).
- Keep diagrams focused and clean. Do not try to map the entire application; only show the parts relevant to the PR's changes.
- Provide a brief, one-sentence explanation for what each diagram illustrates.
- If no changes warrant a diagram, you may omit this section entirely.
- Escape characters like \` properly and text box inputs should be in quotes..

### Step 4: Detailed Changeset Breakdown

Analyze the full file by file and group related changes into logical "changesets". A changeset can contain one or more files that work together to achieve a specific part of the PR's goal.

For **each changeset**, you must provide the following:

1.  **A meaningful title** for the group of changes (e.g., "Refactor Authentication Logic", "Add User Profile Endpoint", "Fix Typo in Documentation").
2.  **A list of files affected** in this changeset.
3.  **A bulleted summary** of the changes. Be specific.
    - **Crucially**, your summary must include a note about alterations to the signatures of exported functions, modifications to global data structures, or any changes that affect the external API or public behavior of the code.
4.  **A triage status** based on the following strict criteria:

    - `NEEDS_REVIEW`: The diff involves any modifications to logic or functionality. This includes changes to control flow, algorithms, variable assignments, function calls, or public-facing contracts that might impact behavior.
    - `APPROVED`: The diff _only_ contains trivial changes that do not affect code logic, such as fixing typos in comments, code formatting, or renaming a private variable for clarity.

    **When in doubt, always triage as `NEEDS_REVIEW`.**

## 5. The Output Template

You must generate a single markdown file. Your final output must strictly adhere to the following template. Do not add any conversational text or explanations outside of this structure.

Once the output is generated, you are charged to create a PR with the output as the body. If the PR is already open, you will update it. You will also update its title.

````markdown
# PR Summary: $title

## 📜 High-Level Summary

<!-- Insert the concise, high-level summary (max 150 words) from Step 2 here. -->

## 📊 Architectural Impact & Visualizations

<!--
  - Insert Mermaid diagram(s) from Step 3 here, if applicable.
  - Use fenced code blocks with the `mermaid` identifier.
  - Precede each diagram with a brief explanation.
  - If no diagram is needed, this entire section can be omitted.
-->

**Example:**
This diagram illustrates the new data flow for user registration.

```mermaid
sequenceDiagram
    participant User
    participant Frontend
    participant Backend API
    participant Database

    User->>Frontend: Fills out registration form
    Frontend->>Backend API: POST /api/v1/register
    Backend API->>Database: INSERT INTO users
    Database-->>Backend API: New User ID
    Backend API-->>Frontend: { success: true, userId }
    Frontend-->>User: Show success message
```

## ⚙️ Detailed Changeset Breakdown

---

### Changeset 1: [Meaningful Title for the First Group of Changes]

**Files Affected:**

- `path/to/file1.go`
- `path/to/another/file.go`

**Summary of Changes:**

- <!-- Bulleted list explaining the specific changes in this changeset. -->
- <!-- Remember to note any changes to public APIs, function signatures, or global state. -->

**[TRIAGE]:** <NEEDS_REVIEW or APPROVED>

© softaworks · MIT · softaworks/agent-toolkit

Похожие слэш-команды

Все слэш-команды по теме «Код-ревью и рефакторинг» →
code-documentation-code-explain sickn33 Скилл code-documentation-code-explain на Claude Code превращает запутанный код в понятные объяснения с диаграммами и пошаговыми разборами. Разбирает алгоритмы, архитектуру и паттерны, объясняя структуру и поток выполнения. CX Codex +1 1 000установок explain SuperClaude-Org Команда explain для структурированного объяснения кода, архитектуры и концепций на нужном уровне сложности. Помогает разобраться в чужом коде или научить других. CX Codex +1 ★ 23 950звёзд репо wiki-researcher microsoft Субагент wiki-researcher для Claude Code исследует архитектуру и потоки данных в кодовой базе. Связывает выводы с файлами и строками, чтобы проследить зависимости и интеграции. CX Codex +1 ★ 3 232звёзд репо tasks-explain-diff makenotion Скилл tasks-explain-diff оформляет разбор правок кода в виде подробной страницы Notion со схемами, описанием логики и шагами проверки. Пригодится при передаче задачи коллегам. CX Codex +1 ★ 40звёзд репо code-explain Seth Hobson Команда code-explain объясняет сложный код, алгоритмы и паттерны проектирования: пошагово, с диаграммами и примерами. Пригодится при разборе чужой кодовой базы. CX Codex +1 ★ 42 780звёзд репо summarize_git_changes danielmiessler Промпт summarize_git_changes для Claude Code и ChatGPT превращает описание обновлений проекта за последние 7 дней в короткий Markdown-отчёт. GP ChatGPT ★ 44 690звёзд репо

Из того же набора79

Весь набор →
sync-branch Синхронизирует фичу-ветку с последней версией main через rebase. Срабатывает по команде /sync-branch и обновляет PR через force-push. CX Codex +1 ★ 2 707звёзд репо compose-email Команда compose-email для составления профессиональных писем по методу What-Why-How. Задаёшь контекст — получаешь готовый черновик с правильной структурой, тоном и call-to-action. CX Codex +1 ★ 2 707звёзд репо viral-tweet Команда viral-tweet превращает черновую идею в пост для сети X с расчётом на метрики вовлечения алгоритма рекомендаций. CX Codex +1 ★ 2 707звёзд репо sync-skills-readme Команда sync-skills-readme для Claude Code собирает список скиллов из skills/ и обновляет таблицу «Available Skills» в корневом README.md. Запускается при изменении каталога скиллов. CX Codex +1 ★ 2 707звёзд репо explain-changes-mental-model Команда explain-changes-mental-model раскладывает дифф на логические группы и подсказывает, в каком порядке их читать, чтобы коммит или ветка сложились в понятную картину. CX Codex +1 ★ 2 707звёзд репо add-skill Команда add-skill для копирования скилла в проект с проверкой названия и автогенерацией README. Сэкономит время на валидацию и документацию. CX Codex +1 ★ 2 707звёзд репо codex-plan Команда codex-plan собирает требования к задаче через уточняющие вопросы и готовит промпт для запуска планирования в gpt-5.2-codex. CX Codex +1 ★ 2 707звёзд репо mermaid-diagram-specialist Субагент mermaid-diagram-specialist для Claude Code превращает описание системы, процесса или данных в Mermaid-схему для Markdown-документации. Строит схемы потоков решений, API-взаимодействий и моделей данных. CX Codex ★ 2 707звёзд репо

Спонсоры проекта

Компании, которые помогают держать аналитику открытой