agentleFS
lgtm-hqlgtm-hq/ai-skills/skills/stand-ts/SKILL.md

stand-ts

Skill1 starsChanged 11 days agoMITView on GitHub

TypeScript and JavaScript standards. Use when writing TS/JS code. Covers strict mode, type patterns, error handling, imports, naming, testing, React conventions, and package management with bun.

The file

Show its rules and text

We split this skill into the rules it gives an agent

18 rules. About 0 are common, 6 are distinctive, and 12 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈6

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 12

    Very specific

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

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

    Prefer bun over npm

    line 15
  2. Very specific:

    Use bun install instead of npm install

    line 16
  3. Very specific:

    Prefer interface for object shapes.

    line 28
  4. Very specific:

    Use satisfies over as for type narrowing — preserves the inferred type while validating the shape

    line 30
  5. Very specific:

    Avoid enum — use as const objects instead:

    line 32
  6. Distinctive:

    Prefer discriminated unions over optional fields for state modeling

    line 49
  7. Very specific:

    Use unknown in catch clauses, not any:

    line 53
  8. Distinctive:

    Never swallow errors with empty catch blocks

    line 65
  9. Very specific:

    Prefer typed error results (Result<T, E> pattern) over thrown exceptions for expected failure paths

    line 66
  10. Very specific:

    Use type-only imports for types: import type { Foo } from "./foo".

    line 71
  11. Very specific:

    Avoid barrel files (index.ts re-exports) in libraries — they defeat tree-shaking and obscure dependency graphs

    line 72
  12. Very specific:

    Follow the lint skill for linting and formatting workflow.

    line 89
  13. Distinctive:

    Prefer Vitest over Jest

    line 93
  14. Distinctive:

    Use test functions, not test classes

    line 94
  15. Very specific:

    Use beforeEach / afterEach for shared setup/teardown

    line 96
  16. Very specific:

    Use it.each or test.each for parameterized tests

    line 97
  17. Distinctive:

    When working in React codebases:

    line 117
  18. Distinctive:

    Prefer hooks over HOCs and render props

    line 120

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “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 / JavaScript Standards

Standards for TypeScript and JavaScript code.

Package Manager

  • Prefer bun over npm
  • Use bun install instead of npm install
  • Use bun run instead of npm run
  • Use bunx instead of npx

Strict Mode

  • Enable strict: true in tsconfig.json
  • No any escape hatches without justification — if unavoidable, add a comment explaining why

Type Patterns

  • Prefer interface for object shapes; use type for unions, intersections, and mapped types
  • Use satisfies over as for type narrowing — preserves the inferred type while validating the shape
  • Avoid enum — use as const objects instead:

    // Good
    const Status = {
      Active: "active",
      Inactive: "inactive",
    } as const;
    type Status = (typeof Status)[keyof typeof Status];
    
    // Avoid
    enum Status {
      Active = "active",
      Inactive = "inactive",
    }
  • Prefer discriminated unions over optional fields for state modeling

Error Handling

  • Use unknown in catch clauses, not any:

    // Good
    catch (err: unknown) {
      if (err instanceof SpecificError) { ... }
    }
    
    // Bad
    catch (err: any) { ... }
  • Never swallow errors with empty catch blocks
  • Prefer typed error results (Result<T, E> pattern) over thrown exceptions for expected failure paths

Imports

  • Use type-only imports for types: import type { Foo } from "./foo";
  • Avoid barrel files (index.ts re-exports) in libraries — they defeat tree-shaking and obscure dependency graphs

Naming

  • PascalCase for types, interfaces, classes, and React components
  • camelCase for variables, functions, and methods
  • UPPER_SNAKE_CASE for constants and environment variable names
  • Prefix boolean variables/props with is, has, should, can

Formatting Rules

  • More than 1 arg/param requires a trailing comma (consistent with the stand-py skill)
  • Be explicit with named arguments in object parameters when more than 1 property

Linting

Follow the lint skill for linting and formatting workflow.

Testing

  • Prefer Vitest over Jest
  • Use test functions, not test classes
  • Leverage describe blocks for grouping, not class hierarchies
  • Use beforeEach / afterEach for shared setup/teardown
  • Use it.each or test.each for parameterized tests
// Good
describe("parseConfig", () => {
  it("returns defaults for empty input", () => {
    expect(parseConfig({})).toEqual(defaults);
  });

  it.each([
    { input: "yes", expected: true },
    { input: "no", expected: false },
  ])("parses '$input' as $expected", ({ input, expected }) => {
    expect(parseBoolean(input)).toBe(expected);
  });
});

React

When working in React codebases:

  • Function components only — no class components
  • Prefer hooks over HOCs and render props
  • Named exports for components (no export default)
  • Co-locate component, styles, and tests in the same directory
  • Extract custom hooks when logic is reused across components

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.