Chuyển đến nội dung
Skillpedia
Lập trình chung260k · #573

pr-lens

Skill này làm gì

Skill này biến một thay đổi code hoặc một codebase thành sơ đồ trực quan cho thấy các phần kết nối với nhau và dữ liệu di chuyển thế nào. Phù hợp với lập trình viên muốn giải thích một pull request hoặc một hệ thống cho người khác.

Khi nào nên dùng

  • ✓Khi bạn muốn một sơ đồ giải thích thay đổi code làm gì.
  • ✓Khi bạn muốn một hình kiến trúc hoặc luồng dữ liệu của hệ thống cho một pull request.
  • ✓Khi bạn yêu cầu AI trực quan hóa hoặc giải thích cách một codebase được cấu trúc.

Liên kết skill

https://github.com/NousResearch/hermes-agent/blob/main/optional-skills/software-development/pr-lens/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/NousResearch/hermes-agent/blob/main/optional-skills/software-development/pr-lens/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Vẽ một sơ đồ kiến trúc cho pull request này để người review có thể thấy dữ liệu chảy thế nào.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Skill để AI của bạn viết mô tả JSON về các lane, node và cạnh, rồi chạy công cụ dòng lệnh PR Lens để render các sơ đồ SVG có hoạt ảnh. Nó không tìm lỗi.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

PR Lens Skill

PR Lens draws code as visually rich animated diagrams: diffs, architecture, data flows. You describe the diff or codebase as one JSON document (lanes, nodes, edges, ordered flows) and the CLI renders it as animated SVGs. There is no findings lens — PR Lens is a comprehension layer, not a review bot. There is no field for a bug, risk, or security note, and a document that invents one is rejected.

When to Use

  • Asked to diagram, visualise, or explain a code change or a system.
  • A pull request should carry an architecture or data-flow diagram.
  • Keywords: PR Lens, diagram, architecture, data flow, visualise, pull request.

Prerequisites

  • Node.js with npx (the CLI runs via npx @coldtea/pr-lens-cli@latest; no install step).
  • gh (GitHub CLI) — optional, only for attaching diagrams to PRs.
  • Optional canvas publishing calls the third-party service prlens.dev (see step 4b).

How to Run

Run all commands with the terminal tool from the repository root.

  1. Read the diff. When representing a code change: git diff --find-renames <base>...<head>. The base is the merge base, not the tip of the base branch. If not expressing a diff, read the code to be visualised.

  2. Write the document to .pr-lens/graph.json, following references/graph-document.md. references/example.graph.json is a valid reference with three lanes, all four delta states, a hero edge, a seven-step flow, a nested drill-down tree and a six-step walkthrough. Read it before writing your first document — quicker than reading the reference.

  3. Validate, and fix.

    npx @coldtea/pr-lens-cli@latest validate .pr-lens/graph.json
    

    Fix every failure and run it again. Do not render an invalid document; do not "work around" a failure by deleting the element it names.

  4. Render.

    npx @coldtea/pr-lens-cli@latest render .pr-lens/graph.json --theme light
    

    Render light by default unless the user requests another theme. The SVGs, the manifest and drawn.graph.json land in .pr-lens/, which the CLI adds to the repository's .gitignore. Do not commit any of it — these files are rebuilt from the diff on demand. Each SVG is named after its view, theme and content hash; manifest.json lists them by lens and view.

4b. Canvas push — OPTIONAL, opt-in. Only when the user explicitly asks for a shareable link. This publishes .pr-lens/drawn.graph.json to the third-party service prlens.dev:

npx @coldtea/pr-lens-cli@latest canvas push

It prints three links. Give the user the view link (https://prlens.dev/c/{id}): the full-screen diagram, every view on one page, no login. The edit link (ending in #w=…) lets its holder overwrite the canvas — it is a secret: leave it out of the reply unless asked, never paste it anywhere public. The embed link serves the top view as an SVG for a README. Pushing the same file again updates the same canvas, so "rename that node" is: edit, validate, render, push — the link stays the same. If the push fails, say so and tell the user where the local SVGs are and which is the top view.

  1. Attach to a PR, when there is one. Upstream documents gh pr create/edit/comment --attach <path>, but --attach arrived in GitHub CLI 2.99 — check gh --version first (e.g. gh 2.97 does NOT have it). With gh ≥ 2.99: write the body with a Markdown image ![alt](.pr-lens/<view>.svg) (an HTML <img> is left as written and the file appended at the bottom instead; alt text is the one-line caption a reader without images gets), then repeat --attach <path> per referenced diagram:

    gh pr create --title "…" --body-file .pr-lens/body.md --attach .pr-lens/overview-light-<hash>.svg
    

    Without --attach, use a commit-free path:

    • Upload the SVGs to a gist: gh gist create .pr-lens/<view>.svg, then reference the raw gist URL in the PR body/comment, or
    • Publish via the canvas link (step 4b, with user consent) and link the view URL, or
    • Note the local .pr-lens/ path in the PR body so reviewers can rebuild.

    Once published somewhere durable, let the CLI compose the comment markdown:

    npx @coldtea/pr-lens-cli@latest comment \
      --graph .pr-lens/drawn.graph.json \
      --manifest .pr-lens/manifest.json \
      --asset-base-url <where you published the SVGs>
    

    --graph takes drawn.graph.json, not the document you wrote — the CLI refuses a document its manifest does not descr

Câu hỏi thường gặp

Nó có tìm lỗi hoặc vấn đề bảo mật không?

Không. Skill nói PR Lens là công cụ giúp hiểu, không có trường nào cho lỗi hay rủi ro.

Nó có cần cài đặt không?

Skill chạy công cụ qua npx, nên không có bước cài riêng, dù vẫn cần Node.js.

Các sơ đồ có thể đưa lên pull request không?

Có. Skill nói GitHub CLI có thể đính kèm sơ đồ vào PR, dù bước này là tùy chọn.

Chi tiết

Mô tả gốc của tác giả

Draw code changes as animated architecture/data-flow SVGs.

repo: NousResearch/hermes-agent

Độ phổ biến

Sao GitHub
260k
Vị trí xếp hạng
#573
Giấy phép
MIT
Cập nhật
2/11/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự