Logo Code Explanation

Code Explanation

Tổ chứcPhổ biến
Leanmcp
code-explanation

Generate a complete, beginner-friendly explanation of an entire code repository as a set of markdown files. Maps the repo structure with `treecap` (installing it if missing), studies the actual source, then writes a `CODE_EXPLANATION/` folder containing an `OVERVIEW.md` plus numbered deep-dive files (01_architecture.md, 02_models.md, ...) that explain how the code is built, what it does, and how the pieces fit together — illustrated with real code excerpts. Use this skill whenever the user wants to understand, document, onboard onto, or get a walkthrough of a codebase: phrases like "explain this repo", "explain the code", "code explanation", "walk me through this codebase", "help me understand how this is built", "document the architecture", or "what does this project do" — even if they don't say the word "skill". Prefer this over ad-hoc summaries whenever the goal is a durable, written explanation of a whole repo.

Tổng quan

Nhà phát hànhLeanmcp
Kho mãgateway-skills
Tên kỹ năngcode-explanation
Sao
2.1K
Bản fork
2.1K
Tệp đi kèm
Chỉ có hướng dẫn
Giấy phépMIT
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI là Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • Đầy đủ trong hướng dẫn

    Mọi thứ mô hình cần đều nằm trong hướng dẫn — không có tệp bổ sung cần đồng bộ.

  • Mã nguồn mở

    Được Leanmcp công bố trên GitHub. Hãy đọc nội dung nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Code Explanation trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL thư mục kỹ năng bên dưới và xác nhận.
    https://github.com/Leanmcp/gateway-skills/tree/main/skills/code-explanation
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/Leanmcp/gateway-skills.git /tmp/gateway-skills
mkdir -p .claude/skills
cp -r /tmp/gateway-skills/skills/code-explanation .claude/skills/code-explanation
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Code Explanation trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự tải Code Explanation ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên Code Explanation không bị giới hạn ở mô hình mà kỹ năng này được viết cho. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên kỹ năng chưa dùng không tốn chi phí.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

Code Explanation

Produce a thorough written explanation of an entire repository so someone new can understand what it does, how it is built, and how the pieces fit together. The output is a CODE_EXPLANATION/ folder of markdown files: one OVERVIEW.md and a series of numbered deep-dive documents.

The goal is genuine understanding, not a file inventory. A good explanation reads like a knowledgeable engineer walking a new teammate through the codebase: it names the important abstractions, shows real code, and explains why things are shaped the way they are.

Workflow

1. Establish the structural map with treecap

Before reading any code, get a bird's-eye view of the repo layout. Use treecap, a tree viewer that caps how many entries it shows per folder so large repos stay readable.

