Vue3 Style logo

Vue3 Style

Community
happydog-intj
vue3-style

Vue 3 核心源码编码风格 Skill。蒸馏自 vuejs/core 源码、Evan You 的代码审查记录、 Vue RFC 文档、Vue 核心团队成员的技术博客。 触发词:「Vue3 风格」「像 Vue 一样写 TypeScript」「vue3 style」「Evan You 风格」。 适用:前端框架开发、TypeScript 库开发、响应式系统、编译器开发。

Overview

Publisherhappydog-intj
Repositoryluban-skill
Skill namevue3-style
Stars
32
Forks
3
Bundled files
Instructions only
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by happydog-intj on GitHub. Read the source before you install it.

Installation

Install the Vue3 Style AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/happydog-intj/luban-skill/tree/master/skills/vue3.skill
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/happydog-intj/luban-skill.git /tmp/luban-skill
mkdir -p .claude/skills
cp -r /tmp/luban-skill/skills/vue3.skill .claude/skills/vue3-style
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Vue3 Style in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Vue3 Style on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Vue3 Style is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Vue 3 · 编码 DNA

"The best API is the one that feels obvious the first time you see it." — Evan You

角色定义

此 Skill 激活后,你写出的 TypeScript 代码应该让 Vue 核心团队 contributor 在 code review 时 感觉「这段代码很 Vue」,而不是「这看起来像从 React 搬过来的」。

这意味着:类型显式、接口直觉、抽象有节制。


命名 DNA

5 条直觉规则:

  1. 动词开头的函数,名字说清楚行为

    ts
    // ✅ 动词+名词,意图清晰
    function createApp(rootComponent: Component): App
    function defineComponent(options: ComponentOptions): Component
    function computed<T>(getter: () => T): ComputedRef<T>
    
    // ❌ 含糊的名词
    function app(root: Component): App
    function component(options: any): any
  2. Ref 类型加 Ref 后缀,响应式变量不加

    ts
    const count = ref(0)          // ✅ 变量名不加 Ref
    const countRef = ref(0)       // ❌ 多余
    type CountRef = Ref<number>   // ✅ 类型名可以加
  3. 内部 API 用 _ 前缀或放 internal 模块,不暴露

    ts
    export function _normalizeProps() { ... }  // 内部工具
    // 或放在 packages/runtime-core/src/internal/
  4. 布尔值命名用 is/has/should 前缀

    ts
    const isVNode = (val: unknown): val is VNode => ...
    const hasOwn = (obj, key) => Object.hasOwn(obj, key)
  5. 泛型参数用语义化名称,不用 T/U/V

    ts
    // ✅ 语义化泛型
    function ref<Value>(value: Value): Ref<Value>
    function shallowRef<Target>(value: Target): ShallowRef<Target>
    
    // ❌ 字母泛型(除了最简单的情况)
    function wrap<T>(value: T): Wrapper<T>

结构偏好

模块组织:

  • 一个功能一个文件,文件名就是功能名(ref.ts、computed.ts、watch.ts)
  • 相关工具函数集中到 utils.ts 或单独的工具模块,不散在各处
  • 导出从顶层 index.ts 聚合,内部文件不关心谁引用它
packages/reactivity/src/
├── index.ts        ← 唯一的公开出口
├── ref.ts          ← ref 相关逻辑
├── computed.ts     ← computed 相关逻辑
├── effect.ts       ← 响应式依赖追踪
└── baseHandlers.ts ← Proxy handler 实现

函数粒度:

  • 函数短而专注,副作用显式(不做隐式的事)
  • 工厂函数(createXxx)返回对象,不用 class(除非有明确理由)
  • Composable 以 use 开头,只做一件事
ts
// ✅ 工厂函数风格
function createReactiveEffect(fn: () => void): ReactiveEffect {
  const effect = new ReactiveEffect(fn)
  effect.run()
  return effect
}

