agentleFS
qinshuangqinshuang/claude-skill/typescript/SKILL.md

typescript

Skill0 starsChanged 9 months agoApache-2.0View on GitHub

This skill should be used when the user asks to "configure TypeScript", "fix type errors", "use dayjs", "add type definitions", "set up React with TypeScript", mentions ".ts" or ".tsx" files, or asks about TypeScript best practices or TypeScript-specific tooling.

66 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use msw, rust and 10 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.
  • 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

  • MicrosoftSkill

    rust

    Use this guide when working on Rust changes in the FAST monorepo.

    Also in 9 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

  • VercelSkill

    react

    React renderer for json-render that turns JSON specs into React components. Use when working with @json-render/react, building React UIs from JSON, creating component catalogs, or rendering AI-generated specs.

    Also in 10 projects that use this

  • leonaaardobSkill

    drizzle

    Complete Drizzle ORM documentation in markdown format. Use when working with Drizzle ORM - covers schema definition, queries, migrations, database connections (PostgreSQL, MySQL, SQLite), integrations (Neon, Supabase, PlanetScale, Cloudflare D1, Turso), column types, relations, transactions, and framework usage (Next.js, SvelteKit, Astro).

    Also in 3 projects that use this

  • thongdn-itSkill

    tailwind

    Tailwind CSS v4 performance optimization and best practices guidelines (formerly tailwindcss-v4-style). This skill should be used when writing, reviewing, or refactoring Tailwind CSS v4 code to ensure optimal build performance, minimal CSS output, and correct usage of v4 features. Triggers on tasks involving Tailwind configuration, @theme directive, utility classes, responsive design, dark mode, container queries, or CSS generation optimization.

    Also in 5 projects that use this

  • +1 more from thongdn-it

The file

We split this skill into the rules it gives an agent

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

  • 0

    Common

    Most of the 52 edited versions we read keep these.

  • 3

    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:

    Use BiomeJS for linting and formatting JavaScript and TypeScript code.

    line 41
  2. Very specific:

    Use the dayjs library for date calculations.

    line 47
  3. Very specific:

    Never use the any type.

    line 60
  4. Distinctive:

    Use TypeScript for all new code.

    line 88
  5. Very specific:

    Use type instead of interface for declaring types.

    line 92
  6. Distinctive:

    Use centered comment dividers for major section breaks:

    line 105
  7. Distinctive:

    NOT for every function or small grouping

    line 125

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

Rules

Note that these are not hard-and-fast rules. If there's a good reason not to apply a rule, don't apply it.

Alphabetical Order

Maintain alphabetical order for better readability and consistency:

  • Function parameters - Order by parameter name
  • Object literal fields - Sort by key name
  • Type definitions - Arrange fields alphabetically
  • Class properties - Order by property name

Example (type definitions):

// bad
type User = {
  name: string;
  age: number;
  email: string;
};

// good
type User = {
  age: number;
  email: string;
  name: string;
};

Biome

Use BiomeJS for linting and formatting JavaScript and TypeScript code. Look for a biome.jsonc file and, if it's not present, create it.

Exception: project already uses ESLint and Prettier.

dayjs for date and time calculations

Use the dayjs library for date calculations. Avoid using the native JavaScript Date object.

Example:

import dayjs from "dayjs";

const now = dayjs();
const tomorrow = now.add(1, "day");

No any type

Never use the any type.

Never return a value in forEach callbacks

Example:

[].forEach(() => {
  return 1; // bad
});

[].forEach(() => {
  // good
});

Another example:

[].forEach((item) => console.log(item)); // bad

[].forEach((item) => {
  console.log(item); // good
});

Prefer TypeScript over JavaScript

Use TypeScript for all new code.

Prefer type instead of interface

Use type instead of interface for declaring types.

Use Number.isNaN instead of isNaN

Example:

const x = Number.isNaN(y); // good
const x = isNaN(y); // bad

Comment Dividers

Use centered comment dividers for major section breaks:

Format (80 chars total):

// -------------------------------------------------------------------------- //
//                                   TITLE                                    //
// -------------------------------------------------------------------------- //

Rules:

  • Total width: 80 characters
  • Title: UPPERCASE, centered with spaces
  • Border line: dashes - filling the space between // and //

When to use:

  • Major logical sections (imports, types, constants, main logic, exports)
  • Separating distinct feature areas
  • NOT for every function or small grouping

Example:

// -------------------------------------------------------------------------- //
//                                   IMPORTS                                  //
// -------------------------------------------------------------------------- //

import { Effect } from "effect";

// -------------------------------------------------------------------------- //
//                                    TYPES                                   //
// -------------------------------------------------------------------------- //

type Config = {
  name: string;
};

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.