Feature gated command registry loading

From ychampion/cskill-agents · View interactive version

Feature gated command registry loading is an AI agent skill from the GitHub repository ychampion/cskill-agents. Assemble the command registry so optional modules only load when their feature flag is enabled and the registry is accessed.

How to use this skill

Skill file

SKILL: Feature-Gated Command Registry Loading

Domain: Command Architecture

Trigger: Use when a command registry must gate optional commands behind feature flags and only initialize them when the registry is actually requested.

Source Pattern: Distilled from reviewed command-surface, feature-gating, and lazy-registry implementations.

Core Method

List the baseline commands normally, but place optional commands behind explicit feature checks so their modules do not load unless the feature is enabled. Build the registry lazily and cache the result after first access so startup does not pay for configuration reads or heavyweight command wiring. If you maintain companion registries such as internal-only or hidden commands, derive them from the same gated entries instead of rebuilding the logic in parallel.

Key Rules

Example Application

If you add an advanced /insights command, keep it behind a feature gate and load it only when the gate is enabled and the registry is requested. Users without that feature never pay the startup cost of the heavy module.

Anti-Patterns (What NOT to do)

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.