# Customrule

> This is a new rule

- Skill: `majiayu000/customrule-2` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add majiayu000/customrule-2`
- Raw SKILL.md: https://api.skillmd.com/api/skills/majiayu000/customrule-2/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: majiayu000 (https://skillmd.com/u/majiayu000)
- Updated: 2026-09-22
- Page: https://skillmd.com/skills/majiayu000/customrule-2

---


# TypeScript Migration Rules for 9jang Project

## Architecture Standard
- We are using a Monorepo structure with `pnpm workspaces`.
- Centralized Data Source: All API schemas and types MUST reside in `packages/shared/src/schemas`.
- Never define types locally if they represent API entities; always use `z.infer<typeof Schema>` from the shared package.

## TypeScript Best Practices
- **No `any`**: Use `unknown` with type guards if a type is truly uncertain.
- **Zod Integration**: Use Zod for runtime validation at the API service layer. 
- **Tiptap Extensions**: When migrating extensions, use "Module Augmentation" to register custom commands and attributes in `@tiptap/core`.

## Migration Strategy
- When converting Vue components, prioritize `<script setup lang="ts">`.
- For large composables (e.g., usePrintPreview), break down the logic into smaller, typed internal functions.
- Ensure all path aliases use `@/` for frontend and `@9jang/shared` for shared types.
