typescript-best-practices
Skill1 starsChanged 8 months agoMITView on GitHub
TypeScript プロジェクトの初期設定と型安全なコーディングのベストプラクティスを提供するスキル。 tsconfig.json の最適設定、パス エイリアス、厳格モードの段階的導入をガイドする。 React (Vite):
- Installs packages
77 other projects use a version of this.
Adopted by
Most recently taken up by
- Yeachan-Heo/oh-my-claude-sisyphustheir own version, first seen Nov 8, 2026
- caidanw/skillstheir own version, first seen Nov 8, 2026
- trpc/trpctheir own version, first seen Nov 8, 2026
- Yeachan-Heo/oh-my-claudecodetheir own version, first seen Nov 8, 2026
- endqwerty/endstacktheir own version, first seen Nov 8, 2026
- tristanphvn/keeltheir own version, first seen Nov 8, 2026
Used with
Projects with it also use setup-pstack, poteto-help and 10 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
bnemaSkillsetup-pstack
Configure which Pi models pstack uses per role. Detects available provider/model specs and writes pstack's user configuration. Use for /setup-pstack, "configure pstack models", or changing pstack model choices.
Also in 22 projects that use this
ianclearySkillpoteto-help
Guides users through pstack setup, /poteto-mode, and picking the skill, playbook, or principle for a task. Type /poteto-help with a question.
Also in 12 projects that use this
eryzerzSkillmake-bot-ui
Use when building a custom UI (page, dashboard, buttons) that should wake a Grok Bot over a webhook, when the user must provide a webhook sender key, or when exposing that UI on Tailscale.
Also in 14 projects that use this
ianclearySkillprinciple-explain-the-number
Apply before you trust, report, or act on a number you measured: a speedup, a regression, a throughput, a latency, or an eval result. Find what limits it, and rule out that it measured something other than the work you think.
Also in 20 projects that use this
tristanphvnSkillketchup-video
Catch the user up like /keel:ketchup, with a short silent video of slides for what happened and the waiting calls as text under it. Use for /keel:ketchup-video.
Also in 8 projects that use this
instructureSkillketchup
Rebuild context after /clear by analyzing uncommitted changes across Canvas LMS and all plugin repositories
Also in 17 projects that use this
Other versions77 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 77
- trpc/trpc★ 41ksame name
- Yeachan-Heo/oh-my-claude-sisyphus★ 41ksame name
- Yeachan-Heo/oh-my-claudecode★ 41ksame name
- backnotprop/pstack★ 3.8ksame name
- jtaroreh/agystack★ 128same name
- uzairansaruzi/p3-stack★ 126same name
- dsebban/skills★ 71same name
- baekenough/oh-my-customcode★ 42same name
- overextended/skills★ 22same name
- TheOnlyFusionCube/potetos-for-everyone★ 21same name
67 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository7 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- my_pm_toolsSkill
- ci-cd-pipelineSkill
- code-qualitySkill
- git-workflowSkill
- project-setup-automationSkill
- workspace-bridgeSkill
The file
Files
TypeScript ベストプラクティス & プロジェクト初期設定スキル
メタデータ
- トリガー: 「TypeScript設定」「tsconfig設定」「TypeScriptプロジェクト初期設定」「型安全」
- 前提条件: Node.js プロジェクト
概要
TypeScript プロジェクトの初期設定と型安全なコーディングのベストプラクティスを提供するスキル。 tsconfig.json の最適設定、パス エイリアス、厳格モードの段階的導入をガイドする。
Phase 1: TypeScript 導入判定
1.1 新規プロジェクト
npm install --save-dev typescript @types/node
npx tsc --init1.2 既存 JavaScript プロジェクトの移行
npm install --save-dev typescript @types/node
# allowJs: true で段階的に移行Phase 2: tsconfig.json 推奨設定
2.1 厳格モード(推奨)
{
"compilerOptions": {
"target": "ES2022",
"module": "ESNext",
"moduleResolution": "bundler",
"lib": ["ES2022", "DOM", "DOM.Iterable"],
"strict": true,
"noUncheckedIndexedAccess": true,
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true,
"exactOptionalPropertyTypes": false,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"skipLibCheck": true,
"isolatedModules": true,
"resolveJsonModule": true,
"declaration": true,
"declarationMap": true,
"sourceMap": true,
"outDir": "./dist",
"rootDir": "./src",
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
}
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist", "coverage", "**/*.test.ts"]
}2.2 フレームワーク別追加設定
Next.js:
{
"compilerOptions": {
"jsx": "preserve",
"incremental": true,
"plugins": [{ "name": "next" }]
}
}React (Vite):
{
"compilerOptions": {
"jsx": "react-jsx",
"moduleResolution": "bundler"
}
}Phase 3: 型安全コーディングガイドライン
3.1 避けるべきパターン
// BAD: any の使用
function process(data: any) { ... }
// GOOD: 適切な型定義
interface ProcessInput {
id: string;
value: number;
}
function process(data: ProcessInput) { ... }
// BAD: 型アサーション の乱用
const user = response as User;
// GOOD: 型ガードの使用
function isUser(obj: unknown): obj is User {
return typeof obj === 'object' && obj !== null && 'id' in obj;
}
if (isUser(response)) { ... }
// BAD: Non-null assertion の乱用
const name = user!.name;
// GOOD: オプショナルチェーン + nullish coalescing
const name = user?.name ?? 'Unknown';3.2 推奨パターン
// Branded Types で型安全な ID
type UserId = string & { readonly __brand: 'UserId' };
type OrderId = string & { readonly __brand: 'OrderId' };
function createUserId(id: string): UserId {
return id as UserId;
}
// Discriminated Union で安全な状態管理
type Result<T, E = Error> = { success: true; data: T } | { success: false; error: E };
// Exhaustive check
function assertNever(x: never): never {
throw new Error(`Unexpected value: ${x}`);
}
// Readonly で不変性を保証
interface Config {
readonly apiUrl: string;
readonly timeout: number;
}3.3 ユーティリティ型の活用
// Partial — 全プロパティをオプショナルに
type UpdateUser = Partial<User>;
// Pick / Omit — 必要なプロパティだけ抽出
type UserSummary = Pick<User, 'id' | 'name'>;
type UserWithoutPassword = Omit<User, 'password'>;
// Record — キー・値の型を指定
type StatusMap = Record<string, boolean>;
// Extract / Exclude — Union 型の操作
type NumericStatus = Extract<Status, number>;Phase 4: テスト設定
4.1 Vitest(推奨)
npm install --save-dev vitest @vitest/coverage-v8// vitest.config.ts
import { defineConfig } from 'vitest/config';
import path from 'path';
export default defineConfig({
test: {
globals: true,
environment: 'node',
coverage: {
provider: 'v8',
reporter: ['text', 'lcov'],
exclude: ['node_modules/', 'dist/', '**/*.config.*'],
},
},
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
},
},
});4.2 package.json scripts
{
"scripts": {
"test": "vitest run",
"test:watch": "vitest",
"test:coverage": "vitest run --coverage"
}
}完了チェックリスト
| # | 確認項目 | 状態 |
| 1 | TypeScript がインストールされている | |
| 2 | tsconfig.json が strict: true で設定されている | |
| 3 | パスエイリアス (@/*) が設定されている | |
| 4 | npm run typecheck が正常動作する | |
| 5 | テストフレームワークが設定されている | |
| 6 | any の使用が最小限に抑えられている |
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

