typescript-rules SKILL.md skillA

typescript-rules from shinpr/ai-coding-project-boilerplate is an agent skill: a SKILL.md folder an AI agent loads when a task calls for it.

Install it, pinned
mdr add shinpr/ai-coding-project-boilerplate/typescript-rules@git:20260831.b183037

Pins git:20260831.b183037 in mdr.lock. Pin the fingerprint instead.

Audit grade
A, 17 of 17 checks passed
Kind
SKILL.md skill
Repository
shinpr/ai-coding-project-boilerplate
Path
.claude/skills-zh-CN/typescript-rules/SKILL.md
Versions recorded
1
Latest version
git:20260831.b183037, committed Aug 31, 2026
Size
5,873 bytes
Repository stars
234
License
MIT

应用类型安全与错误处理规则。强制执行禁用 any 策略与类型守卫。在实现 TypeScript 或评审类型时使用。.

Collected from public GitHub. Every version is saved exactly as it was and never changes. Install it at an exact version with the mdr tool, and every file is checked before it reaches your agent. The main file is checked against the SHA-256 fingerprint recorded here, and the others against the fingerprints GitHub keeps for its source commit. The automatic checks below grade the latest version, and the same checks always give the same file the same grade.

What the file says

# TypeScript 开发规则

## 前置条件检测

在应用项目约定之前,先检查 `tsconfig`、运行时/框架配置、lint/格式化配置、路径别名、package 脚本以及有代表性的模块。仅当配置或既有模式支持某条规则时,才将其视为项目特有规则。将基于有限样本得出的结论标注为推断所得。当相互竞争的约定会改变公共契约、运行时行为或错误边界时,应停下来指出所需的约束来源或用户决策。

## 后端实现中的类型安全

**数据流中的类型安全**
输入层(`unknown`)-> 类型守卫 -> 业务层(类型已保证)-> 输出层(序列化)

**后端特有的类型场景**:
- **API 通信**:将响应作为 `unknown` 接收,并通过类型守卫进行校验
- **表单输入**:外部输入作为 `unknown`,校验后再确定类型
- **遗留系统集成**:将遗留边界作为 `unknown` 接收;将任何有依据支撑的类型断言隔离在拥有该边界的适配器内
- **测试代码**:使用配置好的测试工具定义模拟输入/输出类型;对有意为之的部分 fixture 使用 `Partial<T>`,仅在配置了 Vitest 时使用带类型的 `vi.fn<[Args], Return>()`

## 编码约定

**类的使用标准**
- **推荐:使用函数与接口实现**
  - 理由:提升可测试性与函数组合的灵活性
- **允许使用类的情形**:
  - 框架要求(NestJS Controller/Service、TypeORM Entity 等)
  - 自定义错误类定义
  - 状态与业务逻辑紧密耦合时(例如 ShoppingCart、Session、StateMachine)
- **判断标准**:若“这份数据是否具有行为?”的答案是肯定的,可考虑使用类
  ```typescript
  // 函数与接口
  interface UserService { create(data: UserData): User }
  const userService: UserService = { create: (data) => {...} }
  ```

**函数设计**
- **最多 0-2 个参数**:3 个及以上参数时使用对象
  ```typescript
  // 对象参数
  function createUser({ name, email, role }: CreateUserParams) {}
  ```

