Modernization Phase 1: Existing Library Analysis
Phase Flow
Phase 1: Existing Library Analysis
- Process each project separately
- Analyze code and tests
- Create reference-code-specs files
- Document interfaces and signatures
- Document business and tech purpose
- Analyze usage and visibility
- List unknowns and assumptions
- Link implementation and tests
- Describe test coverage
Context
PREREQUISITES: None
OBJECTIVES:
- Create complete, factual specification of existing code
- Understand functionality, requirements, edge cases, and usage
- Identify unknowns and create follow-up tasks
- Use and rely on performance optimizations already applied (we must not downgrade!).
- These project must not be modernized, but could be extended, and definitely must be reused!
Requirements
- MUST process each project separately
- MUST create
docs/reference-code-specs-<lib/project>.md for each project
- MUST analyze ALL code AND associated unit tests
- MUST use search/grep/tools to discover all relevant details
- MUST document findings with evidence (references to actual code)
- MUST list all files and create todo tasks systematically
Address Edge Cases
Edge cases MUST be explicitly identified and documented:
- Case sensitivity handling
- Reference parameters and side effects
- Out parameters
- Null/undefined handling
- Boundary conditions
- Error conditions
Specification Contents (MANDATORY)
Each specification MUST include:
-
Interfaces & Method Signatures & Enums & Other Code Constructs
- Full signature with parameters, return types
- Access modifiers (public, private, internal, protected)
- Static vs instance
-
Business/Technology Purpose
- What does this code do?
- Why does it exist?
- What problem does it solve?
-
Special Requirements & Edge Cases
- Performance requirements
- Threading/concurrency considerations
- Transaction handling
- Security requirements
- Edge cases identified from tests
-
Usage Analysis
- Who calls this code? (list all callers)
- What calls this code? (classes, methods, external systems)
- If PUBLIC: note possible external callers outside codebase
-
Visibility
- public, private, internal, protected
- Package/assembly visibility
-
Unknowns
- List anything that is unclear or not understood
- Custom libraries not yet analyzed
- External dependencies not documented
- Patterns not yet seen
-
Assumptions
- List all assumptions made during analysis
- Flag assumptions that need validation
-
Implementation Links
- File path and line numbers for implementation
- File path and line numbers for corresponding tests
-
Test Descriptions
- Summary of what tests cover
- Test rules and validation logic
- Edge cases tested
- Coverage gaps
Critical Rules for This Phase
- NO GENERALIZATION - Only document facts
- NO ASSUMPTIONS - Call out assumptions explicitly
- NO SUGGESTIONS - This is specification, not design
- NO RECOMMENDATIONS - Only what exists
- MUST call out inconsistencies explicitly (byte-to-byte consistency required)
- MUST create follow-up tasks for any ambiguity
- MUST validate spec completeness before advancing
Validation Checkpoint
MUST spawn separate subagent to validate grounding, truthfulness, gaps, consistency, reasoning, and overall completion of the phase.
Before proceeding to Phase 2:
DEPENDENTS: Phase 2 (existing old code analysis) depends on completion of all project specs