typescript-conventions
Skill1 starsChanged 2 months agoMITView on GitHub
Use when writing, reviewing, or refactoring TypeScript or JavaScript code — naming conventions, type annotations, private fields, null vs. undefined, async/await pitfalls, and module structure.
4 other projects use a version of this.
Adopted by
Most recently taken up by
- HermeticOrmus/typescript-conventions-skillstheir own version, first seen Nov 8, 2026
- YLfjuk/skillstheir own version, first seen Nov 6, 2026
- ek33450505/claude-agent-teamtheir own version, first seen Oct 25, 2026
- fielding/skillstheir own version, first seen Jul 2, 2026
Other versions4 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 4
- ek33450505/claude-agent-team★ 8same name
- fielding/skills★ 1same name
- YLfjuk/skills★ 1same name
- HermeticOrmus/typescript-conventions-skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository77 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- .cursor/rules/accessibility.mdcCursor rule
- .cursor/rules/agentharness-router.mdcCursor rule
- .cursor/rules/agentic-loops.mdcCursor rule
- .cursor/rules/api-design.mdcCursor rule
- .cursor/rules/audit-review-followup.mdcCursor rule
- .cursor/rules/big-work-plan-review.mdcCursor rule
- .cursor/rules/branching.mdcCursor rule
- .cursor/rules/clean-architecture.mdcCursor rule
- .cursor/rules/code-review-api.mdcCursor rule
- .cursor/rules/code-review-db.mdcCursor rule
- .cursor/rules/code-review.mdcCursor rule
- .cursor/rules/code-review-ui.mdcCursor rule
- .cursor/rules/committing.mdcCursor rule
- .cursor/rules/database-conventions.mdcCursor rule
- .cursor/rules/dependency-audit.mdcCursor rule
- .cursor/rules/dependency-injection.mdcCursor rule
- .cursor/rules/design-patterns.mdcCursor rule
- .cursor/rules/docker-conventions.mdcCursor rule
- .cursor/rules/error-handling.mdcCursor rule
- .cursor/rules/file-placement-policy.mdcCursor rule
- .cursor/rules/github-issue-triage.mdcCursor rule
- .cursor/rules/go-conventions.mdcCursor rule
- .cursor/rules/harness-feedback.mdcCursor rule
- .cursor/rules/logging.mdcCursor rule
- .cursor/rules/multi-agent-coordination.mdcCursor rule
- .cursor/rules/mutation-testing.mdcCursor rule
- .cursor/rules/performance-profiling.mdcCursor rule
- .cursor/rules/planning-with-files.mdcCursor rule
- .cursor/rules/port-agent-config.mdcCursor rule
- .cursor/rules/project-bootstrap.mdcCursor rule
- .cursor/rules/python-conventions.mdcCursor rule
- .cursor/rules/react-best-practices.mdcCursor rule
- .cursor/rules/refactoring.mdcCursor rule
- .cursor/rules/requirements-clarification.mdcCursor rule
- .cursor/rules/security-review.mdcCursor rule
- .cursor/rules/solid-principles.mdcCursor rule
- .cursor/rules/testing.mdcCursor rule
- .cursor/rules/typescript-conventions.mdcCursor rule
- accessibilitySkill
- agentic-loopsSkill
- api-designSkill
- audit-review-followupSkill
- big-work-plan-reviewSkill
- branchingSkill
- clean-architectureSkill
- code-review-apiSkill
- code-review-dbSkill
- code-reviewSkill
- code-review-uiSkill
- committingSkill
- database-conventionsSkill
- dependency-auditSkill
- dependency-injectionSkill
- design-patternsSkill
- docker-conventionsSkill
- error-handlingSkill
- file-placement-policySkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
3 rules. 0 are common, 0 are distinctive, and 3 are very specific to this project.
0
Common
Most of the 4 edited versions we read keep these.
0
Distinctive
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 43
Prefer native # private fields (ES2022+/TS 3.8+) in new code — real runtime privacy, not a convention that's still readable via ["_name"].
- Very specific: line 45
Don't rewrite working _prefix code on sight.
- Very specific: line 100
Use vitest for Vite-based projects, jest for Node/Next.
“Common” is measured: kept by at least 6 in 10 of the 4 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.
Files
TypeScript Conventions
This file is self-contained for day-to-day use. Deeper reference (needs
the full harness checkout): languages/typescript/CONVENTIONS.md (full
examples including generics and import grouping) and
frameworks/react/CONVENTIONS.md (React/JSX-specific additions).
Naming
camelCase— functions, variables, method names.PascalCase— classes, interfaces, type aliases, enum names.UPPER_SNAKE_CASE— module-level constants.- Enum members:
PascalCase. - Generic type params:
T/Ufor simple one-liners; descriptive names (TEntity,TResponse) for complex or nested generics.
Imports & module structure
Group: external packages → internal modules → type-only imports.
Separate each group with a blank line. Prefer import type for
type-only imports (helps tools that strip types without full parsing).
import fs from 'fs';
import express from 'express';
import { UserRepository } from './repositories/UserRepository';
import type { User } from './types';Private members: # over _prefix
Prefer native # private fields (ES2022+/TS 3.8+) in new code — real
runtime privacy, not a convention that's still readable via ["_name"].
Don't rewrite working _prefix code on sight; it's not deprecated.
class TokenStore {
#tokens: Map<string, string> = new Map(); // true runtime privacy
#rotate(): void { /* ... */ }
}Null vs. Undefined
Pick based on what absence means, then apply it consistently:
undefined(via?) — "not provided / not yet set."null— an explicit "no value" the code sets deliberately (nullable column, "user cleared this field").- Do not mix both for the same kind of absence in one module.
Pitfalls to catch in review
// WRONG: async function catches error, logs it, then resolves — hides failure
async function save(data: Data): Promise<void> {
try {
await db.write(data);
} catch (err) {
logger.error('save failed', err);
// caller sees a successful promise despite the failure
}
}
// RIGHT: rethrow after logging so the caller can handle the failure
async function save(data: Data): Promise<void> {
try {
await db.write(data);
} catch (err) {
logger.error('save failed', err);
throw err; // caller knows this failed
}
}
// Type-cast escape hatch silences the compiler, not the bug
const result = someValue as SomeType; // risky without a runtime check
// Prefer a type guard:
function isSomeType(v: unknown): v is SomeType { /* ... */ }
// Non-null assertion hides null/undefined bugs
const name = user!.profile!.name; // crashes at runtime if null
// RIGHT: optional chaining + fallback
const name = user?.profile?.name ?? 'Unknown';Testing
tests/ or __tests__/ directories, *.test.ts / *.spec.ts files.
Use vitest for Vite-based projects, jest for Node/Next. See
patterns/testing/TDD.md for the broader methodology — this skill covers
TypeScript-specific structure only.
Formatting & tooling
Defer to the project's tsconfig.json and eslint.config.* — don't
impose defaults over an existing configured setup. If unconfigured:
strict: true in tsconfig, prettier for formatting (2-space indent,
single quotes), eslint with @typescript-eslint/recommended.
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
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.

