
Typescript
- 1.6k installs
- 81.3k repo stars
- Updated August 5, 2026
- lobehub/lobe-chat
This is a copy of typescript by lobehub - installs and ranking accrue to the original listing.
typescript is a LobeHub agent skill that enforces consistent, safe TypeScript patterns across agent skills and MCP servers for developers editing TS, TSX, or MTS files who need type-safety conventions.
About
typescript is LobeHub's TypeScript code style guide packaged as an agent skill for editing TS, TSX, and MTS across skills and MCP servers. It directs developers to avoid explicit annotations when inference suffices, eliminate implicit any, prefer Record<PropertyKey, unknown> over object or any, and choose interface for object shapes while reserving type for unions and intersections. The guide recommends as const satisfies over plain as const and @ts-expect-error over @ts-ignore for intentional suppressions. Developers invoke typescript when fixing types, choosing interface versus type, handling async flow, or reviewing agent-shipped TypeScript. The skill is user-invocable false, meaning agents apply it automatically during relevant edits rather than on direct user command.
- Covers interface vs type, Record<PropertyKey, unknown> over any/object, as const satisfies, @ts-expect-error over @ts-ig
- Enforces separate-type-imports, async/await + Promise.all, for…of over indexed for loops
- Bans silent .catch(() => fallback) and meaningless null/undefined parameters
- Guides module augmentation with declare module over namespace and extensible types like PipelineContext.metadata
- Triggers on any TypeScript file edit or questions about type quality
Typescript by the numbers
- 1,619 all-time installs (skills.sh)
- +82 installs in the week ending Aug 5, 2026 (Skillselion tracking)
- Security screen: LOW risk (skills.sh audit)
- Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/lobehub/lobe-chat --skill typescriptAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 1.6k |
|---|---|
| repo stars | ★ 81.3k |
| Security audit | 3 / 3 scanners passed |
| Last updated | August 5, 2026 |
| Repository | lobehub/lobe-chat ↗ |
How do you enforce TypeScript style in agent code?
Enforce consistent, safe TypeScript patterns across every agent skill and MCP server they ship.
Who is it for?
Developers editing LobeHub skills, MCP servers, or TypeScript codebases who want consistent type-safety conventions applied during refactors.
Skip if: Greenfield JavaScript projects without TypeScript or teams needing ESLint rule configuration instead of editorial style guidance.
When should I use this skill?
An agent is editing TS, TSX, or MTS files, fixing types, or choosing between interface and type aliases.
What you get
Type-safe TS and TSX edits following LobeHub interface, import, and error-suppression conventions.
- Type-safe TypeScript edits following LobeHub conventions
Files
TypeScript Code Style Guide
Types and Type Safety
- Avoid explicit type annotations when TypeScript can infer
- Avoid implicitly
any; explicitly type when necessary - Use accurate types: prefer
Record<PropertyKey, unknown>overobjectorany - Prefer
interfacefor object shapes (e.g., React props); usetypefor unions/intersections - Prefer
as const satisfies XyzInterfaceover plainas const - Prefer
@ts-expect-errorover@ts-ignoreoveras any - Avoid meaningless null/undefined parameters; design strict function contracts
- Prefer ES module augmentation (
declare module '...') overnamespace; do not introducenamespace-based extension patterns - When a type needs extensibility, expose a small mergeable interface at the source type and let each feature/plugin augment it locally instead of centralizing all extension fields in one registry file
- For package-local extensibility patterns like
PipelineContext.metadata, define the metadata fields next to the processor/provider/plugin that reads or writes them
Async Patterns
- Prefer
async/awaitover callbacks or.then()chains - Prefer async APIs over sync ones (avoid
*Sync) - Use promise-based variants:
import { readFile } from 'fs/promises' - Use
Promise.all,Promise.racefor concurrent operations where safe
Imports
- This project uses
simple-import-sort/importsandconsistent-type-imports(fixStyle: 'separate-type-imports')
- Separate type imports: always use
import type { ... }for type-only imports, NOTimport { type ... }inline syntax
- When a file already has
import type { ... }from a package and you need to add a value import, keep them as two separate statements:
import type { ChatTopicBotContext } from '@lobechat/types';
import { RequestTrigger } from '@lobechat/types';- Within each import statement, specifiers are sorted alphabetically by name
Code Structure
- Prefer object destructuring
- Use consistent, descriptive naming; avoid obscure abbreviations
- Replace magic numbers/strings with well-named constants
- Defer formatting to tooling
- Prefer named exports over
export default— keeps refactor renames and IDE auto-import in sync, and avoids thedefaultre-naming drift you get withimport Foo from './foo'. Reserveexport defaultfor files where the framework requires it (Next.js page/route/layout, React.lazy targets, config files likevitest.config.ts) - Before adding local helpers for common guards/parsing/normalization (record checks, string extraction, empty-string handling, timing helpers, JSON-safe utilities, etc.), search
packages/utilsfirst. If the helper already exists or clearly belongs there, import it from@lobechat/utils(or the relevant@lobechat/utils/*subpath) instead of duplicating tiny helpers across feature files.
UI and Theming
- Use
@lobehub/ui, Ant Design components instead of raw HTML tags - Design for dark mode and mobile responsiveness
- Use
antd-styletoken system instead of hard-coded colors
Performance
- Reuse existing utils in
packages/utilsor installed npm packages - Query only required columns from database
Time Consistency
- Assign
Date.now()to a constant once and reuse for consistency
Logging
- Never log user private information (API keys, etc.)
- Don't use
import { log } from 'debug'directly (logs to console) - Use
console.errorin catch blocks instead of debug package - Always log the error in
.catch()callbacks — silent.catch(() => fallback)swallows failures and makes debugging impossible
Related skills
How it compares
Use typescript for LobeHub editorial type-safety conventions; use ESLint or Biome config skills when the goal is automated lint rule enforcement.
FAQ
What files does the typescript skill target?
The typescript skill applies when editing TS, TSX, and MTS files in LobeHub projects, including agent skills and MCP servers. It covers type fixes, interface versus type choice, import type usage, and async flow patterns.
How does typescript handle type suppressions?
The typescript skill prefers @ts-expect-error over @ts-ignore for intentional suppressions and discourages implicit any. It recommends accurate types such as Record<PropertyKey, unknown> instead of object or any.
Is Typescript safe to install?
skills.sh reports 3 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.