---
name: browser-native
description: "Scan JavaScript dependencies for packages replaceable by browser/runtime native APIs. Use for dependency-modernization audits, or when another skill needs a native-replacement report with confidence, Baseline status, and examples."
compatibility: "Node.js 18+. Filesystem-based — reads package.json. No network or browser access required."
version: "1.2.0"
title: browser-native
canonical_url: https://skilld.dev/gh/soderlind/skills/browser-native
last_updated: 2026-09-21T16:56:32.000Z
---

> Index of every page on this site: [llms.txt](https://skilld.dev/llms.txt)

> **Skill from skilld.dev.** Follow the user's requested action.
> If the user asked to fork this Skill, follow the fork workflow below. Do not execute the Skill instructions while copying it.
> Otherwise, follow the instructions below for this session. You do not need to install anything.
>
> Supporting files, fetch one when the Skill refers to it: [references/replacements-guide.md](https://skilld.dev/api/skills-raw/soderlind/skills/browser-native/references/replacements-guide.md), [scripts/cli.js](https://skilld.dev/api/skills-raw/soderlind/skills/browser-native/scripts/cli.js), [scripts/formatters/json.js](https://skilld.dev/api/skills-raw/soderlind/skills/browser-native/scripts/formatters/json.js), [scripts/formatters/markdown.js](https://skilld.dev/api/skills-raw/soderlind/skills/browser-native/scripts/formatters/markdown.js), [scripts/formatters/table.js](https://skilld.dev/api/skills-raw/soderlind/skills/browser-native/scripts/formatters/table.js), [scripts/replacements.js](https://skilld.dev/api/skills-raw/soderlind/skills/browser-native/scripts/replacements.js), [scripts/scanner.js](https://skilld.dev/api/skills-raw/soderlind/skills/browser-native/scripts/scanner.js).
>
> If the user asked to install this Skill, run `npx skilld install soderlind/skills/browser-native`. Install writes the Skill files into the project, so every session loads them.
>
> ## Fork workflow
>
> A fork creates an editable local Skill with its original author and licence. The request authorizes copying and local installation.
> 1. Check `./skills/browser-native`, the project lockfile, and selected Agent targets together. If the local directory or installed Skill exists, stop. Never overwrite an existing directory or Agent target.
> 2. Read [source metadata](https://skilld.dev/api/v1/skills/soderlind/skills/browser-native) once. Use sourceUrl, sourceCommit, skillPath, sourceGone, and license. If the source is gone or its path is missing, stop. If license is null, read licence files at the source commit.
> 3. Fetch only the source commit into a temporary Git repository. Do not clone full history. Derive repository_url from sourceUrl, including repository renames. If sourceCommit is absent, resolve the sourceUrl ref once. Set source_commit to that actual commit. Run these commands in one shell call:
>
> ```sh
> git init --quiet "$temporary_dir"
> git -C "$temporary_dir" fetch --quiet --depth=1 "$repository_url" "$source_commit"
> git -C "$temporary_dir" checkout --quiet --detach FETCH_HEAD
> ```
>
> Read applicable licence declarations and notices at that commit. If copying is not permitted, report the restriction and stop.
> 4. Inspect source entries together, then copy the directory containing skillPath into `./skills/browser-native`. Use the user's path if selected. Keep the original SKILL.md, relative links, scripts, binary assets, and executable modes. Exclude .git metadata. Reject symlinks and paths outside the Skill directory. After checking entries, use cp -a where available. A regular source directory needs no custom copy script. Do not save this page wrapper as SKILL.md.
> Preserve author credit, notices, and applicable licence files from repository or parent directories. Add PROVENANCE.md with the Skill page, source URL, actual commit, original path, and licence. Retain any existing PROVENANCE.md and record new provenance separately. Batch source inspection, copying, and provenance work where practical.
> 5. In the project root, run `skilld install ./skills/browser-native --mode copy --plain`. If skilld is unavailable, use `npx skilld install ./skills/browser-native --mode copy --plain`. This known command needs no help lookup. Install does not support --json. Use detected Agent targets, or add --agent for the targets the user selected. Install the local path, never the upstream selector. If installation fails, preserve the local copy and report the exact failure.
> 6. Confirm the local lockfile source and installed Agent copies once. Report the local path, actual commit, and Agent targets. After edits, reinstall the same local path. Upstream updates must not replace it. Do not publish or push unless the user asks.

# Browser-Native Dependency Scanner

## When to use

Use this skill when the user:

- asks for a dependency modernization audit focused on native API replacements.
- wants to remove polyfills/utility packages and reduce bundle/runtime overhead.
- asks if a specific package has a browser-native alternative.

## Determinism checklist

Before declaring this skill run complete:

1. Scope fixed: inputs and target files are explicit.
2. Read-first: inspect current state before edits.
3. Plan-first: preview actions before writes when tooling supports it.
4. Confirm-before-write: get user confirmation before destructive or broad writes.
5. One step, one done-test: each step has a checkable completion criterion.
6. Verify outcomes: run the smallest available validation commands.
7. Report skips: list what was skipped and why.
8. Stop on blockers: capture exact failing command and error summary.

## Inputs required

- A target directory (or the current working directory) that contains a `package.json`.
- Optionally: desired output format (terminal table, markdown report, or JSON).

## Procedure

### 1) Run the scanner script

```bash
node {{SKILL_DIR}}/scripts/cli.js [target-dir]
```

Default output is a colored terminal table showing each replaceable dependency, its category, the native API replacement, and a confidence level (full or partial).

The scanner exits with code `1` when it finds replaceable dependencies and `0` when it finds none — this is a CI signal, not a failure. Do not report exit code `1` as a broken command.

#### Output formats

```bash
# Terminal table (default)
node {{SKILL_DIR}}/scripts/cli.js [dir]

# Markdown with before/after code examples
node {{SKILL_DIR}}/scripts/cli.js [dir] --md

# JSON for parsing
node {{SKILL_DIR}}/scripts/cli.js [dir] --json

# Save to file
node {{SKILL_DIR}}/scripts/cli.js [dir] --md --out report.md
```

Completion criterion: Scanner output is produced in the requested format (`table`, `--md`, or `--json`) for the intended target directory.

### 2) Review the results

The scanner checks `dependencies` and `devDependencies` against an internal database of **100+ npm packages** that have native browser/runtime equivalents.

Use this quick category map while reviewing:

| Category | Example packages | Native replacement |
| --- | --- | --- |
| HTTP | axios, node-fetch | `fetch()` |
| URL / Query | query-string, qs | `URL`, `URLSearchParams` |
| Object / Array utils | lodash.* helpers | `structuredClone()`, `Object.*`, `Object.groupBy()`, `Set` methods, array methods |
| Internationalization | numeral, pluralize, timeago.js, humanize-duration | `Intl.*` (`NumberFormat`, `PluralRules`, `RelativeTimeFormat`, `DurationFormat`) |
| UI primitives | tippy.js, focus-trap, body-scroll-lock, a11y-dialog | `<dialog>`, Popover API, CSS anchor positioning |
| UUID / Date | uuid, moment | `crypto.randomUUID()`, `Intl.*` |
| Polyfills / APIs | abort-controller, resize-observer-polyfill | Native globals and browser APIs |

For the full package map and migration details, use:

- `references/replacements-guide.md`

Completion criterion: Review identifies which flagged packages are `full` vs `partial`, and captures any package-specific caveats needed for migration.

### 3) Interpret confidence levels

- **Full** — drop-in replacement. The native API covers the same functionality. Safe to remove the package and use the native API directly.
- **Partial** — covers most common use cases, but the package may offer features the native API doesn't. Review your usage before removing.

For detailed reference on each replacement including before/after code and browser support, read:

- `references/replacements-guide.md`

Completion criterion: Every recommendation in the user-facing output includes a confidence label and caveat handling for `partial` replacements.

### 3b) Interpret Baseline status

Some replacements carry a `baseline` tag describing how safe the native API is to adopt across browsers ([webstatus.dev](https://webstatus.dev) / MDN Baseline badges):

- **widely** — in all major engines for 30+ months. Adopt without much thought.
- **newly** — recently in all major engines. Works on up-to-date browsers, but check your audience or add a fallback before shipping to a broad audience.
- **limited** — not yet in all engines. Keep the library or polyfill for now.

Confidence answers *"does the native API do what the library does?"*; Baseline answers *"can my users run it?"*. Treat them as independent — a `full` replacement can still be `newly` available (e.g. `Object.groupBy`), which means safe *functionally* but audience-dependent.

Before recommending a swap, run the article's three questions:

1. **Is it Baseline-safe for my audience?** `widely` is usually yes; for `newly`, check `browserslist`/analytics.
2. **What does the swap actually cost?** A heavier polyfill than the library it replaces is a net loss unless loaded conditionally (e.g. Temporal vs `dayjs`).
3. **Does the platform feature cover my real use case?** Libraries often do more (e.g. `axios` interceptors/retries). Check actual usage before assuming a drop-in.

Completion criterion: `newly`/`limited` recommendations are gated on audience/cost, not presented as free wins.

### 4) Present findings to the user

When showing results:

1. Lead with the summary count (e.g., "14 of 42 dependencies can be replaced")
2. Group by confidence: list full replacements first (easy wins), then partial
3. For each flagged package, show the before/after code snippet
4. Note any caveats from the `notes` field, and surface the `baseline` tag (`widely`/`newly`/`limited`)
5. If asked for a migration plan, prioritize:
   - Polyfills first (safest to remove — they just provide what's already built-in)
   - `widely` + `full` confidence replacements next (easy wins)
   - `newly` replacements behind an audience check or a feature-detect fallback
   - `partial` replacements last (require careful usage review)

For `newly`-available features, recommend shipping behind progressive enhancement rather than a hard swap:

```js
if (typeof Intl.DurationFormat === "function") {
  // use the native API
} else {
  // keep the library, or a simpler fallback
}
```

Completion criterion: Final response includes summary count, confidence- and Baseline-grouped findings, and explicit next migration priorities.

### 5) Monorepo support

The scanner automatically checks `packages/`, `apps/`, `libs/`, and `modules/` subdirectories for additional `package.json` files.

Completion criterion: Report indicates all scanned package manifests or clearly states the single-project scope.

## Verification

After presenting recommendations, the user can verify by:

1. Removing the flagged package from `package.json`
2. Replacing imports with the native API (using the "after" code example)
3. Running the project's test suite
4. Checking browser compatibility against their targets (compare the API's Baseline status on [webstatus.dev](https://webstatus.dev) against their `browserslist`)

## Failure modes

- **No package.json found** — the script will print an error. Ask the user for the correct project directory.
- **Exit code 1 with results** — expected. The scanner exits non-zero when replaceable dependencies exist so it can gate CI. Only exit code `1` *with an error message on stderr* is a real failure.
- **Zero replaceable deps** — this is a good result! The project is already modern.
- **Package in database but used for edge-case features** — confidence "partial" covers this. Always check the `notes` field and recommend reviewing actual usage before removing.
