← ClaudeAtlas

boxlang-best-practiceslisted

Use this skill when writing, reviewing, or improving BoxLang code to ensure it follows community best practices for naming, structure, scoping, error handling, performance, and maintainability.
ortus-boxlang/skills · ★ 0 · AI & Automation · score 58
Install: claude install-skill ortus-boxlang/skills
# BoxLang Best Practices ## Overview BoxLang is a modern dynamic JVM language. These best practices reflect idiomatic BoxLang patterns informed by the language's design, CFML heritage, and JVM performance characteristics. Following them produces code that is readable, maintainable, performant, and safe. --- ## Naming Conventions | Item | Convention | Example | |------|-----------|---------| | Variables | camelCase | `userProfile`, `orderTotal` | | Functions/Methods | camelCase | `getUserById()`, `processOrder()` | | Classes | PascalCase | `UserService`, `OrderProcessor` | | Constants | UPPER_SNAKE_CASE | `MAX_RETRIES`, `DEFAULT_TIMEOUT` | | Files (classes) | PascalCase | `UserService.bx` | | Files (templates) | camelCase or kebab-case | `userProfile.bxm`, `order-details.bxm` | | Files (scripts) | camelCase | `buildReport.bxs` | ```boxlang // Good class UserService { function getUserById( required numeric id ) { var MAX_RETRIES = 3 var userId = arguments.id return userRepository.find( userId ) } } ``` --- ## Variable Scoping Always declare local variables with `var` inside functions to avoid polluting the `variables` scope (the component-level scope). ```boxlang // BAD — leaks into variables scope function process() { result = doWork() return result } // GOOD — properly local function process() { var result = doWork() return result } ``` Use explicit scope prefixes when ambiguity exists: ```boxlang function getUser(