// ❌ 过度 OOP
class ReactiveEffectFactory {
  create(fn: () => void): ReactiveEffect { ... }
}

类型定义:

  • 优先 interface 用于对象形状,type 用于联合/交叉类型
  • 类型和实现放同一文件(除非类型要跨包共享)
  • 避免 any,实在不行用 unknown + 类型收窄
ts
// ✅
interface ComputedRef<T = any> extends WritableComputedRef<T> {
  readonly [RefSymbol]: true
  readonly value: T
}

// ❌
type ComputedRef = any

注释哲学

Vue 源码的注释非常克制,但关键地方必须解释 Why:

ts
// ✅ 解释非直觉的实现决策
// Using a symbol as WeakMap key to avoid string-keyed property collision
// and ensure the map is always associated with the right target proxy
const targetMap = new WeakMap<object, Map<unknown, Dep>>()

// ✅ 标注 edge case 和 workaround
// #2308: force root effects to run as they need to avoid
// flush timing issue with mounted hooks
if (instance.isMounted) { ... }

// ❌ 废话注释
// create a new map
const map = new Map()

注释格式规范:

  • issue 引用:// #2308: 描述(对应 GitHub issue)
  • TODO 格式:// TODO: 描述,优先附上 issue 链接
  • 类型注释用 JSDoc,方便 IDE 和文档生成

反模式(绝不这样写)

  1. as any 甩锅 — 类型不对就该修类型,不是 as any 绕过

    ts
    const el = document.querySelector('.app') as any  // ❌
    const el = document.querySelector('.app') as HTMLElement  // ✅
  2. 过早抽象 — Vue 的哲学是「当你需要抽象时再抽象」,不是「以防万一先抽象」

    ts
    // ❌ 为了 DRY 创造不必要的抽象层
    abstract class BaseReactiveHandler { ... }
    class MutableHandler extends BaseReactiveHandler { ... }
    // ✅ 直接实现,相似代码出现 3 次再抽象
  3. 副作用藏在纯函数里 — 如果函数有副作用,名字/签名要体现出来

  4. Ref 当 Reactive 用 — ref 用于基本值,reactive 用于对象,不混用

  5. 直接 mutate props — Composable 接收的响应式参数只读,不直接修改

  6. 过度嵌套 Composable — 超过 3 层嵌套调用是设计问题

  7. 类型断言替代类型设计 — as Type 是最后手段


校验测试

写完代码,问自己:

  1. 直觉测试:把这段代码 API 给一个 Vue 用户看,他 5 秒内能猜出怎么用吗?
  2. 纯度检查:有没有没有函数偷偷做了名字之外的事?
  3. 类型逃逸:有几个 any 或 as?超过 2 个就需要审查

来源

  • vuejs/core 源码(packages/reactivity, packages/runtime-core)
  • Vue 3 RFC 文档:vuejs/rfcs
  • Evan You 关于 Vue 3 设计决策的演讲和博客
  • Vue 核心团队 code review 记录(GitHub PR comments)

Frequently asked questions

What does the Vue3 Style AI skill do?

Vue 3 核心源码编码风格 Skill。蒸馏自 vuejs/core 源码、Evan You 的代码审查记录、 Vue RFC 文档、Vue 核心团队成员的技术博客。 触发词:「Vue3 风格」「像 Vue 一样写 TypeScript」「vue3 style」「Evan You 风格」。 适用:前端框架开发、TypeScript 库开发、响应式系统、编译器开发。

Why use Vue3 Style on TypingMind?

Because you install it once and use it with any model. Vue3 Style is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Vue3 Style in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/happydog-intj/luban-skill/tree/master/skills/vue3.skill. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Vue3 Style?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Vue3 Style?

As many as you like. As long as a model supports skills, you can use Vue3 Style with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Vue3 Style AI skill free?

It is published on GitHub by happydog-intj. Check the repository for licensing terms. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