Resolve all TypeScript errors using root cause analysis, targeted fixes, and mandatory validation
Resolves TypeScript errors through root cause analysis and targeted fixes. Triggers when you ask to fix type errors in a specific file, running validation until zero errors remain.
/plugin marketplace add djankies/claude-configs/plugin install typescript@claude-configsThis skill inherits all available tools. When active, it can use any tool Claude has access to.
Project configuration: read tsconfig.json if haven't already read package.json if haven't already
Run type check and collect all errors for the target file:
pnpm type-check 2>&1 | grep "target-file"
Replace target-file with the actual file path from the user's request.
List all errors with:
Prioritize errors by dependency order:
Read the target file specified by the user.
For each error, trace to underlying cause:
Verify type structures from source:
Identify root cause categories:
Consider impact on dependent code:
Apply targeted fixes using Edit tool.
For type narrowing:
if (typeof value === 'string') {
}
if (value !== null && value !== undefined) {
}
if ('property' in object) {
}
if (Array.isArray(value)) {
}
For generic constraints:
function process<T extends SomeType>(value: T): void {}
For union discrimination:
type Result = { success: true; data: Data } | { success: false; error: Error };
if (result.success) {
result.data;
} else {
result.error;
}
For null safety:
value?.property;
value ?? defaultValue;
const nonNull = value!;
For unknown types:
function parse(input: unknown): Result {
if (typeof input !== 'object' || input === null) {
throw new Error('Invalid input');
}
const obj = input as Record<string, unknown>;
if (typeof obj.property !== 'string') {
throw new Error('Invalid property');
}
return { property: obj.property };
}
Minimal changes:
Address root causes:
Maintain consistency:
Prefer interfaces over types (for objects):
interface User {
id: string;
name: string;
}
Use type aliases for unions/primitives:
type Status = 'pending' | 'complete' | 'error';
type ID = string;
Use unknown over any:
const data: unknown = JSON.parse(input);
Run type check after fixes on the target file:
pnpm type-check 2>&1 | grep "target-file"
Replace target-file with the actual file path.
Success criteria: MUST show zero TypeScript errors
If errors remain:
NEVER leave file in broken state
</task> <constraints> **Type Safety Requirements:** - NEVER use `any` type (use `unknown` + guards) - NEVER use `@ts-ignore` or `@ts-expect-error` - ALWAYS verify type structures from source - ALWAYS preserve type safety during fixes - MUST add type guards for narrowing - MUST use generic constraints appropriatelyCode Quality Requirements:
Resolution Requirements:
pnpm type-check 2>&1 | grep "target-file"
Replace target-file with the actual file path. Must show zero errors or report "No errors found".
File Integrity:
Failure Handling:
For each fix:
Location: {file}:{line}
Original error:
{TypeScript error message}
Change made:
{Code change applied}
Rationale: {Why this fix resolves the error}
{Output of type check showing zero errors}
✅ All TypeScript errors resolved ✅ Type safety maintained ✅ Zero errors remaining
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.