Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add skills/shinpr/ai-coding-project-boilerplate/typescript-rulesnpx skills add shinpr/ai-coding-project-boilerplate --skill typescript-rulesgit clone --depth 1 https://github.com/shinpr/ai-coding-project-boilerplateWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/shinpr/ai-coding-project-boilerplate/typescript-rules)<a href="https://agentmods.dev/skills/shinpr/ai-coding-project-boilerplate/typescript-rules"><img src="https://agentmods.dev/badge/skills/shinpr/ai-coding-project-boilerplate/typescript-rules.svg" alt="Measured on agentmods" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00031 | $0.01252 |
| Opus 5 | $0.00015 | $0.00626 |
| Sonnet 5 | $0.00006 | $0.00250 |
| Haiku 4.5 | $0.00003 | $0.00125 |
Grade A, and why
typescript-rules scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 125 lines — stays where its author put it; the contents beside it link to each section on GitHub.
TypeScript Development Rules
Prerequisite Detection
Inspect tsconfig, runtime/framework configuration, lint/format configuration, path aliases, package scripts, and representative modules before applying project conventions. Treat a rule as project-specific only when configuration or an established pattern supports it. Label limited-pattern conclusions as inferred. When competing conventions change a public contract, runtime behavior, or error boundary, stop and name the source or user decision required.
Type Safety in Backend Implementation
Type Safety in Data Flow
Input Layer (unknown) -> Type Guard -> Business Layer (Type Guaranteed) -> Output Layer (Serialization)
Backend-Specific Type Scenarios:
- API Communication: Receive responses as
unknownand validate them with type guards - Form Input: External input as
unknown, type determined after validation - Legacy Integration: Receive the legacy boundary as
unknown; isolate any evidence-backed assertion in the adapter that owns the boundary - Test Code: Define mock input/output types with the configured test harness; use
Partial<T>for intentionally partial fixtures and typedvi.fn<[Args], Return>()only when Vitest is configured
Coding Conventions
Class Usage Criteria
- Recommended: Implementation with Functions and Interfaces
- Rationale: Improves testability and flexibility of function composition
- Classes Allowed:
- Framework requirements (NestJS Controller/Service, TypeORM Entity, etc.)
- Custom error class definitions
- When state and business logic are tightly coupled (e.g., ShoppingCart, Session, StateMachine)
- Decision Criterion: If "Does this data have behavior?" is Yes, consider using a class
// Functions and interfaces interface UserService { create(data: UserData): User } const userService: UserService = { create: (data) => {...} }
Function Design
- 0-2 parameters maximum: Use object for 3+ parameters
// Object parameter function createUser({ name, email, role }: CreateUserParams) {}
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 5d ago First seen · 125 lines · 31 tokens per session scan A 14ed63860295
typescript-rules is a skill published in the GitHub repository shinpr/ai-coding-project-boilerplate (227 stars, last pushed 7d ago), licensed MIT. It adds 31 tokens to every session and 1,252 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other skills, from other repositories
clean-code-ts
Use when writing or reviewing TypeScript — deeper idioms (eliminate any, discriminated unions, narrowing, exhaustiveness, schema-derived types, async correctness).
typescript-advanced-types
Master TypeScript's advanced type system including generics, conditional types, mapped types, template literals, and utility types for building type-safe applications. Use when implementing complex type logic, creating reusable type utilities, or ensuring compile-time type safety in TypeScript projects.
drizzle-orm
Type-safe SQL ORM for TypeScript with zero runtime overhead.
language-typescript
TypeScript conventions with generic guidance plus a monorepo-specific addendum.
lint-js
Lint JS/TS code only. Use before opening a PR when only JavaScript or TypeScript files were changed (no Rust).
saas-builder
Clone, verify, map, and build on top of ixartz/SaaS-Boilerplate for a user's SaaS idea. Use when a user wants to reuse SaaS Boilerplate, evaluate how their product fits it, or build product-specific pages, database schema, roles, permissions, MVP features, and launch scope on top of the boilerplate.