Module 01 · Lesson 1.4
Writing a Codebase Orientation Guide
On this page
By now you hold something valuable and perishable: an accurate picture of a system that nobody else has written down. Within a few weeks you will forget why you believed half of it. The person who joins after you will start from the stale README you started from.
An orientation guide is a short document that fixes this. It is not a manual. It answers the questions a new engineer has in their first week: what the system is for, how to run it, where things live, how a request flows, what is risky, and who to ask. This lesson shows how to write one from your reading log, how an assistant can draft it, and how to stop it going out of date.
The example continues with the fictional Tidewell Wholesale service tidewell-orders, drawing on the notes from Reading an Unfamiliar Codebase and Mapping Entry Points and Data Flow. The company and people are invented.
What you will learn
- Choose the content an orientation guide needs, and leave out what does not belong.
- Write each claim so that a reader can check it against the code.
- Use an assistant to draft the guide from your notes, and review the draft against the evidence.
- Set up a lightweight way to keep the guide accurate.
Before you start
- A reading log with facts, hypotheses and questions, and at least one traced call path.
- Permission to share the notes you will give an assistant. See Sharing Code with an AI Assistant Safely.
- A place in the repository, such as a
docs/folder, where the guide can live and be reviewed like code.
What the guide is for, and what it is not
Good orientation documents are written for a specific reader at a specific moment: a competent engineer on their first day who has never seen this system. That reader does not need the history of every decision, a description of each class, or a restatement of the framework's documentation. They need a route through the system and an honest account of where it is weak.
| Belongs in the guide | Does not belong |
|---|---|
| What the system does and for whom, in a paragraph | Marketing language or a feature list |
| How to build, run and test it, with commands that work | Every configuration option |
| A map of directories and entry points | A description of each file |
| One or two traced paths with file and function names | Every path in the system |
| Hotspots, fragile areas and known traps | Blame or opinions about past engineers |
| Open questions, each with who might answer it | Speculation presented as fact |
The most important design choice is that every statement is either checkable or marked as unchecked. A guide that mixes facts and guesses invites the next reader to trust the guesses. Your reading log already separates them; the guide should keep that separation visible.
- Evidence link
- A file path, command or commit beside a claim, so a reader can verify it in under a minute.
- Verified date and commit
- The point in history at which the guide was last checked against the code. A guide without one cannot be judged stale or fresh.
- Known trap
- Something that looks safe but is not, such as a README that no longer works or a module that looks unused but is imported.
Worked scenario: the tidewell-orders guide
Your minimum-order change is nearly ready for review. Before you move on, you spend about an hour turning your notes into docs/orientation.md. The new engineer joining next month will read it first, so you keep it to two screens of text and put the traps near the top.
# tidewell-orders: orientation
Verified against commit 4f9c2e1 on 2026-11-13. Owner: platform team.
Claims marked (unverified) have not been checked in code or by running it.
## What it does
Accepts and prices trade orders from the portal, EDI importer and support
tools, stores them, and triggers confirmation emails and invoices.
Evidence: orders/services.py, invoicing/totals.py, dispatch/importers.py.
## Run it
1. Python 3.11+ (pyproject.toml). The README says 3.8: it is out of date.
2. docker compose up db redis
3. python manage.py migrate && pytest
Baseline at the commit above: 3 invoicing tests fail, 27 are skipped.
## Where things live
orders/ order creation and statuses
invoicing/ totals, invoices; legacy/pricing_v1.py is still imported here
api/ trade portal endpoints
dispatch/ delivery planning and the EDI order importer
tidewell/ settings, Celery setup, URLs
## How an order flows (portal)
api/views.py -> orders/services.py create_order -> invoicing/totals.py
price_order -> save and commit -> confirmation task (orders/tasks.py).
Other callers of create_order: dispatch/importers.py, replay_orders command.
## Known traps
- legacy/pricing_v1.py looks dead but is imported by invoicing/totals.py.
- Confirmation tasks must be queued after commit, or a rollback sends mail.
- The EDI token was hard-coded in importers.py and has been reported for rotation.
## Hotspots (last 12 months)
orders/services.py, invoicing/totals.py. Change with tests.
## Open questions
- Is the weekly CSV export still used? Ask finance systems.
- (unverified) Nightly stock sync runs from the host scheduler.A skeleton for the guide. Each section is short and has evidence.
Notice what the guide does not say. It does not explain Django. It does not describe the catalogue app, because the reader does not need it yet. It says exactly where its claims came from and which are unchecked, and it admits that three tests were already failing, so a new engineer does not waste a morning thinking they broke them.
Step-by-step workflow
Step 1: Decide the reader and the moment
Write one sentence: 'This is for an engineer on their first day with no background in the system.' If your reader differs, such as an operations engineer, change the content accordingly.
What you should see: A one-line statement of audience at the top of your draft notes.
Step 2: Select from the reading log
Promote facts with evidence, include the traced paths and traps, and list questions that remain open. Leave out hypotheses that have not been checked unless you mark them clearly as unverified.
What you should see: A short list of items that will appear in the guide.
Step 3: Draft with an assistant, from your notes only
Give the assistant your selected notes and a section skeleton, and ask for a draft that uses only those notes, keeps the evidence next to each claim, and marks unsupported statements. This is where it saves time: structure and wording, not discovery.
What you should see: A first draft in the skeleton's shape.
Step 4: Check every statement against the evidence
Read the draft with the repository open. Verify each command by running it, each path by opening it, and each claim by its evidence link. Delete or mark anything you cannot confirm.
What you should see: A draft in which every claim is confirmed or labelled unverified.
Step 5: Stamp, commit and get it reviewed
Add the commit hash and date, then submit the guide as an ordinary change to the repository so a colleague reviews it. A second reader also finds the steps you forgot.
What you should see: A reviewed guide that lives next to the code.
Step 6: Test it on a newcomer
Ask someone who has not seen the system to follow the 'Run it' section on a clean machine. Every place they get stuck is a gap in the guide.
What you should see: A list of corrections, applied.
- Reading log
Facts, hypotheses, questions
- Selection
For one reader
- Assistant draft
From your notes only
- Check against code
Run, open, search
- Review and stamp
Commit hash and date
- Newcomer test
Follow it cold
Verification is the stage the assistant cannot do for you.
Keeping the guide true
Every document describing a living system starts to decay on the day it is written. You cannot stop that, but you can make decay visible and cheap to repair. Three habits are enough for most teams.
- Keep it in the repository. A guide beside the code is changed in the same pull request as the code it describes, and reviewers can see when a change should have touched it.
- Date and commit-stamp it. A reader who sees 'verified against commit 4f9c2e1' can judge how far to trust it, and can ask for the diff since then.
- Re-verify on a schedule or at a trigger. Check the run commands whenever dependencies or build files change, and set a recurring reminder, such as once a quarter, to re-check the rest.
Reusable prompt
Orientation guide drafter
Drafts a guide from your reading notes in a fixed skeleton, keeping evidence beside each claim and marking anything unsupported.
Draft an orientation guide for a new engineer on their first day, using ONLY the notes below. Do not add facts from general knowledge about the framework or the company.
System: tidewell-orders (fictional trade order service, Python and Django, PostgreSQL, Celery with Redis).
Notes (FACT = checked, with evidence; HYPOTHESIS = unchecked):
- FACT: INSTALLED_APPS includes orders, customers, catalogue, stock, invoicing, dispatch, legacy (tidewell/settings/base.py).
- FACT: README says Python 3.8; pyproject.toml requires >=3.11.
- FACT: legacy/pricing_v1.py is imported by invoicing/totals.py (git grep).
- FACT: create_order is called from api/views.py, dispatch/importers.py and the replay_orders command.
- FACT: confirmation task is queued after commit (orders/services.py:62).
- FACT: baseline at 4f9c2e1: 3 invoicing tests fail, 27 skipped.
- HYPOTHESIS: the nightly stock sync runs from the host scheduler.
- QUESTION: is the weekly CSV export still used? Ask finance systems.
Use these sections: What it does, Run it, Where things live, How an order flows, Known traps, Hotspots, Open questions.
Rules: keep the evidence next to each claim; label hypotheses (unverified); put anything you cannot support in a final list called "Needs checking" instead of inventing it; keep it under 350 words.Show the reusable template
Replace each {{placeholder}} with your own details.
Draft an orientation guide for a new engineer on their first day, using ONLY the notes below. Do not add facts from general knowledge about the framework or the company.
System: {{system_description}}
Notes (FACT = checked, with evidence; HYPOTHESIS = unchecked):
{{reading_log_notes}}
Use these sections: {{sections}}.
Rules: keep the evidence next to each claim; label hypotheses (unverified); put anything you cannot support in a final list called "Needs checking" instead of inventing it; keep it under {{word_limit}} words.Expected output and limitations
A guide in the requested sections, each claim carrying its evidence, unchecked items labelled, and a short 'Needs checking' list for anything the notes did not support. The text should reuse your wording rather than add background about the framework.
## Known traps
- legacy/pricing_v1.py looks unused but is imported by invoicing/totals.py (git grep).
- The README asks for Python 3.8; pyproject.toml requires 3.11 or later. Trust pyproject.toml.
- The confirmation task is queued after commit (orders/services.py:62); keep it that way.
## Open questions
- Is the weekly CSV export still used? Ask finance systems.
- (unverified) The nightly stock sync runs from the host scheduler.
## Needs checking
- How the app is deployed: not covered by the notes.Limitations to keep in mind
- The assistant reorders and rewords what you gave it; it has not checked the claims and may smooth over gaps.
- It may add generic framework advice. Delete anything that is not in your notes or your evidence.
- Commands in the draft are not tested until you run them on a clean checkout.
- A fluent, confident guide is not an accurate one. Verification against the code is your job.
Common errors and how to fix them
A guide that explains the framework
Why it happens: The assistant filled gaps with general knowledge.
Fix: Restrict it to your notes in the prompt, and delete background the reader can find in the framework's own documentation.
Commands that no longer work
Why it happens: The guide was never run on a clean machine.
Fix: Have a newcomer follow it cold, and re-run the commands whenever build files change.
Hypotheses presented as fact
Why it happens: Labels were lost while drafting.
Fix: Keep evidence links and the unverified marker in the text, and check the draft claim by claim.
A guide nobody updates
Why it happens: It lives in a wiki away from the code, with no date.
Fix: Keep it in the repository, stamp it with a commit and date, and put a re-check in the team's routine.
Validation checklist
Tick each item once you have confirmed it.
Hands-on exercise
Write and test a guide
Using your reading log and call-path table from the previous lessons, write a one- to two-page orientation guide for the repository, then have a second person follow its 'Run it' section.
You will need
- Your reading log and call-path table.
- The skeleton from this lesson.
- One colleague or friend with enough skill to follow the build steps, and a clean checkout.
Acceptance criteria
Your work is done when every one of these is true.
Hints (2)
- If no one can test it, follow the guide yourself on a fresh clone in a new folder.
- If you used an assistant, keep a note of which claims you changed or removed after checking.
Show a model answer
A strong guide reads quickly and is easy to challenge. It opens with a verification stamp, gives three or four runnable commands, and shows a small directory map with one line on each important folder. Its flow section names real functions, and its traps section shows the surprises you hit: a stale README, a module that looks dead, an ordering constraint. Open questions name who to ask. The test log is the best evidence of quality: the tester got stuck on a missing environment variable, and the guide now says so. A weak guide restates the framework's documentation, has no dates and has never been run by anyone else.
Knowledge check
Choose an answer, then check it. Nothing is recorded — this is for you.
Show the answer and explanation
Answer: B. A stamp and evidence let a reader check claims and measure how far the code has moved since. Length is tempting as a sign of care, but it increases the amount that can be wrong. Polished writing says nothing about accuracy, and authors alone do not show when it was checked.
Show the answer and explanation
Answer: B. The guide records what you know about this system; general background dilutes it and may be wrong for this project's version. The first option feels generous but lengthens the guide with unchecked text. Marking it unverified is acceptable for project claims, but this one adds nothing you can check.
Show the answer and explanation
Answer: C. Only running the steps on a clean machine reveals missing prerequisites and environment assumptions that the author no longer sees. Rereading and asking an assistant check plausibility, not behaviour, and the README is the document you already know is unreliable.
- Written by
- PromptFable Editorial
- Last updated 13 Nov 2026
- Review
- Reviewed by Waseem Nadir, Technical Reviewer
- Last reviewed 27 Nov 2026
References
Primary sources for the technical details in this lesson. Vendor platforms change — check the official page if anything here looks different from what you see.
- git-log Documentation(opens in a new tab)
Git project · Official documentation · For commit hashes and history used as evidence.
- git-grep Documentation(opens in a new tab)
Git project · Official documentation
PromptFable is independent and is not affiliated with, endorsed by or sponsored by Anthropic, Google, OpenAI or any other vendor. Claude, Gemini, Google AI Studio and other product names are trademarks of their respective owners.