From bpmn-to-code
Generates a single Kotlin BpmnValidationRule implementation from BPMN_STYLE_GUIDE.md. Use when drafting or iterating on one rule without regenerating the full file.
How this skill is triggered — by the user, by Claude, or both
Slash command
/bpmn-to-code:generate-rule-to-enforce-bpmn-styleguide [rule-slug][rule-slug]This skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Generate a single Kotlin `BpmnValidationRule` implementation for one entry in `BPMN_STYLE_GUIDE.md`. Same template, conventions and output directory as the bulk variant — use this when you're drafting a rule or iterating on one without regenerating the full file.
Generate a single Kotlin BpmnValidationRule implementation for one entry in BPMN_STYLE_GUIDE.md. Same template, conventions and output directory as the bulk variant — use this when you're drafting a rule or iterating on one without regenerating the full file.
generate-rules-to-enforce-bpmn-styleguide) says also applies here.validation: deterministic or validation: hybrid). If the user asks for an llm-only rule, explain that it belongs to /validate-bpmn-style only and stop.hybrid rules, generate the deterministic half and note in a comment that the semantic half stays for /validate-bpmn-style.BpmnStyleGuideRules.kt) owned by the bulk variant. This skill writes its own per-rule file; the user can run the bulk skill later to regenerate the aggregator.requireNotNull() instead of !!.bpmn-to-code-core/src/main/kotlin/io/miragon/bpmn/domain/validation/rules/InvalidIdentifierRule.kt as the structural template.For rule bodies, read the actual domain classes under bpmn-to-code-core/src/main/kotlin/io/miragon/bpmn/domain/shared/ — don't trust static summaries.
bpmn-to-code-testing SetupSame check as the bulk variant — generated rules need the dependency.
build.gradle, build.gradle.kts, pom.xml, */build.gradle*, */pom.xml.bpmn-to-code-testing.BPMN_STYLE_GUIDE.md (current dir, then git root). Missing → suggest /build-bpmn-styleguide.<!-- rule:<slug> --> anchor. yaml``` fenced block + the preceding prose.$ARGUMENTS is a rule slug, look it up.Decide based on the rule's validation:
deterministic → proceed.hybrid → proceed (deterministic half); inform the user the semantic half stays for /validate-bpmn-style.llm → stop. Explain that the rule is enforced only by /validate-bpmn-style and there's nothing to generate.Before generating, show the user:
applies-to + the YAML schema).Ask for confirmation.
One Kotlin file, one class. Class name is PascalCase of the slug (e.g. element-id-format → ElementIdFormatRule).
File header:
// Generated from BPMN_STYLE_GUIDE.md by /generate-rule-to-enforce-bpmn-styleguide.
// Re-run the skill after editing the rule in the style guide.
Class for a deterministic rule (follow InvalidIdentifierRule.kt for shape):
/**
* element-id-format (deterministic)
* Category: technical-configuration
*/
class ElementIdFormatRule : BpmnValidationRule {
override val id = "element-id-format"
override val severity = Severity.ERROR
override fun validate(context: ValidationContext): List<ValidationViolation> {
val pattern = Regex("^(serviceTask|userTask|...)_[A-Z][a-zA-Z0-9]*$")
return context.model.flowNodes
.filter { node ->
val nodeId = requireNotNull(node.id) { "FlowNode missing id" }
!pattern.matches(nodeId)
}
.map { node ->
ValidationViolation(
ruleId = id,
severity = severity,
elementId = node.id,
processId = context.model.processId,
message = "Element ID '${node.id}' does not match format type_DescriptionInCamelCase",
)
}
}
}
Class for a hybrid rule — same shape, but the doc comment calls out the split:
/**
* service-task-topic (hybrid — deterministic half only)
* Category: technical-configuration
*
* This rule covers the deterministic shape check. The semantic half
* is enforced by /validate-bpmn-style using the rule's prose as the brief.
*/
class ServiceTaskTopicRule : BpmnValidationRule { /* ... */ }
Before asking where to write, see whether the project already has a rule for this slug:
**/src/test/kotlin/**/architecture/bpmn/**/*.kt, plus a broader **/src/test/kotlin/**/*Rule.kt to catch alternative layouts.override val id = "<slug>" literal, and for the expected class name.Default to src/test/kotlin/<package>/architecture/bpmn/<ClassName>.kt in the module from Step 0 — same directory as the bulk skill uses. If Step 4 found an existing file, suggest that location by default. Confirm or let the user override.
Create architecture/bpmn/ if needed.
Write the file.
Run ./gradlew compileKotlin (or the module's test-compile task).
Fix and retry if it fails.
Show how to plug the rule in:
BpmnValidator
.fromClasspath("bpmn/")
.engine(ProcessEngine.CAMUNDA_7)
.withRules(BpmnRules.all() + listOf(ElementIdFormatRule()))
.validate()
.assertNoErrors()
Mention the bulk skill for when the user is ready to generate the full aggregator (BpmnStyleGuideRules.kt). If this is a hybrid rule, remind them that /validate-bpmn-style still needs to run for the semantic half.
npx claudepluginhub miragon/bpmn-to-code --plugin bpmn-to-codeCreates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.