スキル一覧に戻る
oro-ad

typescript-strict

by oro-ad

Nuxt DevTools integration for Claude Code AI assistant

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

SKILL.md


name: typescript-strict description: Strict TypeScript practices. Use when writing TypeScript code to ensure type safety.

Enforce strict TypeScript practices:

No any

Never use any. Use unknown for truly unknown types:

// ❌ Avoid
function process(data: any) { }

// ✅ Better
function process(data: unknown) {
  if (typeof data === 'string') {
    // Now TypeScript knows it's a string
  }
}

Explicit Return Types

Add explicit return types for public/exported functions:

// ✅ Explicit return type
function calculateTotal(items: Item[]): number {
  return items.reduce((sum, item) => sum + item.price, 0)
}

// ✅ For async functions
async function fetchUser(id: string): Promise<User | null> {
  // ...
}

Interface over Type

Prefer interface for object shapes (better error messages, extendable):

// ✅ Prefer interface
interface User {
  id: string
  name: string
  email: string
}

// Use type for unions, primitives, or complex types
type Status = 'pending' | 'active' | 'done'
type Nullable<T> = T | null

Readonly

Mark immutable data as readonly:

interface Config {
  readonly apiUrl: string
  readonly maxRetries: number
}

function processItems(items: readonly Item[]) {
  // items.push() would be an error
}

Type Guards

Use type guards for runtime type checking:

function isUser(value: unknown): value is User {
  return (
    typeof value === 'object' &&
    value !== null &&
    'id' in value &&
    'name' in value
  )
}

if (isUser(data)) {
  // TypeScript knows data is User
  console.log(data.name)
}

Const Assertions

Use as const for literal types:

const STATUSES = ['pending', 'active', 'done'] as const
type Status = typeof STATUSES[number] // 'pending' | 'active' | 'done'

Non-null Assertion

Avoid ! when possible. Use optional chaining or type guards:

// ❌ Risky
const name = user!.name

// ✅ Safer
const name = user?.name ?? 'Unknown'

スコア

総合スコア

65/100

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

SKILL.md

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

+20
LICENSE

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

+10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

1ヶ月以内に更新

+10
フォーク

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

0/5
Issue管理

オープンIssueが50未満

+5
言語

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

+5
タグ

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

+5

レビュー

💬

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