Agent skill

Webui Lit Migration

by nwjs in nwjs/chromium.src

Guide for migrating Chromium WebUI components from Polymer to Lit.

BSD-3-ClauseAuto-check passed

Install Webui Lit Migration

skills CLI
$ npx skills add nwjs/chromium.src --skill webui-lit-migration -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install nwjs/chromium.src webui-lit-migration --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/nwjs/chromium.src.git skills-src && mkdir -p .claude/skills && cp -r skills-src/agents/skills/webui-lit-migration .claude/skills/webui-lit-migration && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
webui-lit-migration
GitHub stars
160
Token cost
~2.3k tokens
SKILL.md length
973 words
Files
3 (incl. scripts)
Skills in repo
64
Repo updated
First seen
Licence
BSD-3-Clause

At a glance

Guide for migrating Chromium WebUI components from Polymer to Lit.

  • Works in 6 steps: Run scripts/run_codemod_script.sh → .ts file cleanup → Check for any missing shared CSS styles. → …
  • SKILL.md covers Step 1: Run…, Step 2: .ts file cleanup, Step 3: Check for any missing… and Step 4: Update .html.ts…, plus 2 more sections
  • Runs Shell scripts from its folder

What it does

Webui Lit Migration is an agent skill from nwjs/chromium.src. Guide for migrating Chromium WebUI components from Polymer to Lit. Activate this skill if the user asks to migrate a file or component to Lit.

Its SKILL.md is about 2.3k tokens, which your agent loads only when the skill is triggered. The skill folder holds 3 other files, including scripts (for example `scripts/run_codemod_script.sh`).

The repository describes itself as: Chromium codebase with NW.js modifications. Based on https://chromium.googlesource.com/chromium/src.git. The licence is BSD-3-Clause.

Example prompts

  • “/webui-lit-migration”

Requirements

  • A Bash shell

Workflow steps

6 steps, taken from the step headings in SKILL.md.

  1. Run scripts/run_codemod_script.sh
  2. .ts file cleanup
  3. Check for any missing shared CSS styles.
  4. Update .html.ts template file
  5. BUILD.gn file updates
  6. Validation

What it can do on your machine

Read from SKILL.md and the folder at commit a9e8946. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 1 file in scripts/ (Shell), which the agent can run.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Webui Lit Migration loads about 2.3k tokens when it runs. Until then it costs about 41 tokens; SKILL.md has 973 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~41
When it runs · the whole SKILL.md, loaded when a task matches
~2.3k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.

SKILL.md

The full file from nwjs/chromium.src at commit a9e8946, republished under its BSD-3-Clause licence (© nwjs). 973 words, ~2,283 tokens.

