Agent skill

Typescript Rules

by shinpr in shinpr/ai-coding-project-boilerplate

型安全性とエラーハンドリングルールを適用。any禁止、型ガード必須。TypeScript実装、型定義レビュー時に使用. An agent skill from shinpr/ai-coding-project-boilerplate.

MITAuto-check passed

Install Typescript Rules

skills CLI
$ npx skills add shinpr/ai-coding-project-boilerplate --skill typescript-rules -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install shinpr/ai-coding-project-boilerplate typescript-rules --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/shinpr/ai-coding-project-boilerplate.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.claude/skills-ja/typescript-rules .claude/skills/typescript-rules && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
typescript-rules
GitHub stars
232
Token cost
~920 tokens
SKILL.md length
83 words
Files
1
Skills in repo
42
Repo updated
First seen
Licence
MIT

At a glance

型安全性とエラーハンドリングルールを適用。any禁止、型ガード必須。TypeScript実装、型定義レビュー時に使用. An agent skill from shinpr/ai-coding-project-boilerplate.

  • SKILL.md covers 前提条件の検出, Backend実装における型安全性, コーディング規約 and エラーハンドリング, plus 1 more section
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Typescript Rules is an agent skill from shinpr/ai-coding-project-boilerplate. 型安全性とエラーハンドリングルールを適用。any禁止、型ガード必須。TypeScript実装、型定義レビュー時に使用。

Its SKILL.md is about 920 tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It works with TypeScript. The repository describes itself as: Agentic coding TypeScript boilerplate for Claude Code: sub-agent workflows with built-in quality checks and context engineering. The licence is MIT.

Example prompts

  • “/typescript-rules”

What it can do on your machine

Read from SKILL.md and the folder at commit 56913a2. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are typescript).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Typescript Rules loads about 920 tokens when it runs. Until then it costs about 19 tokens; SKILL.md has 83 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~19
When it runs · the whole SKILL.md, loaded when a task matches
~920

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from shinpr/ai-coding-project-boilerplate at commit 56913a2, republished under its MIT licence (© shinpr). 83 words, ~920 tokens.

