Is there anything like global rules?

https://www.eclipse.org/xtend/documentation/203_xtend_expressions.html

The OH DSL allows for lambdas and scripts. Separating rule files is really just for logical arrangement… otherwise, there is no benefit. Scripts can be shared across rule files, but have their own context, so no access to lambdas/global variables. The closest thing OH offers to what you are looking for is a lambda, but can’t be shared across rule files.