Resolve the tool in this order:

  1. treecap — preferred. Check with which treecap.
  2. If it is missing, install it: pip install treecap (it is a PyPI package: https://pypi.org/project/treecap/). If pip isn't available, try pip3 install treecap or python -m pip install treecap.
  3. If installation fails or is declined, fall back to tree (which tree).
  4. If neither exists, fall back to a manual listing (e.g. find . -type f filtered sensibly), but prefer the real tools.

Run it on the target repo. Sensible defaults:

bash
treecap -W 0 -L 3        # full width (all entries), 3 levels deep

-W caps entries shown per directory (0 = unlimited; the default is 5). -L caps display depth. Start broad, then re-run deeper or with a higher width on the directories that turn out to matter (e.g. treecap src -W 0). treecap skips .git, node_modules, __pycache__, and .venv by default, which is usually what you want.

Capture this tree — you'll embed a trimmed version of it in OVERVIEW.md.

2. Read the code and build a mental model

Now actually understand the repo. Don't write any explanation files until you have a real model of how it works. Investigate in roughly this order, because each step gives you vocabulary for the next:

  • Entry points & manifests — package.json, pyproject.toml, Cargo.toml, go.mod, main.*, index.*, app.*, CLI definitions, server bootstraps. These tell you what the project is (library? service? CLI? web app?), its tech stack, and how it starts.
  • Core data shapes — Pydantic models, dataclasses, TypeScript types/interfaces, ORM/DB schemas, protobufs, GraphQL schemas. These are the nouns of the system and the fastest way to understand the domain. They almost always deserve an early deep-dive file.
  • Architecture & control flow — how requests/commands flow through the system, the major layers/modules and their dependencies, key design patterns.
  • Major subsystems — each significant module, package, or feature area, one at a time.
  • Cross-cutting concerns — config, auth, error handling, logging, persistence, external integrations.

Read the real source. Quote it later. If the repo is large, prioritize the code that carries the most meaning over exhaustively covering every file.

3. Create the CODE_EXPLANATION/ folder and write the docs

Create a CODE_EXPLANATION/ directory at the root of the repo being explained. Inside it, write OVERVIEW.md first, then numbered deep-dive files.

OVERVIEW.md

This is the front door. Include:

  • What this project is — one or two paragraphs: purpose, what problem it solves, what kind of thing it is (service/library/CLI/app).
  • Tech stack — languages, frameworks, key libraries, datastores.
  • High-level architecture — a short narrative of how the major pieces fit, plus the trimmed treecap tree annotated with what each top-level directory/file is for.
  • Reading guide — a table of contents listing every numbered file with a one-line description, so the reader knows where to go.
Numbered deep-dive files (01_*.md, 02_*.md, …)

Order them foundational-first, so each file builds on the previous. A typical-but-not-mandatory ordering:

  • 01_architecture.md — the big picture: layers, modules, data/control flow, how a typical operation travels through the system end to end.
  • 02_models.md (or 02_types.md / 02_data_model.md) — the core data structures (Pydantic models, TS types, schemas). These are foundational vocabulary, so explain them early.
  • 03_*.md onward — each major subsystem/module/feature, one per file.
  • Later files — cross-cutting concerns (config, auth, errors), key end-to-end flows, and how to run/extend the project.

Adapt the exact split and naming to the repo. A small CLI might need 3 files; a large service might need 10. Use descriptive slugs (04_auth_and_sessions.md, not 04_misc.md).

How to write the explanations

Explain code with real code. This is the core of the skill. For each important abstraction, show an actual excerpt from the repo (with a path/to/file.py:line-style reference), then explain what it does and why it matters. Prefer real snippets over invented pseudo-code. Trim long blocks to the revealing parts with # ... rather than pasting hundreds of lines.

markdown
The central request handler lives in `src/server/handler.py`:

```python
class RequestHandler:
    def __init__(self, store: Store, auth: AuthService):
        self.store = store
        self.auth = auth

    async def handle(self, req: Request) -> Response:
        user = await self.auth.verify(req.token)   # 1. authenticate
        record = await self.store.fetch(req.id)    # 2. load state
        return self._render(record, user)          # 3. shape response
```

Every inbound request flows through `handle()`: it authenticates the caller,
loads the relevant record, and renders a response. Note the dependency
injection in `__init__` — `Store` and `AuthService` are passed in rather than
constructed here, which is what makes the handler unit-testable.

Explain the why, not just the what. Point out design decisions, trade-offs, patterns, and non-obvious connections between files. "This uses a registry pattern so plugins can self-register at import time" is far more useful than "this is a dictionary."

Do not explain documentation or markdown. Existing docs, READMEs, changelogs, license files, and other prose are not the target — the code is. Don't summarize their contents. If they're worth pointing to, just list them briefly (e.g. a short "Existing documentation" section noting "docs/api.md — API reference; CONTRIBUTING.md — contributor guide") so the reader knows they exist, and move on.

Write for a capable newcomer. Assume the reader is a competent engineer who has never seen this repo. Define project-specific jargon. Use diagrams in fenced code blocks (ASCII or mermaid) when a flow or hierarchy is easier shown than told.

Be accurate. Only describe code you've actually read. If something is unclear or you're inferring, say so rather than inventing behavior.

Quick checklist

  • Resolved a tree tool (treecap preferred, installed if missing, else tree)
  • Captured the repo structure
  • Read entry points, core models/types, and major modules before writing
  • Created CODE_EXPLANATION/ at the repo root
  • OVERVIEW.md with purpose, stack, architecture, annotated tree, and a TOC
  • Numbered files, foundational-first (architecture/models early)
  • Real code excerpts with file references throughout
  • Explained the why, not just the what
  • Docs/markdown listed, not explained

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

Kỹ năng AI Code Explanation làm được gì?

Generate a complete, beginner-friendly explanation of an entire code repository as a set of markdown files. Maps the repo structure with `treecap` (installing it if missing), studies the actual source, then writes a `CODE_EXPLANATION/` folder containing an `OVERVIEW.md` plus numbered deep-dive files (01_architecture.md, 02_models.md, ...) that explain how the code is built, what it does, and how the pieces fit together — illustrated with real code excerpts. Use this skill whenever the user wants to understand, document, onboard onto, or get a walkthrough of a codebase: phrases like "explain...

Vì sao nên dùng Code Explanation trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Code Explanation là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Code Explanation trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/Leanmcp/gateway-skills/tree/main/skills/code-explanation. TypingMind đọc tệp SKILL.md và cài đặt thành một kỹ năng mà bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Code Explanation?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Bạn có thể dùng Code Explanation với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Code Explanation với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Code Explanation có miễn phí không?

Có. Kỹ năng này được Leanmcp phát hành trên GitHub theo giấy phép MIT. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp cho mô hình các công cụ mới để gọi — mã được chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và tiêu chí của đầu ra tốt. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