スキル一覧に戻る
aiskillstore

typescript-strict

by aiskillstore

typescript-strictは、other分野における実用的なスキルです。複雑な課題への対応力を強化し、業務効率と成果の質を改善します。

102🍴 3📅 2026年1月23日
GitHubで見るManusで実行

SKILL.md


name: typescript-strict description: Strict TypeScript rules. Use when writing ANY TypeScript.

Strict TypeScript Standards

Rules

1. NO any

// NEVER
function process(data: any) {}

// CORRECT
function process(data: unknown) {
  if (isValidData(data)) { /* use data */ }
}

2. Explicit Returns

// NEVER
function getUser(id: string) { return db.find(id); }

// CORRECT
function getUser(id: string): Promise<User | null> { return db.find(id); }

3. Typed Errors

// NEVER
catch (e) { console.log(e.message); }

// CORRECT
catch (error: unknown) {
  if (error instanceof AppError) { logger.error(error.message); }
  else if (error instanceof Error) { logger.error(error.message); }
  else { logger.error('Unknown error', { error }); }
}

4. No Unexplained Assertions

// NEVER
const user = users.find(u => u.id === id)!;

// CORRECT
const user = users.find(u => u.id === id);
if (!user) throw new NotFoundError(`User ${id} not found`);

5. Prefer Type Inference Where Obvious

// Unnecessary - type is inferred
const count: number = 5;

// Good - type is inferred
const count = 5;

// Good - explicit for function signatures
function add(a: number, b: number): number {
  return a + b;
}

6. Use Discriminated Unions

// CORRECT
type Result<T> =
  | { success: true; data: T }
  | { success: false; error: string };

function handle(result: Result<User>) {
  if (result.success) {
    // TypeScript knows result.data exists
    console.log(result.data.name);
  } else {
    // TypeScript knows result.error exists
    console.log(result.error);
  }
}

Quick Reference

PatternStatus
anyNEVER
Implicit returnNEVER
! without commentNEVER
// @ts-ignoreNEVER
as castingMINIMIZE
unknown + guardsPREFERRED

スコア

総合スコア

60/100

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

SKILL.md

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

+20
LICENSE

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

0/10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

+5
最近の活動

3ヶ月以内に更新

+5
フォーク

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

0/5
Issue管理

オープンIssueが50未満

+5
言語

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

+5
タグ

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

+5

レビュー

💬

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