Agent skill

Browser Window Feature Refactor

by nwjs in nwjs/chromium.src

Refactor Chrome desktop Browser-scoped logic, such as Browser and BrowserWindow methods and state, into encapsulated feature controllers owned by BrowserWindowFeatures.

BSD-3-ClauseAuto-check passedDevelopment

Install Browser Window Feature Refactor

skills CLI
$ npx skills add nwjs/chromium.src --skill browser-window-feature-refactor -a claude-code

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

GitHub CLI
$ gh skill install nwjs/chromium.src browser-window-feature-refactor --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/browser-window-feature-refactor .claude/skills/browser-window-feature-refactor && 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
browser-window-feature-refactor
GitHub stars
160
Token cost
~2.3k tokens
SKILL.md length
964 words
Files
3 (incl. references)
Skills in repo
64
Repo updated
First seen
Licence
BSD-3-Clause

At a glance

Refactor Chrome desktop Browser-scoped logic, such as Browser and BrowserWindow methods and state, into encapsulated feature controllers owned by BrowserWindowFeatures.

  • Works in 3 steps: New Feature Controller → Existing Feature Controller → Lifecycle Hook Cleanup
  • Tasks that involve Refactoring
  • SKILL.md covers Core Constraints, Migration Types, BWF Ordering Rules and Anti-Patterns, plus 1 more section
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Browser Window Feature Refactor is an agent skill from nwjs/chromium.src. Refactor Chrome desktop Browser-scoped logic, such as Browser and BrowserWindow methods and state, into encapsulated feature controllers owned by BrowserWindowFeatures.

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 reference files (for example `references/bwf-ordering.md`).

It sits in Development, covering Refactoring. 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.

When your agent uses it

  • Tasks that involve Refactoring

Example prompts

  • “/browser-window-feature-refactor”

Workflow steps

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

  1. New Feature Controller
  2. Existing Feature Controller
  3. Lifecycle Hook Cleanup

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

    No scripts in the folder and no shell commands in SKILL.md (its code samples are cpp).

    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

Browser Window Feature Refactor loads about 2.3k tokens when it runs, and up to ~3.1k if it reads all its reference files. Until then it costs about 52 tokens; SKILL.md has 964 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~52
When it runs · the whole SKILL.md, loaded when a task matches
~2.3k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~3.1k

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); files beside SKILL.md are not scanned.

SKILL.md

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

