03-refactor-legacy

Refactor legacy or procedural WordPress plugins into Antonella MVC. Use when modernizing existing plugins with configurable backward-compatibility levels.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "03-refactor-legacy" with this command: npx skills add bmiguelbc16/antonella-agent-pack/bmiguelbc16-antonella-agent-pack-03-refactor-legacy

Skill: 03-refactor-legacy (Modernizer)

📜 Source of Truth

Standard: Architecture Standards Standard: Security Standards

🎯 Purpose

Modernize legacy WordPress plugins or messy procedural codebases by refactoring them into the Antonella MVC structure, while optionally ensuring 100% backward compatibility via proxy methods. You act as a modernization architect.


🗣️ Agent Interaction Protocol — The Audit Phase

[!CAUTION] Refactoring a legacy plugin is high-risk. DO NOT move or delete any files until you have fully mapped the legacy plugin and received explicit confirmation from the user regarding the risk tolerance.

First Action: Ask the user to provide the path to the legacy plugin and determine the modernization strategy:

"I am ready to modernize a legacy plugin for you. Please provide the path to the legacy plugin (e.g., wp-content/plugins/my-old-plugin). Additionally, choose the level of aggressiveness for this refactor:"

Option A: Conservative (Safety First) I will extract the procedural logic into proper MVC Controllers and Services, but I will keep all original global function signatures and hooks intact as "proxy" shells. This prevents breaking other plugins that might depend on them.

Option B: Standard Migration I will do a full MVC migration. Legacy global functions will be removed unless explicitly stated otherwise. Database tables and major hook names will remain identical.

Option C: Aggressive Rebuild Full migration. I will remove deprecated patterns, update database schemas to modern standards, and fully rewrite inefficient queries. Backward compatibility is not guaranteed.

Wait for the user's response to proceed.


🔄 Execution Protocol

🧭 Phase 1: Snapshot & Map

Before changing any logic, scan the legacy plugin and map:

  • All add_action and add_filter calls.
  • All global functions declared.
  • All direct database interactions ($wpdb).

🧭 Phase 2: Logic Extraction

Move procedural functions from legacy files into structured Controllers or Services in the Antonella src/ directory.

🧭 Phase 3: Backward Compatibility (If Option A)

Keep legacy function names in the main plugin file or a dedicated legacy-functions.php file. These functions should simply call the new MVC classes. Example: function my_old_function() { return (new MyController())->newMethod(); }

🧭 Phase 4: Route Translation

Move inline $_POST/$_GET handling from procedural files into standard Antonella config/Config.php routing definitions mapped to the new Controllers.


🏁 Quality Gates

  • ✅ Agent asked for confirmation and risk tolerance before touching files.
  • ✅ All extracted logic is now PSR-4 compliant.
  • ✅ If Conservative, legacy entry points remain functional.
  • ✅ No logic resides directly in the main plugin bootstrap file.

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Automation

02-implement-features

No summary provided by upstream source.

Repository SourceNeeds Review
Automation

01-scaffold-and-plan

No summary provided by upstream source.

Repository SourceNeeds Review
Security

04-audit-and-release

No summary provided by upstream source.

Repository SourceNeeds Review
Automation

clinic-visit-prep

帮助患者整理就诊前问题、既往记录、检查清单与时间线,不提供诊断。;use for healthcare, intake, prep workflows;do not use for 给诊断结论, 替代医生意见.

Archived SourceRecently Updated