Download SKILL.mdSave it as .claude/skills/typescript-rules/SKILL.md (or your agent's skills folder).
name
typescript-rules
description
型安全性とエラーハンドリングルールを適用。any禁止、型ガード必須。TypeScript実装、型定義レビュー時に使用。

TypeScript 開発ルール

前提条件の検出

プロジェクト規約を適用する前に、tsconfig、ランタイム・フレームワーク設定、lint・format設定、パスエイリアス、package scripts、代表的なモジュールを確認する。設定または確立済みのパターンに裏付けられたルールだけをプロジェクト固有として扱う。限られたパターンから導いた結論には推測であることを明記する。競合する規約によって公開契約、ランタイムの振る舞い、エラー境界が変わる場合は作業を止め、必要な情報源またはユーザー判断を具体的に示す。

Backend実装における型安全性

データフローでの型安全性 入力層(unknown) → 型ガード → ビジネス層(型保証) → 出力層(シリアライズ)

Backend固有の型シナリオ:

  • API通信: レスポンスはunknownで受け、型ガードで検証
  • フォーム入力: 外部入力はunknown、バリデーション後に型確定
  • レガシー統合: レガシーとの境界ではunknownとして受け取り、根拠のある型アサーションが必要な場合は、その境界を所有するアダプター内に限定する
  • テストコード: 設定済みのテストハーネスでモックの入出力型を定義する。意図的に一部だけを持つfixtureにはPartial<T>を使用し、Vitestが設定されている場合にのみ型付きのvi.fn<[Args], Return>()を使用する

コーディング規約

クラス使用の判断基準

  • 推奨:関数とinterfaceでの実装
    • 背景: テスタビリティと関数合成の柔軟性が向上
  • クラス使用を許可:
    • フレームワーク要求時(NestJSのController/Service、TypeORMのEntity等)
    • カスタムエラークラス定義時
    • 状態とビジネスロジックが密結合している場合(例: ShoppingCart、Session、StateMachine)
  • 判断基準: 「このデータは振る舞いを持つか?」がYesならクラス検討
    typescript
    // 関数とinterface
    interface UserService { create(data: UserData): User }
    const userService: UserService = { create: (data) => {...} }

関数設計

  • 引数は0-2個まで: 3個以上はオブジェクト化
    typescript
    // オブジェクト引数
    function createUser({ name, email, role }: CreateUserParams) {}

依存性注入

  • 外部依存は引数で注入: テスト可能性とモジュール性確保
    typescript
    // 依存性を引数で受け取る
    function createService(repository: Repository) { return {...} }

非同期処理

  • Promise処理: リポジトリで確立済みのスタイルに従う。処理順序とエラー伝播を明確にできる場合はasync/awaitを使用する
  • エラーハンドリング: 現在の層で失敗の変換、情報付加、復旧、記録ができる場合にtry-catchを追加する。それ以外は、所有する境界までPromiseのrejectionを伝播させる
  • 型定義: 戻り値の型は明示的に定義(例: Promise<Result>)

フォーマット規則

  • セミコロンの扱いを含め、リポジトリで設定されたformatterに従う
  • 型はPascalCase、変数・関数はcamelCase
  • 絶対importはtsconfigまたは設定済みのビルドツールで宣言されたaliasを通じて使用する。それ以外は相対importを使用する

クリーンコード原則

  • 今回の変更範囲にある未使用コードを削除する
  • デバッグ用console.log()は削除
  • 実行可能なソースにはコメントアウトしたコードを残さない。削除した実装の履歴はバージョン管理で保持する
  • コメントは「なぜ」を説明(「何」ではなく)

エラーハンドリング

エラー結果のルール: すべての失敗に対して、型付きの想定内エラーを返す、明記された要件に従って復旧する、診断情報を付加して伝播する、のいずれか1つを選ぶ。同じ失敗を重複して記録しないよう、ログ出力を担う境界で記録する。

Fail-Fast原則: エラー時は速やかに失敗させ、不正な状態での処理継続を防ぐ

typescript
// 無効: 呼び出し元が必要とする失敗をフォールバックで隠している
catch (error) {
  return defaultValue // エラーを隠蔽
}

// 情報を付加して明示的に伝播する
catch (error) {
  throw new Error('処理失敗', { cause: error })
}

Result型パターン: エラーを型で表現し、明示的に処理

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

// 使用例:エラーの可能性を型で表現
function parseUser(data: unknown): Result<User, ValidationError> {
  if (!isValid(data)) return { ok: false, error: new ValidationError() }
  return { ok: true, value: data as User }
}

カスタムエラークラス

typescript
export class AppError extends Error {
  constructor(message: string, public readonly code: string, public readonly statusCode = 500) {
    super(message)
    this.name = this.constructor.name
  }
}
// 用途別: ValidationError(400), BusinessRuleError(400), DatabaseError(500), ExternalServiceError(502)

層別エラー処理

  • API層: HTTPレスポンスに変換、機密情報を除外してログ出力
  • サービス層: ビジネスルール違反を検出、AppErrorはそのまま伝播
  • リポジトリ層: 技術的エラーをドメインエラーに変換

構造化ログと機密情報保護 現在の信頼境界で許可されたフィールドだけをログに含める。認証情報、トークン、シークレット、決済情報、個人データはログ出力前に除去する。

非同期エラーハンドリング

  • ランタイムがunhandledRejectionやuncaughtExceptionを公開する場合は、アプリケーションのentry pointでランタイムレベルのhandlerを設定する。ライブラリではプロセスレベルの方針をhostに委ねる
  • 非同期の失敗は、型付きの結果、復旧、診断情報のいずれかを付加できる層でcatchする
  • その層での復旧を要件が明記している場合を除き、情報を付加した失敗は伝播させる

パフォーマンス最適化

  • ストリーミング処理: 計測した入力サイズが利用可能なメモリ予算を超える場合、または要件で逐次出力が必要な場合は、ストリーミングまたは上限付きbatchを使用し、判断の根拠となった計測値または制約を記録する
  • リソースのライフタイム: timer、subscription、handle、保持している参照は、そのライフサイクルを所有する境界で解放する

© shinpr, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .claude/skills-ja/typescript-rules of shinpr/ai-coding-project-boilerplate.

Open the folder on GitHubat commit 56913a2

Compare with similar skills

Typescript Rules next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Typescript Rules compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Typescript Rules this skillshinpr/ai-coding-project-boilerplate232—~920Automated safety check: PassMIT
MCP Server Builderanthropics/skills180k64 repos~2.3kAutomated safety check: PassApache-2.0
Web Artifacts Builderanthropics/skills180k41 repos~769Automated safety check: PassApache-2.0
Typescript Advanced Typesrolling-scopes/rsschool-app10k25 repos~4.2kAutomated safety check: PassMPL-2.0
Code Review ChecklistshareAI-lab/learn-claude-code78k5 repos~1.1kAutomated safety check: PassMIT
MCP Server BuildershareAI-lab/learn-claude-code78k5 repos~1.2kAutomated safety check: PassMIT

Similar skills

  • MCP Server Builder

    anthropics/skills

    Official

    Guides the design and implementation of Model Context Protocol servers in TypeScript or Python, from tool naming and error messages to evaluation.

    180k GitHub starsUsed in 64 repos~2.3k tokens
    Agent WorkflowsAuto-check passed
  • Web Artifacts Builder

    anthropics/skills

    Official

    Builds multi-component claude.ai HTML artifacts as a small React, TypeScript and Tailwind project, then bundles it into one shareable HTML file.

    180k GitHub starsUsed in 41 repos~769 tokens
    Frontend & DesignAuto-check passed
  • Typescript Advanced Types

    rolling-scopes/rsschool-app

    Master TypeScript's advanced type system including generics, conditional types, mapped types, template literals, and utility types for building type-safe applications.

    10k GitHub starsUsed in 25 repos~4.2k tokens
    DevelopmentAuto-check passed
  • Code Review Checklist

    shareAI-lab/learn-claude-code

    Reviews code against a five-part checklist covering security, correctness, performance, maintainability and testing, and reports findings in a fixed format.

    78k GitHub starsUsed in 5 repos~1.1k tokens
    DevelopmentAuto-check passed
  • MCP Server Builder

    shareAI-lab/learn-claude-code

    Walks through building MCP servers in Python or TypeScript that expose tools, resources and prompts to Claude, with templates, registration and testing.

    78k GitHub starsUsed in 5 repos~1.2k tokens
    Agent WorkflowsAuto-check passed
  • Nx Import

    nrwl/nx

    Import, merge, or combine repositories into an Nx workspace using nx import.

    29k GitHub starsUsed in 6 repos~3.5k tokens
    DevelopmentAuto-check passed

More from shinpr/ai-coding-project-boilerplate

All 42 skills in this repo
  • Integration E2E Testing

    shinpr/ai-coding-project-boilerplate

    Selects and designs the smallest integration/E2E test set that proves accepted behavior at an observable boundary.

    232 GitHub stars~2.8k tokensUpdated 4 days ago
    Auto-check passed
  • Skill Optimization

    shinpr/ai-coding-project-boilerplate

    Evaluates and optimizes skill file quality using 9 content patterns and 10 editing principles.

    232 GitHub stars~3.5k tokensUpdated 4 days ago
    Auto-check passed
  • Frontend Technical Spec

    shinpr/ai-coding-project-boilerplate

    Defines React environment, component architecture, state/data flow, build verification, and frontend non-functional criteria from repository evidence.

    232 GitHub stars~1.9k tokensUpdated 4 days ago
    Auto-check: notes
  • Frontend Typescript Rules

    shinpr/ai-coding-project-boilerplate

    Applies React/TypeScript type safety, component design, and state management rules.

    232 GitHub stars~1.7k tokensUpdated 4 days ago
    Auto-check passed
  • Implementation Approach

    shinpr/ai-coding-project-boilerplate

    Selects implementation strategy (vertical slice, horizontal, or hybrid) with risk assessment.

    232 GitHub stars~3.2k tokensUpdated 4 days ago
    Auto-check passed
  • Subagents Orchestration Guide

    shinpr/ai-coding-project-boilerplate

    Coordinates subagents through scale-based planning, approval, implementation, verification, and escalation flows.

    232 GitHub stars~8k tokensUpdated 4 days ago
    Auto-check passed

Works with

Questions about Typescript Rules

What does Typescript Rules do?

型安全性とエラーハンドリングルールを適用。any禁止、型ガード必須。TypeScript実装、型定義レビュー時に使用. An agent skill from shinpr/ai-coding-project-boilerplate. Typescript Rules is an agent skill from shinpr/ai-coding-project-boilerplate.

How do I install Typescript Rules in Claude Code?

Run `npx skills add shinpr/ai-coding-project-boilerplate --skill typescript-rules -a claude-code`. Or copy the skill folder (.claude/skills-ja/typescript-rules in shinpr/ai-coding-project-boilerplate) into .claude/skills/typescript-rules in your project. Claude Code loads it when a task matches its description.

How do I install Typescript Rules in Codex?

Run `npx skills add shinpr/ai-coding-project-boilerplate --skill typescript-rules -a codex`. Or copy the skill folder (.claude/skills-ja/typescript-rules in shinpr/ai-coding-project-boilerplate) into .agents/skills/typescript-rules in your project. Codex loads it when a task matches its description.

Can I use Typescript Rules in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add shinpr/ai-coding-project-boilerplate --skill typescript-rules -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/typescript-rules, .gemini/skills/typescript-rules, .github/skills/typescript-rules and .opencode/skills/typescript-rules in your project.

What does Typescript Rules need to run?

SKILL.md names no scripts, command-line tools or credentials: Typescript Rules is instructions for the agent only.

Does Typescript Rules access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Typescript Rules safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Typescript Rules use?

Typescript Rules is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Typescript Rules use?

About 920 tokens (SKILL.md is roughly 3.7k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Typescript Rules?

Skills that share tags, products or a category with Typescript Rules: MCP Server Builder (anthropics/skills, 180k stars), Web Artifacts Builder (anthropics/skills, 180k stars), Typescript Advanced Types (rolling-scopes/rsschool-app, 10k stars) and Code Review Checklist (shareAI-lab/learn-claude-code, 78k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Typescript Rules?

shinpr (a GitHub user) maintains it in shinpr/ai-coding-project-boilerplate, which has 232 GitHub stars. The repository holds 42 skills in this directory. The repository was last updated on October 4, 2026.

Source: shinpr/ai-coding-project-boilerplate on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.