antfu
编码实践
代码组织
- 单一职责: 每个源文件应具有明确、专注的作用域/目的
- 拆分大文件: 当文件变得过大或处理过多关注点时拆分文件
- 类型分离: 始终将类型和接口分离到
types.ts或types/*.ts中 - 常量提取: 将常量移到专用的
constants.ts文件中
运行时环境
- 首选同构代码: 编写可在 Node、浏览器和 worker 中运行的运行时无关代码
- 明确运行时指标: 当代码特定于环境时,在文件顶部添加注释:
// @env node
// @env browser
More from tnnevol/skills
memos
Assistant for Memos (https://github.com/usememos/memos), an open-source self-hosted memo/note tool. Use when the user asks about Memos, creating/listing/updating/deleting memos, managing tags, or securely interacting with a Memos instance via API.
14pnpm
Node.js 包管理器,具有严格的依赖解析。在运行 pnpm 特定命令、配置工作区或使用目录、补丁或覆盖管理依赖项时使用。
8vue
Vue 3 组合式 API、script setup 宏、响应式系统和内置组件。在编写 Vue SFC、defineProps/defineEmits/defineModel、监视器或使用 Transition/Teleport/Suspense/KeepAlive 时使用。
6vitepress
VitePress static site generator powered by Vite and Vue. Use when building documentation sites, configuring themes, or writing Markdown with Vue components.
6tsdown
Bundle TypeScript and JavaScript libraries with blazing-fast speed powered by Rolldown. Use when building libraries, generating type declarations, bundling for multiple formats, or migrating from tsup.
6vitest
Vitest fast unit testing framework powered by Vite with Jest-compatible API. Use when writing tests, mocking, configuring coverage, or working with test filtering and fixtures.
6