Download SKILL.mdSave it as .claude/skills/webui-lit-migration/SKILL.md (or your agent's skills folder). This skill also uses 2 other files; get the full folder from GitHub.
name
webui-lit-migration
description
Guide for migrating Chromium WebUI components from Polymer to Lit. Activate this skill if the user asks to migrate a file or component to Lit.

Chromium WebUI Lit Migration

Step 1: Run scripts/run_codemod_script.sh

IMPORTANT: Always do this first, as it automates trivial migration steps.

Run the script in this skill's scripts directory. Pass the path to the Polymer based element's TS class definition file as the parameter. Example: ./webui-lit-migration/scripts/run_codemod_script.sh
chrome/browser/resources/certificate_manager/certificate_entry.ts

Step 2: .ts file cleanup

  1. Replace PolymerElement import The script replaces this import except in cases where multiple things are imported from Polymer. If an import from polymer_bundled.min.js is still present after running the script, remove it and add: import {CrLitElement} from '//resources/lit/v3_0/lit.rollup.js';

  2. Update 'extends PolymerElement' The script will update this in the case that no mixins are used. If there is still a reference to PolymerElement: replace SomeMixin(PolymerElement) with SomeMixinLit(CrLitElement)

  3. Address any "TODO: Port this observer to Lit" comments left by the migration script as follows: a. Examine the observer (e.g. 'onFooChanged_') method. If it does not reference the DOM, add the following in a willUpdate callback. If it does reference the DOM (e.g., this.shadowRoot or this.$), add this in a updated() lifecycle callback instead.

ts
if (changedProperties.has('foo')) {
  this.onFooChanged_();
}
b. If the property being observed is protected or private, the
   changedProperties lifecycle method parameter will require a cast:
ts
const changedPrivateProperties = changedProperties as Map<PropertyKey, unknown>;
if (changedPrivateProperties.has('myProperty_')) { ... }
c. Remove the added TODO and the commented out observer line.
  1. Address any complex observers in a similar way. Look for an "observers: " line:
ts
observers: ['onFooOrBarChanged_(foo, bar)']

Remove the line and for each observer listed, add to a lifecycle method as described for single property observers, but check changedProperties for any of the properties listed in the observer:

if (changedProperties.has('foo') || changedProperties.has('bar')) {
  this.onFooOrBarChanged_();
}
  1. Move value initialization out of 'properties' to the declaration.

Replace

  foo: {
    type: String,
    value: 'foo',
  },
  ...
  value: string;

with

  foo: {
    type: String,
  },
  ...
  accessor value: string = 'foo';

For uninitialized properties, if a TS compiler error is thrown on build, initialize to a dummy or default value rather than using a non-null assertion operator or changing the type definition.

Step 3: Check for any missing shared CSS styles.

If any imported style file does not exist, check if the Polymer version (same file path, but without _lit suffix) exists. If so, generate the Lit version as follows:

  1. Create Lit Version: Create [shared_style]_style_lit.css.
  2. Copy Content: Copy the CSS rules to the new *_lit.css file.
  3. Update Metadata: Use #type=style-lit in the metadata. Update any imported and included styles to the lit version (e.g. cr_shared_style.css.js import --> cr_shared_style_lit.css.js import, include="cr-shared-style" becomes include="cr-shared-style-lit").
  4. Empty Original: Clear the original *_style.css file, leaving only its] metadata header and a comment:
    css
    /* Purposefully empty since this style is generated at build time from the
     * equivalent Lit version. */
  5. Import in Component: Component CSS should import the new *_lit.css.js and include it.
  6. BUILD.gn: Add the new *_lit.css to css_files.

Step 4: Update .html.ts template file

  1. Replace any <template is="dom-if" if=[[someCondition]]> with conditional rendering.
