← ClaudeAtlas

boxlang-core-dev-bif-developmentlisted

Use this skill when creating custom BoxLang built-in functions (BIFs): @BoxBIF annotation, invoke() method, argument handling, accessing BoxRuntime and services, BoxLang vs Java BIF implementations, member functions, and registering BIFs via modules.
ortus-boxlang/skills · ★ 0 · AI & Automation · score 58
Install: claude install-skill ortus-boxlang/skills
# BoxLang BIF Development ## Overview Built-in functions (BIFs) are globally available functions in BoxLang — no imports needed. When placed in a module's `bifs/` directory, they are automatically discovered and registered at module load time. BIFs can be implemented in either BoxLang or Java. ## BoxLang BIF ### Minimal Example ```boxlang // bifs/Greet.bx // File name = function name (case-insensitive: greet, Greet, GREET all work) @BoxBIF class { function invoke( required string name ) { return "Hello, #arguments.name#!" } } ``` ```boxlang // Usage anywhere in BoxLang (no import) greet( "Ada" ) // "Hello, Ada!" ``` ### Full-Featured BoxLang BIF ```boxlang // bifs/StringTitleCase.bx @BoxBIF class { /** * Converts a string to title case. * * @str The input string * @delimiters Word delimiters (default: space) * @return Title-cased string */ string function invoke( required string str, string delimiters = " " ) { if ( !len( arguments.str ) ) return "" var words = listToArray( arguments.str, arguments.delimiters ) return words .map( (w) -> uCase( left(w,1) ) & lCase( mid(w,2,len(w)) ) ) .toList( arguments.delimiters ) } } ``` ## Java BIF For performance-critical functions or when you need deep JVM access: ```java // src/main/java/com/example/bifs/StringTitleCase.java package com.example.bifs; import ortus.boxlang.runtime.bifs.BIF; impo