TypeScript type safety patterns and best practices for maximum type coverage. Triggers: 型安全, type safety, any, unknown, 型推論, 型ガード, type guard, discriminated union, 判別可能なUnion, strictNullChecks, 型定義, 型カバレッジ, TypeScript, 暗黙のany, implicit any, 型アサーション, type assertion.
/plugin marketplace add thkt/claude-config/plugin install complete-workflow-system@thkt-development-workflowsThis skill is limited to using the following tools:
references/strict-mode.mdreferences/type-coverage.mdreferences/type-guards.mdTarget: Maximum type safety with minimal type gymnastics.
| Context | Target | Warning |
|---|---|---|
| Type coverage | 95%+ | < 90% |
| Any usage | 0 (justified only) | > 5 instances |
| Type assertions | Minimal | > 10 instances |
| Implicit any | 0 | Any > 0 |
| Strict mode | All enabled | Any disabled |
| Section | File | Focus | Triggers |
|---|---|---|---|
| Coverage | references/type-coverage.md | Explicit types, avoiding any | any, unknown, 型カバレッジ |
| Guards | references/type-guards.md | Narrowing, discriminated unions | 型ガード, type guard |
| Strict | references/strict-mode.md | tsconfig, React types | strictNullChecks, React |
any without explicit justificationis functions)neveras)strictNullChecks: truenoImplicitAny: truestrictFunctionTypes: true| Principle | Application |
|---|---|
| Fail Fast | Catch errors at compile-time, not runtime |
| Let TS Infer | Don't over-type what's already clear |
| Types as Docs | Good types serve as documentation |
| Prefer unknown | Use unknown over any for safer handling |
function isSuccess<T>(response: Response<T>): response is SuccessResponse<T> {
return response.success === true;
}
type Action =
| { type: "INCREMENT"; payload: number }
| { type: "DECREMENT"; payload: number }
| { type: "RESET" };
// Exhaustive check
function reducer(action: Action): number {
switch (action.type) {
case "INCREMENT":
return action.payload;
case "DECREMENT":
return -action.payload;
case "RESET":
return 0;
default:
const _exhaustive: never = action;
return _exhaustive;
}
}
interface SelectProps<T> {
value: T;
options: T[];
onChange: (value: T) => void;
}
function Select<T>({ value, options, onChange }: SelectProps<T>) {
/* ... */
}
applying-code-principles - General code quality principlesgenerating-tdd-tests - Type-safe test patternstype-safety-reviewer - Primary consumer of this skillThis 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 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 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.