| name | coldbox-documenter |
| description | Use this skill when writing or improving documentation comments for ColdBox application code -- handlers, models, services, interceptors, layouts, modules, and configuration files. Covers what to document, what to skip, ColdBox-specific patterns for @event/@rc/@prc, integration with DocBox annotations, and documentation standards that result in accurate, useful API docs. |
| applyTo | **/*.{bx,bxm,cfc,cfm,cfml} |
ColdBox Documenter
When to Use This Skill
Use this skill when:
- Writing or reviewing documentation comments for any ColdBox component
- Deciding what information belongs in a block comment vs inline code comments
- Preparing a ColdBox application for DocBox API documentation generation
- Establishing documentation standards across a development team
Language Mode Reference
Examples use BoxLang (.bx) syntax by default. Adapt for your target language:
| Concept | BoxLang (.bx) | CFML (.cfc) |
|---|
| Class declaration | class [extends="..."] { | component [extends="..."] { |
| DI annotation | @inject above property name="svc"; | property name="svc" inject="svc"; |
| View templates | .bxm suffix | .cfm / .cfml suffix |
| Tag prefix | <bx:if>, <bx:output>, <bx:set> | <cfif>, <cfoutput>, <cfset> |
CFML Compat Mode: With BoxLang + CFML Compat module, .bx and .cfc files coexist freely. BoxLang-native classes use class {} (.bx files); CFML-compat classes use component {} (.cfc files).
Guiding Principles
- Document the contract, not the implementation. Comments should describe what and why, not how. The code already shows how.
- Prioritize public API. Every public method needs a comment. Private/package-private methods need one only when the intent is not obvious.
- Be concise but complete. One sharp sentence is better than three vague ones.
- Keep comments synchronized. Outdated comments are worse than no comments — update them when code changes.
File-Level Documentation Standards
Which Files to Document
| File Type | Priority | Notes |
|---|
| Handlers | High | All public actions + class-level description |
| Services / Models | High | All public methods + class-level description |
| Interceptors | High | configure() + every announced event method |
Modules / ModuleConfig | High | Module purpose, version, dependencies |
Configuration (ColdBox.cfc, Router.cfc) | Medium | Annotate non-obvious settings |
| Layouts + Views | Low | Only complex layouts with significant logic |
| Tests | Skip | Test names document intent well enough |
Documenting Handlers
Class-Level
class extends="coldbox.system.EventHandler" {
Action Methods (@event, @rc, @prc)
ColdBox handler actions always receive event, rc, and prc. Use these standard tags:
function index( event, rc, prc ) {
...
}
REST Actions
For REST handlers, document the HTTP contract explicitly:
function show( event, rc, prc ) {
...
}
Documenting allowedMethods
this.allowedMethods = {
create : "POST",
update : "PUT,PATCH",
delete : "DELETE"
};
Documenting Services
Services form the backbone of business logic. Document every public method thoroughly.
class {
property name="userDAO" inject="UserDAO";
property name="passwordService" inject="PasswordService";
User function findOrFail( required numeric userId ) { ... }
User function authenticate( required string email, required string password ) { ... }
void function delete( required numeric userId ) { ... }
}
Documenting Models / Entities
For ORM or Active Record entities, document non-obvious properties and all computed/relationship methods.
class persistent="true" table="users" {
property name="id" type="numeric" fieldtype="id" generator="native";
property name="passwordHash" type="string" column="password_hash";
boolean function isVerified() { return len( getEmailVerifiedAt() ) > 0 }
array function getRoles() { ... }
}
Documenting Interceptors
class extends="coldbox.system.Interceptor" {
property name="interceptorSettings" inject="coldbox:interceptorSettings";
void function preProcess( event, interceptData, buffer ) { ... }
}
Documenting Modules (ModuleConfig.cfc)
class {
this.title = "cbSecurity";
this.description = "Security module for ColdBox applications";
this.cfMapping = "cbSecurity";
function configure() {
}
}
Documenting Configuration Files
config/ColdBox.cfc
Comment non-obvious settings in the configure() body:
function configure() {
coldbox = {
appName : "MyApp",
appKey : "MyApp",
logBoxConfig : "config.LogBox"
};
coldbox.exceptionHandler = "main.onException";
interceptors = [
{ class: "interceptors.Security", properties: {} },
{ class: "interceptors.Maintenance", properties: {} }
];
}
config/Router.cfc
Document non-obvious routing rules:
class extends="coldbox.system.web.routing.Router" {
function configure() {
route( "/app/:anything" ).to( "main.index" );
group( { pattern: "/api/v1", namespace: "api.v1" }, function() {
resources( resource: "users", handler: "Users" );
resources( resource: "products", handler: "Products" );
} );
}
}
What NOT to Document
Avoid noise comments that restate the obvious:
User function getUser() { ... }
User function getCurrentUser() { ... }
Also skip:
- Getters/setters generated by
accessors=true — they need no comments
- One-liner private helpers where the name is self-explanatory
- Test spec files — test names document behavior
Documentation Checklist
Before submitting a ColdBox component: