retire-imperative-block

Retire imperative Blockly block definitions by reconciling them against declarative counterparts before deletion.

9|Updated Mar 4, 2026
One-click install
npx skills add https://github.com/timcsy/semorphe --skill retire-imperative-block-timcsy
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: retire-imperative-block
Source: https://github.com/timcsy/semorphe/tree/main/knowledge/skills/retire-imperative-block
Command: npx skills add https://github.com/timcsy/semorphe --skill retire-imperative-block-timcsy

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Deleting an imperative Blockly block definition (Blockly.Blocks['x'] = {...}) is actually a behavior change, because the imperative definition is the one users see while the declarative one sits dormant. This Skill prevents silent regressions by enforcing a compare-first, judge-which-side-is-correct, then delete workflow. ## Core Features & Use Cases - Parity-driven audit: Runs the audit-block-def-parity vitest report to list per-block differences in slots, fields, output, statement, and color before any deletion. - Semantic judgment checklist: Decides which definition is correct based on the block's semantics, with documented traps like swapped declarations, hollow declarations, and guardrails that silently skip constructor-based blocks. - Safe deletion gates: Requires parity confirmation, round-trip conversion tests, browser verification of labels and field types, baseline updates, and tombstone comments before removing code. - Use Case: When migrating a Blockly-based editor from imperative to declarative block definitions, use this Skill to retire one block type at a time without breaking labels, dropdowns, or extraState behavior. ## Quick Start Ask the AI to retire the imperative definition of a specific block type such as cpp_var_ref, or leave the argument empty to pick the next block from the parity report.

Frequently Asked Questions about retire-imperative-block

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

FAQPage Schema
How do I safely delete an imperative Blockly block definition?

Run the audit-block-def-parity vitest report first, judge which definition is semantically correct, fix the correct side until parity passes, then verify in a browser that labels and field types render before deleting. Leave a tombstone comment recording the reason.

Why can't I just delete the imperative Blockly registration directly?

The imperative definition has no guard and runs last, so it is the one users actually see; the declarative one is guarded and dormant. Deleting the imperative version silently swaps in the declarative behavior, which may be wrong or incomplete.

Why does the block parity report show zero differences but blocks remain?

Blocks with hollow declarations lacking message0 are skipped by the comparator, shrinking the audited population. Check the hollowDeclaration field in block-def-parity.json, since a shrinking population looks identical to a clean result.

What should I check when the parity audit accuses the declarative definition?

Verify the comparator environment first: missing i18n loads, unregistered field types like field_dynamic_dropdown, or unconnected constructors cause false accusations. Import the real language packages and assert every referenced dropdown source is registered.

When should a block difference be treated as intentional rather than a parity failure?

When the imperative definition is the wrong one, the difference is the goal of the change. Document the differing field and reason, validate with round-trip conversion parity tests and a full green suite, then confirm in the browser with a pinned environment.