code-realign

Guide domain-model enum realignments with explicit value mappings and versioned data migrations.

22|3|Updated Jul 28, 2024
One-click install
npx skills add https://github.com/webdevcody/go-mailing-list --skill code-realign
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: code-realign
Source: https://github.com/webdevcody/go-mailing-list/tree/main/.claude/skills/code-realign
Command: npx skills add https://github.com/webdevcody/go-mailing-list --skill code-realign

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It helps you safely rename or remap a domain model’s persisted enum/state vocabulary when the meaning changes, preventing corrupted data and inconsistent behavior across code and stored rows.

Core Features & Use Cases

  • Scope verification: Distinguishes a realignment (meaning change + persisted data migration) from a refactor (behavior preserved) or cleanup (no requirement change).
  • Explicit value mapping: Produces an old_value → new_value table with support for collapsed mappings, dropped values, and newly introduced states.
  • Migration-first execution plan: Guides you through renaming at the type root, sweeping via type checking, hunting non-typed string leaks, and migrating persisted data using the project’s migration conventions.
  • Safety guardrails: Enforces “never inline data migrations” and “never start editing before the mapping is agreed” to avoid hybrid vocabularies and untracked rewrites.

Quick Start

Ask the AI to realign your domain enum/state by mapping the old persisted values to the new business meanings, then updating types, sweeping string leaks, and creating a versioned migration to remap stored rows.

Frequently Asked Questions about code-realign

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

FAQPage Schema
How do I safely rename an enum state in Rails when the database already has persisted rows?

To safely rename an enum state in Rails with persisted rows, you must use a versioned data migration to remap the stored strings. This process requires an explicit old-to-new value mapping to prevent corrupted data and maintain consistent behavior across your application.

What is the difference between refactoring a state machine and realigning its persisted vocabulary?

Realigning a state machine changes the business meaning of persisted vocabulary and requires a tracked data migration, whereas refactoring preserves behavior and requires no data changes. Realigning explicitly handles collapsed, dropped, or newly introduced states.

How do I migrate SQLite database rows when changing a domain model enum meaning?

To migrate SQLite rows during an enum meaning change, you create a versioned migration using your project's conventions instead of inline updates. You must define an explicit old-to-new value mapping to safely update the persisted status and state strings.

Can I update domain model enum values inline during a type-root rename?

No, you should never perform inline data migrations during a type-root rename. Inline updates create hybrid vocabularies and untracked rewrites; you must use a proper versioned migration workflow after agreeing on the explicit old-to-new state mapping.

How do I find non-typed string leaks after renaming a state machine enum?

After renaming a state machine enum at the type root, you hunt non-typed string leaks by sweeping the codebase via type checking. This identifies old status strings lingering in payloads, UI labels, and external integrations that require updating to the new vocabulary.

What's the best way to handle dropped or collapsed values in an enum migration?

The best way to handle dropped or collapsed values in an enum migration is to produce an explicit old-value to new-value mapping table. This ensures all persisted database rows, payloads, and integrations are safely transitioned before executing the versioned migration workflow.