LobeHub TypeScript style and type-safety guide. Use when editing TS/TSX/MTS, fixing types, choosing interface vs type, avoiding any/object, import type, async flow, or ts-expect-error.
The typescript skill is LobeHub's TypeScript style and type-safety guide, used when editing TS, TSX, or MTS files, fixing types, choosing between interface and type, avoiding any or object, or handling import type, async flow, or ts-expect-error. It captures the conventions the LobeHub codebase expects.
It covers type safety (let TypeScript infer where possible, avoid implicit any, prefer accurate types like Record over object or any, interface for object shapes and type for unions, as const satisfies, and ts-expect-error over ts-ignore over as any), async patterns (prefer async/await and promise-based APIs, use Promise.all where safe), import conventions (separate type imports, alphabetical sorting), code structure (object destructuring, named constants, named exports over default, and reusing helpers from packages/utils), UI and theming (use the component library and token system, design for dark mode and mobile), performance, and logging (never log secrets, always log errors in catch blocks).
It is most useful for contributors to the LobeHub project, or similar TypeScript codebases, who want consistent, type-safe, maintainable code aligned with the project's linting and conventions.
When editing TypeScript (TS, TSX, MTS) in the LobeHub codebase, fixing types, choosing interface versus type, avoiding any or object, or handling import type and async flow.
Let TypeScript infer where possible, avoid implicit any, prefer accurate types like Record over object or any, use interface for shapes and type for unions, and prefer ts-expect-error over ts-ignore over as any.
Always use separate import type statements (not inline type), keep type and value imports as separate statements, and sort specifiers alphabetically.
Prefer named exports over export default to keep refactors and IDE auto-import consistent, reserving default exports for files where the framework requires them.
Never log private information like API keys, avoid the debug package in favor of console.error in catch blocks, and always log the error rather than silently swallowing it.
Quick Setup:
.claude/skills/Repository
lobehub/lobehub