Download SKILL.mdSave it as .claude/skills/browser-window-feature-refactor/SKILL.md (or your agent's skills folder). This skill also uses 2 other files; get the full folder from GitHub.
name
browser-window-feature-refactor
description
Refactor Chrome desktop `Browser`-scoped logic, such as `Browser` and `BrowserWindow` methods and state, into encapsulated feature controllers owned by `BrowserWindowFeatures`.

Browser Window Feature Refactor

Use this skill for Project Bedrock refactors that modularize desktop Chrome browser-window logic by moving ownership, methods, or initialization into BrowserWindowFeatures (BWF) and its feature controllers.

Core Constraints

  1. Classify the migration before editing. Decide whether this is a new feature controller, an existing feature controller migration, or a lifecycle hook cleanup.
  2. Preserve behavior. Most Bedrock refactors should have no intended behavior change. Keep edits narrow and avoid opportunistic cleanup.
  3. Prefer existing controllers. If an appropriate BWF-owned controller already exists, move the method or state there instead of creating another controller.
  4. Prefer specific dependencies. Use BrowserWindowInterface, Profile, TabStripModel, BrowserWindow, or feature-controller dependencies before reaching for Browser* or GetBrowserForMigrationOnly().
  5. Respect BWF ordering. Forward declarations and public accessors are mostly sorted. Private members and lifecycle initialization are ordered by ownership, lifecycle, and dependency constraints.

Migration Types

1. New Feature Controller

Use this when BrowserWindow/BrowserView/WebUIBrowserWindow exposes cohesive feature-specific behavior and no existing BWF-owned controller matches it.

Workflow:

  1. Create the controller near the feature's UI domain.

  2. Pass only the dependencies the controller needs. Prefer BrowserWindowInterface*, Profile*, TabStripModel*, BrowserWindow*, concrete view dependencies, or other feature controller dependencies owned by BrowserWindowFeatures over Browser* when practical.

  3. Add GN sources and deps to the narrow owning target. Verify a modular BUILD.gn exists in the feature controller's own directory and add the controller there, using public/sources separation (public headers in public, implementation in sources). Do not cargo-cult the sources into a monolithic target such as //chrome/browser or //chrome/browser/ui; if no modular target exists yet, create one in the controller's directory.

  4. Own the controller with a std::unique_ptr<FooController> member, and in the same edit add a matching forward declaration class FooController; to the BWF header (see step 5 — never skip it). Initialize the member in the earliest correct lifecycle hook via the BrowserWindowFeatures user data factory rather than std::make_unique. Configuring new controllers through the factory keeps them easy to fake or override in tests. Add Must be before/after comments when ordering matters.

    Example:

    cpp
    foo_controller_ =
        GetUserDataFactory().CreateInstance<FooController>(*browser, ...);
  5. Always pair the std::unique_ptr<FooController> member with a forward declaration in the same header. Add class FooController; alongside the other forward declarations in the BWF header — never #include the controller header (its #include belongs in the .cc). The std::unique_ptr<FooController> member from step 4 names an incomplete type, so omitting class FooController; breaks compilation. Adding the member without the forward declaration is the most common mistake in this migration — double-check the header has both before moving on.

    The header needs two coupled edits — the forward declaration near the top and the member lower down. They live far apart, so it is easy to land the member but forget the forward declaration. Make both edits, as shown:

    cpp
    // browser_window_features.h
    
    // Forward declarations (keep this block sorted).
    class BarController;
    class FooController;  // <-- EDIT 1: add alongside the existing declarations.
    class QuxController;
    
    class BrowserWindowFeatures {
      // ...
     private:
      std::unique_ptr<FooController> foo_controller_;  // <-- EDIT 2: the member.
    };

    Before moving on, open the BWF header and confirm class FooController; is present in the forward-declaration block. If it is missing, add it now — a std::unique_ptr<FooController> member with no matching forward declaration is a guaranteed compile failure.

  6. Expose the controller through UnownedUserData: declare it with DECLARE_USER_DATA(FooController), hold a ui::ScopedUnownedUserData<FooController> member, and provide a static From(browser) that returns the instance corresponding to the BrowserWindowInterface. Do not add a public BWF accessor; even when sibling controllers already expose accessors, do not mirror them for the new controller; add one only if an existing caller genuinely needs it.

    Example setup in foo_controller.h:

    cpp
    #include "ui/base/unowned_user_data/scoped_unowned_user_data.h"
    
    class FooController {
     public:
      DECLARE_USER_DATA(FooController);
    
      explicit FooController(BrowserWindowInterface* browser);
    
      // Returns the instance owned by `browser`, or nullptr.
      static FooController* From(BrowserWindowInterface* browser);
    
     private:
      ui::ScopedUnownedUserData<FooController> scoped_user_data_;
    };

    Matching implementation in foo_controller.cc:

    cpp
    FooController::FooController(BrowserWindowInterface* browser)
        : scoped_user_data_(browser->GetUnownedUserDataHost(), *this) {}
    
    // static
    FooController* FooController::From(BrowserWindowInterface* browser) {
      return Get(browser->GetUnownedUserDataHost());
    }
  7. Update all callsites — in both production code and tests — to reach the controller through FooController::From(browser). Missing callsites stay silent until step 8 removes the old API, then break as compilation errors in production and test targets; refactor them now instead of later hunting for the removed BrowserWindow methods.

  8. Remove obsolete BrowserWindow/BrowserView/WebUIBrowserWindow/test-window API.

Show full SKILL.md (357 more words)Show less
2. Existing Feature Controller

Use this when the target feature already has a BWF-owned controller.

Workflow:

  1. Move the method, state, or initialization into the existing controller.
  2. Update callsites to retrieve the existing feature through the local pattern.
  3. Remove obsolete BrowserWindow or BrowserView virtual methods.
  4. Keep tests pointed at the feature behavior, not the old BrowserWindow shim.
3. Lifecycle Hook Cleanup

Use this when a controller is already BWF-owned but constructed in a later hook than its dependencies require.

Lifecycle decision tree:

  • Init(): Feature does not require the concrete window object or view hierarchy. It can depend on BrowserWindowInterface, Profile, TabStripModel, session id, type, and other BWF state already created there.
  • InitPostWindowConstruction(): Feature needs BrowserWindow, widget focus manager, BrowserView vs WebUIBrowserWindow dispatch, the view hierarchy, or window-level platform objects.
  • TearDownPreBrowserWindowDestruction(): Feature has observers, raw pointers, view/window dependencies, or explicit teardown requirements that must be cleared before the window is destroyed.

BWF Ordering Rules

Before modifying BrowserWindowFeatures, read bwf-ordering.md. Preserve the lifecycle and ownership layout; do not mechanically alphabetize private members.

Anti-Patterns

Avoid:

  • Adding new BrowserWindow virtual methods or thin BWF wrappers around BrowserView.
  • Creating duplicate controllers when an existing feature controller owns the domain.
  • Adding public BWF accessors by default instead of the static controller accessor (FooController::From(browser)).
  • Moving features to an earlier lifecycle hook without proving their dependencies exist there.

Validation

MANDATORY — do not report the task complete until this passes. For a new feature controller, re-open the BWF header and confirm it literally contains both class FooController; (forward-declaration block) and the std::unique_ptr<FooController> member. These are two separate edits and a tool edit can silently fail to land; if either is missing, re-apply it and re-read the file to verify. Treat a header missing either line as a blocking failure, not done — a member without its forward declaration (or vice versa) does not compile.

In the final report, state:

  • the migration type;
  • the selected BWF lifecycle hook and why;
  • any remaining GetBrowserForMigrationOnly() usage and why it remains;
  • for a new feature controller, that the BWF header has both class FooController; and the std::unique_ptr<FooController> member;
  • the validation commands that passed or could not be run.

© 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 (references) in agents/skills/browser-window-feature-refactor of nwjs/chromium.src.

  • SKILL.md
  • OWNERS
  • references/bwf-ordering.md

Open the folder on GitHubat commit a9e8946

Compare with similar skills

Browser Window Feature Refactor 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.

Browser Window Feature Refactor compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Browser Window Feature Refactor this skillnwjs/chromium.src160—~2.3kAutomated safety check: PassBSD-3-Clause
Guidelinesakash-network/node1.1k22 repos~577Automated safety check: PassMIT
Component Refactoringlangflow-ai/langflow156k—~3.5kAutomated safety check: PassMIT
Migrate Core Code to Submodulestinyhumansai/openhuman42k—~2.6kAutomated safety check: PassGPL-3.0
Systematic Code Refactoringluongnv89/claude-howto42k—~3kAutomated safety check: PassMIT
Codexskills-directory/skill-codex1.5k3 repos~1.8kAutomated safety check: PassMIT

Similar skills

  • Guidelines

    akash-network/node

    Behavioral guidelines to reduce common LLM coding mistakes. An agent skill from akash-network/node.

    1.1k GitHub starsUsed in 22 repos~577 tokens
    DevelopmentAuto-check passed
  • Component Refactoring

    langflow-ai/langflow

    Refactor high-complexity React components in Langflow frontend.

    156k GitHub stars~3.5k tokensUpdated today
    DevelopmentAuto-check passed
  • Migrate Core Code to Submodules

    tinyhumansai/openhuman

    Plans and carries out moving non-host-specific code and its tests from the OpenHuman core into vendored tiny submodule libraries, then releases the submodule and re-pins the host.

    42k GitHub stars~2.6k tokensUpdated today
    DevelopmentAuto-check passed
  • Systematic Code Refactoring

    luongnv89/claude-howto

    Guides refactoring in phases based on Martin Fowler's method: research, test coverage check, planning and small tested steps, with your approval at each phase.

    42k GitHub stars~3k tokensUpdated 8 days ago
    DevelopmentAuto-check passed
  • Codex

    skills-directory/skill-codex

    A skill your agent uses when the user asks to run Codex CLI (codex exec, codex resume) or references OpenAI Codex for code analysis, refactoring, or automated editing

    1.5k GitHub starsUsed in 3 repos~1.8k tokens
    DevelopmentAuto-check passed
  • Ponytail

    DavidObando/gsharp

    Forces the laziest solution that actually works, simplest, shortest, most minimal.

    565 GitHub starsUsed in 8 repos~1.7k tokens
    DevelopmentAuto-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

Categories

Questions about Browser Window Feature Refactor

What does Browser Window Feature Refactor do?

Refactor Chrome desktop Browser-scoped logic, such as Browser and BrowserWindow methods and state, into encapsulated feature controllers owned by BrowserWindowFeatures. src. Refactor Chrome desktop Browser-scoped logic, such as Browser and BrowserWindow methods and state, into encapsulated feature controllers owned by BrowserWindowFeatures.

When should I use Browser Window Feature Refactor?

Browser Window Feature Refactor fits situations like: tasks that involve Refactoring.

How do I install Browser Window Feature Refactor in Claude Code?

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

How do I install Browser Window Feature Refactor in Codex?

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

Can I use Browser Window Feature Refactor 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 browser-window-feature-refactor -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/browser-window-feature-refactor, .gemini/skills/browser-window-feature-refactor, .github/skills/browser-window-feature-refactor and .opencode/skills/browser-window-feature-refactor in your project.

What does Browser Window Feature Refactor need to run?

SKILL.md names no scripts, command-line tools or credentials: Browser Window Feature Refactor is instructions for the agent only.

Does Browser Window Feature Refactor 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 Browser Window Feature Refactor 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. Review the folder before installing.

What licence does Browser Window Feature Refactor use?

Browser Window Feature Refactor 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 Browser Window Feature Refactor 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. Its references folder adds about 854 tokens, read only when the agent opens those files.

What are the alternatives to Browser Window Feature Refactor?

Skills that share tags, products or a category with Browser Window Feature Refactor: Guidelines (akash-network/node, 1.1k stars), Component Refactoring (langflow-ai/langflow, 156k stars), Migrate Core Code to Submodules (tinyhumansai/openhuman, 42k stars) and Systematic Code Refactoring (luongnv89/claude-howto, 42k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Browser Window Feature Refactor?

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.