一键导入
typescript
// Write clear, predictable TypeScript and Vue TypeScript code with strong typing, maintainability, and consistent documentation conventions.
// Write clear, predictable TypeScript and Vue TypeScript code with strong typing, maintainability, and consistent documentation conventions.
Minimal starter runbook for cloud agents to install dependencies, run packages, execute tests, and troubleshoot the Scalar monorepo quickly.
Skill for writing and updating scalar.config.json — Scalar Docs configuration reference for users and LLMs.
Build, customize, and troubleshoot OpenAPI mock servers with @scalar/mock-server, including x-handler, x-seed, authentication, and Docker.
Use consistent OpenAPI terminology and definitions when writing documentation, educational material, and tooling guidance.
Write clear, maintainable Vitest and Playwright tests with precise assertions, consistent structure, and strong behavioral coverage.
Build Vue 3 components with TypeScript and Tailwind using clean structure, composable logic, accessibility, and maintainable patterns.
| name | typescript |
| description | Write clear, predictable TypeScript and Vue TypeScript code with strong typing, maintainability, and consistent documentation conventions. |
You write TypeScript code that is clear, predictable, and easy to maintain. The goal is to make the codebase safer, more understandable, and easier to refactor without over-engineering.
name.test.ts.Good:
/**
* We load the user here to make sure we have fresh data when the component mounts.
* Without this, the user info could be stale.
*/
Bad:
/**
* Load user.
*/
Avoid contractions in comments. Use do not instead of don't, it is instead of it's, etc. This makes comments easier to read, especially for non-native speakers.
If you use contractions, make sure they have proper apostrophes. Sometimes contractions can make a comment more approachable. If you choose to use them, use proper punctuation.
Comment on types when their purpose isn't obvious. If a type models an external API, or has a non-obvious constraint, explain it.
Explain relationships between types when they're not clear.
Example:
/**
* Maps UserStatus to a badge color used in the UI.
* Should stay in sync with the theme color palette.
*/
export type StatusColorMap = {
active: 'green'
inactive: 'gray'
}
Example:
/**
* Represents a partial object where at least one property is required.
* Useful when you want to enforce at least one field update in a PATCH request.
*/
export type AtLeastOne<T> = {
[K in keyof T]: Partial<T> & Pick<T, K>
}[keyof T]
Example:
/**
* useUser composable for loading and managing user data.
* Fetches the user from the API and exposes reactive state.
*
* Returns:
* - user: Ref<User | null>
* - isLoading: Ref<boolean>
* - loadUser: Function to manually trigger user loading
*/
export function useUser() { ... }
Example:
/**
* TODO: Replace with dynamic permissions from backend when available.
*/
export type Permissions = 'read' | 'write' | 'admin'
/**
* A user in the system.
* This type represents the internal data structure for application logic.
* If you need to expose user data publicly, use `PublicUser`.
*/
export type User = {
/** Unique identifier for the user (UUID). */
id: string
/** The user's full name. */
name: string
/** Email address. Must be validated before saving. */
email: string
/** ISO date string of when the user signed up. */
createdAt: string
/** Whether the user has verified their email. */
isVerified: boolean
}