code-archaeology
Skill1 starsChanged 4 days agoMITView on GitHub
Understand unfamiliar or legacy code before changing it — map entry points, mine git history (blame, churn, log -S), trace data flow, recover the why behind odd code, pin current behavior with characterization tests, find seams for safe change. Triggers: understand this codebase, legacy code, inherited this project, what does this code do, why is it written this way, nobody knows how this works, onboard to this repo, is it safe to change this. Prioritizing debt → technical-debt-review; improving code you already understand → refactoring.
3 other projects use a version of this.
Adopted by
Most recently taken up by
- flonat/flonat-researchtheir own version, first seen Nov 3, 2026
- itsmuskanagarwal/claude-packtheir own version, first seen Oct 11, 2026
- tstapler/dotfilestheir own version, first seen Oct 10, 2026
Other versions3 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 3
- flonat/flonat-research★ 150same name
- tstapler/dotfiles★ 8same name
- itsmuskanagarwal/claude-pack★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository68 other files it gives its agents.
- AGENTS.mdAGENTS.md
- accessibility-designSkill
- ai-evaluationSkill
- api-designSkill
- architecture-designSkill
- architecture-documentationSkill
- brainstormingSkill
- browser-verificationSkill
- bug-investigatingSkill
- build-vs-buySkill
- cicd-pipelineSkill
- code-reviewingSkill
- code-slop-cleanupSkill
- compliance-privacySkill
- configuration-strategySkill
- containerizationSkill
- data-modelingSkill
- data-pipeline-designSkill
- data-qualitySkill
- dependency-impact-analysisSkill
- dependency-managementSkill
- deployment-checklistSkill
- deployment-repoSkill
- dx-auditSkill
- effort-estimationSkill
- exploratory-data-analysisSkill
- feature-planningSkill
- finops-cost-optimizationSkill
- frontend-architectureSkill
- gitops-deliverySkill
- git-workflowSkill
- incident-responseSkill
- infrastructure-as-codeSkill
- llm-app-engineeringSkill
- metrics-and-okrsSkill
- ml-experiment-trackingSkill
- ml-model-deploymentSkill
- ml-pipeline-designSkill
- mobile-architectureSkill
- mobile-releaseSkill
- notebook-to-productionSkill
- observability-designSkill
- performance-optimizationSkill
- plan-executionSkill
- prd-writingSkill
- project-documentationSkill
- project-proposalSkill
- project-reviewSkill
- refactoringSkill
- release-managementSkill
- research-methodologySkill
- resilience-engineeringSkill
- retrospectiveSkill
- rollback-strategySkill
- security-auditSkill
- skill-routerSkill
- statistical-analysisSkill
- strategic-reviewSkill
- subagent-orchestrationSkill
- tdd-workflowSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
1 rule. 0 are common, 1 is distinctive, and 0 are very specific to this project.
0
Common
Most of the 3 edited versions we read keep these.
1
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 66
Before changing anything you don't fully understand, write tests that capture what the code currently does — not what it should do.
“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Code Archaeology
Build a working model of code nobody fully understands — before changing it.
The cardinal rule: the code is the way it is for reasons; find them before
overriding them. Chesterton's fence applies — weird code is usually a bug fix
whose bug report is lost, and "cleaning it up" reintroduces the bug. Boundary
with siblings: technical-debt-review assesses and prioritizes what to fix;
refactoring improves code you already understand; this skill produces the
understanding both depend on.
Workflow
Step 1: Survey Before Digging
Get the shape of the territory without reading line-by-line: entry points (main, routes, handlers, cron, consumers), the dependency skeleton (what are the load-bearing modules — imported by everything), build/run/test commands (does the test suite even pass? that's data), and the directory map with sizes. Resist starting at file one and reading forward — comprehension follows the call graph, not the alphabet.
Step 2: Mine the History — the Code's Memory
Git knows what the docs forgot. The high-yield digs:
git log --follow -p -- <file>— a file's life story; the commit that introduced the odd code usually says why (and links a ticket).git log -S '<string>'(pickaxe) — when a magic value or weird guard appeared, and what else changed with it.- Churn analysis — files with the most commits are the active organs
(
git log --format= --name-only | sort | uniq -c | sort -rn | head); high-churn + large = where understanding pays most (same hotspot logic astechnical-debt-review). git blame -w -C(ignore whitespace, follow copies) — who last touched this line and in what commit context; blame the commit, then read its message and siblings.- Merge/PR references in messages — the review thread often holds the design discussion that never made it into the code.
Step 3: Trace, Don't Guess
For the specific behavior you need to understand, follow the data: pick one concrete input (a request, an event, a row) and trace it end to end — through handlers, transformations, side effects, and persistence. Use the debugger or strategic log statements over static reading when the control flow is dynamic (dispatch tables, DI containers, metaprogramming). Write the trace down as you go; a data-flow narrative ("the order enters here, gets enriched here, forks here") is worth ten class diagrams.
Step 4: Interrogate the Oddities
For each "why on earth" you hit, run the checklist before concluding it's senseless: What does history say (Step 2)? Does a test encode it as intended behavior? Do comments/tickets/ADRs reference it? Does production data depend on it (that dead-looking branch may handle the 2019 records)? Only after all four come up empty may you suspect it's vestigial — and even then you prove it (logging/telemetry on the branch) rather than assume it.
Step 5: Pin Behavior with Characterization Tests
Before changing anything you don't fully understand, write tests that capture
what the code currently does — not what it should do. Feed it
representative inputs (including the weird ones from production), assert the
observed outputs, and lock in today's behavior as the baseline. These tests
are your tripwire: if a "safe cleanup" changes an output, you learn it in CI,
not in production. Golden-master/snapshot testing works well when outputs are
large or numerous. (For designing the suite around them long-term:
test-suite-design.)
Step 6: Leave the Map Better Than You Found It
Record what you learned where the next archaeologist will find it: a short
architecture note or README-in-the-directory (the data-flow narrative from
Step 3, the load-bearing oddities from Step 4 and why they exist), backfilled
ADRs for the big recovered decisions (architecture-design), and comments only
on the genuinely non-obvious constraints. Then, with understanding and
characterization tests in place, changes proceed via refactoring (seams,
safe transformations) or dependency-impact-analysis (blast radius) as normal.
Principles Applied
- Chesterton's fence: understand why the fence is there before removing it; lost context is not absent context.
- Evidence over inference: history, traces, and tests beat reading-and- guessing — the code's actual behavior outranks anyone's model of it.
- Capture as you go: understanding that lives in one head (or one session) is re-excavated at full cost next time.
Cross-Skill References
technical-debt-review— assess and prioritize what to fix once understoodrefactoring— the safe-change patterns applied after comprehensiontest-suite-design— growing characterization tests into a real suitedependency-impact-analysis— blast radius before changing a shared piecearchitecture-documentation— recording the recovered architecture (C4, flows)bug-investigating— when the goal narrows to one specific misbehavior
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