${this.someCondition ? html`<conditionally-rendered-element>` : ''}
  1. Replace any <template is="dom-repeat" items=[[myItems]]> with map():
  ${this.myItems.map((item, index) => html`<some-item data="${item}"></some-item>`)
  1. Look for on-foo-changed event listeners that were added by the script to replace Polymer double bindings. Ex:
<cr-input .value="${this.value_}" @value-changed="${this.onValueChanged_}">

Add a corresponding onFooChanged() method to the .ts file that updates the bound property from event.detail.value:

protected onFooChanged(e: CustomEvent<{value: string}>) {
  this.value_ = e.detail.value;
}
  1. Update attribute bindings. Polymer uses "attr-name$=" syntax for attribute bindings. Replace this with "?attr-name=" if the attribute is a boolean, or "attr-name=" if the attribute is a string/number.

  2. Update property bindings. Any other bindings that were bound using "property-name=" syntax should migrate to Lit's property syntax: ".propertyName=".

  3. Look for properties that are passed to methods in the HTML. If the method is used in multiple places in the template with different parameters or is not a class method, keep the properties as parameters and add this. to reference them. Ex:

Replace:

<div aria-label="${this.i18n('foo', someProp)}"></div>
<button>${this.i18n('buttonLabel', somOtherProp)}</button>

with:

<div aria-label="${this.i18n('foo', this.someProp)}"></div>
<button>${this.i18n('buttonLabel', this.somOtherProp)}</button>

If a method is a class member method used in a single location, remove the property parameters in the template and change the method to reference them directly. Ex: if getDivClass() is only used in this location, then:

Replace:

<div class="${this.getDivClass(someProp, someOtherProp)}">
protected getDivClass(value: string, otherValue: string) {
  return value + ' ' + otherValue;
}

with

<div class="${this.getDivClass()}">
protected getDivClass() {
  return this.someProp + ' ' + this.someOtherProp;
}
  1. Identify any enums that are reactive properties for the purposes of using them from the template, and replace by importing the enum directly in the .html.ts file. Then clean up the enum reactive property in the .ts file.
Show full SKILL.md (360 more words)Show less

Step 5: BUILD.gn file updates

Find the BUILD.gn file referencing the old .html and .ts files. It should be in the same directory as the .ts file or in an ancestor directory. If you can't locate it, prompt the user for the BUILD.gn file to update.

  1. Web Component to TS: Move the component's .ts file from web_component_files to ts_files.
  2. Add HTML Template: Add the new [component].html.ts file to ts_files.
  3. Update CSS: Add the component's .css and any new shared style *_lit.css files to css_files.
  4. Platform Specifics: For ChromeOS-only or other platform-specific components/files, ensure they are added within the appropriate conditional blocks (e.g., if (is_chromeos) { ... }).

Step 6: Validation

  1. Build resources target to check for TS compiler or eslint errors. <out_folder> is the desired build output directory, commonly out/Default or similar. Prompt the user to identify this directory if it cannot be identified automatically.
autoninja -C <out_folder> <migrating_directory>:resources

Address any errors. Note that error line numbers for TSC and eslint correspond to preprocessed code, not source code. Look at the line number, open the generated preprocessed file, which is at <build_dir>/gen/<migrating_directory>/preprocessed, look at the error line, and then find this line in the corresponding source file to fix it.

  1. Build tests and manual checking targets:
autoninja -C <out_folder> chrome browser_tests interactive_ui_tests

** Important: Always re-build the full test target when debugging. ** Resources are served from .pak files that will not be updated properly without performing a full build.

  1. Identify the test directory for the migrating WebUI. It should be located at chrome/test/data/webui/<path_from_chrome_browser_resources>/. E.g., tests for chrome/browser/resources/certificate_manager are at chrome/test/data/webui/certificate_manager. If no such directory is found, prompt the user to ask for the WebUI test directory.

  2. Examine any .cc files found in the test directory to find the names of the TEST_F targets to gtest_filter for. By convention, .cc files ending in browsertest.cc or browser_tests.cc or similar will be run as part of the browser_tests target. .cc files ending in focus_test.cc or interactive_test.cc will be run as part of the interactive_ui_tests target.

  3. Run all tests found in all .cc files in the WebUI's test directory and debug any test failures.

<out_folder>/browser_tests --gtest_filter=<TestNamePatternHere>
<out_folder>/interactive_ui_tests --gtest_filter=<TestNamePatternHere>
  1. Run git cl format --js on the prod and test directories and run presubmits.

© nwjs, BSD-3-Clause. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 2 other files (scripts) in agents/skills/webui-lit-migration of nwjs/chromium.src.

  • SKILL.md
  • OWNERS
  • scripts/run_codemod_script.sh

Open the folder on GitHubat commit a9e8946

Compare with similar skills

Webui Lit Migration next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Webui Lit Migration compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Webui Lit Migration this skillnwjs/chromium.src160—~2.3kAutomated safety check: PassBSD-3-Clause
Reversible MigrationJuliusBrussee/caveman110k1 repos~196Automated safety check: PassApache-2.0
Database Migrationsaffaan-m/ECC275k4 repos~3kAutomated safety check: PassMIT
Database Migrationsaffaan-m/ECC275k1 repos~2.4kAutomated safety check: PassMIT
Safe Database Migration Patternsaffaan-m/ECC275k—~3.3kAutomated safety check: PassMIT
Migrate Createruvnet/ruflo74k—~583Automated safety check: NotesMIT

Similar skills

  • Reversible Migration

    JuliusBrussee/caveman

    Implement reversible compatibility-safe transitions. Use for schema, data, API, protocol, configuration, or dependency migrations requiring rollback and…

    110k GitHub starsUsed in 1 repo~196 tokens
    DevelopmentAuto-check passed
  • Safe, reversible database migration patterns: forward-only production changes, expand-contract zero-downtime renames, concurrent indexes, batched backfills, and per-tool workflows for PostgreSQL…

    275k GitHub starsUsed in 4 repos~3k tokens
    DatabasesAuto-check passed
  • Şema değişiklikleri, veri migration'ları, rollback'ler ve PostgreSQL, MySQL ve yaygın ORM'ler (Prisma, Drizzle, Django, TypeORM, golang-migrate) arasında sıfır kesinti deployment'ları için…

    275k GitHub starsUsed in 1 repo~2.4k tokens
    DatabasesAuto-check passed
  • Rules and examples for safe, reversible schema changes in production: zero-downtime column and index changes, large data backfills and ORM migration workflows.

    275k GitHub stars~3.3k tokensUpdated 3 days ago
    DatabasesAuto-check passed
  • Migrate Create

    ruvnet/ruflo

    Create a new sequentially numbered database migration with up/down SQL files

    74k GitHub stars~583 tokensUpdated today
    DatabasesAuto-check: notes
  • Migration

    kortix-ai/suna

    How to change the database schema in this repo. An agent skill from kortix-ai/suna.

    20k GitHub stars~1.2k tokensUpdated today
    DatabasesAuto-check passed

More from nwjs/chromium.src

All 64 skills in this repo
  • Analyzing SQL Traces

    nwjs/chromium.src

    Extracts raw trace data from Perfetto traces, runs arbitrary SQL queries for custom follow-up analysis, and applies expert cognitive principles (Tiered Flow Analysis, Semantic Mismatch, Redundancy)…

    160 GitHub stars~2.9k tokensUpdated 4 days ago
    Auto-check passed
  • Autonomous multi-agent performance optimization loop for Chromium and V8.

    160 GitHub stars~4.2k tokensUpdated 4 days ago
    Auto-check passed
  • Automated Tracing

    nwjs/chromium.src

    Automated Tracing & Performance Telemetry in Chromium using Perfetto and Telemetry benchmarks.

    160 GitHub stars~1.5k tokensUpdated 4 days ago
    Auto-check passed
  • Chrome Releases

    nwjs/chromium.src

    Queries Chrome commit, version, release, and milestone metadata.

    160 GitHub stars~1.3k tokensUpdated 4 days ago
    Auto-check passed
  • Chromium Docs

    nwjs/chromium.src

    Search and reference Chromium documentation from the local docs index, including design docs, APIs, and development guides.

    160 GitHub stars~1.2k tokensUpdated 4 days ago
    Auto-check passed
  • Gn Deps Debugging

    nwjs/chromium.src

    Diagnose Chromium GN dependency and include-visibility failures, including BUILD.gn deps/publicdeps, DEPS include rules, private headers, and circular dependencies.

    160 GitHub stars~1.5k tokensUpdated 4 days ago
    Auto-check passed

Questions about Webui Lit Migration

What does Webui Lit Migration do?

Guide for migrating Chromium WebUI components from Polymer to Lit. src. Guide for migrating Chromium WebUI components from Polymer to Lit.

How do I install Webui Lit Migration in Claude Code?

Run `npx skills add nwjs/chromium.src --skill webui-lit-migration -a claude-code`. Or copy the skill folder (agents/skills/webui-lit-migration in nwjs/chromium.src) into .claude/skills/webui-lit-migration in your project. Claude Code loads it when a task matches its description.

How do I install Webui Lit Migration in Codex?

Run `npx skills add nwjs/chromium.src --skill webui-lit-migration -a codex`. Or copy the skill folder (agents/skills/webui-lit-migration in nwjs/chromium.src) into .agents/skills/webui-lit-migration in your project. Codex loads it when a task matches its description.

Can I use Webui Lit Migration in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add nwjs/chromium.src --skill webui-lit-migration -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/webui-lit-migration, .gemini/skills/webui-lit-migration, .github/skills/webui-lit-migration and .opencode/skills/webui-lit-migration in your project.

What does Webui Lit Migration need to run?

Going by SKILL.md and its folder, Webui Lit Migration needs a shell for the scripts in its folder. Our summary lists: A Bash shell.

Does Webui Lit Migration access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Webui Lit Migration safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Webui Lit Migration use?

Webui Lit Migration is published under the BSD-3-Clause licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Webui Lit Migration use?

About 2.3k tokens (SKILL.md is roughly 9.1k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Webui Lit Migration?

Skills that share tags, products or a category with Webui Lit Migration: Reversible Migration (JuliusBrussee/caveman, 110k stars), Database Migrations (affaan-m/ECC, 275k stars), Database Migrations (affaan-m/ECC, 275k stars) and Safe Database Migration Patterns (affaan-m/ECC, 275k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Webui Lit Migration?

nwjs (a GitHub organization) maintains it in nwjs/chromium.src, which has 160 GitHub stars. The repository holds 64 skills in this directory. The repository was last updated on October 3, 2026.

Source: nwjs/chromium.src on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.