cc-field-mapping-safety

Validates field mappings, enum mappings, and data synchronization logic during code refactoring.

1.0k|109|Updated Jan 4, 2026
One-click install
npx skills add https://github.com/doccker/cc-use-exp --skill cc-field-mapping-safety
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cc-field-mapping-safety
Source: https://github.com/doccker/cc-use-exp/tree/main/.codex/skills/cc-field-mapping-safety
Command: npx skills add https://github.com/doccker/cc-use-exp --skill cc-field-mapping-safety

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Refactoring code that involves field mappings (dataIndex, enum type maps, data conversion) often introduces subtle bugs that TypeScript cannot catch: wrong field names guessed from type definitions, incomplete enum mappings, undefined values rendering as "Invalid Date", and sync jobs silently overwriting manually adjusted data. This Skill enforces verification against the original code instead of guessing from type definitions.

Core Features & Use Cases

  • Field Name Verification: Checklists for validating dataIndex, rowKey, and API field names against the original source code (e.g., via git show) rather than inferring from TypeScript interfaces.
  • Enum Mapping Completeness: Rules to ensure no enum values are dropped during refactoring, with correct spelling, text, and colors.
  • Sync Overwrite Protection: A last-sync-value pattern with a decision matrix preventing external data syncs (ERP/CRM imports) from clearing fields or overwriting manual user edits.
  • Use Case: When refactoring an Ant Design table's column definitions, use this Skill to compare each dataIndex and enum map against the pre-refactor code, then add defensive rendering for optional date fields.

Quick Start

Ask the AI to refactor the table columns and enum mappings of a component while following the field mapping safety checks against the original code.

Frequently Asked Questions about cc-field-mapping-safety

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

FAQPage Schema
How do I safely refactor table column dataIndex fields?

Verify each dataIndex against the original code using git show rather than inferring from TypeScript type definitions. Prefer required fields over optional ones, and watch for similar names like changedAt versus createdAt that type checking cannot distinguish.

How to prevent enum mapping values from being lost in refactoring?

Compare the refactored enum map entry-by-entry against the original source code to ensure no values are dropped. Check spelling casing such as UPLOAD versus Upload, and confirm text and color values match the original exactly.

Why does my refactored table show Invalid Date or undefined?

This happens when a dataIndex points to an optional field that is undefined at runtime, which TypeScript cannot detect. Use required fields where possible and add defensive rendering that returns a placeholder when the value is missing or date parsing fails.

How do I stop data sync from overwriting manual user edits?

Use the last-sync-value pattern: store the value set by the previous sync in a mapping table, and only overwrite when the current target value still equals it. Skip the update and log when the user has modified the field, and never overwrite with null source values.

When is TypeScript type checking not enough for field mapping?

Type checking passes whenever a field exists in the interface, even if it is optional and undefined at runtime or semantically the wrong field. Runtime testing and comparison against the original code are required to catch these errors.