with one click
typescript-expert
Advanced TypeScript patterns and best practices
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Menu
Advanced TypeScript patterns and best practices
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Based on SOC occupation classification
Pull request lifecycle domain knowledge — branch strategy detection, PR size classification, confidence-scored review, git-aware context, PR analytics, dependency management, and split/merge/describe operations.
Production readiness audit domains, weighted scoring criteria, and check specifications for the /preflight workflow.
Application scaffolding orchestrator. Creates full-stack applications from requirements, selects tech stack, coordinates agents.
Production deployment workflows, rollback strategies, and CI/CD best practices.
Internationalization and localization patterns for multi-language applications
Mobile UI/UX patterns for iOS and Android. Touch-first, platform-respectful design with React Native/Expo focus.
| name | typescript-expert |
| description | Advanced TypeScript patterns and best practices |
| triggers | ["context","typescript","types","generics"] |
Purpose: Apply advanced TypeScript patterns for type-safe code
This skill provides advanced TypeScript techniques for building robust, type-safe applications.
// Partial - all properties optional
type UpdateUser = Partial<User>;
// Required - all properties required
type CompleteUser = Required<User>;
// Pick - select specific properties
type UserCredentials = Pick<User, "email" | "password">;
// Omit - exclude specific properties
type PublicUser = Omit<User, "password" | "hashedToken">;
// Record - key-value mapping
type UserRoles = Record<string, Role>;
function identity<T>(value: T): T {
return value;
}
function getProperty<T, K extends keyof T>(obj: T, key: K): T[K] {
return obj[key];
}
class Repository<T extends { id: string }> {
async findById(id: string): Promise<T | null> { ... }
async save(entity: T): Promise<T> { ... }
}
function process(value: string | number) {
if (typeof value === "string") {
return value.toUpperCase();
}
return value * 2;
}
function handleError(error: Error | string) {
if (error instanceof ValidationError) {
return { code: "VALIDATION", message: error.message };
}
return { code: "UNKNOWN", message: String(error) };
}
interface User {
type: "user";
name: string;
}
interface Admin {
type: "admin";
name: string;
permissions: string[];
}
function isAdmin(person: User | Admin): person is Admin {
return person.type === "admin";
}
type Result<T> = { success: true; data: T } | { success: false; error: string };
function handleResult<T>(result: Result<T>) {
if (result.success) {
console.log(result.data); // TypeScript knows data exists
} else {
console.error(result.error); // TypeScript knows error exists
}
}
type Readonly<T> = {
readonly [P in keyof T]: T[P];
};
type Optional<T> = {
[P in keyof T]?: T[P];
};
type Nullable<T> = {
[P in keyof T]: T[P] | null;
};
| Pattern | Usage |
|---|---|
Partial<T> | Optional updates |
Required<T> | Strict validation |
Pick<T, K> | Select properties |
Omit<T, K> | Exclude properties |
Record<K, V> | Key-value maps |
Extract<T, U> | Filter union types |
Exclude<T, U> | Exclude union types |
NonNullable<T> | Remove null/undefined |