importing-a-codebase
What it does
This skill has the AI study a project that has code but no written specs, then draft the key documents describing its design and decisions. It is for teams who want to document an existing app.
When to use it
- βWhen you have an existing project with code and no architecture or product documents.
- βWhen you want the AI to draft specs from README files, agent rules and the code itself.
- βWhen you want to review and correct a draft of project specs before they are trusted.
Skill link
https://github.com/JetBrains/thinkrail/blob/main/packages/pi-thinkrail-workflow/skills/importing-a-codebase/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agentβs skills folder.
Example of what to ask your AI
βMy project has code but no documentation, so read it and draft the first specs for me to review.β
5 new skills a week. 1 minute to read.
How it works
The AI reads the project's notes, setup files and main code, drafts documents marked as drafts, and asks you only about intent it cannot find in the files.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
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
FAQ
Will the drafts be final?
No. They stay drafts until you review them, and anything guessed is marked as unconfirmed.
What files does it read first?
Agent instruction files, the README, docs, package files and the main entry points.
Does it change my code?
The skill focuses on writing specs, so its main output is documents rather than code changes.
Details
Original description by the author
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
Popularity
- GitHub stars
- 7.1k
- Ranking position
- #13491
- License
- Apache-2.0
- Updated
- 11/2/2026
Comments
- β¦
More skills from this repository
asking-user-questions
7.1kTeaches your agent how to ask you clear questions in rounds, with good answer options, until the open points are settled.
brainstorming
7.1kHelps your agent talk through a feature, behavior change or bug fix with you before building it, and record the agreed design.
choosing-a-workflow
7.1kHelps your agent pick the right ThinkRail workflow for a new project, a pull request, or any change to what the product does.
setting-up-a-project
7.1kHelps your agent set up a project for spec-driven work, choosing the right path for a new idea, existing code or a project already documented.
Similar skills
diffs
394kLets your agent produce a real, shareable diff of edits as a viewer link or image file, instead of a hand-written summary.
coding-agent
394kHelps your agent hand a larger coding job to Codex, Claude Code, or OpenCode as a background worker, then check on its progress.
gh-issues
394kHelps your agent find GitHub issues, pick the ones to work on, and open pull requests with fixes, including follow-up on review comments.