Comprehensive TypeScript development guidance covering configuration, type safety, architectural patterns, and best practices. Use when working with TypeScript codebases for (1) TypeScript configuration and setup (tsconfig.json, strict mode), (2) Type definitions and patterns (utility types, type-safe approaches), (3) Resolving TypeScript compilation errors, (4) Applying TypeScript best practices (project structure, error handling, package selection). Automatically triggered when working in .ts/.tsx files or addressing TypeScript-specific queries.
From devsnpx claudepluginhub aaronbassett/agent-foundry --plugin devsThis skill uses the workspace's default tool permissions.
assets/tsconfig-templates/library.jsonassets/tsconfig-templates/monorepo-base.jsonassets/tsconfig-templates/strict-node.jsonassets/tsconfig-templates/strict-react.jsonreferences/code-review.mdreferences/common-errors.mdreferences/dependencies.mdreferences/error-handling.mdreferences/naming.mdreferences/packages-always-use.mdreferences/packages-cli.mdreferences/packages-utilities.mdreferences/patterns.mdreferences/principles.mdreferences/project-structure.mdreferences/strict-configuration.mdreferences/testing.mdreferences/type-utilities.mdSearches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
Searches prompts.chat for AI prompt templates by keyword or category, retrieves by ID with variable handling, and improves prompts via AI. Use for discovering or enhancing prompts.
Implements structured self-debugging workflow for AI agent failures: capture errors, diagnose patterns like loops or context overflow, apply contained recoveries, and generate introspection reports.
Comprehensive guidance for TypeScript development with strict type safety, functional patterns, and modern tooling.
Follow these fundamental principles in all TypeScript work:
See principles.md for detailed guidance.
Choose the appropriate tsconfig template based on project type:
Install required dependencies - Always use the latest versions with pnpm:
pnpm add -D typescript @types/node
pnpm add effect zod true-myth @logtape/logtape
Configure strict linting - See strict-configuration.md for ESLint and Prettier setup
Organize project structure - Follow feature-oriented layout from project-structure.md
When encountering TypeScript compilation errors:
All projects must use strict TypeScript configuration to catch errors early and maintain code quality.
Key requirements:
strict: true (includes all strict type-checking options)noUncheckedIndexedAccess: true (not in strict by default, prevents undefined array access issues)See strict-configuration.md for complete tsconfig.json and ESLint setup.
Prefer True Myth's Maybe type over null/undefined:
import Maybe from 'true-myth/maybe';
// Instead of: User | null
function findUser(id: string): Maybe<User> {
const user = db.findById(id);
return Maybe.of(user);
}
// Use with chaining
const userName = findUser("123")
.map(user => user.name)
.unwrapOr("Unknown");
Use Result types instead of throwing exceptions:
import Result from 'true-myth/result';
// Instead of throwing
function parseConfig(data: string): Result<Config, ParseError> {
try {
const parsed = JSON.parse(data);
return Result.ok(parsed);
} catch (e) {
return Result.err(new ParseError("Invalid JSON", e));
}
}
// Use with pattern matching
parseConfig(data)
.match({
Ok: config => console.log("Config loaded:", config),
Err: error => console.error("Parse failed:", error)
});
For complex async operations, prefer Effect over raw Promises - See error-handling.md for complete strategy.
Leverage built-in utility types for type transformations:
Partial<T> - Make all properties optional (partial updates)Required<T> - Make all properties requiredPick<T, K> - Extract specific properties (DTOs, API responses)Omit<T, K> - Exclude properties (hide sensitive fields)Record<K, V> - Type-safe dictionaries/mapsReturnType<T> - Extract function return typeParameters<T> - Extract function parameter typesSee type-utilities.md for comprehensive guide with examples.
Favor composing functionality rather than class hierarchies:
// Prefer this
const withLogging = <T extends (...args: any[]) => any>(fn: T) => {
return ((...args: Parameters<T>) => {
logger.info("Calling function", { args });
return fn(...args);
}) as T;
};
// Over this
class LoggableService extends BaseService {
// ...
}
Chain operations with Effect or Result types to handle errors gracefully:
import { pipe } from 'effect';
import Result from 'true-myth/result';
const result = pipe(
validateInput(data),
Result.andThen(processData),
Result.andThen(saveToDatabase),
Result.mapErr(err => new ApplicationError("Process failed", err))
);
See patterns.md for complete pattern library including immutability, pattern matching, and concurrency patterns.
Structure projects by feature, not by technical type:
src/
├── features/
│ └── users/
│ ├── components/
│ ├── services/
│ ├── hooks/
│ └── types.ts
├── lib/
│ ├── api/
│ └── utils/
└── state/
See project-structure.md for complete layouts for web apps, backends, CLIs, and monorepos.
These packages are included by default in new projects:
Maybe/Result types for null safety and error handlingSee packages-always-use.md for detailed rationale and usage.
Context-specific packages for common needs:
For command-line applications:
Use Vitest with Testing Library for all tests:
import { describe, it, expect } from 'vitest';
describe('UserService', () => {
it('should create user with valid input', () => {
const result = createUser({ name: "Alice", email: "alice@example.com" });
expect(result.isOk()).toBe(true);
});
});
See testing.md for complete testing strategy including React component testing, Effect testing, and MSW for API mocking.
Before submitting code:
tsc --noEmit passes with no errorsSee code-review.md for complete checklist.
pnpm audit before releasespnpm-lock.yaml always in version controlSee dependencies.md for update strategies and security practices.
Configuration & Setup:
Patterns & Practices:
TypeScript-Specific:
Packages:
Pre-configured tsconfig.json files for quick project setup: