agentleFS
leroyguillaumeleroyguillaume/claude/frontend-conventions/SKILL.md

frontend-conventions

Skill7 starsChanged 3 days agoMITView on GitHub

Frontend code: TypeScript, React, Biome, Vitest coverage. TRIGGER when: editing `.tsx`, `.ts` in a frontend app, or React components, hooks or pages; touching a frontend `package.json`, `tsconfig*.json`, `biome.json`/`.jsonc`, `vitest.config.*` or lockfile; measuring a front end's test coverage; user asks about frontend tooling, React or Biome. SKIP when: server-side TS (Node, CDK, Pulumi), plain HTML (`web-layout-conventions`), or no frontend code.

  • Reads credentials

9 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use backend-conventions.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • SentrySkill

    backend-conventions

    Sentry backend conventions for logging, tracing/spans, span/tag attribute naming, metrics tags, and the options system. Use when adding or editing Python in src/ that logs (logger.info/exception), records metrics (metrics.incr/timing with tags), instruments spans/transactions, calls sentry_sdk.set_tag/set_attribute or set_span_tag/set_span_data, or reads registered options with options.get(). Trigger on "add logging", "log an error", "add a metric", "add a span", "instrument tracing", "set an attribute", "add a tag", "read an option", "LOG005", "LOG011", or metrics tag cardinality questions.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

8 rules. 0 are common, 1 is distinctive, and 7 are very specific to this project.

  • 0

    Common

    Most of the 6 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 7

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Write everything in TypeScript.

    line 17
  2. Very specific:

    Add a Biome pre-commit hook as a local language: system hook running the lockfile's Biome (npm run lint, or npx biome check), alongside the …

    line 31
  3. Very specific:

    Never weaken the type checker: do not set strict: false, noImplicitAny: false, or sprinkle @ts-ignore / @ts-expect-error / as casts to …

    line 98
  4. Very specific:

    Never write application code in .js / .jsx, and never ship plain JavaScript modules for app logic.

    line 102
  5. Very specific:

    Never use ESLint or Prettier, and never add an .eslintrc* or .prettierrc*.

    line 105
  6. Distinctive:

    Never use class components or legacy lifecycle methods.

    line 108
  7. Very specific:

    Never thread an untyped or inline-shaped object between components or functions as a stand-in for a known record — define the …

    line 110
  8. Very specific:

    Never use console.log (or console.*) for diagnostics.

    line 113

“Common” is measured: kept by at least 6 in 10 of the 6 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Frontend conventions

Always:

  • Write everything in TypeScript. Application source is .ts / .tsx only. New UI is .tsx; non-UI modules are .ts.
  • Build all UI with React using function components and hooks. Type props and state explicitly; type component return values where it aids clarity.
  • Enforce strict typing. tsconfig.json must set "strict": true (this turns on noImplicitAny, strictNullChecks, and the rest of the strict family). Additionally enable noUncheckedIndexedAccess and exactOptionalPropertyTypes. Treat tsc --noEmit as a blocking gate, on the same footing as Biome — fix every type error before a change is done. Run tsc --noEmit via pre-commit, which CI runs.
  • Format and lint with Biome (biome check --write). It replaces both ESLint and Prettier. Configure everything in biome.json (or biome.jsonc). Enable the recommended rules and set suspicious/noExplicitAny to error.
  • Add a Biome pre-commit hook as a local language: system hook running the lockfile's Biome (npm run lint, or npx biome check), alongside the baseline hooks from pre-commit-conventions. Not biomejs/pre-commit: its additional_dependencies is a second Biome version to keep in step. CI runs npm ci before pre-commit so the hook finds Biome.
  • Exclude the frontend lockfile from check-added-large-files, as pre-commit-conventions describes for every lockfile.
  • Model structured data with an explicit type / interface, never a bare inline object shape threaded through the code. First reuse a type a dependency already ships (an SDK's request/response model, a generated API client, library prop types); only define your own when none exists. Derive rather than duplicate (Pick, Omit, ReturnType, z.infer, …).
  • Validate data crossing an I/O boundary (API responses, form input, URL params, localStorage) with a schema validator (e.g. zod) and infer the TypeScript type from the schema, so the runtime shape and the static type cannot drift.
  • Apply ui-copy-conventions to every string the UI shows, and web-layout-conventions to layout and styling, mobile-first breakpoints included.
  • Apply logging-conventions. Frontend mechanics: use one structured logger module configured at app startup, and log key-values (logger.debug("fetch.done", { url, status })), never by interpolating values into the message string. Gate verbosity by a log level the app's config module reads once (with Vite, import.meta.env.VITE_LOG_LEVEL; see config-conventions), never read inline at the call site.
  • Provide tests for components and logic with Vitest + React Testing Library (or the framework's first-party test runner). Test behaviour through the rendered output and user interactions, not implementation details.
  • Measure their coverage with Vitest's v8 provider (ci-conventions): V8's own counters, with no instrumentation pass over the source. Add @vitest/coverage-v8 as a dev dependency at the same version as Vitest, so the lockfile pins both together; Renovate's monorepo grouping keeps them in step. With the framework's own runner instead, its built-in coverage.

    coverage: {
      provider: "v8",
      include: ["src/**"],
      reporter: ["text", ["text", { file: "summary.txt" }], "html"],
    },
      coverage:
        desc: Run the tests and measure their coverage
        cmds:
          - npx vitest run --coverage {{.CLI_ARGS}}
    
      coverage:summary:
        desc: Print the summary of the last coverage run
        cmds:
          - cat coverage/summary.txt

    The HTML report lands in coverage/, which is gitignored. On GitLab, add the cobertura reporter (coverage/cobertura-coverage.xml); the job's regex reads the All files row's line column: /^All files\s*\|(?:[^|]*\|){3}\s*(\d+(?:\.\d+)?)/.

Never:

  • Never use the any type. Reach for unknown plus narrowing, a generic, or a precise type instead. If any is genuinely unavoidable (an untyped third-party module), isolate it behind a typed boundary and annotate the single line with // biome-ignore lint/suspicious/noExplicitAny: <reason> explaining why. Never use a blanket any to make a type error disappear.
  • Never weaken the type checker: do not set strict: false, noImplicitAny: false, or sprinkle @ts-ignore / @ts-expect-error / as casts to silence tsc. A cast or suppression needs a one-line comment saying why the checker is wrong and why it is safe; prefer fixing the type.
  • Never write application code in .js / .jsx, and never ship plain JavaScript modules for app logic. (Config files a tool requires in JS are the only exception.)
  • Never use ESLint or Prettier, and never add an .eslintrc* or .prettierrc*. Biome owns formatting and linting; all config lives in biome.json.
  • Never use class components or legacy lifecycle methods; function components and hooks only.
  • Never thread an untyped or inline-shaped object between components or functions as a stand-in for a known record — define the type/interface and use it, deriving from an existing type where possible.
  • Never use console.log (or console.*) for diagnostics; route everything through the configured structured logger.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.