# Normalize Compound Operations

> normalize-compound-operations

- Skill: `claudiawong522/normalize-compound-operations` (Agent Skill)
- Install (CLI): `npx skillmds@latest add claudiawong522/normalize-compound-operations`
- Raw SKILL.md: https://api.skillmd.com/api/skills/claudiawong522/normalize-compound-operations/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: claudiawong522 (https://skillmd.com/u/claudiawong522)
- Updated: 2026-09-22
- Page: https://skillmd.com/skills/claudiawong522/normalize-compound-operations

---

# normalize-compound-operations

Preserve relative state relationships when performing compound operations instead of restoring absolute values.

## When to Use

When performing operations that affect multiple related elements (like deleting or moving items in a timeline), avoid trying to restore exact absolute values. Instead, focus on maintaining the relative spacing and relationships between elements.

## The Problem

Attempting to restore absolute positions/values after compound operations often introduces bugs:
- Gaps appear in sequences
- Spacing becomes inconsistent
- State becomes fragile and hard to maintain

## The Solution

1. **Identify relative relationships** - Determine what spacing, order, or distance relationships must stay constant between elements
2. **Track offset changes** - When one element moves, calculate how this affects others relatively
3. **Shift together** - Move or adjust all affected elements by the same relative amount, preserving gaps and spacing
4. **Verify relationships** - Check that relative spacing and order remain intact, not that absolute values match

## Example

When deleting an item from a timeline:
- **Wrong**: Try to restore exact frame numbers (1, 2, 3, 4...)
- **Right**: Shift remaining items left by the deleted item's width while preserving the gaps between them

## Tips

- Think in terms of "distance between" rather than "position at"
- Use deltas/offsets rather than absolute coordinates
- Test by checking relative differences, not absolute values
- This approach makes operations composable and reversible

