Your First Hour in a New Repo: Write the Map Before the Patch
Conclusion first: the map is the deliverable of your first hour. A one-page repo map makes your first PR small. It also makes your first rollback boring.
Most onboarding advice says "read the code". That advice is too vague to act on. You cannot read a whole repo in an hour, but you can map it.
Step 1: Read the contract files, not the source (minutes 0–10)
Four files decide how the repo really works. Find them before anything else.
ls README* CONTRIBUTING* .github/workflows 2>/dev/null head -120 .github/workflows/*.yml The CI file is the truth. The README is a wish. When they disagree, trust the pipeline that gates merges.
Write down three things: the install command, the test command, the deploy branch.
Step 2: Generate the map with a script (minutes 10–25)
Do not do this by hand. Run the same script every time you join a repo. This is the artifact you keep.
#!/usr/bin/env bash # repo-map.sh — run from the repo root, first hour, read-only set -euo pipefail out="repo-map.md" { echo "# Repo map ($(date -u +%FT%TZ))" echo echo "## Head" git log -1 --format='%h %an %ad %s' --date=short echo echo "## Size and churn" echo "- tracked files: $(git ls-files | wc -l)" echo "- commits, 90d: $(git rev-list --count --since=90.days HEAD)" echo echo "## Hot files (90d, by commit count)" git log --since=90.days --name-only --pretty=format: \ | grep -v '^$' | sort | uniq -c | sort -rn | head -20 echo echo "## Test entry points" grep -RIn --include='*.yml' --include='*.yaml' \ -E 'run: .*(test|pytest|jest|go test|mvn)' .github 2>/dev/null | head -20 echo echo "## Risky paths present" for p in migrations/ schema/ infra/ Dockerfile .env.example; do [ -e "$p" ] && echo "- $p" done } > "$out" echo "wrote $out" Read the output once, then trim it into your first PR description. Reviewers recognise their own repo faster than you can describe it.
The hot-file list is the important part. Files that change every week break in ways you cannot predict. That is where your first bug will come from.
Step 3: Pin the baseline before you change anything (minutes 25–40)
You need one known-good log on disk. Keep it out of your memory and out of git.
mkdir -p .local echo '.local/' >> .git/info/exclude ( time npm test ) > .local/baseline.log 2>&1 || true grep -cE '^(FAIL|FAILED)' .local/baseline.log || true grep -E '^(FAIL|FAILED)' .local/baseline.log | head -10 Swap npm test for the command you copied in Step 1. Record the wall time next to it, because slow suites change how you work.
If the suite is already red, that is your starting line. Never "fix" a red baseline inside your first PR. Note the failing names and move on.
A red baseline is information, not an emergency.
Step 4: Pick a first PR by blast radius, not by interest (minutes 40–55)
Score two or three candidate files. The lowest score wins, even if it looks boring.
| Signal | Safe first PR | Walk away |
|---|---|---|
| Diff size | under 50 lines | over 300 lines |
| Tests | file has tests, or a close neighbour does | no tests in the area |
| Schema or migrations | untouched | touched |
| CI config | untouched | changed |
| History | several small reviewed commits | one giant commit, no review |
| Revert cost | one git revert | needs a data fix |
Two rules of thumb. Pick a file with tests, not a file with TODOs. If git log shows one author and zero reviews, ask before you touch it.
Log your scores in the issue. Future you will want the reasoning, not just the diff.
Step 5: Write the rollback line before you open the PR (minutes 55–60)
Put the exact revert command in the PR body. This takes ten seconds and saves an hour later.
git symbolic-ref --short refs/remotes/origin/HEAD git revert --no-edit <merge-or-squash-sha> Replace <merge-or-squash-sha> with the commit your PR actually produced. Check the default branch name first, because it is not always main.
If you cannot write the revert line, your PR is too big. Split it now, not after review.
Where a model actually helps in hour one
The map is mechanical reading. That is the right job for an AI assistant. Ask it to summarise, not to design.
Three safe prompts for a new repo:
- "List every command in this workflow file and what triggers it."
- "Which files under src/ have no test file with a matching name?"
- "Draft a five-line PR body from this diff and this baseline log."
Every answer needs one check against the repo. Paste the command you ran beside the summary, or the summary is a rumour.
This is where MonkeyCode's free tier fits my onboarding habit. The project offers free model access and a free server option. Free tokens let a newcomer ask boring questions all week without a budget conversation. A free server option matters when the suite needs a machine you do not own.
Disclosure: This article was prepared as part of MonkeyCode's product outreach.
Free allowances change. Verify current limits and terms on the project's own page before you plan around them. Never treat a free tier as a permanent guarantee.
Limitations and who should skip this
- This is for a repo you did not write. If you are the main author, skip the map.
- Monorepos with a forty-minute suite need a different baseline. Start with the fastest subset only.
- Regulated codebases may forbid sending repo content to any hosted model. Check policy, then use local tooling.
- If your team already has an onboarding doc, extend it. Do not create a second source of truth.
- If the repo has no working test command, stop mapping. Fixing that comes first, and it is not your first PR.
The 60-minute checklist
Copy this into your first issue or notes file.
- [ ] Install command copied from the workflow file, not the README
- [ ] Test command and measured runtime recorded
- [ ]
repo-map.mdgenerated and pasted into your notes - [ ] Baseline log saved at
.local/baseline.log - [ ] Candidate file scored with the blast-radius table
- [ ] Revert command written in the PR body
Do this once per repo. The second repo takes ten minutes. Ship small, revert clean.
