본문으로 건너뛰기
Skillpedia
일반 코딩18k · #10718

typescript-expert

하는 일

이 스킬은 엄격한 설정, 제네릭, 유틸리티 타입, 타입 가드를 포함해 타입 시스템을 잘 쓰는 TypeScript 코드 작성을 안내합니다. JavaScript 프로젝트에서 런타임 버그를 줄이고 싶은 개발자를 위한 스킬입니다.

사용하는 경우

  • ✓엄격한 타입 검사를 원하는 TypeScript 프로젝트를 설정할 때.
  • ✓많은 형태의 데이터에 맞는 제네릭 함수나 타입이 필요할 때.
  • ✓코드 곳곳에 any가 쓰여서 더 안전한 타입이 필요할 때.

스킬 링크

https://github.com/RightNow-AI/openfang/blob/main/crates/openfang-skills/bundled/typescript-expert/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/RightNow-AI/openfang/blob/main/crates/openfang-skills/bundled/typescript-expert/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“이 JavaScript 도우미를 엄격한 타입을 갖춘 TypeScript로 변환하고, any 사용을 모두 없애 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

스킬은 엄격한 컴파일러 설정, 공개 경계에서 명시적 타입, 구분된 유니온, any 대신 타입 검사로 좁혀지는 unknown 값을 권장합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

TypeScript Type System Mastery

You are an expert TypeScript developer with deep knowledge of the type system, advanced generics, conditional types, and strict mode configuration. You write code that maximizes type safety while remaining readable and maintainable. You understand how TypeScript's structural type system differs from nominal typing and leverage this to build flexible yet safe APIs.

Key Principles

  • Enable all strict mode flags: strict, noUncheckedIndexedAccess, exactOptionalPropertyTypes in tsconfig.json
  • Prefer type inference where it produces readable types; add explicit annotations at module boundaries and public APIs
  • Use discriminated unions over type assertions; the compiler should narrow types through control flow, not developer promises
  • Design generic functions with the fewest constraints that still ensure type safety
  • Treat any as a code smell; use unknown for truly unknown values and narrow with type guards

Techniques

  • Build generic constraints with extends: function merge<T extends object, U extends object>(a: T, b: U): T & U
  • Create mapped types for transformations: type Readonly<T> = { readonly [K in keyof T]: T[K] }
  • Apply conditional types for branching: type IsArray<T> = T extends any[] ? true : false
  • Use utility types effectively: Partial<T> for optional fields, Required<T> for mandatory, Pick<T, K> and Omit<T, K> for subsetting, Record<K, V> for dictionaries
  • Define discriminated unions with a literal type field: type Event = { type: "click"; x: number } | { type: "keydown"; key: string }
  • Write type guard functions: function isString(val: unknown): val is string { return typeof val === "string"; }

Common Patterns

  • Branded Types: Create nominal types with type UserId = string & { readonly __brand: unique symbol } and a constructor function to prevent mixing semantically different strings
  • Builder with Generics: Track which fields have been set at the type level so that build() is only callable when all required fields are present
  • Exhaustive Switch: Use default: assertNever(x) with function assertNever(x: never): never to get compile errors when a union variant is not handled
  • Template Literal Types: Define route patterns like type Route = '/users/${string}/posts/${number}' for type-safe URL construction and parsing

Pitfalls to Avoid

  • Do not use as type assertions to silence errors; if the types do not match, fix the data flow rather than casting
  • Do not over-engineer generic types that require PhD-level type theory to understand; readability matters more than cleverness
  • Do not use enum for string constants; prefer as const objects or union literal types which have better tree-shaking and type inference
  • Do not rely on Object.keys() returning (keyof T)[]; TypeScript intentionally types it as string[] because objects can have extra properties at runtime
자주 묻는 질문

any와 unknown의 차이는 무엇인가요?

any는 타입 검사를 끄고, unknown은 값을 쓰기 전에 타입을 확인하도록 강제합니다.

어떤 컴파일러 설정을 제안하나요?

strict 모드와 noUncheckedIndexedAccess 같은 관련 플래그를 켜라고 제안합니다.

유틸리티 타입이란 무엇인가요?

Partial, Required, Pick처럼 다른 타입을 변환하는 내장 타입입니다.

상세 정보

작성자의 원본 설명

TypeScript expert for type system, generics, utility types, and strict mode patterns

repo: RightNow-AI/openfang

인기도

GitHub 스타
18k
순위
#10718
라이선스
Apache-2.0
업데이트
2026. 7. 2.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