smart-pr-docs

Intelligent PR documentation generator that analyzes code changes, tracks ripple effects across the codebase, updates claude.md files, and creates visual dependency maps. USE WITH codebase-architecture-mapper for elite "System-Aware" context.

16 stars

Best use case

smart-pr-docs is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Intelligent PR documentation generator that analyzes code changes, tracks ripple effects across the codebase, updates claude.md files, and creates visual dependency maps. USE WITH codebase-architecture-mapper for elite "System-Aware" context.

Teams using smart-pr-docs should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/smart-pr-docs/SKILL.md --create-dirs "https://raw.githubusercontent.com/diegosouzapw/awesome-omni-skill/main/skills/documentation/smart-pr-docs/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/smart-pr-docs/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How smart-pr-docs Compares

Feature / Agentsmart-pr-docsStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Intelligent PR documentation generator that analyzes code changes, tracks ripple effects across the codebase, updates claude.md files, and creates visual dependency maps. USE WITH codebase-architecture-mapper for elite "System-Aware" context.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Smart PR Documentation Generator

This skill automatically generates comprehensive PR documentation that tracks what changed, why it changed, and the ripple effects across your entire codebase.

## Instructions

### Step 0: Load Architecture Context (Elite Mode)

Before analyzing changes, check if the project has an architecture map.

1. Look for `architecture-config.json` in the root.
2. If found, use it to map modified files to their respective **Systems**.
3. Identify **Business Rules** and **Consumers** for those systems.

> [!IMPORTANT]
> **System-Aware PRs:** This is the "God Mode" of documentation. Instead of "modified logic.ts", you say "modified **P2P system** (Critical business rule: No negative balance)".

### Step 1: Analyze Active Branch Changes

First, scan all changes in the current branch:

```bash
# Get all changed files
git diff --name-only main...HEAD

# Get detailed changes
git diff main...HEAD
```

**Why this approach:** Git is the source of truth. It knows exactly what changed without guessing.

### Step 2: Map Feature Ownership

For each changed file, determine which feature(s) it belongs to:

1. Look for existing `claude.md` files in the project
2. Read each `claude.md` to understand feature boundaries
3. Match changed files to their feature(s)

> [!TIP]
> **claude.md files** act as feature handbooks that Claude automatically reads. They store context so you don't have to re-explain every time.

### Step 3: Analyze Ripple Effects (CRITICAL)

For each changed file, identify **what else is affected**:

**Check for:**
- Functions/classes that import this file
- Components that use these functions
- API endpoints that depend on this code

```bash
# Find all files that import a specific file
grep -r "import.*from.*<file-path>" . --include="*.ts" --include="*.tsx"
```

**Trade-off:** This grep-based approach is fast but may miss dynamic imports. For 100% accuracy, use a static analysis tool like `ts-morph`.

> [!IMPORTANT]
> **The Blast Radius:** This step reveals the domino effect of your changes. Most developers don't realize that changing one file affects 15+ others.

### Step 4: Generate Mermaid Diagrams

**A. Change Flow Diagram**
```mermaid
graph TD
    A[Changed File: auth/login.ts] --> B[Direct Impact: auth/middleware.ts]
    A --> C[Direct Impact: api/routes.ts]
    B --> D[Ripple Effect: dashboard/protected.tsx]
    
    style A fill:#ff6b6b
    style B fill:#ffd93d
    style D fill:#6bcf7f
```

