fe-javascript
/fe-javascript
Writes and reviews browser JavaScript (plain scripts, modules, framework script blocks) - equality, declarations, async and fetch errors, DOM events, assets through the bundler - so it fails loudly, stays fast and keeps working when moved. Use when writing or editing .js, .mjs, .jsx or a script block, debugging a silent failure or a listener leak, or asked to review JavaScript.
- Author
- dawidolko ↗
- Repository
- frontend-skills ↗
- Licence
- MIT
- Last repository change
- 11.11.2026
Assessment and security
- Files in this package
- 2
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 0
No signals detected. Repository changed on 11.11.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
What it does and when to use it
Writes and reviews browser JavaScript (plain scripts, modules, framework script blocks) - equality, declarations, async and fetch errors, DOM events, assets through the bundler - so it fails loudly, stays fast and keeps working when moved. Use when writing or editing .js, .mjs, .jsx or a script block, debugging a silent failure or a listener leak, or asked to review JavaScript.
Original author description
Writes and reviews browser JavaScript (plain scripts, modules, framework script blocks) - equality, declarations, async and fetch errors, DOM events, assets through the bundler - so it fails loudly, stays fast and keeps working when moved. Use when writing or editing .js, .mjs, .jsx or a script block, debugging a silent failure or a listener leak, or asked to review JavaScript.
How it works
- Rules
- Do this
- Check
- References
SKILL.md preview
---
name: fe-javascript
description: Writes and reviews browser JavaScript (plain scripts, modules, framework script blocks) - equality, declarations, async and fetch errors, DOM events, assets through the bundler - so it fails loudly, stays fast and keeps working when moved. Use when writing or editing .js, .mjs, .jsx or a script block, debugging a silent failure or a listener leak, or asked to review JavaScript.
license: MIT
compatibility: Any agent that reads Agent Skills. The audit command needs Node.js 20 or newer.
metadata:
title: JavaScript in the browser
area: foundations
lane: B
requires: web
globs: "**/*.js **/*.mjs **/*.cjs **/*.jsx **/*.ts **/*.tsx"
rules: "js/strict-equality js/no-var js/no-eval js/document-write js/feature-detect js/throw-error-objects js/fetch-check-ok js/no-empty-catch js/no-floating-promises js/no-inline-handlers js/passive-listeners js/listener-cleanup js/asset-import"
version: 0.1.0
---
# JavaScript in the browser
Read `.frontend-skills/profile.json` (bundler, framework, lint setup) and `.frontend-skills/lessons.md` first when they exist; a confirmed lesson wins over this skill.
## Rules
- Compare with `===` and `!==` (js/strict-equality); declare with `const`, or `let` when reassigned, never `var` (js/no-var).
- Never run strings as code: no `eval`, `new Function`, or string timers (js/no-eval); no `document.write` (js/document-write).
- Detect features (`'share' in navigator`, `CSS.supports`), never parse `navigator.userAgent` (js/feature-detect).
- Throw and reject `Error` objects, with `{ cause }` when rethrowing (js/throw-error-objects).
- Check `res.ok` before reading a `fetch` body (js/fetch-check-ok); give requests a `signal` to cancel or time out.
- Never leave a `catch` empty (js/no-empty-catch); await, return or `.catch()` every promise (js/no-floating-promises).
- Attach handlers with `addEventListener` from a module, not `onclick="..."` attributes (js/no-inline-handlers).
- Make `touchstart`, `touchmove` and `wheel` listeners `{ passive: true }` unless they call `preventDefault()` (js/passive-listeners).
- Remove what a view starts (listeners, timers, observers) when it goes away; one `AbortController` signal ends them all (js/listener-cleanup).
- Import images, fonts and media or use the base-path helper; never hard-code `/images/...` in components (js/asset-import).
- Read layout (`getBoundingClientRect`, `offsetWidth`) before writing styles, never alternating in a loop.
## Do this
1. Load app code as modules: `<script type="module" src>` (deferred and strict by default). A classic script in `<head>` gets `defer` (perf/render-blocking-script).
2. Insert text with `textContent`; markup from users only through a sanitizer (see the `fe-security` skill).
3. Wrap `fetch` once: a helper that adds `signal` (`AbortSignal.any([controller.signal, AbortSignal.timeout(8000)])`), checks `ok`, throws an `Error` with the status, and parses JSON. Show loading, empty and error states where it is called.
4. Use event delegation for lists and tables: one listener on the container, `event.target.closest('[data-id]')`.
5. Split rarely used features with `import()`; keep work off the main thread when a handler takes longer than about 50 ms (`scheduler.yield()` where supported, or `setTimeout` chunks).
6. In TypeScript files also follow `fe-typescript`; in a framework, its skill decides where effects and listeners live.
## Check
- `npx github:dawidolko/frontend-skills audit --changed` reports loose equality, `var`, eval, `document.write`, user-agent sniffing, thrown literals, unchecked `fetch`, empty catches, inline handlers, non-passive scroll listeners and hard-coded asset paths.
- Run the project's ESLint (`eqeqeq`, `no-var`, `no-implied-eval`, `no-empty`); with TypeScript, the typed rule `@typescript-eslint/no-floating-promises`.
- In DevTools, the Performance panel's "Forced reflow" warnings and the Memory panel after navigating away and back show thrashing and leaks.
## References
- [references/javascript.md](references/javascript.md): async patterns, fetch wrapper, DOM and event patterns, W3Schools conventions and where they are dated. Read it when writing a data call, an event-heavy widget or a plain-JS site.
Files in this package (2)
- SKILL.md 4 KB
- references/javascript.md 7 KB
Versions
The database has no other skills named fe-javascript.
Database snapshot: 13.11.2026 · package version e8a917fa446b (SHA-256 digest of the entire package)
Downloads in the last 30 days: 0 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 100writing-bundler-tests
Guides writing bundler tests using itBundled/expectBundled in test/bundler/. Use when creating or modifying bundler, transpiler, or code transformation tests. - 91javascript-development
JavaScript/TypeScript ES2024+, async/await, DOM manipulation, Node.js, and API integration. Use when writing vanilla JS/TS code, working with REST/fetch APIs, implementing frontend logic, or configuring JS build tools. - 100javascript-pro
Writes, debugs, and refactors JavaScript code using modern ES2023+ features, async/await patterns, ESM module systems, and Node.js APIs. Use when building vanilla JavaScript applications, implementing Promise-based async flows, optimising browser or Node.js performance, working… - 100javascript-pro
Writes, debugs, and refactors JavaScript code using modern ES2023+ features, async/await patterns, ESM module systems, and Node.js APIs. Use when building vanilla JavaScript applications, implementing Promise-based async flows, optimising browser or Node.js performance, working… - 100bun-bundler
Use when bundling JavaScript/TypeScript code with Bun's fast bundler. Covers building for different targets, tree-shaking, code splitting, and optimization strategies. - 100javascript
Expert modern JavaScript (ES2024+) assistance covering closures, async/await, promises, modules, event loop concurrency, and DOM manipulation. Use when writing frontend or Node.js code, designing clean asynchronous flows, or modernizing legacy JavaScript.