c_agri_trade/process/.agents/skills/up-legacy-gap-analysis/SKILL.md

64 lines
3.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
name: up-legacy-gap-analysis
description: Inventory legacy modules, APIs, AST source structures, and database schema from legacy repositories, mine legacy screenshots for screen flows, and produce the BRD-vs-legacy gap/conflict analysis for Brownfield modernization projects. Use this after up-brd-extract on Brownfield tracks, whenever a legacy module needs deep analysis, or when a new screenshot set arrives. Covers Stages 2-4 (Inception) of the UP-AI v1.0 Process. (Note: Skipped for Greenfield projects).
---
# up-legacy-gap-analysis — Stages 2–4 (Inception: Brownfield Track)
## Objective
Build a catalogued, indexed understanding of the legacy system (modules, APIs, DB schema, screens) and reconcile it against the PRD/BRD-FR inventory from Stage 1 — producing the authoritative conflict/gap list that Stage 5 (`up-use-case-author`) will consume. This applies to **Brownfield Modernization / Migration** initiatives.
*(Note: For Greenfield 0-to-1 initiatives, skip Stages 2–4 and proceed directly to Domain Modeling and Stage 6 Architecture Spike).*
## When to invoke
- On Brownfield projects after `up-brd-extract` has produced `brd_inventory.md`.
- When a specific legacy module needs its behavior extracted in more depth.
- When legacy screenshots or UI assets arrive for a portal/client application.
## Read first
- `tech-profile.yaml` (identifies legacy source paths under `inception.legacy_sources`)
- `04_generated_documentation/01_source_inventories/brd_inventory.md`
- `02_legacy_source_code/` (the specific module folder(s) in scope)
- `03_old_screenshots/` (if UI screenshots are available)
- `process/AI_Native_Unified_Process_v1.md` §4 "Stages 2–4"
## Procedure
Run as three scoped passes — do not combine them into one prompt (token discipline):
**Stage 2 — Legacy System Inventory** (one module or catalogue type at a time):
1. Folder & AST inventory: catalogue applications/modules present, purpose, architecture pattern, apparent tech stack.
2. API catalogue: enumerate endpoints per module (method, path, request/response models, auth mechanisms).
3. DB catalogue: reconstruct schema/tables per module from ORM models, SQL scripts, or migration files.
Output: behavioral extraction docs under `04_generated_documentation/02_legacy_analysis/`.
**Stage 3 — Screenshot and UX Mining:**
Build a screen inventory from screenshots or legacy templates alone, independent of code, cross-checking Stage 2's findings. Output under `04_generated_documentation/02_legacy_analysis/`.
**Stage 4 — BRD vs Legacy Gap Analysis:**
Cross-reference `brd_inventory.md` (BRD-FR-xxx) against legacy analysis findings. For each BRD-FR, note: matched legacy behavior / partial match / no legacy precedent / legacy behavior contradicts BRD. Output under `04_generated_documentation/02_legacy_analysis/`.
Rules:
- Distinguish confirmed legacy behavior, inferred behavior, proposed modernization, and new requirement.
- Flag ambiguity in `ambiguity_register.md` (`AMB-xxx`) instead of silently assuming.
- Do not invent business rules not evidenced in code, screenshots, or BRD.
## Output expected
Extraction and gap analysis files under `04_generated_documentation/02_legacy_analysis/`.
## Exit criteria (QG-I, combined with Stage 0/1)
Target requirements catalogued; legacy modules/APIs/DB/screens indexed; gap/conflict list produced.
## Sample invocation
> "Run up-legacy-gap-analysis on the legacy auth module and produce the gap analysis against brd_inventory.md."
## Related skills
Previous: `up-brd-extract` (Stage 1). Next: `up-use-case-author` (Stage 5).