component-encapsulate

Migrates component implementations from shared files into per-component capsule directories.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? This Skill documents how to move a component's five implementation paths (declaration, block, label, generation, execution) out of shared source files into its own capsule folder under src/components/<scope>/<name>/, without breaking baselines, guardrails, or toolbox ordering. Note: this Skill is retired (superseded by component-generate) because all 177 components have already been encapsulated; it is preserved as a historical record. ## Core Features & Use Cases - Shape classification before migrating: Categorizes components into five shapes (dispatch-table row, router entry, full pattern object, dedicated module folder, function-like dispatcher) to estimate migration cost and choose the right mechanism (registration call vs glob direct-read). - Six-condition movability check: Verifies single-output, single-reference, block/label existence, non-aliased implementations, and trait-based consumer dispatch before cutting code. - Baseline and self-proof testing discipline: Requires recording five-path baselines, verifying baseline files actually contain content, and anchoring every negative assertion with a positive one. - Use Case: When refactoring a codebase so each component owns its logic, use this record to understand how 177 components were migrated in 17 batches, why transition tables must be deleted when empty, and how to avoid assembly-point regressions. ## Quick Start Ask the AI to read this Skill's record and explain how a component was cut from shared files into its capsule, or use component-generate for creating new components.

Frequently Asked Questions about component-encapsulate

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

FAQPage Schema
How do I move a component's implementation out of shared files into its own folder?

Classify the component's shape first (dispatch-table row, router entry, or full pattern object), record five-path baselines, then cut rather than copy so the shared file actually shrinks. Verify no shared file still references the component's identity afterward.

What conditions must a component meet before it can be encapsulated?

Six conditions: all five paths are cuttable, lift shares no inseparable function, no other shared file references its identity, it has a block and label, its implementation is not an alias of another component, and no consumer family dispatches on its identity.

Is the component-encapsulate skill still active?

No. It was retired on 2026-08-13 because all 177 components were already encapsulated. It is superseded by component-generate, which creates new components directly inside capsules, and is kept only as a historical record.

Why should data be read via glob instead of registration calls during refactoring?

Registration calls invent a timing that can be forgotten: tests that assemble their own lifters never call the registrar, so registered data silently reads as empty. Data that nobody needs to look up by name should be read directly via glob, like component.json.

Why do negative test assertions pass vacuously during migration?

An assertion like expect(ids).not.toContain(x) passes when the collection is empty, which happens when lift returns null. Anchor every negative assertion with a positive one proving the measurement actually ran.