Agent skill

Optimize

by openplayerjs in openplayerjs/openplayerjs

Find and safely apply ONE worthwhile code optimization (reuse, simplification, efficiency, or a dead-weight cleanup) somewhere in packages//src, with new regression tests proving behavior is…

MITAuto-check passedDevelopment

Install Optimize

skills CLI
$ npx skills add openplayerjs/openplayerjs --skill optimize -a claude-code

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

GitHub CLI
$ gh skill install openplayerjs/openplayerjs optimize --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/openplayerjs/openplayerjs.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.claude/skills/optimize .claude/skills/optimize && 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
optimize
GitHub stars
649
Token cost
~1.9k tokens
SKILL.md length
1,016 words
Files
1
Skills in repo
5
Repo updated
First seen
Licence
MIT

At a glance

Find and safely apply ONE worthwhile code optimization (reuse, simplification, efficiency, or a dead-weight cleanup) somewhere in packages//src, with new regression tests proving behavior is…

  • Works in 8 steps: Zero behavior change (CLAUDE.md gate… → New regression/characterization tests… → Full G0 gate green: pnpm run type-check… → …
  • Tasks that involve Debugging
  • SKILL.md covers What counts as an…, The bar (this is what makes it…, Procedure and If nothing clears the bar, plus 1 more section
  • Calls pnpm and git

What it does

Optimize is an agent skill from openplayerjs/openplayerjs. Find and safely apply ONE worthwhile code optimization (reuse, simplification, efficiency, or a dead-weight cleanup) somewhere in packages//src, with new regression tests proving behavior is unchanged, verified against this repo's own gates. Use on demand — "run an optimization pass", "find something to optimize", "/optimize", "is there anything worth cleaning up" — for a cold, repo-wide sweep with no diff to start from. Not for reviewing an in-progress change (use the simplify skill) and not for fixing a known…

Its SKILL.md is about 1.9k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Development, covering Debugging and Agent instruction files. It works with pnpm and TypeScript. The repository describes itself as: Lightweight HTML5 video/audio player with smooth controls and ability to play VAST/VMAP/SIMID/OMID/non-linear ads. The licence is MIT.

When your agent uses it

  • Tasks that involve Debugging
  • Tasks that involve Agent instruction files

Example prompts

  • “s own gates. Use on demand —”
  • “find something to optimize”
  • “/optimize”
  • “/optimize”

Workflow steps

8 steps, taken from the first numbered list in SKILL.md.

  1. Zero behavior change (CLAUDE.md gate G3): public API surface identical, no existing
  2. New regression/characterization tests added — never edits to existing ones — that
  3. Full G0 gate green: pnpm run type-check && pnpm run lint && pnpm run build && pnpm run test
  4. No new escape hatches — same check as the preship skill's Tier 1 #3
  5. Public API surface verified, not assumed — same check as preship Tier 2: build once
  6. Touches only what it should. Allowed: packages/*/src/, packages/*/__tests__/,
  7. Never packages/youtube — it's excluded from the coverage gate (CLAUDE.md §5), so a
  8. Exactly one self-contained change per pass. Resist bundling a second improvement in —

What it can do on your machine

Read from SKILL.md and the folder at commit c26914a. 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

    Shell commands in SKILL.md call:

    • pnpm
    • git

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

  • Network

    No URLs in SKILL.md. Its commands use pnpm and git, which can reach the network depending on how they are called.

    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

Optimize loads about 1.9k tokens when it runs. Until then it costs about 143 tokens; SKILL.md has 1,016 words of instructions outside code blocks.

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

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 openplayerjs/openplayerjs at commit c26914a, republished under its MIT licence (© openplayerjs). 1,016 words, ~1,860 tokens.

Download SKILL.mdSave it as .claude/skills/optimize/SKILL.md (or your agent's skills folder).
name
optimize
description
Find and safely apply ONE worthwhile code optimization (reuse, simplification, efficiency, or a dead-weight cleanup) somewhere in packages/*/src, with new regression tests proving behavior is unchanged, verified against this repo's own gates. Use on demand — "run an optimization pass", "find something to optimize", "/optimize", "is there anything worth cleaning up" — for a cold, repo-wide sweep with no diff to start from. Not for reviewing an in-progress change (use the `simplify` skill) and not for fixing a known bug (that's G1's bug-fix flow in CLAUDE.md).

Optimize — one safe, tested improvement per pass

This is the manual, on-demand version of a job that could otherwise run unattended on a schedule. It stayed manual on purpose (see "Why this isn't a CI job" below) — everything else about it is exactly what an automated version would do: same safety bar, same gates, same one-change-per-pass discipline. Run it whenever you want a pass, not on any cadence.

What counts as an "optimization" here

Same definition the simplify skill uses — reuse, simplification, efficiency, altitude cleanups — just applied cold across the repo instead of to a diff already in front of you:

  • A genuinely more efficient implementation behind an unchanged public signature (fewer allocations, a better algorithm, avoiding redundant work).
  • Dead code, duplicated logic, or an unnecessary abstraction with no behavioral role.
  • A simplification that measurably reduces bundle size or runtime cost without changing what callers observe.

Not eligible for this skill: anything that changes a public signature, event name, event payload shape, default value, or observable behavior — that's a feature or a breaking change, and needs the user's explicit sign-off per CLAUDE.md E1, not a solo pass.

The bar (this is what makes it safe to hand back without asking)

All of these, every time — this list is the whole point of the skill, don't skip steps to save time:

  1. Zero behavior change (CLAUDE.md gate G3): public API surface identical, no existing test assertion touched. If a test needs to change, the candidate isn't a pure optimization — drop it and find another.
  2. New regression/characterization tests added — never edits to existing ones — that concretely pin down the behavior around the changed code path. If that path was already well-covered, a test proving the optimization didn't change outputs is still required. See the write-tests skill for this repo's conventions.
  3. Full G0 gate green: pnpm run type-check && pnpm run lint && pnpm run build && pnpm run test (coverage stays ≥85% on all four metrics).
  4. No new escape hatches — same check as the preship skill's Tier 1 #3:
    sh
    git diff -U0 master... -- packages/ | grep -nE '^\+.*(as any|@ts-ignore|@ts-expect-error|eslint-disable)'
    Any hit must already be a sanctioned R4 pattern with its justification comment, or the candidate is out.
  5. Public API surface verified, not assumed — same check as preship Tier 2: build once on a clean master baseline and once with the change, and diff packages/*/dist/types/. For a real optimization these are byte-identical. If they're not, this wasn't a pure optimization — revert and reclassify it as a feature.
  6. Touches only what it should. Allowed: packages/*/src/**, packages/*/__tests__/**, e2e/**, examples/**. Never: any package.json, pnpm-lock.yaml, tsconfig*, rollup*, jest.config.cjs, eslint.config.cjs, turbo.json, commitlint.config.cjs, CHANGELOG.md, or anything under dist//coverage/ (R16 + the E1 shared-config list). Check with git diff --name-only master... before committing.
  7. Never packages/youtube — it's excluded from the coverage gate (CLAUDE.md §5), so a change there can't be verified the same way the rest of this bar assumes.
  8. Exactly one self-contained change per pass. Resist bundling a second improvement in — that's a second pass, with its own tests and its own verification.
Show full SKILL.md (520 more words)Show less

Procedure

  1. Find a candidate. Look for what the bar above can actually clear: an inefficient hot path, obvious duplication, a simplification that doesn't touch signatures. Check CLAUDE.md §5's "Known weak spot" note (ads/src/strategies/csai.ts, ~74% branches — SIMID/OMID paths need real browsers) before picking something there; it's not off-limits, but the test-proof requirement (§2 above) is harder to satisfy honestly in that file.
  2. Sanity-check eligibility before writing code: is the target part of a public export? If so, can the change stay purely internal (same signature, same behavior, better implementation)? If the improvement requires changing what callers see, stop — it's not for this skill.
  3. Implement it.
  4. Add the regression tests (bar item 2). Write them to fail on the pre-change code and pass on the post-change code where practical — that's what makes "zero behavior change" a verified claim instead of an assertion.
  5. Run the G0 gate (bar item 3). Fix forward on any red; if it can't go green without touching a forbidden file (bar item 6) or a test assertion, abandon the candidate.
  6. Run the escape-hatch check (bar item 4).
  7. Verify the public API diff (bar item 5) — build on master, stash, build on the change, diff dist/types/.
  8. Check the touched-files list (bar item 6) against the allow/deny list.
  9. Branch and commit. Never commit to master. Conventional commit per R12 — perf(scope): ... for a measured efficiency win, refactor(scope): ... for a simplification/reuse cleanup with no direct perf claim. Body: what changed, why it's safe (point at the gate results and the new tests), and the before/after if you measured one.
  10. Stop there. Don't push, don't open a PR — hand the branch back with a summary of what changed and why it's safe, and let the user review, push, and open the PR themselves when they're ready. (If they've asked you to push/open the PR in this conversation, that's a normal git-push/PR-creation request — follow the usual confirm-first flow, it's just not something this skill does on its own.)

If nothing clears the bar

Say so plainly and stop — don't force a marginal or risky change just to have produced something. A pass that finds nothing worth doing is a correct, useful outcome, not a failure.

Why this isn't a CI job

An earlier version of this task was scoped as a scheduled GitHub Actions workflow (Claude Code running on a weekly cron, opening PRs unattended). It needs an LLM in the loop — there's no deterministic way to "find a code optimization" the way audit-fix deterministically resolves a CVE — which means an API key or Pro/Max OAuth token wired into repo secrets, and real API cost on every scheduled run whether or not it finds anything. That tradeoff was deferred, not rejected: run this skill manually for now; if you want it unattended later, the gates above are already exactly what that workflow's independent verification step would run — the only new work at that point is the GitHub Actions wiring itself (see the audit-fix job in .github/workflows/dependency-audit.yml for the pattern: separate the AI step from a deterministic re-verification step, never trust the AI's own self-report).

© openplayerjs, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .claude/skills/optimize of openplayerjs/openplayerjs.

Open the folder on GitHubat commit c26914a

Compare with similar skills

Optimize 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.

Optimize compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Optimize this skillopenplayerjs/openplayerjs649—~1.9kAutomated safety check: PassMIT
Add Plugin Ruleeslint-config/airbnb-extended129—~646Automated safety check: PassMIT
Update Depsviclafouch/meme-studio110—~2.6kAutomated safety check: PassNone
Hexagonal Architecturecitypaul/.dotfiles739—~10kAutomated safety check: PassCustom licence
Leon Coding Agentleon-ai/leon18k—~1.1kAutomated safety check: PassMIT
Runtime DebugOpenHikmah/openhikmah-web181—~618Automated safety check: PassGPL-3.0

Similar skills

  • Add Plugin Rule

    eslint-config/airbnb-extended

    Fix the "<Plugin Updated with <rule" build error from script/checkUpdates.ts by adding a new or deprecated plugin rule to the right rules/ file.

    129 GitHub stars~646 tokensUpdated today
    DevelopmentAuto-check passed
  • Update Deps

    viclafouch/meme-studio

    Audit all outdated dependencies with detailed research on changelogs, breaking changes, bug fixes, and deprecations.

    110 GitHub stars~2.6k tokensUpdated 6 mo ago
    DevelopmentAuto-check passed
  • Hexagonal Architecture

    citypaul/.dotfiles

    A skill your agent uses when the user or project explicitly adopts hexagonal (ports and adapters) architecture — a README, CLAUDE.md, or ADR that says so is the opt-in.

    739 GitHub stars~10k tokensUpdated 4 days ago
    DevelopmentAuto-check passed
  • Leon Coding Agent

    leon-ai/leon

    Has Leon's agent investigate, change and verify code in a repository with its file, search and shell tools, staying inside the scope the owner authorized.

    18k GitHub stars~1.1k tokensUpdated yesterday
    DevelopmentAuto-check passed
  • Runtime Debug

    OpenHikmah/openhikmah-web

    Debug and verification workflow for runtime-bundle and module-resolution regressions.

    181 GitHub stars~618 tokensUpdated today
    DevelopmentAuto-check passed
  • Workflow Authoring

    QuintinShaw/pi-dynamic-workflows

    Guidance for writing, editing, reviewing, and debugging JavaScript workflow code for pi-dynamic-workflows.

    554 GitHub stars~671 tokensUpdated yesterday
    DevelopmentAuto-check passed

More from openplayerjs/openplayerjs

  • Add Event

    openplayerjs/openplayerjs

    Add, rename, change the payload of, or remove a typed player event in OpenPlayerJS.

    649 GitHub stars~1.7k tokensUpdated yesterday
    Auto-check passed
  • Audit Fix

    openplayerjs/openplayerjs

    Resolve a pnpm audit (dependency-audit CI job) failure — high/critical CVEs in the dependency tree.

    649 GitHub stars~1k tokensUpdated yesterday
    Auto-check passed
  • Preship

    openplayerjs/openplayerjs

    Run the full OpenPlayerJS verification gauntlet before committing, opening a PR, or preparing a release.

    649 GitHub stars~1.2k tokensUpdated yesterday
    Auto-check passed
  • Write Tests

    openplayerjs/openplayerjs

    Write or extend Jest tests for OpenPlayerJS to this repo's exact conventions — makeCore factories, typed internals handles instead of as any, media property mocking, fake timers, ads/vast mocks, and…

    649 GitHub stars~1.8k tokensUpdated yesterday
    Auto-check passed

Works with

Questions about Optimize

What does Optimize do?

Find and safely apply ONE worthwhile code optimization (reuse, simplification, efficiency, or a dead-weight cleanup) somewhere in packages//src, with new regression tests proving behavior is…. Optimize is an agent skill from openplayerjs/openplayerjs. Find and safely apply ONE worthwhile code optimization (reuse, simplification, efficiency, or a dead-weight cleanup) somewhere in packages//src, with new regression tests proving behavior is unchanged, verified against this repo's own gates.

When should I use Optimize?

Optimize fits situations like: tasks that involve Debugging; tasks that involve Agent instruction files.

How do I install Optimize in Claude Code?

Run `npx skills add openplayerjs/openplayerjs --skill optimize -a claude-code`. Or copy the skill folder (.claude/skills/optimize in openplayerjs/openplayerjs) into .claude/skills/optimize in your project. Claude Code loads it when a task matches its description.

How do I install Optimize in Codex?

Run `npx skills add openplayerjs/openplayerjs --skill optimize -a codex`. Or copy the skill folder (.claude/skills/optimize in openplayerjs/openplayerjs) into .agents/skills/optimize in your project. Codex loads it when a task matches its description.

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

What does Optimize need to run?

Going by SKILL.md and its folder, Optimize needs the command-line tools its instructions call (pnpm and git).

Does Optimize access the network?

SKILL.md contains no URLs. Its commands use git, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Optimize 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 Optimize use?

Optimize is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Optimize use?

About 1.9k tokens (SKILL.md is roughly 7.4k 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 Optimize?

Skills that share tags, products or a category with Optimize: Add Plugin Rule (eslint-config/airbnb-extended, 129 stars), Update Deps (viclafouch/meme-studio, 110 stars), Hexagonal Architecture (citypaul/.dotfiles, 739 stars) and Leon Coding Agent (leon-ai/leon, 18k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Optimize?

openplayerjs (a GitHub organization) maintains it in openplayerjs/openplayerjs, which has 649 GitHub stars. The repository holds 5 skills in this directory. The repository was last updated on October 5, 2026.

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