AgentSkillsCN

plugin-architecture

深入解析 Kubb 生态系统中插件的生命周期、生成器类型,以及插件常用的通用工具。

SKILL.md
--- frontmatter
name: plugin-architecture
description: Explains plugin lifecycle, generator types, and common utilities used by plugins in the Kubb ecosystem.

Plugin Architecture Skill

This skill instructs agents on how plugins are defined, registered, and how generators interact with the plugin lifecycle.

When to Use

  • When users ask how to create a plugin or resolve names/paths
  • When explaining generator lifecycles and utility helpers

What It Does

  • Describes PluginManager and plugin hooks (pre, post, resolvePath, resolveName, install)
  • Shows a typical plugin factory shape
  • Lists common helper utilities used within generators and components

Example Plugin Shape

ts
export const definePlugin = createPlugin<PluginOptions>((options) => ({
  name: pluginName,
  options,
  pre: [],
  post: [],
  resolvePath(baseName, mode, options) { /* ... */ },
  resolveName(name, type) { /* ... */ },
  async install() { /* ... */ },
}))

Utilities to Reference

  • getFile(operation, { pluginKey })
  • getName(operation, { type, prefix })
  • getSchemas(operation, { pluginKey, type })

Related Skills

SkillUse For
../components-generators/SKILL.mdGuidance for writing @kubb/react-fabric components and generators