agentleFS
mikejhillmikejhill/agent-skills/skills/typescript-development/SKILL.md

typescript-development

Skill0 starsChanged 8 months agoMITView on GitHub

Create, modify, refactor, or review TypeScript snippets, scripts, libraries, browser applications, Node.js services, and CLIs. Use for modular class-first design, strict boundary-safe typing, linting, testing, and portable package/runtime configuration.

6 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

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

  • 0

    Common

    Most of the 5 edited versions we read keep these.

  • 6

    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
  • could be automatic: a setting could enforce it
  1. Distinctive:

    Keep imports free of startup, network, and filesystem side effects.

    line 26
  2. Very specific:

    Avoid any, unsafe assertions, and non-null assertions.

    line 34
  3. Very specific:

    Prefer string unions or as const objects over new enums.

    line 35
  4. Very specific:

    Keep lint, format checking, type checking, tests, and build independently runnable.

    line 41
  5. Very specific:

    Default builds: Vite for bundled browser applications.

    line 42
  6. Distinctive:

    Use local tools and cross-platform scripts.

    line 44
  7. Distinctive:

    Use conventional naming: kebab-case files, PascalCase types/classes, camelCase members.

    line 48
  8. Distinctive:

    Test public behavior, invalid inputs, and boundaries.

    line 51
  9. Distinctive:

    Run frozen install when a lockfile already exists, then typecheck, lint, format check, tests, and build using the project's scripts.

    line 57
  10. Distinctive:

    Follow the repository's existing asynchronous mutation-main/release policy with threshold alerts.

    line 59

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

Deliver cohesive modules, explicit contracts, and reproducible checks. Preserve the repository's supported consumers and established tooling; use the defaults below for new work.

Select scope

ModeUse whenDeliver
OneOffInline answer or quick expressionShort typed snippet, no scaffold
ScriptReusable single-file utilityChecked script and pinned repository-local dependencies when needed
FullProjectLibrary, application, CLI, or multiple modulesSource in src/, tests, package metadata, lockfile, runnable checks

Infer the smallest sufficient mode and target: Library, Browser, Service, or CLI. Inspect existing scripts, lockfile, runtime support, module format, framework, and public API before changing configuration. A narrow edit does not authorize a toolchain migration.

Core rules

Design

  • Strongly prefer classes for stateful services and application orchestration; use readonly value objects and narrow injected interfaces. Pure functions are appropriate for stateless transformations, parsers, and framework callbacks. Avoid artificial utility classes.
  • Group by cohesive domain or feature. Keep domain logic independent of transport, filesystem, CLI, and framework adapters; wire implementations at the entry point. Prefer composition over inheritance.
  • Keep imports free of startup, network, and filesystem side effects. No shared module-level mutable state. Use early guards and shallow control flow; split a method before nesting exceeds three levels.
  • Validate external data once at each trust boundary, then enforce domain invariants where they belong. Keep parsing, I/O, and business logic separate.

Types

  • Enable strict, noUncheckedIndexedAccess, exactOptionalPropertyTypes, noImplicitOverride, and noFallthroughCasesInSwitch for new projects. Check tests and configuration as well as source.
  • Annotate public signatures and non-contextual parameters/returns; allow clear local inference and contextually typed callbacks. Prefer readonly data, discriminated unions with exhaustive handling, and generics that preserve real relationships.
  • Receive JSON, environment, user input, and untyped dependencies as unknown; validate to domain types. A generic fetch<T>, assertion, or satisfies does not validate runtime data.
  • Avoid any, unsafe assertions, and non-null assertions. Isolate unavoidable external unsafety behind a typed adapter with a reason and tests. Use described @ts-expect-error only for a specific known diagnostic or a negative type test; never blanket-disable checks.
  • Prefer string unions or as const objects over new enums. Prefer named exports, type-only imports, and explicit public exports; preserve framework-required defaults and existing compatible API forms.

Tooling and portability

  • New package-managed projects: prefer pnpm with an exact packageManager version and committed pnpm-lock.yaml; preserve npm/Yarn in existing repositories. Pin the development runtime separately from the supported engines range.
  • New comprehensive lint profile: ESLint flat config + typescript-eslint typed rules; Prettier owns formatting, tsc owns type checking. Preserve a working Biome profile when its rules meet the project requirements; do not claim that the compiler fills every typed-lint gap.
  • Keep lint, format checking, type checking, tests, and build independently runnable. Expose one non-mutating check task. Fix commands are separate; never weaken checks to obtain a pass.
  • Default builds: Vite for bundled browser applications; tsc for ordinary Node.js libraries/services/CLIs. Use tsx only when useful for development. These runners/bundlers do not replace type checking.
  • Choose module format, resolution, extensions, runtime APIs, and output target together. Prefer ESM for new compatible projects; retain or explicitly design CommonJS/dual support when consumers require it. See profiles.
  • Use local tools and cross-platform scripts. Review lifecycle scripts and dependency-build permissions for the selected manager version; do not silently enable all scripts, install global tools, or add credentials/network permissions.

Behavior and documentation

  • Use conventional naming: kebab-case files, PascalCase types/classes, camelCase members; keep framework conventions. Document public contracts with concise TSDoc, especially invariants, failure modes, units, and side effects.
  • Catch as unknown, narrow deliberately, preserve causes, and use specific application error categories when callers need to distinguish them. Never silently suppress errors.
  • Separate machine output (stdout) from diagnostics (stderr); use an injected structured logger for services. Configure logging once and redact secrets.
  • Test public behavior, invalid inputs, and boundaries; inject fake I/O and use temporary directories. Test the built artifact and package exports, not only development execution.

Work and verify

  1. Select mode/profile; inspect compatibility and read only the relevant references.
  2. Implement a cohesive vertical slice, including validation and behavior tests.
  3. Run frozen install when a lockfile already exists, then typecheck, lint, format check, tests, and build using the project's scripts.
  4. Exercise emitted code or packed consumers on the advertised runtime/module formats. Report exact commands and failures/unverified platforms; do not equate transpilation with successful checks.
  5. Follow the repository's existing asynchronous mutation-main/release policy with threshold alerts. These quality checks do not establish a new PR gate or authorize publication.

References

ReadWhen
modes.mdRuntime, package management, module format, browser, workspace, or library decisions
standards.mdModule boundaries, naming, typing, errors, documentation, and tests
templates.mdNew strict Node.js compiler/linter/task configuration and profile adaptations
cli-patterns.mdTestable parsing, asynchronous entry points, CLI streams and exit codes
examples.mdValidated boundary decoder, generic API, and refactoring examples

Generic project setup, documentation structure, and release workflows belong to their existing skills; this skill owns TypeScript-specific decisions.

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.