typescript-node-expert
Expert TypeScript/Node.js developer for building high-quality, performant, and maintainable CLI tools and libraries. Enforces best practices, strict typing, and modern patterns.
What this skill does
# TypeScript/Node.js Expert
## Overview
This skill provides expert guidance for TypeScript and Node.js development with a focus on:
- **Type Safety**: Strict TypeScript with full type coverage
- **Performance**: Async patterns, streaming, memory efficiency
- **Maintainability**: Clean architecture, SOLID principles
- **Modern Standards**: ES2022+, ESM modules, latest Node.js features
## PROACTIVE USAGE
**Invoke this skill before ANY TypeScript/Node.js work:**
- New features or modules
- Refactoring existing code
- Performance optimization
- Code review
- Bug fixes in TypeScript files
---
## Critical Rules - Zero Tolerance
### 1. Strict TypeScript Configuration
**Required `tsconfig.json` settings:**
```json
{
"compilerOptions": {
"strict": true,
"noUncheckedIndexedAccess": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"noImplicitOverride": true,
"exactOptionalPropertyTypes": true,
"forceConsistentCasingInFileNames": true,
"isolatedModules": true,
"moduleResolution": "NodeNext",
"module": "NodeNext",
"target": "ES2022",
"declaration": true,
"declarationMap": true,
"sourceMap": true
}
}
```
### 2. No `any` - Ever
```typescript
// ❌ FORBIDDEN
function process(data: any) { ... }
const result: any = await fetch();
// ✅ REQUIRED
function process(data: unknown) { ... }
function process<T extends Record<string, unknown>>(data: T) { ... }
// Use type guards
function isValidResponse(data: unknown): data is ApiResponse {
return typeof data === 'object' && data !== null && 'status' in data;
}
```
### 3. Explicit Return Types
```typescript
// ❌ FORBIDDEN
async function getData() {
return await db.query();
}
// ✅ REQUIRED
async function getData(): Promise<User[]> {
return await db.query();
}
```
### 4. Null Safety
```typescript
// ❌ FORBIDDEN
const name = user.profile.name; // Could be undefined
// ✅ REQUIRED - Optional chaining + nullish coalescing
const name = user?.profile?.name ?? 'Unknown';
// ✅ REQUIRED - Early return pattern
if (!user?.profile?.name) {
throw new Error('User profile name is required');
}
const name = user.profile.name;
```
---
## Performance Patterns
### 1. Async/Await Best Practices
```typescript
// ❌ SLOW - Sequential
const user = await getUser(id);
const posts = await getPosts(id);
const comments = await getComments(id);
// ✅ FAST - Parallel
const [user, posts, comments] = await Promise.all([
getUser(id),
getPosts(id),
getComments(id),
]);
// ✅ CONTROLLED - Promise.allSettled for fault tolerance
const results = await Promise.allSettled([
fetchFromService1(),
fetchFromService2(),
fetchFromService3(),
]);
const successful = results
.filter((r): r is PromiseFulfilledResult<Data> => r.status === 'fulfilled')
.map(r => r.value);
```
### 2. Streaming for Large Data
```typescript
import { createReadStream, createWriteStream } from 'fs';
import { pipeline } from 'stream/promises';
import { Transform } from 'stream';
// ❌ BAD - Loads entire file into memory
const content = await fs.readFile('large-file.json', 'utf-8');
const data = JSON.parse(content);
// ✅ GOOD - Stream processing
async function processLargeFile(inputPath: string, outputPath: string): Promise<void> {
const transform = new Transform({
objectMode: true,
transform(chunk, encoding, callback) {
const processed = processChunk(chunk);
callback(null, processed);
},
});
await pipeline(
createReadStream(inputPath),
transform,
createWriteStream(outputPath)
);
}
```
### 3. Memory-Efficient Collections
```typescript
// ❌ BAD - Creates intermediate arrays
const result = data
.filter(x => x.active)
.map(x => x.id)
.slice(0, 10);
// ✅ GOOD - Generator for lazy evaluation
function* filterAndMap<T, U>(
items: Iterable<T>,
predicate: (item: T) => boolean,
mapper: (item: T) => U,
limit = Infinity
): Generator<U> {
let count = 0;
for (const item of items) {
if (count >= limit) return;
if (predicate(item)) {
yield mapper(item);
count++;
}
}
}
const result = [...filterAndMap(data, x => x.active, x => x.id, 10)];
```
---
## Error Handling
### 1. Custom Error Classes
```typescript
// Define error hierarchy
export class AppError extends Error {
constructor(
message: string,
public readonly code: string,
public readonly statusCode: number = 500,
public readonly isOperational: boolean = true
) {
super(message);
this.name = this.constructor.name;
Error.captureStackTrace(this, this.constructor);
}
}
export class ValidationError extends AppError {
constructor(message: string, public readonly field?: string) {
super(message, 'VALIDATION_ERROR', 400);
}
}
export class NotFoundError extends AppError {
constructor(resource: string, id: string) {
super(`${resource} with id ${id} not found`, 'NOT_FOUND', 404);
}
}
```
### 2. Result Pattern (No Throw for Expected Failures)
```typescript
type Result<T, E = Error> =
| { success: true; data: T }
| { success: false; error: E };
async function parseConfig(path: string): Promise<Result<Config, string>> {
try {
const content = await fs.readFile(path, 'utf-8');
const config = JSON.parse(content);
if (!isValidConfig(config)) {
return { success: false, error: 'Invalid configuration format' };
}
return { success: true, data: config };
} catch (e) {
return { success: false, error: `Failed to read config: ${e}` };
}
}
// Usage
const result = await parseConfig('.config.json');
if (!result.success) {
console.error(result.error);
process.exit(1);
}
console.log(result.data);
```
---
## CLI Development Patterns
### 1. Commander.js Structure
```typescript
import { Command, Option } from 'commander';
const program = new Command()
.name('my-cli')
.description('CLI description')
.version('1.0.0', '-v, --version');
// Subcommand with options
program
.command('generate')
.description('Generate output files')
.argument('<input>', 'Input file path')
.option('-o, --output <path>', 'Output path', './output')
.option('-f, --format <type>', 'Output format', 'json')
.option('--dry-run', 'Preview without writing', false)
.addOption(
new Option('-l, --log-level <level>', 'Log level')
.choices(['debug', 'info', 'warn', 'error'])
.default('info')
)
.action(async (input: string, options: GenerateOptions) => {
try {
await runGenerate(input, options);
} catch (error) {
console.error(chalk.red(`Error: ${error instanceof Error ? error.message : error}`));
process.exit(1);
}
});
program.parseAsync();
```
### 2. User Feedback
```typescript
import ora from 'ora';
import chalk from 'chalk';
async function runWithSpinner<T>(
message: string,
task: () => Promise<T>
): Promise<T> {
const spinner = ora(message).start();
try {
const result = await task();
spinner.succeed();
return result;
} catch (error) {
spinner.fail();
throw error;
}
}
// Progress for multi-step operations
async function processFiles(files: string[]): Promise<void> {
const total = files.length;
for (let i = 0; i < files.length; i++) {
const file = files[i]!;
process.stdout.write(`\r${chalk.cyan('Processing')} [${i + 1}/${total}] ${file}`);
await processFile(file);
}
console.log(chalk.green('\n✔ All files processed'));
}
```
---
## Module Organization
### 1. Barrel Exports
```typescript
// types/index.ts - Export all types
export type { Config, Options, Result } from './config.js';
export type { User, UserProfile } from './user.js';
// Use in imports
import type { Config, User } from './types/index.js';
```
### 2. Dependency Injection
```typescript
// Define interfaces
interface Logger {
info(message: string): void;
error(message: string, error?: Error): void;
}
interface Database {
query<T>(sql: string, params?: unknown[]): Promise<T[]>;
}
// ServiceRelated in Backend & APIs
jfrog
IncludedInteract with the JFrog Platform via the JFrog CLI and REST/GraphQL APIs. Use this skill when the user wants to manage Artifactory repositories, upload or download artifacts, manage builds, configure permissions, manage users and groups, work with access tokens, configure JFrog CLI servers, search artifacts, manage properties, set up replication, manage JFrog Projects, run security audits or scans, look up CVE details, query exposures scan results from JFrog Advanced Security, manage release bundles and lifecycle operations, aggregate or export platform data, or perform any JFrog Platform administration task. Also use when the user mentions jf, jfrog, artifactory, xray, distribution, evidence, apptrust, onemodel, graphql, workers, mission control, curation, advanced security, exposures, or any JFrog product name.
cupynumeric-migration-readiness
IncludedPre-migration readiness assessor for porting NumPy to cuPyNumeric. Use BEFORE substantial porting work begins when the user asks whether code will scale on GPU, whether they should migrate to cuPyNumeric, which NumPy patterns transfer cleanly, what must be refactored before porting, or mentions pre-port assessment, scaling analysis, or refactor planning. Inspect the user's source code, look up NumPy usage, cross-reference the cuPyNumeric API support manifest, and distinguish distributed-scaling-friendly patterns from blockers such as unsupported APIs, scalar synchronization, host round-trips, Python/object-heavy control flow, shape/data-dependent branching, and in-place mutation hazards. Produce a verdict of READY, LIGHT REFACTOR, SIGNIFICANT REFACTOR, or NOT RECOMMENDED, with concrete refactor pointers.
alibabacloud-data-agent-skill
IncludedInvoke Alibaba Cloud Apsara Data Agent for Analytics via CLI to perform natural language-driven data analysis on enterprise databases. Data Agent for Analytics is an intelligent data analysis agent developed by Alibaba Cloud Database team for enterprise users. It automatically completes requirement analysis, data understanding, analysis insights, and report generation based on natural language descriptions. This tool supports: discovering data resources (instances/databases/tables) managed in DMS, initiating query or deep analysis sessions, real-time progress tracking, and retrieving analysis conclusions and generated reports. Use this Skill when users need to query databases, analyze data trends, generate data reports, ask questions in natural language, or mention "Data Agent", "data analysis", "database query", "SQL analysis", "data insights".
token-optimizer
IncludedReduce OpenClaw token usage and API costs through smart model routing, heartbeat optimization, budget tracking, and native 2026.2.15 features (session pruning, bootstrap size limits, cache TTL alignment). Use when token costs are high, API rate limits are being hit, or hosting multiple agents at scale. The 4 executable scripts (context_optimizer, model_router, heartbeat_optimizer, token_tracker) are local-only — no network requests, no subprocess calls, no system modifications. Reference files (PROVIDERS.md, config-patches.json) document optional multi-provider strategies that require external API keys and network access if you choose to use them. See SECURITY.md for full breakdown.
resend-cli
IncludedUse this skill when the task is specifically about operating Resend from an AI agent, terminal session, or CI job via the official resend CLI: installing/authenticating the CLI, sending/listing/updating/cancelling emails, batch sends, domains and DNS, webhooks and local listeners, inbound receiving, contacts, topics, segments, broadcasts, templates, API keys, profiles, or debugging Resend CLI/API failures. Trigger on mentions of Resend CLI, `resend`, `resend doctor`, `resend emails send`, `resend domains`, `resend webhooks listen`, `resend emails receiving`, or agent-friendly terminal automation.
alibabacloud-odps-maxframe-coding
IncludedUse this skill for MaxFrame SDK development and documentation navigation on Alibaba Cloud MaxCompute (ODPS). Helps answer MaxFrame API, concept, official example, and supported pandas API questions; create data processing programs; read/write MaxCompute tables; debug jobs (remote or local); and build custom DPE runtime images. Trigger when users mention MaxFrame, MaxCompute with MaxFrame, ODPS table processing, DPE runtime, MaxFrame docs/examples, DataFrame/Tensor operations, or GPU runtime setup. Works for both English and Chinese queries about Alibaba Cloud data processing with MaxFrame.