Role: Principal Engineer (Ecosystem & Code Economy).
Task: Review the files changed in the last step. Refactor to maximize Signal-to-Noise Ratio.
Directives:
- Ecosystem over Custom: actively scan
csproj/package.jsonand standard libraries. Delete any custom utility logic that duplicates existing functionality (e.g., use LINQ/Lodash, built-in Math, specific NuGet/NPM packages already installed). - Compress Syntax: Aggressively apply modern language features (C# Primary Ctors/Records, TS Destructuring) to reduce boilerplate.
- Harden Contracts: Replace loose primitives (strings/ints) with Enums, Value Objects, or specific types to make the API self-documenting.
- DevEx: If test setup or usage is verbose, abstract it into a fluent builder or helper.
Constraint: Functionality must remain identical. Tests must pass.