**依赖注入**
- **将外部依赖作为参数注入**:确保可测试性与模块化
  ```typescript
  // 将依赖作为参数接收
…

Read the whole file at its exact version.

How to install

The exact contents, by fingerprint
mdr add shinpr/ai-coding-project-boilerplate/typescript-rules@sha256:21496873fb7e8164

The line at the top of this page pins the label git:20260831.b183037, which is what most people want. This one pins the sha256 fingerprint of the contents instead, so it survives a label being moved. Either way the exact version is written to mdr.lock, and mdr install downloads and checks those contents again, so it installs them exactly or stops with an error.

Badge

mdr badge

[![mdr](https://markdownregistry.com/badge/art_milcycm5pkqa4zcw.svg)](https://markdownregistry.com/a/art_milcycm5pkqa4zcw)

4 badge image fetches in 30 days. What the badge shows.

Versions

The registry has recorded 1 version of this file, committed on Aug 31, 2026.

versioncommittedcommitsizeaudit
git:20260831.b183037 latest2026-08-31 b183037 5,873 BA view

Audit of the latest version

A  17 of 17 checks passed. Fixed automatic checks with no AI involved, so the same checks give the same answer every run.
  • pass: Frontmatter block present
  • pass: Frontmatter declares a name
  • pass: Frontmatter declares a description
  • pass: Size between 200 bytes and 200 KB (5873 bytes)
  • pass: No zero-width or bidi control characters
  • pass: No instruction hidden inside an HTML comment
  • pass: No link to an exfiltration or paste host
  • pass: No credential-shaped string
  • pass: No instruction to send local credentials anywhere
  • pass: No text hidden with inline styles
  • pass: No prompt-injection phrasing
  • pass: No curl or wget piped into a shell
  • pass: No recursive delete of root, home or parent
  • pass: No instruction to read or print local credentials
  • pass: No base64 blob over 200 characters
  • pass: No link to a raw IP address
  • pass: No script tag

Source

GitHub

shinpr/ai-coding-project-boilerplate · 234 stars · license MIT · pushed 2026-10-14 · branch main

API

GET https://markdownregistry.com/api/v1/artifacts/art_milcycm5pkqa4zcw
GET https://markdownregistry.com/api/v1/resolve?ref=shinpr/ai-coding-project-boilerplate/typescript-rules
GET https://markdownregistry.com/api/v1/blob/21496873fb7e8164d75d6103c684684ee5a15702ae038d794af2d9e35fc49f06

Your AI assistant does the legwork. You hear about the deals worth your word. Hand yours the standing instructions at modelranch.com and it joins the network that reads files like this one.

Guides: the SKILL.md format and its required fields · what to check before you install a skill · how to pin a skill to an exact version · where to find agent skills · keeping a team on the same skills · which agent file does what.

More from shinpr/ai-coding-project-boilerplate

coding-standards SKILL.md skill
shinpr/ai-coding-project-boilerplate · .claude/skills-en/coding-standards/SKILL.md · Detects code smells, anti-patterns, and readability issues. Use when implementing features, reviewing code, or…
git:20261014.578fed5 · audit A · 234 stars
documentation-criteria SKILL.md skill
shinpr/ai-coding-project-boilerplate · .claude/skills-en/documentation-criteria/SKILL.md · Determines which PRD, ADR, UI Spec, Design Doc, and Work Plan a change requires and where each is stored. Use when…
git:20260923.86a3d79 · audit A · 234 stars
frontend-technical-spec SKILL.md skill
shinpr/ai-coding-project-boilerplate · .claude/skills-en/frontend-technical-spec/SKILL.md · Defines React environment, component architecture, state/data flow, build verification, and frontend non-functional…
git:20260923.03f66be · audit A · 234 stars
frontend-typescript-rules SKILL.md skill
shinpr/ai-coding-project-boilerplate · .claude/skills-en/frontend-typescript-rules/SKILL.md · Applies React/TypeScript type safety, component design, and state management rules. Use when implementing React…
git:20260912.c0d4362 · audit A · 234 stars
frontend-typescript-testing SKILL.md skill
shinpr/ai-coding-project-boilerplate · .claude/skills-en/frontend-typescript-testing/SKILL.md · Designs frontend tests using the repository's configured React test and browser harnesses, including RTL, MSW, Vitest…
git:20261014.578fed5 · audit A · 234 stars
implementation-approach SKILL.md skill
shinpr/ai-coding-project-boilerplate · .claude/skills-en/implementation-approach/SKILL.md · Selects implementation strategy (vertical slice, horizontal, or hybrid) with risk assessment. Use when planning feature…
git:20261014.578fed5 · audit A · 234 stars
integration-e2e-testing SKILL.md skill
shinpr/ai-coding-project-boilerplate · .claude/skills-en/integration-e2e-testing/SKILL.md · Selects and designs the smallest integration/E2E test set that proves accepted behavior at an observable boundary. Use…
git:20261014.578fed5 · audit A · 234 stars
llm-friendly-context SKILL.md skill
shinpr/ai-coding-project-boilerplate · .claude/skills-en/llm-friendly-context/SKILL.md · Clarifies inputs, outputs, success criteria, decisions, and unresolved conditions so downstream agents can execute…
git:20260923.86a3d79 · audit A · 234 stars
project-context SKILL.md skill
shinpr/ai-coding-project-boilerplate · .claude/skills-en/project-context/SKILL.md · Marks project context as unconfigured until domain constraints, repository quality standards, phase, conventions, and…
git:20260901.b347ae2 · audit A · 234 stars
requirement-convergence SKILL.md skill
shinpr/ai-coding-project-boilerplate · .claude/skills-en/requirement-convergence/SKILL.md · Separates the outcome a change must produce from the requirements proposed to reach it, records what the user excluded…
git:20260923.558b381 · audit A · 234 stars
skill-optimization SKILL.md skill
shinpr/ai-coding-project-boilerplate · .claude/skills-en/skill-optimization/SKILL.md · Evaluates and optimizes skill file quality using 9 content patterns and 10 editing principles. Use when creating…
git:20260831.b183037 · audit A · 234 stars
subagents-orchestration-guide SKILL.md skill
shinpr/ai-coding-project-boilerplate · .claude/skills-en/subagents-orchestration-guide/SKILL.md · Coordinates subagents through scale-based planning, approval, implementation, verification, and escalation flows. Use…
git:20261003.24e6460 · audit A · 234 stars

Every file in shinpr/ai-coding-project-boilerplate

Other files named typescript-rules

typescript-rules SKILL.md skill
shinpr/claude-code-workflows · dev-workflows-frontend/skills/typescript-rules/SKILL.md · React/TypeScript frontend development rules including type safety, component design, state management, and error…
git:20260728.e9e235b · audit A · 703 stars
typescript-rules SKILL.md skill
shinpr/claude-code-workflows · dev-workflows-fullstack/skills/typescript-rules/SKILL.md · React/TypeScript frontend development rules including type safety, component design, state management, and error…
git:20260728.e9e235b · audit A · 703 stars
typescript-rules SKILL.md skill
shinpr/claude-code-workflows · skills/typescript-rules/SKILL.md · React/TypeScript frontend development rules including type safety, component design, state management, and error…
git:20260728.e9e235b · audit A · 703 stars
typescript-rules SKILL.md skill
shinpr/claude-code-workflows · dev-skills/skills/typescript-rules/SKILL.md · React/TypeScript frontend development rules including type safety, component design, state management, and error…
git:20260728.e9e235b · audit A · 703 stars
typescript-rules SKILL.md skill
shinpr/ai-coding-project-boilerplate · .claude/skills-en/typescript-rules/SKILL.md · Applies type safety and error handling rules. Enforces no-any policy and type guards. Use when implementing TypeScript…
git:20260719.191ec13 · audit A · 234 stars
typescript-rules SKILL.md skill
shinpr/ai-coding-project-boilerplate · .claude/skills-ja/typescript-rules/SKILL.md · 型安全性とエラーハンドリングルールを適用。any禁止、型ガード必須。TypeScript実装、型定義レビュー時に使用。
git:20260901.dd3607b · audit A · 234 stars

Browse by kind, by grade A, or by owner.