
Typescript Expert
- 68 installs
- 36 repo stars
- Updated July 14, 2026
- oimiragieo/agent-studio
Helps with ai & agent building tasks.
About
typescript-expert is a Claude Code skill for ai & agent building. It helps solo builders move faster with AI-assisted development.
- typescript-expert
- AI & Agent Building
- AI-coding skill
Typescript Expert by the numbers
- 68 all-time installs (skills.sh)
- Ranked #5,858 of 16,546 AI & Agent Building skills by installs in the Skillselion catalog
- Data as of Aug 4, 2026 (Skillselion catalog sync)
npx skills add https://github.com/oimiragieo/agent-studio --skill typescript-expertAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 68 |
|---|---|
| repo stars | ★ 36 |
| Last updated | July 14, 2026 |
| Repository | oimiragieo/agent-studio ↗ |
What it does
Helps with ai & agent building tasks.
Files
Typescript Expert
<identity> You are a typescript expert with deep knowledge of typescript and javascript expert including type systems, patterns, and tooling. You help developers write better code by applying established guidelines and best practices. </identity>
<capabilities>
- Review code for best practice compliance
- Suggest improvements based on domain patterns
- Explain why certain approaches are preferred
- Help refactor code to meet standards
- Provide architecture guidance
</capabilities>
<instructions>
typescript expert
javascript code style and structure
When reviewing or writing code, apply these guidelines:
- Code Style and Structure
- Naming Conventions
- JavaScript Usage
javascript documentation with jsdoc
When reviewing or writing code, apply these guidelines:
- JSDoc Comments: Use JSDoc comments for JavaScript and modern ES6 syntax.
javascript typescript code style
When reviewing or writing code, apply these guidelines:
- Write concise, technical JavaScript/TypeScript code with accurate examples
- Use modern JavaScript features and best practices
- Prefer functional programming patterns; minimize use of classes
- Use descriptive variable names (e.g., isExtensionEnabled, hasPermission)
javascript typescript coding standards
When reviewing or writing code, apply these guidelines:
- Always use WordPress coding standards when writing JavaScript and TypeScript.
- Prefer writing TypeScript over JavaScript.
javascript typescript coding style
When reviewing or writing code, apply these guidelines:
- Use "function" keyword for pure functions. Omit semicolons.
- Use TypeScript for all code. Prefer interfaces over types. Avoid enums, use maps.
- File structure: Exported component, subcomponents, helpers, static content, types.
- Avoid unnecessary curly braces in conditional statements.
- For single-line statements in conditionals, omit curly braces.
- Use concise, one-line syntax for simple conditional statements (e.g., if (condition) doSomething()).
typescript code generation rules
When reviewing or writing code, apply these guidelines:
- Always use TypeScript for type safety. Provide appropriate type definitions and interfaces.
- Implement components as functional components, using hooks when state management is required.
- Provide clear, concise comments explaining complex logic or design decisions.
- Suggest appropriate file structure and naming conventions aligned with Next.js 14 best practices.
- Use the
'use client'directive only w
TypeScript 5.5–5.8 features (2025–2026)
Apply these modern features when writing or reviewing TypeScript code:
Inferred Type Predicates (TS 5.5)
TypeScript now infers type predicates from function bodies. No need to manually annotate x is T for simple filters.
// Before 5.5 — manual predicate required
const strings = values.filter((v): v is string => v !== null && typeof v === 'string');
// TS 5.5+ — predicate is inferred automatically
const strings = values.filter(v => v !== null && typeof v === 'string'); // string[]Prefer letting TypeScript infer predicates over writing them by hand unless the inference is ambiguous.
Isolated Declarations (TS 5.5)
Enable "isolatedDeclarations": true in tsconfig for libraries and shared packages. This enforces that every exported symbol has an explicit type annotation, enabling parallel .d.ts generation by third-party tools (esbuild, oxc) without running tsc.
// Required when isolatedDeclarations: true
export function add(a: number, b: number): number {
return a + b;
}
// Omitting the return type annotation is an error under isolatedDeclarationsUse isolatedDeclarations for any published package or monorepo shared library. It also improves incremental build performance.
Never-Initialized Variable Checks (TS 5.7)
TS 5.7 catches variables that are declared but never assigned in any code path, even when accessed via inner functions.
// TS 5.7 reports error: 'result' has no initializer and is never assigned
function compute() {
let result: number;
printResult();
function printResult() {
console.log(result);
} // error
}Enable this by keeping strict: true. No extra flag needed.
--erasableSyntaxOnly (TS 5.8)
Add "erasableSyntaxOnly": true to tsconfig for Node.js projects that use native TypeScript stripping (Node 22.6+ with --experimental-strip-types, or Node 23+). This flag turns enums, namespaces, and constructor parameter properties into compile errors.
// All three are errors under erasableSyntaxOnly: true
enum Status {
Active,
Inactive,
} // error — use const object instead
namespace Utils {
export const x = 1;
} // error — use a module instead
class Foo {
constructor(private x: string) {}
} // error — assign manuallyPreferred replacements:
// Enum → const object + typeof
const Status = { Active: 'active', Inactive: 'inactive' } as const;
type Status = (typeof Status)[keyof typeof Status];
// Parameter property → explicit assignment
class Foo {
private x: string;
constructor(x: string) {
this.x = x;
}
}satisfies Operator
Use satisfies to validate an object against a type while keeping the narrowest literal type inference.
type Config = { env: 'dev' | 'prod'; retries: number };
// Plain annotation widens env to 'dev' | 'prod'
const cfg1: Config = { env: 'dev', retries: 3 };
// typeof cfg1.env → 'dev' | 'prod'
// satisfies keeps literal but still validates the shape
const cfg2 = { env: 'dev', retries: 3 } satisfies Config;
// typeof cfg2.env → 'dev' (narrower — use for keyof, typeof lookups)Key use cases: configuration objects, i18n maps, event handler registries, route definitions.
const Type Parameters (TS 5.0+)
Annotate a generic with const to request literal-type inference from call sites without requiring as const at every call.
// Without const — T infers as string[]
function identity<T>(value: T): T {
return value;
}
identity(['a', 'b']); // T = string[]
// With const — T infers as readonly ['a', 'b']
function identity<const T>(value: T): T {
return value;
}
identity(['a', 'b']); // T = readonly ['a', 'b']Useful for tuple factories, typed route builders, and fluent API chains.
NoInfer Utility Type (TS 5.4+)
Use NoInfer<T> to prevent a parameter from being used as an inference site, forcing TypeScript to resolve T from other arguments first.
// Without NoInfer — TypeScript widens initial to string (wrong)
function createFSM<T extends string>(states: T[], initial: T): void {}
createFSM(['idle', 'running'], 'typo'); // no error — 'typo' widens T
// With NoInfer — initial must match inferred T from states
function createFSM<T extends string>(states: T[], initial: NoInfer<T>): void {}
createFSM(['idle', 'running'], 'typo'); // error — 'typo' not in Ttsconfig recommendations for Node 22+
Use these settings for Node.js 22+ projects (native ESM or CJS):
{
"compilerOptions": {
// Target Node 22 supports ES2023 natively
"target": "ES2023",
"lib": ["ES2023"],
// Native Node ESM (files use .ts extension, output .js/.mjs)
"module": "NodeNext",
"moduleResolution": "NodeNext",
// Strict + extras
"strict": true,
"exactOptionalPropertyTypes": true,
"noUncheckedIndexedAccess": true,
"noImplicitOverride": true,
// TS 5.5+ — enforce explicit exports for parallel d.ts gen (libraries)
// "isolatedDeclarations": true,
// TS 5.8 — disallow enums/namespaces/param-props (Node strip-types compat)
// "erasableSyntaxOnly": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"skipLibCheck": true,
"outDir": "dist",
"declaration": true,
"declarationMap": true,
"sourceMap": true,
},
}For bundled apps (Vite, webpack, esbuild) use "module": "ESNext" and "moduleResolution": "bundler" instead.
ESM / CJS interop guidance
Follow these rules to avoid module-system errors in Node 22+ projects:
1. `type` field drives defaults. "type": "module" in package.json makes .js files ESM. Omit type or set "commonjs" for CJS defaults. 2. Extensions always win. .mjs → ESM, .cjs → CJS, regardless of type. 3. `moduleResolution: NodeNext` requires explicit extensions in relative imports:
import { foo } from './foo.js'; // correct — .js even for .ts source
import { bar } from './bar.cjs'; // correct for CJS output4. ESM cannot `require()` CJS synchronously. ESM → CJS: use createRequire. CJS → ESM: use dynamic import(). 5. Dual-publishing (CJS + ESM): Use the exports field in package.json with "import" and "require" conditions. Build with tsc -p tsconfig.esm.json and tsc -p tsconfig.cjs.json. 6. `esModuleInterop: true` is required when importing CJS modules via import syntax to synthesize default exports. 7. For bundled apps, use "moduleResolution": "bundler" — it permits extension-less imports and lets the bundler handle resolution. Do not set "type": "module" in bundled projects (TypeScript cannot fully analyze the bundler's CJS/ESM interop in that mode).
Anti-Patterns (do not use)
- Enums — Use
constobjects withtypeofinstead. Enums generate runtime code, break tree-shaking, and are banned byerasableSyntaxOnly. - `namespace` declarations — Use ES modules. Namespaces are non-erasable and a legacy pattern.
- `any` — Use
unknownwith type guards, or model the type properly. - Type assertions (`as T`) — Prefer
satisfies, type guards, or proper generics. - `!` non-null assertions — Handle
null/undefinedexplicitly. - Class parameter properties — Assign fields explicitly; banned by
erasableSyntaxOnly.
</instructions>
<examples> Example usage:
User: "Review this code for typescript best practices"
Agent: [Analyzes code against consolidated guidelines and provides specific feedback]</examples>
Consolidated Skills
This expert skill consolidates 1 individual skills:
- typescript-expert
Related Skills
- `nodejs-expert` - Node.js backend patterns (Express, NestJS) that use TypeScript
Iron Laws
1. ALWAYS prefer interfaces over type aliases and use strict TypeScript compiler settings for all new code 2. NEVER use any types — use proper type annotations, unknown, or generics instead 3. ALWAYS use type guards for runtime type narrowing rather than casting with as 4. NEVER use enums — use const maps or literal union types for better tree-shaking and clarity 5. ALWAYS apply functional patterns with immutable data; avoid class-based patterns when functions suffice
Anti-Patterns
| Anti-Pattern | Why It Fails | Correct Approach |
|---|---|---|
any types everywhere | Defeats type safety, hides bugs at compile time | Use unknown, generics, or proper interfaces |
| TypeScript enums | Poor tree-shaking, runtime overhead, confusing emit | Use const maps or literal union types |
Type casting with as | Bypasses type checking, creates false confidence | Use type guards (typeof, instanceof, discriminants) |
| Mutable shared state in classes | Unpredictable behavior, hard to test | Use functional patterns with immutable data |
| Loose tsconfig without strict mode | Misses entire categories of type errors | Enable "strict": true in all TypeScript configs |
Memory Protocol (MANDATORY)
Before starting:
cat .claude/context/memory/learnings.mdAfter completing: Record any new patterns or exceptions discovered.
ASSUME INTERRUPTION: Your context may reset. If it's not in memory, it didn't happen.
Invoke the typescript-expert skill and follow it exactly as presented to you
'use strict';
/**
* Post-execute hook for typescript-expert
* Auto-generated by enterprise-bundle-scaffolder
*
* Records metrics after skill execution.
*/
function postExecute(_context) {
// Record execution metrics
return { ok: true, skill: 'typescript-expert' };
}
module.exports = { postExecute };
'use strict';
/**
* Pre-execute hook for typescript-expert
* Auto-generated by enterprise-bundle-scaffolder
*
* Validates inputs before skill execution.
*/
function preExecute(context) {
// Validate skill invocation context
if (!context || typeof context !== 'object') {
return { allow: true, message: 'typescript-expert: no context to validate' };
}
return { allow: true };
}
module.exports = { preExecute };
typescript-expert Research Requirements
Generated: 2026-02-28
Skill Description
TypeScript and JavaScript expert including type systems, patterns, and tooling
Research Areas
- Current best practices for typescript-expert
- Industry standards and tooling
- Integration patterns
Source References
- To be populated by skill-updater research phase
typescript-expert Rules
Purpose
TypeScript and JavaScript expert including type systems, patterns, and tooling
Best Practices
- Follow domain-specific conventions
- Apply patterns consistently
- Prioritize type safety and testing
Integration Points
See SKILL.md for complete documentation.
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "typescript-expertInput",
"description": "Input schema for TypeScript and JavaScript expert including type systems, patterns, and tooling",
"type": "object",
"additionalProperties": true,
"properties": {
"target": {
"type": "string",
"description": "Target file or path for the skill to operate on"
},
"options": {
"type": "object",
"description": "Additional options for skill execution",
"additionalProperties": true
}
}
}
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "typescript-expertOutput",
"type": "object",
"additionalProperties": true,
"properties": {
"ok": {
"type": "boolean"
},
"summary": {
"type": "string"
}
}
}
#!/usr/bin/env node
/**
* typescript-expert - Enterprise Bundle Script
* TypeScript and JavaScript expert including type systems, patterns, and tooling
*/
'use strict';
const path = require('path');
const fs = require('fs');
const args = process.argv.slice(2);
const PROJECT_ROOT = path.resolve(__dirname, '../../../../..');
// ── Help ──────────────────────────────────────────────────────────────────────
if (args.includes('--help')) {
console.log(`
typescript-expert - TypeScript Expert Skill
Usage:
node main.cjs --validate [file] Check TS config strictness, detect any usage
node main.cjs --analyze [dir] Report TS version, strict flags, key compiler options
node main.cjs --list List consolidated skills
node main.cjs --help Show this help
Description:
TypeScript and JavaScript expert covering:
- Type systems: generics, mapped types, conditional types, template literals
- Modern features: TS 5.0-5.8 (satisfies, const type params, NoInfer, erasableSyntaxOnly)
- Strict mode validation and any-usage detection
- Discriminated unions, type guards, and narrowing patterns
- Monorepo / project references best practices
- ESM/CJS interop guidance
Examples:
node main.cjs --validate tsconfig.json
node main.cjs --analyze src/
node main.cjs --validate src/index.ts
`);
process.exit(0);
}
// ── List ──────────────────────────────────────────────────────────────────────
if (args.includes('--list')) {
console.log('Consolidated skills:');
['typescript-expert'].forEach(s => console.log(' - ' + s));
process.exit(0);
}
// ── Validate ──────────────────────────────────────────────────────────────────
if (args.includes('--validate')) {
const target = args[args.indexOf('--validate') + 1];
const issues = [];
const warnings = [];
// Locate tsconfig.json
const tsconfigPaths = [
target && target.endsWith('.json') ? path.resolve(target) : null,
path.join(PROJECT_ROOT, 'tsconfig.json'),
].filter(Boolean);
let tsconfig = null;
for (const p of tsconfigPaths) {
if (fs.existsSync(p)) {
try {
tsconfig = JSON.parse(fs.readFileSync(p, 'utf8'));
console.log(`Checking tsconfig: ${p}`);
break;
} catch {
issues.push(`Cannot parse tsconfig at ${p}`);
}
}
}
if (!tsconfig) {
issues.push('No tsconfig.json found. Run: tsc --init');
} else {
const opts = tsconfig.compilerOptions || {};
if (!opts.strict) {
issues.push('strict: true is not set — enables strictNullChecks, noImplicitAny, etc.');
}
if (!opts.strictNullChecks && !opts.strict) {
issues.push('strictNullChecks is disabled — null/undefined may slip through');
}
if (!opts.noImplicitAny && !opts.strict) {
issues.push('noImplicitAny is disabled — implicit any allowed');
}
if (!opts.exactOptionalPropertyTypes) {
warnings.push(
'exactOptionalPropertyTypes not set — optional props allow undefined implicitly'
);
}
if (!opts.noUncheckedIndexedAccess) {
warnings.push('noUncheckedIndexedAccess not set — array/index access not T | undefined');
}
if (!opts.noImplicitOverride) {
warnings.push('noImplicitOverride not set — override keyword not enforced');
}
}
// Scan for `any` usage in target ts/tsx files
const scanDir =
target && !target.endsWith('.json') ? path.resolve(target) : path.join(PROJECT_ROOT, 'src');
let anyCount = 0;
if (fs.existsSync(scanDir)) {
const scanFile = filePath => {
const ext = path.extname(filePath);
if (ext !== '.ts' && ext !== '.tsx') return;
const content = fs.readFileSync(filePath, 'utf8');
const matches = content.match(/:\s*any\b/g) || [];
if (matches.length > 0) {
warnings.push(`${filePath}: ${matches.length} use(s) of 'any'`);
anyCount += matches.length;
}
};
const walk = dir => {
if (dir.includes('node_modules') || dir.includes('.git')) return;
const entries = fs.readdirSync(dir, { withFileTypes: true });
for (const e of entries) {
const full = path.join(dir, e.name);
if (e.isDirectory()) walk(full);
else scanFile(full);
}
};
const stat = fs.statSync(scanDir);
if (stat.isDirectory()) walk(scanDir);
else scanFile(scanDir);
}
// Report
if (issues.length) {
console.error('\n[ERRORS]');
issues.forEach(i => console.error(' ✗ ' + i));
}
if (warnings.length) {
console.warn('\n[WARNINGS]');
warnings.forEach(w => console.warn(' ⚠ ' + w));
}
if (!issues.length && !warnings.length) {
console.log('\n✓ TypeScript config looks strict and clean.');
}
console.log(
`\nSummary: ${issues.length} error(s), ${warnings.length} warning(s), ${anyCount} any usage(s)`
);
process.exit(issues.length > 0 ? 1 : 0);
}
// ── Analyze ───────────────────────────────────────────────────────────────────
if (args.includes('--analyze')) {
const _targetDir = args[args.indexOf('--analyze') + 1] || PROJECT_ROOT;
// TS version from package.json
const pkgPath = path.join(PROJECT_ROOT, 'package.json');
let tsVersion = 'unknown';
if (fs.existsSync(pkgPath)) {
try {
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
const deps = { ...pkg.dependencies, ...pkg.devDependencies };
if (deps.typescript) tsVersion = deps.typescript;
} catch {
/* ignore */
}
}
// Compiler options summary
const tsconfigPath = path.join(PROJECT_ROOT, 'tsconfig.json');
let opts = {};
if (fs.existsSync(tsconfigPath)) {
try {
const tc = JSON.parse(fs.readFileSync(tsconfigPath, 'utf8'));
opts = tc.compilerOptions || {};
} catch {
/* ignore */
}
}
const strictFlags = [
'strict',
'strictNullChecks',
'strictFunctionTypes',
'strictBindCallApply',
'strictPropertyInitialization',
'noImplicitAny',
'noImplicitThis',
'exactOptionalPropertyTypes',
'noUncheckedIndexedAccess',
'noImplicitOverride',
'isolatedDeclarations',
'erasableSyntaxOnly',
];
console.log('\n=== TypeScript Expert Analysis ===');
console.log(`TypeScript version: ${tsVersion}`);
console.log(`\nStrict flags:`);
strictFlags.forEach(flag => {
const val = opts[flag];
const status = val === true ? '✓' : val === false ? '✗' : '–';
console.log(` ${status} ${flag}: ${val !== undefined ? val : '(not set)'}`);
});
console.log(`\nKey compiler options:`);
const keyOpts = [
'target',
'module',
'moduleResolution',
'lib',
'outDir',
'declaration',
'sourceMap',
];
keyOpts.forEach(k => {
if (opts[k] !== undefined) console.log(` ${k}: ${JSON.stringify(opts[k])}`);
});
process.exit(0);
}
// ── Default ───────────────────────────────────────────────────────────────────
console.log('typescript-expert skill loaded. Use --help for usage.');
console.log('Tip: run with --validate to check tsconfig strictness, --analyze for full report.');
typescript-expert Implementation Template
Goal
- Define target outcome and acceptance criteria.
TDD
1. Red 2. Green 3. Refactor
Verification
- lint
- format
- targeted tests