Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Migrates legacy imperative DOM construction to local declarative Lit-html templates rendered inside existing containers.
| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-02 | ✗→✓ | ▲ Improved | 11% | 0% |
| case-03 | ✗→✓ | ▲ Improved | 8% | 0% |
| case-04 | ✗→✓ | ▲ Improved | 16% | 0% |
| case-09 | ✗→✓ | ▲ Improved | 27% | 0% |
| case-11 | ✗→✓ | ▲ Improved | 28% | 0% |
This subskill converts consolidated imperative DOM construction helper methods into reactive, declarative Lit-html templates, rendering them locally inside the existing element containers.
logical groups.
into the main view just to coerce a single master template. Pass 2 should only change the implementation details of rendering (imperative -> declarative) within existing compartments, not the public API or responsibilities of objects.
performUpdate() to executethe main lit render call, and use this.requestUpdate() to queue updates.
update() or scheduleUpdate()) and invoke render() directly inside that method. Do not introduce Widget lifecycle methods (performUpdate) on classes that do not inherit them.
Lit rendering system inside the view module:typescript import {html, render, nothing} from '../../ui/lit/lit.js';
devtools-toolbar). Do not assume standard Lit defaults.legacy event handlers, comparators, or state variables, check if the modern component handles them natively. Drop host-level workarounds in favor of declarative component attributes.
fields generated by appendField or createChild on a parent layout), prefer local modular renders (rendering templates individually into each container) to preserve the legacy layout framework. Do not force a monolithic template if doing so violates the existing topology.
Element. Lit's render()function expects HTMLElement | DocumentFragment.
HTMLElement or update its class property type definition from Element to HTMLElement to satisfy the TypeScript compiler.
render(this.template(), this.containerField as HTMLElement);or specialized UI utilities) to be "pure Lit" during this pass.
HTMLElement or Element instances directly. Treat unmigrated utilities as "black boxes" that generate DOM, and embed their output in standard template expressions: html<div>${this.legacyElement}</div>..then() callback), render the parent container or a placeholder template first. Once the data is retrieved, execute a local render() inside the callback targeting the specific sub-container.
nothing: Use Lit's nothing sentinel instead of emptystrings '' or empty templates for conditional rendering.
intermediate layout branches, extract them into parameterized helper functions inside the class scope returning LitTemplate. This avoids monoliths, preserves readability, and reuses template cache strategies.
DataGrid with <devtools-data-grid>), inspect and update the associated .css file. Replace legacy class selectors (.data-grid) with tag selectors (devtools-data-grid).span todiv) or drop class names during template translation, as CSS may depend on them.
<devtools-button>) defaults may not match legacy appearance. Explicitly bind .data=${{variant: Buttons.Button.Variant.OUTLINED}} (or appropriate variant) rather than relying on defaults.
instrumentation (like ARIAUtils.markAsAlert()) to native ARIA attributes in the template (e.g., role="alert", aria-live="polite").
clang-format off and // clang-format on to prevent clang-format from corrupting template indentation.
Before reporting back or committing, re-read the instructions and verify:
span to div (or vice versa)?aria-*, role, or custom data attributes?// clang-format off?Other measured skills in the registry, with their headline benchmark lift.