Legacy & Codebase Discovery — Archaeology Before Migration
| Field | Value |
|---|---|
| Type | Skill Resource |
| Source | ~/.copilot/skills/architecture/references/discovery.md |
| Description | Not specified |
Source Content
Legacy & Codebase Discovery — Archaeology Before Migration
A repeatable discovery playbook for any system that must be understood before it is changed — modern codebases and legacy platforms alike (IBM i/AS400 RPG, mainframe COBOL/JCL/VSAM, CICS, and “modern legacy” such as .NET Web Forms, end-of-life Java/J2EE, VB6, Oracle Forms, and classic PHP). AI is an archaeology tool here, not a migration engine — the wager is that the expensive, risky part of modernizing a system is understanding it, not converting its syntax.
The core principle: inventory → data model (ERD) → business rules → dependencies & batch schedule → golden-master tests → plain-English onboarding doc → scored retire/rehost/refactor/replace/rebuild disposition. The decision comes after the system is understood, never before. Validate the resulting docs/onboard.md with python3 ~/.copilot/skills/technical-writing/scripts/lint.py docs/onboard.md.
The 7-phase playbook (summary)
- Inventory — classify every artifact deterministically first. Run
scripts/inventory.py <repo>for counts and a classified file table before spending context on any single program. - Data model — decode DDS / DB2 / VSAM / copybooks into a logical ERD and a field dictionary. Extract the data before the logic; the record layout tells you what a program is about.
- Business rules — mine calculations, validations, and state transitions into a rule catalog, each entry citing the program and line range it came from.
- Dependencies & schedule — build the call graph, the file-usage (CRUD) matrix, the batch-job DAG, and the integration inventory.
- Tests — turn the mined rules and real record layouts into golden-master and edge-case scenarios that let a rewrite prove equivalence.
- Document — assemble everything into
docs/onboard.mdfor a reader who has never seen the platform. - Decide — score each subsystem on the disposition rubric (data gravity, rule volatility, coupling, latency/SLA, COTS fit) and recommend per subsystem, never per system.
Phases 1–4 are the load-bearing archaeology; phase 6 is the deliverable; phase 7 is the payoff. Never let a disposition get scored before phases 1–4 exist.
How to route within this subfolder
Identify the platform family first, then read the matching file in references/discovery/:
| Platform | Read |
|---|---|
| RPG / DDS / CL (IBM i, AS400) | references/discovery/ibm-i-as400.md |
| COBOL / JCL / VSAM (mainframe batch) | references/discovery/mainframe-cobol.md |
| CICS / BMS online transactions | references/discovery/cics-online.md |
| .NET Web Forms, Java EE, VB6, Oracle Forms, classic PHP | references/discovery/modern-legacy-platforms.md |
| Any platform — the full 7-phase method | references/discovery/discovery-playbook.md |
| Data model / ERD extraction and decode gotchas | references/discovery/data-model-extraction.md |
| Business-rule mining | references/discovery/business-rule-mining.md |
| Call graphs, CRUD matrix, batch DAG, integrations | references/discovery/dependency-mapping.md |
| Retire/rehost/refactor/replace/rebuild scoring | references/discovery/modernization-strategy.md |
| Diagram skeletons (ERD, call graph, batch DAG, journeys) | references/discovery/mermaid-legacy-patterns.md |
| Onboarding doc section structure | references/discovery/onboard-template.md |
| Plain-English term decoder | references/discovery/glossary.md |
| Public repos to practice on | references/discovery/sample-corpora.md |
House rules
- Keep raw code reads out of the top thread. Delegate per-program reads to subagents that return a filled-in finding — a decoded layout, a rule entry, a dependency edge — not the source.
- Cite the program and line range for every claim. An uncited rule, edge, or field decode is a hypothesis, not a finding.
- Mark confidence. High for “the code plainly says this,” low for “inferred from a field name.” Low-confidence findings go on a validate-this list, not into the doc as fact.
- Every diagram gets a “what to notice” line, and every explanatory section opens with a two-person story — both per the
technical-writingskill, which owns diagram and Markdown rules. - Score dispositions per subsystem, never per system. One monolith usually contains a retire candidate, a COTS-replaceable module, and a genuinely custom rules engine that deserves a careful rebuild.
Pair with these skills
technical-writing— owns the Diátaxis mode, readability gate, two-person-story openers, Markdown mechanics, and the diagram rules for every Mermaid block in the onboarding doc.database-designer— hand it the extracted ERD when designing the target schema.ato-readiness— for public-sector targets, run the FedRAMP/800-53 control story in parallel with the rebuild.
Don’t use this for
- Writing the migration itself — hand the artifacts to the relevant build skill (
frontend,backend,platform) once discovery is done. - Greenfield schema design — that’s
database-designer. - Generic prose docs with no legacy code to read — that’s
technical-writing.