commandbox-developing

Create CommandBox commands, modules, and interceptors with CFML and WireBox.

16|78|Updated Nov 28, 2014
One-click install
npx skills add https://github.com/ortus-docs/coldbox-docs --skill commandbox-developing
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: commandbox-developing
Source: https://github.com/ortus-docs/coldbox-docs/tree/main/.agents/skills/commandbox-developing
Command: npx skills add https://github.com/ortus-docs/coldbox-docs --skill commandbox-developing

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

CommandBox extension and module development can be complex; this skill provides a structured, example-driven guide to create custom commands, modules, and interceptors with dependency injection and lifecycle awareness.

Core Features & Use Cases

  • Minimal Command: create a basic command with a ModuleConfig and run() implemented.
  • Namespaced Commands and Modules: organize commands and modules into a scalable hierarchy.
  • DI and Interceptors: leverage WireBox injection and pre/post command interception points.
  • Lifecycle and ModuleGlue: lifecycle hooks like onLoad and onUnLoad, module linking, and sharing modules.
  • Quick Start oriented: includes practical steps to verify setup and run sample commands.

Quick Start

Create a minimal CommandBox module under ~/.CommandBox/cfml/modules and run a sample command to verify your setup.

Frequently Asked Questions about commandbox-developing

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

FAQPage Schema
How do I develop CommandBox modules with dependency injection?

To develop CommandBox modules with dependency injection, you leverage WireBox injection within your ModuleConfig to provide necessary objects to your commands and interceptors, ensuring maintainable and testable tooling.

What is the best way to create custom CLI commands in CFML?

The best way to create custom CLI commands in CFML is by defining a minimal command structure with a ModuleConfig and implementing the run() method, which can then be organized into a scalable hierarchy using namespaced commands.

How do lifecycle hooks work when building CommandBox extensions?

Lifecycle hooks like onLoad and onUnLoad work by executing specific logic when your CommandBox extension or module is installed or removed, allowing you to initialize resources, register interceptors, and clean up dependencies properly.

Can I use interceptors to run logic before CommandBox commands execute?

Yes, you can use interceptors to run custom logic before or after CommandBox commands execute by leveraging pre and post command interception points, enabling you to modify behavior or enforce constraints across your custom CLI modules.

Where do I place a minimal CommandBox module to verify my setup?

You place a minimal CommandBox module under the ~/.CommandBox/cfml/modules directory and run a sample command from your CLI to verify the module configuration, dependency injection, and lifecycle hooks are functioning correctly.

Does WireBox support organizing namespaced commands in CommandBox?

Yes, WireBox supports organizing namespaced commands in CommandBox by allowing you to structure your modules into a scalable hierarchy, ensuring your custom CLI extensions remain maintainable as the number of commands grows.