plugin-architecture

Explains how to define, register and manage plugins and generator lifecycles in the Kubb ecosystem.

1.8k|146|Updated Jan 8, 2023
One-click install
npx skills add https://github.com/kubb-labs/kubb --skill plugin-architecture
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: plugin-architecture
Source: https://github.com/kubb-labs/kubb/tree/main/.skills/plugin-architecture
Command: npx skills add https://github.com/kubb-labs/kubb --skill plugin-architecture

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Defines how plugins are structured, registered, and how generators interact with the plugin lifecycle within the Kubb ecosystem.

Core Features & Use Cases

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

Quick Start

Create a minimal plugin using definePlugin and walk through its pre, post, and install hooks.

Frequently Asked Questions about plugin-architecture

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I define a custom plugin in the Kubb ecosystem?

The plugin lifecycle in Kubb generators is managed through the PluginManager, which orchestrates plugin hooks including pre, post, resolvePath, resolveName, and install to control execution flow during generation.

How do I extend generators with plugin hooks in Kubb?

The resolvePath and resolveName hooks in Kubb plugins allow developers to intercept and customize file path resolution and naming conventions, ensuring generated outputs align with specific project structures.

What is the typical shape of a plugin factory in Kubb?

The PluginManager in Kubb handles plugin registration, orchestrates hook execution order, and provides common helper utilities that generators and components rely on during the build and generation process.

When do I need to build a plugin for Kubb generators?

Kubb plugins are best used when extending generators with custom logic through pre, post, or install hooks, but standard generation tasks can often be handled by existing configurations without new plugins.

Can I use custom helper utilities within Kubb generator plugins?

No, Kubb plugins are self-contained within the ecosystem and have no external dependencies, relying solely on the PluginManager and definePlugin to manage registration and lifecycle execution.