소스 정보
- 저장소
- carrot-foundation/schemas
- 최근 소스 활동
- 2026년 3월 25일 20:55
- 감지된 SKILL.md 언어
- 영어
- 스타
- 1
- 포크
- 0
설치 방법
기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.
소스 파일 검토
설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.
메뉴
기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.
설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
직접 명령은 검토 Prompt를 거치지 않습니다. 실행하기 전에 소스를 확인하세요.
npx skills add https://github.com/carrot-foundation/schemas --skill rule-typescript명령은 한 줄로 유지됩니다. 복사하기 전에 가로로 스크롤해 전체 내용을 확인하세요.
로컬 사본을 원하시나요? SkillsMP에서 현재 제공할 수 있는 파일을 다운로드하세요.
Schema version injection, $id format, and SCHEMA_VERSION environment variable
Generated JSON Schema structure — required fields, validation patterns, and $ref usage
Use when a task is complete and needs the full check, commit, and PR workflow
SOC 직업 분류 기준
SKILL.md 표시 중
| name | rule-typescript |
| description | TypeScript conventions — strict mode, type patterns, and inference preferences |
Apply this rule whenever work touches:
src/**/*.tsThis is a published npm library where type safety directly impacts every consumer. Strict TypeScript configuration is non-negotiable.
The tsconfig extends @tsconfig/recommended and enables strict: true, which covers all strict family checks (strictNullChecks, strictFunctionTypes, strictBindCallApply, etc.).
any — everIn a schema library, any undermines the entire value proposition. Every any is a hole in the type system that propagates to consumers.
// BAD: any leaks to consumers
export function parseSchema(data: any): any {
return SomeSchema.parse(data);
}
// GOOD: unknown at boundaries, precise types internally
export function parseSchema(data: unknown): MassIDData {
return MassIDDataSchema.parse(data);
}
When working with truly dynamic data, use unknown and narrow:
// BAD: type assertion
const result = response.data as MassIDData;
// GOOD: runtime validation
const result = MassIDDataSchema.parse(response.data);
Every exported function must declare its return type. This serves as documentation and prevents accidental API changes.
// BAD: inferred return type can change silently
export function createFixture() {
return { name: 'test', weight_kg: 100 };
}
// GOOD: explicit contract
export function createFixture(): MassIDData {
return { name: 'test', weight_kg: 100 };
}
Internal (non-exported) functions should prefer inference to reduce noise:
// Internal — inference is fine
function buildMetadata(input: RawInput) {
return { title: input.name, created_at: new Date().toISOString() };
}
Never write manual type guards when Zod can validate. The schemas ARE the source of truth — use them.
// BAD: manual type guard duplicates schema logic
function isMassIDData(data: unknown): data is MassIDData {
return typeof data === 'object' && data !== null && 'name' in data;
}
// GOOD: Zod handles validation and type narrowing
const result = MassIDDataSchema.safeParse(data);
if (result.success) {
// result.data is typed as MassIDData
}
Use interface for object shapes that may be extended by consumers or composed with other interfaces. Use type for unions, intersections, mapped types, and Zod inferences.
// GOOD: interface for extensible shapes
interface SchemaMetadata {
title: string;
description: string;
}
// GOOD: type for Zod inference (cannot be interface)
type MassIDData = z.infer<typeof MassIDDataSchema>;
// GOOD: type for unions
type SchemaResult = MassIDData | CertificateData;
This project does not use path aliases. Use relative imports:
// GOOD: relative import
import { UuidSchema } from '../../../shared/schemas/primitives/ids.schema';
Avoid as assertions. If you must assert, prefer satisfies for compile-time checking without widening:
// BAD: assertion bypasses type checking
const config = { timeout: 5000 } as Config;
// GOOD: satisfies validates at compile time
const config = { timeout: 5000 } satisfies Config;
The only acceptable as usage is as const for literal types and narrowing from unknown after validation.
@ts-ignore and @ts-expect-errorNever use @ts-ignore. If you must suppress an error, use @ts-expect-error with a comment explaining why:
// BAD: suppresses without explanation
// @ts-ignore
const result = legacyFunction();
// ACCEPTABLE: documented reason
// @ts-expect-error — legacy function has incorrect typings, tracked in SCHEMAS-123
const result = legacyFunction();
If you find yourself needing @ts-expect-error, consider fixing the root cause first.