importing-a-codebase
Skill này làm gì
Skill này để AI nghiên cứu một dự án đã có mã nhưng chưa có đặc tả viết, rồi soạn các tài liệu chính mô tả thiết kế và quyết định của dự án. Phù hợp với các nhóm muốn ghi lại một ứng dụng đang có.
Khi nào nên dùng
- ✓Khi bạn có một dự án đang có mã nhưng chưa có tài liệu kiến trúc hoặc sản phẩm.
- ✓Khi bạn muốn AI soạn đặc tả từ các tệp README, tệp quy tắc agent và chính mã nguồn.
- ✓Khi bạn muốn xem lại và chỉnh sửa bản nháp đặc tả dự án trước khi tin cậy chúng.
Liên kết skill
https://github.com/JetBrains/thinkrail/blob/main/packages/pi-thinkrail-workflow/skills/importing-a-codebase/SKILL.mdSao 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
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Dự án của tôi có mã nhưng chưa có tài liệu, hãy đọc nó và soạn các đặc tả đầu tiên để tôi xem lại.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
AI đọc ghi chú của dự án, các tệp thiết lập và mã chính, soạn các tài liệu được đánh dấu là bản nháp, và chỉ hỏi bạn về ý định mà nó không tìm thấy trong các tệp.
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.
Importing a codebase
The workspace holds real code but no specs. Reverse-engineer the spec graph the project should have had. When the repo already carries real spec-like documents, build the graph around them, not parallel to them. Do as much as possible yourself, from the files; ask the user only where the code genuinely can't tell you and the answer changes a spec.
Hold the writing-specs bar. Read that concept skill before drafting — everything in this flow is inferred rather than confirmed, so its honesty rules (draft until the user reviews, unconfirmed marked inline) bind hardest here.
1. Read first, ask last
Survey before you ask a single question. Read, in roughly this order:
- Agent files (mine these first — they state intent + conventions directly):
AGENTS.md,CLAUDE.md,.cursor/rules/*,.cursorrules,.github/copilot-instructions.md,GEMINI.md,.windsurfrules. - Docs:
README,docs/,CONTRIBUTING, ADRs. - Manifests & layout:
package.json/pyproject.toml/go.mod/Cargo.toml, workspace globs,tree-style structure, entry points, build/test scripts. - Code: entry points and the top of each candidate module — enough to see responsibilities and the dependency edges between them.
While you read, collect adoption candidates: durable, declarative documents that state the world as it is — architecture/design docs, ADRs / decision records, domain glossaries, protocol/contract docs. Never candidates (input only): READMEs, CONTRIBUTING, changelogs, roadmaps, TODOs, implementation plans (finished or planned), generated API docs.
Confirm with the spec tools (spec_grep / spec_graph) that there's no graph yet. If specs already
exist, stop and hand back to the setting-up-a-project dispatcher — this flow is for un-specced repos.
2. Build a working model
From what you read, form a working model of what the project is and how it's shaped — held in the conversation, not written to a file (this flow declares no working files):
what: one-sentence purpose (the job the codebase does)
domain: the space it's in
stack: languages / frameworks / runtime
modules: the real boundaries + the dependency edges between them (who imports whom)
invariants: rules the code already enforces (layering, "X never imports Y", public surfaces)
decisions: non-obvious choices visible in the code (and where the "why" is missing)
Agent files and READMEs usually hand you what, invariants, and decisions for free — prefer them over
re-deriving from code.
3. Interview only the gaps
Ask only what the files can't answer and that would change a spec — typically: the primary job / who it's for, explicit non-goals, and the why behind a non-obvious decision. Interview them in rounds per the asking-user-questions concept skill; infer a concrete answer and let the user correct it rather than asking open-ended.
Two kinds of question belong in the round whenever the files leave them open — the code shows what, rarely why:
- The why behind each non-obvious decision in your working model that the files don't explain — "I see X is done this way — why?" — with your inferred reasons as options. The answer goes into the spec that owns the decision.
- Known limitations — one multiSelect of the gaps you saw (unhandled cases, TODOs, missing tests, slow paths) for the user to confirm; confirmed ones are recorded in the owning spec.
If adoption candidates exist, add one question to the same round: a multiSelect listing them (grouped
when many — an adr/ set is one option) — which should become spec-graph nodes? A contradiction
between a candidate and the code found by now goes into the round too (confirm the correction).
Skipped or declined → adopt none; candidates stay input, noted at hand-off.
If the files answered everything material — the whys and limitations included — skip the interview and say so; don't manufacture questions (adoption candidates alone still make a round — the offer is never dropped as "no gaps"). A skipped/declined question is not a blocker: record the assumption inline in the spec, marked unconfirmed.
4. Draft the graph, top-down
Save with the spec tools as you go (spec_create per node, edit for prose). Order:
goal-and-requirements.md(type: goal-and-requirements) — what the product is and why, in the goal-doc shapewriting-specssets; capabilities are what the c
Câu hỏi thường gặp
Các bản nháp có phải bản cuối không?
Không. Chúng vẫn là bản nháp cho đến khi bạn xem lại, và mọi điều được đoán sẽ được đánh dấu là chưa xác nhận.
Nó đọc tệp nào trước?
Các tệp hướng dẫn cho agent, README, tài liệu, tệp package và các điểm vào chính.
Nó có thay đổi mã của tôi không?
Skill tập trung vào viết đặc tả, nên kết quả chính là tài liệu chứ không phải thay đổi mã.
Chi tiết
Mô tả gốc của tác giả
Use when asked to create the initial spec graph for an existing codebase that has source code but no specs. Normally reached via setting-up-a-project.
repo: JetBrains/thinkrail
Độ phổ biến
- Sao GitHub
- 7.1k
- Vị trí xếp hạng
- #13491
- Giấy phép
- Apache-2.0
- Cập nhật
- 2/11/2026
Bình luận
- …
Thêm skill từ kho mã này
asking-user-questions
7.1kDạy agent của bạn cách hỏi bạn những câu hỏi rõ ràng theo từng vòng, với các lựa chọn trả lời tốt, cho đến khi các điểm còn mở được giải quyết.
brainstorming
7.1kGiúp agent của bạn bàn bạc với bạn về một tính năng, thay đổi hành vi hoặc sửa lỗi trước khi xây dựng, rồi ghi lại thiết kế đã thống nhất.
choosing-a-workflow
7.1kGiúp agent của bạn chọn đúng quy trình ThinkRail cho một dự án mới, một pull request hoặc bất kỳ thay đổi nào về những gì sản phẩm làm.
setting-up-a-project
7.1kGiúp agent của bạn thiết lập dự án để làm việc theo đặc tả, chọn đúng con đường cho một ý tưởng mới, mã hiện có hoặc dự án đã có tài liệu.
Skill tương tự
diffs
394kGiúp agent của bạn tạo một diff có thể chia sẻ về các chỉnh sửa, dưới dạng liên kết xem hoặc file ảnh, thay vì một bản tóm tắt viết tay.
coding-agent
394kGiúp agent của bạn giao một việc lập trình lớn cho Codex, Claude Code hoặc OpenCode chạy nền, rồi theo dõi tiến độ của nó.
gh-issues
394kGiúp agent của bạn tìm issue trên GitHub, chọn những issue cần xử lý và mở pull request với bản sửa, kể cả theo dõi nhận xét đánh giá.