スキル一覧に戻る
JohnVicke

typescript-strict

by JohnVicke

1🍴 0📅 2026年1月13日
GitHubで見るManusで実行

SKILL.md


name: typescript-strict description: Strict TypeScript patterns - no any, no assertions, type-safe code

Core Rules

Never Use

// BAD: any
function process(data: any) { ... }

// BAD: non-null assertion
const value = obj.prop!;

// BAD: type assertion
const user = data as User;

Instead Use

// GOOD: proper typing
function process(data: ProcessInput) { ... }

// GOOD: null check
if (obj.prop !== undefined) {
  const value = obj.prop;
}

// GOOD: type guard or validation
function isUser(data: unknown): data is User {
  return typeof data === 'object' && data !== null && 'id' in data;
}

Make Illegal States Unrepresentable

Discriminated Unions

type Result<T, E> =
  | { ok: true; value: T }
  | { ok: false; error: E };

// Usage forces handling both cases
if (result.ok) {
  console.log(result.value);
} else {
  console.error(result.error);
}

Parse at Boundaries

// Validate external input immediately
const parsed = schema.parse(externalData);
// Now `parsed` is typed and validated

Patterns

Exhaustive Switch

function assertNever(x: never): never {
  throw new Error(`Unexpected: ${x}`);
}

switch (action.type) {
  case 'add': return handleAdd(action);
  case 'remove': return handleRemove(action);
  default: return assertNever(action);
}

Branded Types

type UserId = string & { readonly __brand: 'UserId' };

function createUserId(id: string): UserId {
  // validation here
  return id as UserId;  // only place assertion allowed
}

Abstraction Guidelines

  • Consciously constrained
  • Pragmatically parameterized
  • Doggedly documented

スコア

総合スコア

40/100

リポジトリの品質指標に基づく評価

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

0/10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

0/5

レビュー

💬

レビュー機能は近日公開予定です