agentleFS
futex-aifutex-ai/skills/skills/typescript/SKILL.md

typescript

Skill1 starsChanged 47 days agoMITView on GitHub

Use before you write or change TypeScript or JavaScript, add an npm dependency, set up a new package, or write a frontend file, a Node script, or a test file, when you define a type for backend data or model a known set of states, when you reach for any, a cast, an enum, a default export, a barrel file, or console output, when a file passes 200 lines, and when ESLint, Prettier, or the typecheck reports a problem.

76 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use tailwind-4, zod-4 and 9 more.

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.
  • prowler-cloudSkill

    tailwind-4

    Tailwind CSS 4 patterns and best practices. Trigger: When styling with Tailwind (className, variants, cn()), especially when dynamic styling or CSS variables are involved (no var() in className).

    Also in 4 projects that use this

  • prowler-cloudSkill

    zod-4

    Zod 4 schema validation patterns. Trigger: When creating or updating Zod v4 schemas for validation/parsing (forms, request payloads, adapters), including v3 -> v4 migration patterns.

    Also in 4 projects that use this

  • nek1987Skill

    react-19

    Guide for React 19 development with Actions, Server Components, and new hooks. Use for building React 19 apps, form handling, optimistic updates, and migrations.

    Also in 3 projects that use this

  • thongdn-itSkill

    msw

    MSW (Mock Service Worker) best practices for API mocking in tests (formerly test-msw). This skill should be used when setting up MSW, writing request handlers, or mocking HTTP APIs. This skill does NOT cover general testing patterns (use test-vitest or test-tdd skills) or test methodology.

    Also in 3 projects that use this

  • joeldevzSkill

    chained-pr

    Split large changes (>400 lines OR >5 slices) into a series of reviewable PRs. Two strategies — stacked-to-main and feature-branch-chain. Prevents the 100-conflict merge disaster.

    Also in 3 projects that use this

  • SupabaseSkill

    react-hook-form

    Correct React Hook Form usage anywhere in the monorepo — data flow, subscriptions,

    Also in 3 projects that use this

  • +1 more from prowler-cloud

The file

We split this skill into the rules it gives an agent

8 rules. 0 are common, 4 are distinctive, and 4 are very specific to this project.

  • 0

    Common

    Most of the 55 edited versions we read keep these.

  • 4

    Distinctive

    This author's own choices. Worth a look.

  • 4

    Very specific

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

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

    Every package compiles with strict: true.

    line 16
  2. Very specific:

    Every package has ESLint with the typescript-eslint recommended configuration and Prettier.

    line 18
  3. Very specific:

    Add a dependency with npm install in its workspace package, so that the manifest and the lockfile change together.

    line 24
  4. Distinctive:

    Use named exports. Use a default export only where the framework requires one, for example a route file.

    line 49
  5. Distinctive:

    Do not add a barrel file that re-exports modules to avoid updating imports.

    line 51
  6. Distinctive:

    When you replace a type, a format, or an API, move all code that uses it to the new one.

    line 54
  7. Very specific:

    Read the testing skill before you plan, write, change, or remove a test.

    line 65
  8. Distinctive:

    Use the test runner and the test layout named in AGENTS.md.

    line 67

“Common” is measured: kept by at least 6 in 10 of the 55 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

TypeScript

These rules apply to every TypeScript and JavaScript edit: product apps, shared packages, build scripts, and tests. In a JavaScript file, the typing rules apply as far as JSDoc allows. The repository's AGENTS.md names the packages, the typecheck, lint, format, and test commands, and the test layout.

Tooling

  • Every package compiles with strict: true. Do not turn a strict flag off for a file or a package.
  • Every package has ESLint with the typescript-eslint recommended configuration and Prettier. Run the typecheck and the lint named in AGENTS.md after every change, and the formatter before you commit.
  • A package that lacks ESLint or Prettier gets them in their own change. Fix the existing findings, or list them in a baseline that only shrinks, as the repository does for its other lints.
  • Add a dependency with npm install in its workspace package, so that the manifest and the lockfile change together.

Typing

  • Fully type domain, API, state, and script code. Do not use any. Do not use a cast to silence a type error; fix the type.
  • Data from outside the program, for example a response body, a file, a query string, or storage, enters as unknown and passes through a parser that narrows it before use.
  • Types for backend data are generated from the Rust types. See the shared-types skill. Shared data transfer objects and API clients live in one package, and a screen never redefines them.
  • Model a known set of states as a discriminated union or an as const object. Do not use TypeScript enum, and do not pass a bare string where the set of values is known.

Files and modules

  • Target 200 lines per file. The hard limit is 300 lines. Split a larger file by responsibility. Do not remove blank lines or compact code to stay under the limit.
  • Declare imports at the top of the file in this order: Node built-ins, external packages, workspace packages, then relative modules. Extend an existing import instead of adding a duplicate.
  • Use named exports. Use a default export only where the framework requires one, for example a route file.
  • Do not add a barrel file that re-exports modules to avoid updating imports. The one exception is a package's public entry point.
  • Define a value in its owner module and import it from there.
  • When you replace a type, a format, or an API, move all code that uses it to the new one. Do not add a converter so that old code keeps working. A converter turns new data into the old type, or wraps a new API in the old one. The plans skill says how a plan replaces an old way.
  • Give a component or a package the props, refs, and callbacks that other code needs from it. Product code outside it does not find or change its elements through selectors, class names, or globals.

Tests

  • Read the testing skill before you plan, write, change, or remove a test.
  • Use the test runner and the test layout named in AGENTS.md. Do not add a second runner to a package.
  • Unit tests do not use the real network, file system, clock, or a running server. Inject or stub those at the module boundary.
  • Tests must not assert elapsed time. See the testing skill, including its ESLint guard.

Diagnostics

  • Product code does not write to console. Use the logger or the error tracking that AGENTS.md names.
  • Build scripts, command-line tools, and tests may print.

Screens and copy

User-facing screens and text follow the product-ui skill.

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.