typescript-patterns
Skill30 starsChanged 52 days agoMITView on GitHub
TypeScript type system patterns, generics, utility types, and strict mode best practices. Use when writing or reviewing TypeScript code.
8 other projects use a version of this.
Adopted by
Most recently taken up by
- MMACABRE/SKILLStheir own version, first seen Nov 8, 2026
- reddygopalkrishna/developer-agent-skillstheir own version, first seen Nov 8, 2026
- ku5ic/claude-kittheir own version, first seen Nov 4, 2026
- mikulgohil/claude-skillstheir own version, first seen Oct 13, 2026
- techmefr/mentistheir own version, first seen Sep 11, 2026
- bjornjee/skillstheir own version, first seen Sep 8, 2026
Used with
Projects with it also use fastapi-patterns, react-patterns and 1 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.
seikaikyoSkillfastapi-patterns
FastAPI + SQLModel + Neon PostgreSQL 後端開發最佳實踐。適用於 Render 部署的 API 服務。涵蓋路由設計、資料庫操作、錯誤處理、認證授權。
Also in 3 projects that use this
xenitV1Skillreact-patterns
Modern React patterns and principles. Hooks, composition, performance, TypeScript best practices.
Also in 3 projects that use this
xenitV1Skillpython-patterns
Python development principles and decision-making. Framework selection, async patterns, type hints, project structure. Teaches thinking, not copying.
Also in 3 projects that use this
Other versions8 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 8
- cohen-liel/hivemind★ 108same name
- reddygopalkrishna/developer-agent-skills★ 8same name
- peopleforrester/claude-dotfiles★ 3same name
- bjornjee/skills★ 2same name
- ku5ic/claude-kit★ 2same name
- MMACABRE/SKILLS★ 1same name
- mikulgohil/claude-skills★ 0same name
- techmefr/mentis★ 0same name
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 repository30 other files it gives its agents.
- AGENTS.mdAGENTS.md
- claude/CLAUDE.mdCLAUDE.md
- llms.txtllms.txt
- api-design-patternsSkill
- auth-patternsSkill
- backend-dev-guidelinesSkill
- brainstormingSkill
- code-review-patternsSkill
- deployment-guideSkill
- docker-patternsSkill
- docx-officialSkill
- frontend-designSkill
- github-actionsSkill
- git-workflowSkill
- nestjs-patternsSkill
- nextjs-app-routerSkill
- pdf-officialSkill
- pptx-officialSkill
- prisma-workflowSkill
- prompt-engineeringSkill
- react-best-practicesSkill
- security-checklistSkill
- skill-creatorSkill
- software-architectureSkill
- systematic-debuggingSkill
- tailwind-patternsSkill
- test-driven-developmentSkill
- webapp-testingSkill
- web-design-guidelinesSkill
- xlsx-officialSkill
The file
Files
TypeScript Patterns
Core Rules
- Strict mode always (
"strict": true) - No
any— useunknownfor dynamic values - Explicit return types on all functions
constoverlet, nevervar
Type Definitions
Interfaces vs Types
// ✅ Interface for objects/classes (extensible)
interface User {
id: string
email: string
name: string
}
// ✅ Type for unions, primitives, computed
type Status = 'active' | 'inactive' | 'pending'
type UserOrAdmin = User | Admin
type ReadonlyUser = Readonly<User>Generics
// ✅ Reusable generic types
type ApiResponse<T> = {
data: T
error: string | null
status: number
}
type PaginatedResponse<T> = {
items: T[]
total: number
page: number
limit: number
}
// ✅ Generic functions
const findById = <T extends { id: string }>(items: T[], id: string): T | undefined =>
items.find(item => item.id === id)Utility Types
// Pick specific fields
type UserPreview = Pick<User, 'id' | 'name'>
// Omit sensitive fields
type PublicUser = Omit<User, 'password' | 'salt'>
// Make all optional (for partial updates)
type UpdateUserDto = Partial<User>
// Make all required
type RequiredUser = Required<User>
// Make all readonly
type FrozenUser = Readonly<User>
// Extract from union
type ActiveStatus = Extract<Status, 'active' | 'pending'>
// Record type
type UserMap = Record<string, User>Discriminated Unions
// ✅ Type-safe error handling
type Result<T> =
| { success: true; data: T }
| { success: false; error: string }
const processUser = (id: string): Result<User> => {
try {
return { success: true, data: fetchUser(id) }
} catch (e) {
return { success: false, error: 'User not found' }
}
}
// Usage — TypeScript knows the type
const result = processUser('123')
if (result.success) {
console.log(result.data.name) // User
} else {
console.log(result.error) // string
}Type Guards
// ✅ Custom type guards
const isUser = (value: unknown): value is User =>
typeof value === 'object' &&
value !== null &&
'id' in value &&
'email' in value
// ✅ Assertion functions
const assertDefined = <T>(value: T | null | undefined): T => {
if (value == null) throw new Error('Value is null or undefined')
return value
}Async Patterns
// ✅ Always type async return values
const fetchUser = async (id: string): Promise<User> => {
const res = await fetch(`/api/users/${id}`)
if (!res.ok) throw new Error('Failed to fetch user')
return res.json() as Promise<User>
}
// ✅ Error handling with unknown
try {
await fetchUser(id)
} catch (error) {
if (error instanceof Error) {
console.error(error.message)
}
}Forbidden Patterns
// ❌ Never
const data: any = fetchData()
function process(x) { return x } // implicit any
const obj = {} as User // unsafe assertion
// @ts-ignore // suppressing errorsDoes 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.

