Claude Code for code archaeology: understanding old code faster | Claude Code Toolkit
Patterns

Claude Code for code archaeology: understanding old code faster

The unglamorous but high-value use case that gets ignored in most Claude Code content — using it to understand code you didn't write, in codebases nobody remembers well.

FA
Fatima A. September 7, 2026 · 10 min read

Most Claude Code content focuses on writing new code. The unglamorous but high-value use case that gets underdiscussed: understanding code you didn't write. Legacy modules, unfamiliar codebases, that one service nobody on the current team was around for. This is code archaeology, and it's where Claude Code often shines brightest in practice.

This post is the specific patterns we use for archaeology. Not "ask Claude what this code does" — that's the beginner move and rarely produces enough. The patterns that actually work involve using Claude to synthesize multiple sources: the code itself, git history, related PRs, docs (if any), and — often — the humans who might remember.

The problem shape

You need to change something in a module you don't understand. Or fix a bug in code that predates your tenure. Or evaluate whether to keep or rewrite a legacy service. In all these cases, the first challenge isn't "write the change" — it's "understand what's here and why."

Traditional approaches: read the code, read the git log, ask senior engineers. All of these still work. Claude Code adds a synthesis layer on top: it can read faster than you can, correlate git history with code, and produce compressed explanations that would take you hours to construct manually.

Pattern 1: The reconnaissance pass

The first pass into unfamiliar code. Goal: get a mental map before diving into details.

bash
> I need to work in src/services/pricing/. Give me the reconnaissance:
- What are the main files and their purposes?
- Where does the entry point / public API live?
- What external dependencies does it have?
- What does the test coverage look like?
- Any files that look old, unusual, or dead?

Claude walks through the directory, reads key files, and produces a summary. Twenty minutes of manual exploration compressed to two minutes. The output isn't deep — it's wide. You now know the shape of the thing before you dive into specifics.

What the recon pass gets right: identifying the "unusual" files. Claude will notice things like "this file was last touched two years ago and doesn't match the style of the rest" or "these two files look like they're doing overlapping things." Human eyes miss these on first pass; Claude sees them consistently.

The recon pass is where Claude adds the most value in archaeology. Not deep understanding — wide awareness. It sees things you'd take an hour to notice, in two minutes.

Pattern 2: Tracing intent through git history

For a specific piece of code that looks weird, git blame tells you who wrote it. Git log tells you when. Combining these with Claude reading the referenced PRs and commit messages tells you why.

bash
> Look at src/services/pricing/discount-engine.ts, lines 47-60.
This logic looks unusual. Trace:
- When was this code first written?
- What PR introduced it?
- What was the PR description saying about intent?
- Has it been touched since? What did those changes do?
- Are there related discussions in commit messages or PR comments?

Claude does the git archaeology: reads git log, finds the PR, reads the PR description, checks for related changes. What you get: not just what the code does but why it exists in its current shape.

This is where "the intern framing" definitely doesn't apply — Claude reads git history faster than anyone. For code archaeology, this is the killer capability. Weird code usually has weird history; correlating them explains a lot.

Pattern 3: The "explain this pattern" query

You're looking at code that follows a specific pattern you don't recognize. Not the language — the team's pattern for solving some class of problem. It's a house style that's idiosyncratic.

bash
> Multiple files in this codebase use a pattern where classes 
have a `.hydrate()` method that's called after construction. 
Find 3-5 examples of this pattern. Explain:
- Why not just do this in the constructor?
- What are the hydration methods doing that constructors couldn't?
- Is this an intentional pattern or accidental?

Claude finds examples, reads them, correlates. Often you'll get an answer like: "this pattern was introduced in PR #892 to handle async initialization; the class boundary needed to happen before the async work; the pattern spread from there." Now you know: this is a real pattern with a reason. Follow it in new code you write.

This is real value

Reading unfamiliar patterns and asking "is this intentional?" is a slow manual task without Claude. With Claude, it's two minutes. The compression is real, and the resulting understanding is often better than what a manual review would produce because Claude looks at more examples than you'd have patience for.

Pattern 4: Cross-reference with docs (that might lie)

Old docs are often out of date. They describe how the code was supposed to work, not how it does work. But they're still useful — they tell you what the original intent was, which helps understand what the code was trying to do vs what it evolved into.

bash
> Read the design doc at docs/pricing-architecture.md.
Compare against the current code in src/services/pricing/:
- What matches the design?
- What differs, and how?
- Any parts of the design that were never implemented?
- Any code that seems to have no design doc equivalent?

The output tells you where the drift is. Sometimes the code is right and the docs need updating. Sometimes the code drifted and needs to come back. Sometimes both are wrong and there's a design conversation to have. Claude surfaces the mismatch; humans decide what to do about it.

Pattern 5: The "who might know" mapping

When Claude has done its part but human context is still needed, it can help identify who to ask.

bash
> I need to understand why the discount engine has a special case 
for orders over $10,000. The code has no comment about it. Who on 
the team should I ask?
- Check git blame for the specific lines
- Look at PR authors and reviewers  
- Check if any of these people still work here
- Suggest who's most likely to remember

You get: "Original author is Alice (no longer at company). Reviewer was Bob (still here, on payments team). Alice mentioned in the PR description that this was requested by finance. Bob or someone on the finance-tech team probably remembers."

Now you know exactly who to Slack. Two minutes of Claude time saved you 30 minutes of "who might know?" investigation.

What archaeology with Claude doesn't give you

Some things Claude can't archaeology-away:

Institutional memory that isn't written down. If the reason for the $10K special case exists only in someone's head, no amount of code reading recovers it. You still need to talk to the human.

Judgment about whether the code is bad. Claude can describe what code does. It can't reliably tell you whether the code is well-designed for its purpose. "Should this be refactored?" needs human judgment.

Context about business realities. "Why does the checkout flow have four steps when three would work?" might be answered by "regulatory requirement." Not visible in the code.

Confidence about coverage. Claude's "here are the main files" reconnaissance can miss critical pieces. Verify by checking the file tree, not just trusting the summary.

When archaeology is the primary use case

Some teams use Claude Code primarily for archaeology, not primarily for writing new code. Teams inheriting legacy systems, teams doing acquisition integrations, teams evaluating dead-code candidates. For these teams, the archaeology patterns are the whole workflow.

If that's your context, invest in the archaeology-supporting infrastructure: MCPs for issue trackers (so PR comments and issues are queryable), skills for your team's known patterns (so Claude recognizes them), CLAUDE.md that captures the archaeological findings as they accumulate.

The output of archaeology work is often docs. When you've understood what a module does and why, write it down. Future you (or the next engineer to touch this module) benefits enormously. Archaeology that gets forgotten needs to be redone; archaeology that gets documented compounds.

The underrated pattern

A lot of AI marketing sells the "write new code faster" story. Fine, but in practice, senior engineers spend a huge fraction of their time understanding existing code — during reviews, during incident response, during architecture work, during hand-offs. Compressing that time is at least as valuable as compressing writing time, and it's where a lot of the real productivity comes from.

If you're only using Claude Code for new writing, you're getting maybe half the value available. Try the archaeology patterns for a week. Notice how many hours of "read this legacy code" work compress. That's where the productivity story often lives, even if the marketing doesn't talk about it much.

FA

Written by

Fatima A.

Fatima covers developer experience, tooling architecture, and how MCP-native workflows change day-to-day dev.

Get cctk running in one command

85 slash commands, 12 subagents, 12 MCP integrations, 12 hooks. All the patterns from this post are shipped in cctk.

npx cctk@latest init Get cctk v1.5.2 →