Agent skill

Replace Anonymous Runnables

by nwjs in nwjs/chromium.src

Replace anonymous classes with lambdas where applicable (SAM interfaces)

BSD-3-ClauseAuto-check passedDevelopment

Install Replace Anonymous Runnables

skills CLI
$ npx skills add nwjs/chromium.src --skill replace-anonymous-runnables -a claude-code

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

GitHub CLI
$ gh skill install nwjs/chromium.src replace-anonymous-runnables --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/projects/code-health/replace-anonymous-runnables .claude/skills/replace-anonymous-runnables && 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
replace-anonymous-runnables
GitHub stars
160
Token cost
~1k tokens
SKILL.md length
462 words
Files
5 (incl. scripts, references)
Skills in repo
64
Repo updated
First seen
Licence
BSD-3-Clause

At a glance

Replace anonymous classes with lambdas where applicable (SAM interfaces)

  • Works in 6 steps: Workspace Preparation → Discovery & Batch Selection → Refactoring & Implementation → …
  • Tasks that involve Code quality
  • SKILL.md covers Relevant Resources & Style… and Workflow
  • Runs Python scripts from its folder; calls git

What it does

Replace Anonymous Runnables is an agent skill from nwjs/chromium.src. Replace anonymous classes with lambdas where applicable (SAM interfaces)

Its SKILL.md is about 1k tokens, which your agent loads only when the skill is triggered. The skill folder holds 6 other files, including scripts and reference files (for example `references/automated_review.md`, `references/patterns.md` and `references/subagent_verification.md`).

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

Example prompts

  • “/replace-anonymous-runnables”

Requirements

  • Python 3

Workflow steps

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

  1. Workspace Preparation
  2. Discovery & Batch Selection
  3. Refactoring & Implementation
  4. Validation
  5. Verification
  6. Submission

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/ (Python), which the agent can run.

    Shell commands in SKILL.md call:

    • git

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

  • Network

    Links to these hosts (documentation or services it may open):

    • source.chromium.org

    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

Replace Anonymous Runnables loads about 1k tokens when it runs, and up to ~3k if it reads all its reference files. Until then it costs about 25 tokens; SKILL.md has 462 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~25
When it runs · the whole SKILL.md, loaded when a task matches
~1k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~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). 462 words, ~1,044 tokens.

