Agent skill
typescript-patterns
TypeScript and JavaScript development patterns including package manager detection (npm, pnpm, bun, yarn), project structure, and Node.js backend/tooling. Use when writing, reviewing, or refactoring TypeScript/JavaScript application or library code. Do NOT use for test code -- use typescript-testing instead.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/typescript-patterns-cooldaemon-dotfiles
SKILL.md
TypeScript/JavaScript Patterns
Patterns for TypeScript and JavaScript development (Node.js, tooling).
Package Manager Detection (CRITICAL)
Before running ANY npm/package commands, detect the package manager:
| File | Package Manager | Install | Run Script |
|---|---|---|---|
bun.lockb or bun.lock |
bun | bun install |
bun run |
pnpm-lock.yaml |
pnpm | pnpm install |
pnpm run |
yarn.lock |
yarn | yarn install |
yarn |
package-lock.json |
npm | npm install |
npm run |
| None (new project) | npm | npm init -y |
npm run |
NEVER use npm install directly when a non-npm lock file exists.
Follow the existing project's lock file. Never mix package managers.
Async/Await Patterns
Parallel Execution
// GOOD: Parallel when independent
const [users, markets, stats] = await Promise.all([
fetchUsers(),
fetchMarkets(),
fetchStats()
])
// BAD: Sequential when unnecessary
const users = await fetchUsers()
const markets = await fetchMarkets()
const stats = await fetchStats()
Type Safety
// GOOD: Proper types with union for status
interface Market {
id: string
name: string
status: 'active' | 'resolved' | 'closed'
created_at: Date
}
function getMarket(id: string): Promise<Market> { }
Module Organization
src/
├── index.ts # Entry point
├── types/ # TypeScript types
├── lib/ # Utilities and helpers
├── services/ # Business logic
└── handlers/ # Request handlers
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?