Skip to content
cccskills
FreePublished on GitHub

refactor-safely

Load for behavior-preserving rename, move, decomposition, dead-code removal, dependency cleanup, record/class conversion, or immutable contract migration that needs caller, flow, test, and impact analysis; not for feature work or one-line cleanup.

The English summary is being prepared. Showing the original description.

See how to install

Files included (1)

  • SKILL.md3.5 KB

SKILL.md (original)

Review the instructions the agent will receive before you install.

<!-- ABOUTME: Knowledge-graph workflow for behavior-preserving structural refactoring. --> <!-- ABOUTME: Requires preview, impact, affected-flow, and post-change verification. -->

Resources

  • Record contracts — load for record/class conversion, immutable collections/results, semantic values, generated contracts, and focused ratchets.
  • Architecture — load when the refactor crosses projects or layers.

Rules

  • Preserve observable behavior before changing structure. Lock the exact consumer seam with a failing regression test; do not weaken tests or retain compatibility shims to make the migration easier.
  • Start with the knowledge graph: minimal context, impact radius, affected flows, callers, and tests. Escalate detail only when the bounded result cannot resolve ownership.
  • Use LSP rename for symbols when available. Preview every rename/move and keep generated artifacts under their owning generator.
  • A record/class conversion must classify identity, construction, equality, collection ownership, serialization, PATCH presence, HAL behavior, framework mutation, and diagnostic privacy.
  • Change the innermost owning contract first and migrate every caller outward. Do not create duplicate DTOs, transitional aliases, public setters, or legacy generated clients.
  • Generated C# contracts change through eng/tools/Explore.GeneratedContracts and MSBuild, never by editing EventApiClient.g.cs.
  • Stop and re-baseline when impact evidence reveals feature behavior rather than a structural transformation.
  • The Expand–Contract Protocol for Wide Refactors: When a mechanical refactor (e.g. renaming a database column, converting an aggregate identity to UUIDv7, modifying a shared CQS request/result shape) has a blast radius too wide for a single atomic PR:
    1. Phase 1 (Expand): Introduce the new model, property, or handler method alongside the existing one without breaking or modifying old call sites. Ensure build and tests stay green.
    2. Phase 2 (Migrate in Batches): Migrate callers and tests in bounded slices (per feature directory or layer), keeping CI green at every batch because the old form remains functional.
    3. Phase 3 (Contract): Delete the obsolete form, remove deprecated fields, and clean up transitional shims once zero callers remain.

Workflow

  1. Use get_minimal_context, get_impact_radius_tool, and get_affected_flows_tool; query callers and tests for each changed symbol.
  2. Add a focused failing test for the behavior the old structure currently supplies.
  3. Preview the rename/move or write the exact record eligibility classification before editing.
  4. Apply the smallest structural change and migrate all callers without unrelated cleanup.
  5. Run detect_changes_tool, affected tests, architecture ratchets, and one real consumer surface.

Verification

  • For record migrations, run the focused commands in RECORD_CONTRACTS.md.
  • Run LSP diagnostics on every changed source file.
  • Run the changed domain's tests and project build once, then inspect detect_changes_tool for unexpected flows.

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

More skills from this repository

Load for Blazor/MudBlazor UI changes involving forms, dialogs, focus, keyboard navigation, landmarks, ARIA, color contrast, RTL-safe styling, or WCAG 2.2 AA tests; not for backend-only changes.

The English summary is being prepared. Showing the original description.

islamu-ngo/Event8Updated Oct 21, 2026

Load when a task asks to research, verify, compare, or look up framework/package behavior, release notes, standards, RFCs, CVEs, or unfamiliar APIs; use repository evidence first, then official docs, and not for codebase navigation alone.

The English summary is being prepared. Showing the original description.

islamu-ngo/Event8Updated Oct 21, 2026

aspire

Free

Load for Aspire AppHost work: start/stop/wait resources, inspect dashboard/logs/traces, add integrations/resources, rebuild a service, run isolated worktrees, or diagnose Aspire orchestration; not for plain dotnet apps, container-only deployments, or cloud deployment.

The English summary is being prepared. Showing the original description.

islamu-ngo/Event8Updated Oct 21, 2026

Load for authentication or authorization changes involving BFF cookies/tokens, JWT validation, claims/user ID extraction, policies, handler access checks, impersonation, or 401/403 bugs; not for UI affordance gating alone.

The English summary is being prepared. Showing the original description.

islamu-ngo/Event8Updated Oct 21, 2026

Load for Blazor BFF server work involving YARP proxy routes, cookie sessions, access-token forwarding/refresh, downstream API calls, BFF handlers, or browser-to-API auth failures; not for client component rendering or API JWT validation alone.

The English summary is being prepared. Showing the original description.

islamu-ngo/Event8Updated Oct 21, 2026

Load when editing Blazor `.razor.css`, scoped selectors, `::deep`, BEM class names, RTL/logical CSS properties, or styling nested MudBlazor components; not for global design tokens or non-Blazor CSS.

The English summary is being prepared. Showing the original description.

islamu-ngo/Event8Updated Oct 21, 2026

See all skills by islamu-ngo

Report a problem with this skill