Download SKILL.mdSave it as .claude/skills/replace-anonymous-runnables/SKILL.md (or your agent's skills folder). This skill also uses 4 other files; get the full folder from GitHub.
name
replace-anonymous-runnables
description
Replace anonymous classes with lambdas where applicable (SAM interfaces)

Code Health: Replace Anonymous Runnables

Replace Java anonymous classes implementing Single Abstract Method (SAM) interfaces with lambdas to leverage Lambda Grouping and reduce binary size.

Goal: Clean up all occurrences of this pattern in the codebase.

Relevant Resources & Style Guides

Workflow

[!IMPORTANT] Execution Protocol: Execute all steps sequentially one by one. Do not skip any step. Use rg (ripgrep) for searches.

Step 1: Workspace Preparation

Follow the workspace preparation steps in workspace_preparation.md to ensure a clean and updated environment.

Step 2: Discovery & Batch Selection
  1. Follow the Discovery & Batch Selection workflow to run the scanner.
  2. Verify SAM Candidates (Subagent Verification): If auditing a specific subsystem or directory, the raw scanner might return false positives (e.g. abstract classes or interfaces with multiple methods). To filter these out dynamically:
    • Spawn a self subagent.
    • Pass it the verification prompt template from subagent_verification.md along with the list of raw candidates.
    • Use the subagent's verified list as the final batch.
  3. Present the verified candidates to the user and ask for explicit approval before proceeding.
Step 3: Refactoring & Implementation

Process the candidates by handling them one file at a time, and applying modifications inside each file one instance at a time. This ensures stability and allows for precise verification.

Refactoring Guidelines:

  • Convert single-method anonymous classes to Java lambdas.
  • Warning: Skip if the method has annotations (like @JavascriptInterface or @SuppressLint). Do not attempt to move @SuppressLint to the field or enclosing method to bypass this, as it may not suppress the warning on the lambda.
  • Warning: Skip if the anonymous class body uses this to refer to itself.
  • Warning: Skip if the anonymous class is in a field initializer and references blank final fields initialized in the constructor (causes compile error).
  • Warning: Do not convert View.OnTouchListener to lambdas. These often trigger ClickableViewAccessibility lint warnings if they do not call View#performClick(), and converting them can break existing lint baselines.
  • Refer to patterns.md for concrete examples.
  • Ensure no functional changes are introduced.
Show full SKILL.md (124 more words)Show less
Step 4: Validation
  1. Code Formatting: Run git cl format to format changes.
  2. Mandatory Final Review: Follow the Automated Review Protocol to delegate a final review of the patch. Proceed only after it returns PASS.
Step 5: Verification

Follow the Verification workflow.

Step 6: Submission

Invoke the Submission workflow. Pass the following context variables:

  • Branch Name: cleanup-replace-anonymous-runnables-[component-name]
  • Commit Hashtag: Code Health
  • Cleanup Title: Replace anonymous classes with lambdas in [Component]
  • Cleanup Description: "Convert Java anonymous classes implementing SAM (Single Abstract Method) interfaces to lambdas. This allows R8 to perform Lambda Grouping and merge them, reducing overall DEX/binary size."
  • Parent Bug: 541671762
  • Bug ID: "none"
  • Omit Skill Attribution: "true"
  • Cleaned Component: The parent directory of the batch.
  • File Count: Number of files cleaned up.

© 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 4 other files (scripts, references) in agents/projects/code-health/replace-anonymous-runnables of nwjs/chromium.src.

  • SKILL.md
  • references/automated_review.md
  • references/patterns.md
  • references/subagent_verification.md
  • scripts/find_candidates.py

Open the folder on GitHubat commit a9e8946

Compare with similar skills

Replace Anonymous Runnables 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.

Replace Anonymous Runnables compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Replace Anonymous Runnables this skillnwjs/chromium.src160—~1kAutomated safety check: PassBSD-3-Clause
Install Anti-Slop Oxlint Rulesdmmulroy/anti-slop5.3k1 repos~2.2kAutomated safety check: PassMIT
WooCommerce Code Reviewwoocommerce/woocommerce11k3 repos~1.1kAutomated safety check: PassCustom licence
Systematic Code Refactoringluongnv89/claude-howto42k—~3kAutomated safety check: PassMIT
Constraint-Driven Developmentaddyosmani/agent-skills103k2 repos~5.2kAutomated safety check: PassMIT
Skill Doli Code ReviewDolibarr/dolibarr7.7k1 repos~1.1kAutomated safety check: PassMIT

Similar skills

  • Installs, updates or migrates the vendored anti-slop Oxlint plugin in a repository, keeping local rule changes and the plugin's license and provenance files.

    5.3k GitHub starsUsed in 1 repo~2.2k tokens
    DevelopmentAuto-check passed
  • WooCommerce Code Review

    woocommerce/woocommerce

    Reviews WooCommerce code changes against the project's standards, flagging backend PHP architecture, naming, documentation, data integrity and testing violations.

    11k GitHub starsUsed in 3 repos~1.1k tokens
    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
  • Constraint-Driven Development

    addyosmani/agent-skills

    Records a project's quality bar in CONSTRAINTS.md and watches diffs for signs an agent quietly weakened it, such as suppressions, skipped tests or lowered thresholds.

    103k GitHub starsUsed in 2 repos~5.2k tokens
    DevelopmentAuto-check passed
  • Skill Doli Code Review

    Dolibarr/dolibarr

    Reviews Dolibarr PHP code for compliance with coding standards and security best practices, and fixes identified issues.

    7.7k GitHub starsUsed in 1 repo~1.1k tokens
    DevelopmentAuto-check passed
  • Ponytail Lazy Developer Mode

    DietrichGebert/ponytail

    Makes the agent pick the laziest solution that works: skip unneeded work, reuse what exists, prefer the standard library and platform features, and keep diffs small.

    158k GitHub stars~871 tokensUpdated today
    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 Replace Anonymous Runnables

What does Replace Anonymous Runnables do?

Replace anonymous classes with lambdas where applicable (SAM interfaces). src.

When should I use Replace Anonymous Runnables?

Replace Anonymous Runnables fits situations like: tasks that involve Code quality.

How do I install Replace Anonymous Runnables in Claude Code?

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

How do I install Replace Anonymous Runnables in Codex?

Run `npx skills add nwjs/chromium.src --skill replace-anonymous-runnables -a codex`. Or copy the skill folder (agents/projects/code-health/replace-anonymous-runnables in nwjs/chromium.src) into .agents/skills/replace-anonymous-runnables in your project. Codex loads it when a task matches its description.

Can I use Replace Anonymous Runnables 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 replace-anonymous-runnables -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/replace-anonymous-runnables, .gemini/skills/replace-anonymous-runnables, .github/skills/replace-anonymous-runnables and .opencode/skills/replace-anonymous-runnables in your project.

What does Replace Anonymous Runnables need to run?

Going by SKILL.md and its folder, Replace Anonymous Runnables needs Python for the scripts in its folder and the command-line tools its instructions call (git). Our summary lists: Python 3.

Does Replace Anonymous Runnables access the network?

SKILL.md names 1 domain. As links in the text: source.chromium.org. This is read from the text; nothing was executed.

Is Replace Anonymous Runnables 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 Replace Anonymous Runnables use?

Replace Anonymous Runnables 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 Replace Anonymous Runnables use?

About 1k tokens (SKILL.md is roughly 4.2k 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 2k tokens, read only when the agent opens those files.

What are the alternatives to Replace Anonymous Runnables?

Skills that share tags, products or a category with Replace Anonymous Runnables: Install Anti-Slop Oxlint Rules (dmmulroy/anti-slop, 5.3k stars), WooCommerce Code Review (woocommerce/woocommerce, 11k stars), Systematic Code Refactoring (luongnv89/claude-howto, 42k stars) and Constraint-Driven Development (addyosmani/agent-skills, 103k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Replace Anonymous Runnables?

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.