**Color coding methodology:**
- Red (#ff6b6b): Primary changes (what you modified)
- Yellow (#ffd93d): Direct dependencies (files that import your changes)
- Green (#6bcf7f): Ripple effects (indirect dependencies)

**Why visual maps:** Humans process visual information 60,000x faster than text. A diagram beats a text list for understanding complex dependencies.

### Step 5: Update claude.md Files

For each affected feature, update its `claude.md` file:

**Structure for each claude.md:**
```markdown
# [Feature Name] - Last Updated: [Date]

## Recent Changes
### [Date] - [Change Title]
**What Changed:**
- [file]: [description]

**Why:**
- [Business context and reasoning]

**Ripple Effects:**
- Affects: [Feature] - [Impact description]
- Breaking changes: [Yes/No - Details]
```

**Edge case:** If a `claude.md` doesn't exist for a feature, create one. This is an opportunity to establish context for future work.

### Step 6: Generate PR Documentation

## 🏗️ Architectural Impact (if system-aware)

### 📦 [System Name]
**Role:** [Description from architecture-config.json]
**Changes:** [Summary of changes in this system]
**⚠️ Critical Rules:**
- [Rule 1 from config]
- [Rule 2 from config]

**🔗 Ripple Effect:**
This system is consumed by **[Consumers list]**.

---

## 🎯 What Changed
[High-level summary]

## 📝 Detailed Changes
- [file]: [description]

## 🔄 Ripple Effects & Dependencies

### Dependency Map
```mermaid
[Full dependency diagram]
```

### Direct Impact
- **[Feature]**: [Impact description]

### Indirect Impact
- **[Feature]**: [Impact description]

## ⚠️ Breaking Changes
[Yes/No - Migration guide if yes]

## 🧪 Testing Checklist
- [ ] [Test case 1]
- [ ] [Test case 2]

## 📚 Documentation Updated
- [x] [file] - [what was updated]
```

### Step 7: Validate Documentation

**Completeness Check:**
- All changed files documented?
- All ripple effects identified?
- Mermaid diagrams render correctly?

```bash
# Validate Markdown syntax
find . -name "claude.md" -exec markdown-lint {} \;

# Check for unfinished work
grep -r "TODO\|FIXME" */claude.md
```

## Methodology: The Ripple Effect Analysis

The core philosophy is **Contextual Certainty**. Before documenting, build a complete mental model of the system.

**Approach:**
1. **Bottom-up exploration**: Start with git diff, move to dependency analysis
2. **Layered impact**: Direct → Indirect → System-wide
3. **Visual synthesis**: Convert data to diagrams for instant comprehension

**Principles:**
- **Deep Context First**: Never guess dependencies. Use grep/scripts to find actual imports.
- **Self-Correction**: If a diagram doesn't render, validate Mermaid syntax before proceeding.
- **User-First Lens**: Every PR doc should be readable by non-technical stakeholders (PMs, designers).

## Advanced Technical Nuance

**Memory vs. Speed Trade-off:**
- Grep-based dependency search is fast (< 1 second) but may miss edge cases
- AST-based analysis (ts-morph, babel) is 100% accurate but slower (5-10 seconds)
- **Recommendation**: Use grep for most cases, AST for critical production changes

**Edge Case: Monorepos**
- In monorepos with 100+ packages, limit dependency search to relevant workspaces
- Use `--include` flags to filter by file type and avoid scanning node_modules

```bash
# Efficient monorepo search
grep -r "import.*auth" packages/web packages/api --include="*.ts*"
```

**The 80/20 Rule:**
- 80% of bugs come from 20% of dependencies
- Focus ripple effect analysis on high-traffic files (API routes, auth, payments)

Related Skills

write-docs

16
from diegosouzapw/awesome-omni-skill

Write documentation with real, validated examples. Executes commands through the user to capture actual output. Use for any new documentation or major doc updates.

wiki-docs

16
from diegosouzapw/awesome-omni-skill

Document custom Magento 2 site functionality in the project wiki. Systematically captures custom features, modules, configurations, and business logic for client handover and developer onboarding.

update-docs

16
from diegosouzapw/awesome-omni-skill

Update documentation pages to match source code changes on the current branch

update-docs-and-commit

16
from diegosouzapw/awesome-omni-skill

Updates documentation files (changelog, architecture, project_status) based on git changes, then stages and commits all changes. Use after completing features or fixes.

three-tier-docs

16
from diegosouzapw/awesome-omni-skill

Use after code changes. Syncs CLAUDE.md, CONTEXT.md, and docs/ai-context/ automatically.

sync-docs

16
from diegosouzapw/awesome-omni-skill

Strategic documentation sync - review docs before implementation (pull context) OR export learnings after implementation (push to living docs). NOT bidirectional - two separate one-way operations at different phases.

review-docs

16
from diegosouzapw/awesome-omni-skill

Review documentation (README.md and CLAUDE.md) for quality, completeness, and consistency. Use when asked to review docs, check documentation, validate README files, or audit CLAUDE.md coverage.

reindex-docs

16
from diegosouzapw/awesome-omni-skill

Re-index all PDF and HTML documents, update index.html, and commit/push changes to the repository

pitchdocs-suite

16
from diegosouzapw/awesome-omni-skill

One-command generation and audit of the full public repository documentation set — README, CHANGELOG, ROADMAP, CONTRIBUTING, CODE_OF_CONDUCT, SECURITY, issue templates, PR template, and discussion templates. Use when setting up a new repo or auditing an existing one.

organize-agent-docs

16
from diegosouzapw/awesome-omni-skill

Organize project agentic documentation into universal (AGENTS.md) and agent-specific files (CLAUDE.md, GEMINI.md, etc.). Use when asked to "organize agent docs", "separate agent instructions", "restructure AGENTS.md", or when a project has agent documentation that mixes universal and tool-specific content.

openclaw-docs-sync

16
from diegosouzapw/awesome-omni-skill

Sync OpenClaw + ClawHub + Skills docs into a local mirror for the QMD memory backend.

moai-docs-unified

16
from diegosouzapw/awesome-omni-skill

Enhanced docs unified with AI-powered features. Enhanced with Context7 MCP for up-to-date documentation.