본문으로 건너뛰기
cccskills
무료GitHub에 공개

typescript

Apply these opinionated TypeScript conventions whenever writing or reviewing TypeScript: branded types for domain modeling, discriminated unions for state, `satisfies` over `as`, const objects instead of enums, type-only imports, and the strict tsconfig baseline beyond `strict: true`. Also use for monorepo project references and incremental build setup.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

설치 방법 보기

포함된 파일(1)

  • SKILL.md4.2 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

TypeScript

House conventions for TypeScript 5+. Apply them to code you are writing or changing — don't refactor untouched files to match unless asked.

Conventions

  • Model the domain in types, not in checks. Branded types (type UserId = string & { readonly __brand: 'UserId' }) and discriminated unions push errors to compile time, where they cost nothing. A runtime guard catches the same bug in production.
  • Discriminated unions for anything with states — request lifecycles, form state, parse results. The compiler then forces every state to be handled, so a new variant surfaces as an error rather than a silent fallthrough.
  • satisfies over as. satisfies validates against a type while keeping the narrow inferred literal; as throws the check away. Reach for as only when you know something the compiler cannot, and say why in a comment.
  • Const objects over enum. as const objects are plain values with no emit and no nominal-typing surprises; enum generates runtime code and const enum breaks under isolatedModules.
  • any is a bug report. Use unknown and narrow. If any is genuinely unavoidable at a boundary, isolate it in one adapter function rather than letting it spread through call sites.
  • Separate type-only imports (import type { … }). Bundlers erase them cleanly; mixed imports can keep a runtime dependency alive that you meant to drop.
  • Let inference work. Annotate exported/public signatures and let everything internal infer — over-annotation is noise that drifts from the real type.
  • Ship .d.ts for anything consumed as a library (declaration: true). Without it, consumers fall back to any and your type work stops at the package boundary.
  • Monorepos: project references + composite. Incremental builds only rebuild what changed; a single flat tsconfig recompiles the world on every edit.

The two idioms worth showing

Exhaustiveness only actually holds if you force it. A switch over a union compiles fine when a new variant appears — assertNever is what turns that into a build error at every site that needed updating:

function assertNever(x: never): never {
  throw new Error(`Unhandled variant: ${JSON.stringify(x)}`);
}

function area(s: Shape): number {
  switch (s.kind) {
    case "circle":
      return Math.PI * s.r ** 2;
    case "rect":
      return s.w * s.h;
    default:
      return assertNever(s); // add a variant → compile error here
  }
}

A brand is only worth having if the sole way to obtain one is a function that validates:

type Brand<T, B> = T & { readonly __brand: B };
type Email = Brand<string, "Email">;

export function toEmail(raw: string): Email {
  if (!raw.includes("@")) throw new Error(`Not an email: ${raw}`);
  return raw as Email;
}

The as inside the constructor is the one legitimate use — it's the boundary where validation converts an unverified value into a verified one. Casting to Email anywhere else defeats the whole type.

tsconfig baseline

strict: true does not enable everything worth having. Add these — each one catches a class of bug the default set misses:

{
  "compilerOptions": {
    "strict": true,
    "noUncheckedIndexedAccess": true,
    "noPropertyAccessFromIndexSignature": true,
    "noImplicitOverride": true,
    "noImplicitReturns": true,
    "noFallthroughCasesInSwitch": true,
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "isolatedModules": true,
    "declaration": true,
    "skipLibCheck": true
  }
}

noUncheckedIndexedAccess is the highest-value one and the most disruptive to adopt: it makes arr[i] return T | undefined, which is the truth. Turn it on for new projects; for existing ones, expect a migration.

Module resolution: NodeNext when Node runs the output, bundler when a bundler does.

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Write a short, fact-checked reply that answers a colleague's question in one meaning only, ready to copy and paste. The input is their pasted message. Check the claims against the code first, use the project glossary terms, and print only the reply in chat. Read-only — no writes to code, the issue tracker, GitHub, chat or any MCP. Use on "/cortex-communication:answer-buzzkill", "help me answer", "reply to this question", or when the user pastes a colleague's question and asks for an answer in the same manner.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

alexander-danilenko/cortex-claude-code-plugins172026년 10월 13일 업데이트

Apply these opinionated .NET 8 architecture conventions whenever structuring or reviewing a backend service: clean architecture layering and which direction dependencies point, when CQRS with MediatR is worth it, cross-cutting concerns as pipeline behaviours, minimal APIs grouped by feature, keeping DbContext in Infrastructure, health checks and structured logging, WebApplicationFactory integration tests, and when AOT pays off.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

alexander-danilenko/cortex-claude-code-plugins172026년 10월 13일 업데이트

Apply these opinionated testing conventions whenever writing, reviewing, or planning tests: what earns a test and what is coverage theatre, asserting outputs rather than mock calls, the three modes (functional, performance, security), naming and isolation rules, where to mock, and reporting findings for coverage rather than self-filtering. Includes house Jest standards for NestJS unit and contract tests, TDD discipline, and test-report structure.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

alexander-danilenko/cortex-claude-code-plugins172026년 10월 13일 업데이트

Apply these opinionated Python 3.11+ conventions when writing Python in this codebase: type hints with mypy, async/await, pytest fixtures, dataclasses, Poetry packaging, production patterns.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

alexander-danilenko/cortex-claude-code-plugins172026년 10월 13일 업데이트

csharp

무료

Apply these opinionated C# conventions whenever writing or reviewing C# 12 / .NET 8+ code: nullable enabled with warnings as errors, records and primary constructors, pattern matching over cast chains, the Result pattern for expected failures, async all the way with CancellationToken, IOptions config, IHttpClientFactory, and never returning EF entities from an API.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

alexander-danilenko/cortex-claude-code-plugins172026년 10월 13일 업데이트

ALWAYS invoke for any task involving docstrings, JSDoc/TSDoc, or REST API documentation — even when the request seems handleable without it. Enforces Microsoft contract-first conventions and a bare-minimum rule that Claude won't apply by default: never restate the signature, drop @param/@returns that only echo names and types, always document @throws, and document data shapes as WHAT not WHY. Covers Python docstring styles (Google/NumPy/Sphinx), TSDoc tags and @inheritDoc, and API doc patterns for NestJS/Express/FastAPI/Django. Trigger on: adding or auditing docstrings, redundant or missing tags, deleting comment rot, or producing a documentation-health report. Do not skip for documentation tasks — consistent conventions are the whole point.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

alexander-danilenko/cortex-claude-code-plugins172026년 10월 13일 업데이트

alexander-danilenko의 스킬 모두 보기

이 스킬의 문제 신고