Refatoração de Código FreePascal/Lazarus

Refactor FreePascal/Lazarus source code using extraction and design-pattern techniques.

17|7|Updated Mar 26, 2026
One-click install
npx skills add https://github.com/delphicleancode/lazarus-spec-kit --skill refatora-o-de-c-digo-freepascal-lazarus
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Refatoração de Código FreePascal/Lazarus
Source: https://github.com/delphicleancode/lazarus-spec-kit/tree/main/.gemini/skills/refactoring
Command: npx skills add https://github.com/delphicleancode/lazarus-spec-kit --skill refatora-o-de-c-digo-freepascal-lazarus

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Refactor FreePascal/Lazarus code to improve readability, maintainability, and testability without changing observable behavior.

Core Features & Use Cases

  • Extract Method, Extract Class, Guard Clauses, Replace Magic Numbers, Replace Conditional with Polymorphism, Introduce Parameter Object, Remove With, and Extract Interface to structure legacy Object Pascal code.
  • Applies to codebases with long procedures, nested conditionals, and tight coupling, enabling safer changes and easier future enhancements.

Quick Start

Provide the target Pascal unit or class, describe the refactoring objective, and I will apply the listed techniques while preserving behavior.

Frequently Asked Questions about Refatoração de Código FreePascal/Lazarus

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I refactor legacy FreePascal code to reduce deep nesting and long methods?

Refactor legacy FreePascal code by applying Extract Method and Guard Clauses to flatten deep nesting and break down long procedures. This restructuring improves readability and maintainability while preserving the original observable behavior.

What is the best way to remove tight coupling in Lazarus Object Pascal classes?

Remove tight coupling in Lazarus Object Pascal by using Extract Class and Extract Interface techniques. These refactoring patterns isolate fragile dependencies, enabling safer feature evolution and significantly improving overall code testability.

Can I replace conditional logic with polymorphism in FreePascal without altering behavior?

Replace conditional logic with polymorphism in FreePascal to simplify complex branching without altering observable behavior. This refactoring technique routes execution through distinct object hierarchies, making future extensions safer and code cleaner.

How do I eliminate magic numbers and parameter bloat in Lazarus refactoring?

Eliminate magic numbers and parameter bloat in Lazarus refactoring by applying Replace Magic Numbers and Introduce Parameter Object. These cleanup techniques clarify method signatures and centralize constants for safer code evolution.

Why should I remove the With statement when refactoring Object Pascal?

Remove the With statement when refactoring Object Pascal to prevent ambiguous variable scope and fragile references. Eliminating this construct clarifies explicit property access, directly improving code readability and reducing debugging complexity.