xiaohongshu
xiaohongshu
legacy-migration
This skill should be used when migrating features from src.legacy/ to the new kernel implementation or removing legacy code after reaching feature parity. Use for systematic legacy code removal, updating FEATURE_COMPARISON.md, verifying feature equivalence, and ensuring safe code retirement.
Full skill instructions
Systematically migrate features from legacy kernel and remove old code when parity is reached.
Breenix is transitioning from a legacy kernel (src.legacy/) to a modern implementation (kernel/). This skill provides patterns for safely migrating features, verifying parity, and removing legacy code.
When new implementation reaches parity:
1. Remove code from src.legacy/
2. Update FEATURE_COMPARISON.md
3. Include removal in same commit as feature completion
Key Point: Don't accumulate dead code. Remove legacy as soon as parity is reached.
Review FEATURE_COMPARISON.md:
# See what's in legacy but not new
cat docs/planning/legacy-migration/FEATURE_COMPARISON.md | grep "❌"
# See what's partially implemented
cat docs/planning/legacy-migration/FEATURE_COMPARISON.md | grep "🚧"
Common patterns:
Locate the legacy code:
# Find legacy implementation
find src.legacy -name "*feature_name*"
# Search for specific functionality
grep -r "feature_function" src.legacy/
Understand the implementation:
Extract key characteristics:
Follow Breenix standards:
// 1. Add to appropriate module in kernel/src/
// 2. Use modern Rust patterns
// 3. Add #[cfg(feature = "testing")] for test code
// 4. Write comprehensive tests
// 5. Document with clear comments
Quality checklist:
Functional equivalence:
# Run tests for the feature
cargo test feature_name
# Check behavior matches legacy
# (Compare outputs, test edge cases)
# Run full test suite
cargo test
API compatibility:
Behavioral parity checklist:
Update FEATURE_COMPARISON.md:
### Feature Category
| Feature | Legacy | New | Notes |
|---------|--------|-----|-------|
| Feature X | ~~✅ Full~~ (removed) | ✅ | Migrated in PR #123, legacy removed |
Patterns:
~~✅ Full~~ (removed)Document any differences:
## Implementation Differences
### Feature X
- **Legacy**: Used approach A
- **New**: Uses approach B (reason)
- **Rationale**: Cleaner design, better performance, etc.
In the SAME commit as feature completion:
# Remove the legacy files
git rm src.legacy/path/to/feature.rs
# Or if removing entire module
git rm -r src.legacy/module/
# Stage FEATURE_COMPARISON.md changes
git add docs/planning/legacy-migration/FEATURE_COMPARISON.md
# Commit together
git commit -m "Complete Feature X implementation and remove legacy
- Implement Feature X in kernel/src/module/feature.rs
- Full parity with legacy implementation
- Remove legacy code from src.legacy/
- Update FEATURE_COMPARISON.md
Tested with: cargo test feature_x
"
Critical: Legacy removal MUST be in the same commit to maintain atomicity.
What: Feature can be ported directly with minimal changes
Example: VGA text mode removed after framebuffer complete
Process:
What: New approach taken, but achieves same goals
Example: Timer system (different RTC implementation)
Process:
What: Feature no longer needed or superseded
Example: VGA text after framebuffer works
Process:
What: Features not yet needed in new kernel
Example: Network stack (not current priority)
Process:
// Legacy: src.legacy/drivers/device_x.rs
// New: kernel/src/drivers/device_x.rs
// 1. Port driver structure
pub struct DeviceX {
// ... fields
}
// 2. Port initialization
impl DeviceX {
pub fn new() -> Self { ... }
}
// 3. Port public API
impl DeviceX {
pub fn operation(&mut self) { ... }
}
// 4. Add tests
#[cfg(test)]
mod tests {
#[test]
fn test_device_x() { ... }
}
// Legacy: src.legacy/syscall/handler.rs (mostly commented out)
// New: kernel/src/syscall/handler.rs (full implementation)
// 1. Define syscall number
pub const SYS_FEATURE: u64 = N;
// 2. Add to dispatcher
pub fn syscall_handler(num: u64, args: ...) {
match num {
SYS_FEATURE => sys_feature(args),
// ...
}
}
// 3. Implement handler
fn sys_feature(args: ...) -> u64 {
// Implementation
}
// 4. Test from userspace
// userspace/tests/feature_test.rs
// Legacy: Multiple files implementing async
// New: Consolidated in kernel/src/task/
// 1. Analyze legacy architecture
// 2. Design improved structure
// 3. Implement with better patterns
// 4. Migrate tests
// 5. Document improvements
Before removing legacy code, assess:
# 1. Check if legacy has this feature
grep -r "feature_name" src.legacy/
# 2. If found, analyze it
less src.legacy/path/to/feature.rs
# 3. Implement in new kernel
# ... development work ...
# 4. Test thoroughly
cargo test feature_name
# 5. Remove legacy in same commit
git rm src.legacy/path/to/feature.rs
# 6. Update FEATURE_COMPARISON.md
# ... edit ...
# 7. Commit together
git commit -m "Implement feature_name and remove legacy"
When reviewing PRs that claim feature parity:
Based on FEATURE_COMPARISON.md (as of latest):
Completed Migrations:
Not Yet Migrated:
Different Approach:
Scenario: Legacy code is actually better designed
Action:
Scenario: Legacy API is poor, new needs different design
Action:
Scenario: Not sure if new implementation is equivalent
Action:
# Identify target feature
cat docs/planning/legacy-migration/FEATURE_COMPARISON.md | grep "❌"
# Found: Event system not yet implemented
# Analyze legacy
less src.legacy/events/mod.rs
grep -r "Event" src.legacy/
# Implement in new kernel
# ... create kernel/src/events/mod.rs ...
# ... write tests ...
# Verify
cargo test events
# Remove legacy and update docs
git rm -r src.legacy/events/
# Edit FEATURE_COMPARISON.md
# Commit atomically
git add kernel/src/events/ tests/test_events.rs
git add docs/planning/legacy-migration/FEATURE_COMPARISON.md
git commit -m "Implement event system and remove legacy
- Add event system in kernel/src/events/
- Full parity with legacy implementation
- Enhanced with better error handling
- Remove src.legacy/events/
- Update FEATURE_COMPARISON.md
Tested with: cargo test events
All tests passing, no regressions.
"
Legacy code migration requires:
The goal: Clean codebase with no dead code accumulation.
xiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience