Dynamic skill insertion before builtins

From ychampion/cskill-agents · View interactive version

Dynamic skill insertion before builtins is an AI agent skill from the GitHub repository ychampion/cskill-agents. Merge runtime-discovered commands into an existing command registry by deduping them against the enabled base surface and inserting them at a stable boundary before built-in commands.

How to use this skill

Skill file

SKILL: Dynamic Skill Insertion Before Builtins

Domain: Command Architecture

Trigger: Use when commands can be discovered at runtime and must be added to a prebuilt command list without duplicating enabled entries or scrambling the established built-in ordering.

Source Pattern: Distilled from reviewed command-surface, skill-discovery, and CLI capability implementations.

Core Method

First compute the user-visible base command list, then treat that enabled surface as the dedupe authority for any newly discovered runtime commands. Filter dynamic entries by stable command name against that base set so you only add commands that are truly absent for the current session. Instead of re-sorting or rebuilding the whole registry, locate the first built-in command and splice the new dynamic entries immediately before it. This keeps plugin and external discoveries ahead of the built-in block while preserving the built-ins' internal order and keeping the command surface stable across refreshes.

Key Rules

Example Application

If a CLI can discover new slash commands while scanning the working tree, first build the enabled command list the user can actually run, remove any discovered commands whose names already appear there, then insert the remaining discoveries just before the first built-in help or config command. The runtime additions stay visible near other extensible commands without shuffling the built-in command block on each scan.

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.