← ClaudeAtlas

coldbox-decoratorslisted

Use this skill when extending or overriding ColdBox framework internals via the Decorator pattern -- specifically creating a ControllerDecorator to wrap the main ColdBox controller, or a RequestContextDecorator to wrap and augment the request context (event) object with custom methods or overridden behavior.
ColdBox/skills · ★ 0 · AI & Automation · score 61
Install: claude install-skill ColdBox/skills
# ColdBox Decorators (Controller & Request Context) ## When to Use This Skill Use this skill when you need to: - Add custom methods or override existing methods on the ColdBox **controller** object (e.g., always force SSL on all relocations) - Add custom methods or override existing methods on the **request context** (event/`rc`/`prc`) object (e.g., auto-trim values, add helper getters) - Extend framework behavior without modifying framework source code ## Core Concepts Both decorators follow the [Decorator Pattern](https://sourcemaking.com/design_patterns/decorator): - You create a CFC that **extends the framework decorator base class** - Implement a `configure()` method for initialization - Add new methods or override existing ones - Access the **original** object via a getter (`getController()` or `getRequestContext()`) - Register the decorator path in `config/ColdBox.cfc` Neither decorator requires modifying framework source — changes are application-level. --- ## Controller Decorator ### When to Use - Override `relocate()` / `setNextEvent()` to always add SSL, tracking params, etc. - Add application-specific controller-level helpers - Implement different controller behaviors per deployment protocol ### Base Class `coldbox.system.web.ControllerDecorator` Access original controller: `getController()` ### Implementation ```javascript // models/MyControllerDecorator.cfc component extends="coldbox.system.web.ControllerDecorator" { /** * Called when the