ALWAYS follow this style when writing Python / JavaScript code
Docs:
Tests:
npx -y lighthouse@latest: when semantics, controls, colors, performance changesOps:
Bug fixes:
Avoid python or python3. Prefer uv run script.py for PEP 723 scripts and uv run --with pkg ... for ad-hoc code/tests.
Tests importing a PEP 723 script must use the repo test environment or explicitly include its dependencies.
Avoid requirements.txt. Unless pyproject.toml is present, add dependencies as PEP 723 metadata:
#!/usr/bin/env -S uv run --script
# /// script
# requires-python = ">=3.14"
# dependencies = ["scipy>=1.10", "httpx"]
# ///
Prefer when really needed:
Prefer modern HTML/CSS/platform features over custom JavaScript or libraries.
srcset/sizes; loading="lazy" for offscreen images, but never likely LCP images; use fetchpriority="high" for important/LCP imagesautocomplete=, inputmode=, enterkeyhint=, list=, autocapitalize=, spellcheck=, form=<dialog>, popover, popovertarget=, commandfor=/command=, inert, <details name="">, closedby=<search>, <meter>, <progress>, <output>, <data>, <time> over custom equivalents<picture>, srcset=, preload=, poster=, playsinline, <track>clamp(), text-wrap: balance|pretty, color-scheme, light-dark(), color-mix(), oklch() where usefulprefers-reduced-motion:focus-visible; prefer native HTML semantics over ARIA/custom JavaScript:user-valid/:user-invalid@supports and degrade gracefully; avoid polyfills/dependencies unless required.npx -y modern-web-guidance@latest search "<task>" and retrieve only the relevant guide.Preferred JS style:
id="user-id" not id="userId")?., ??, destructuring, spread, implicit returns (=> over => { return })// @ts-check. .d.ts is OK for packagesfetch(), check response.ok before consuming the response unless non-2xx responses are intentionally handledtextContent/DOM APIs for untrusted content; never interpolate untrusted data into innerHTMLDebug front-end apps with agent-browser, Playwright via CDP on localhost:9222.
For single-page HTML, prefer file:// when a server isn't required.
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer