Operational reference for BESSER code generators — covers per-generator options, output layout, regeneration behavior, safe customization patterns, template overrides, and debugging failures.
Ships in besser. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Every BESSER generator implements the same shape:
class GeneratorInterface(ABC):
def __init__(self, model, output_dir=None): ...
def generate(self): ...
If output_dir is omitted, output goes to <cwd>/output/. The directory
is created automatically (os.makedirs(..., exist_ok=True)).
Regeneration always overwrites. Every call to generate() replaces the
output files entirely. This is by design — the model is the source of truth.
Customizations belong in separate files (see "Safe customization" below).
Once you have generated, the besser-user skill's "Verification checklist"
covers what to check next (files exist, syntax parses, it runs).
Generate the baseline, then build on top. The point of these generators is that you don't hand-write the boilerplate. Regenerate the baseline freely and spend your effort only where the work is actually custom: extending and overriding in separate files so a re-run never clobbers it. Often the generated code is all you need; when it isn't, the "Safe customization" patterns below are how you build on top without fighting regeneration.
The output is equivalent across runs, but not byte-identical. Generators iterate unordered collections, so the same model can emit the same members in a different order each run — fields, columns, constructor arguments, table columns. Nothing changes semantically. Two consequences worth knowing: don't diff one regeneration against another expecting silence, and don't hard-code a column position when reading generated output (in a test, say) — look columns up by name.
Per-generator detail (inputs, outputs, options, templates, gotchas) lives in
references/. Find your target, then read the listed reference:
| Want | Generator | Reference |
|---|---|---|
| Python data classes | PythonGenerator | python-and-data.md |
| Java classes | JavaGenerator | python-and-data.md |
| Pydantic models (with optional OCL→validator) | PydanticGenerator | python-and-data.md |
| JSON Schema (regular or NGSI-LD) | JSONSchemaGenerator | python-and-data.md |
| JSON data from an ObjectModel (instances) | JSONObjectGenerator | python-and-data.md |
| RDF Turtle vocabulary | RDFGenerator | python-and-data.md |
| SQLAlchemy ORM | SQLAlchemyGenerator | persistence.md |
| Raw SQL DDL | SQLGenerator | persistence.md |
| Supabase (Postgres + RLS) schema | SupabaseGenerator | persistence.md |
| FastAPI + ORM + Pydantic stack | BackendGenerator | api-and-web.md |
| Standalone REST API | RESTAPIGenerator | api-and-web.md |
| Django project | DjangoGenerator | api-and-web.md |
| Full-stack web app (React + FastAPI + Docker) | WebAppGenerator | api-and-web.md |
| Flutter mobile app | FlutterGenerator | api-and-web.md |
| Conversational agent / chatbot | BAFGenerator | agents-and-other.md |
| Quantum circuit | QiskitGenerator | agents-and-other.md |
| Terraform infrastructure | TerraformGenerator | agents-and-other.md |
| PyTorch / TensorFlow neural net | PytorchGenerator / TFGenerator | agents-and-other.md |
Not generating, but stuck?
references/debugging.md.By default a generator writes to <cwd>/output/ and produces the single
file documented in its reference. The exceptions worth memorizing:
BackendGenerator → defaults to ./output_backend/ (not ./output/); emits a package, not a single module: main_api.py (app setup only), database.py, bal_stdlib.py, routers/<class>.py per class, plus pydantic_classes.py and sql_alchemy.py.WebAppGenerator → output_dir must be specified; emits frontend/, backend/, docker-compose.yml.DjangoGenerator → creates a project folder in the CWD (myproject/myapp/models.py, …).SupabaseGenerator → timestamped filename, so every run creates a new file and never overwrites.For the exact output filename of any other generator, see its row in the
relevant references/ file.
Since generate() overwrites everything, customizations need a strategy
that survives regeneration.
Many "I need to tweak the output" requests are already covered by parameters:
SQLAlchemyGenerator.generate(dbms="postgresql") — switch dialectBackendGenerator(http_methods=["GET", "POST"]) — limit endpointsBackendGenerator(nested_creations=True) — allow nested createsDjangoGenerator(containerization=True) — add Docker supportQiskitGenerator(backend_type="ibm_quantum", shots=2048)BAFGenerator(generation_mode=GenerationMode.CODE_ONLY)Put custom code in separate files that import from generated code. Generated files are overwritten; your extension files are not.
output/
sql_alchemy.py # GENERATED — do not edit
custom_queries.py # YOUR CODE — imports from sql_alchemy.py
custom_endpoints.py # YOUR CODE — imports from main_api.py
# custom_queries.py — safe from regeneration
# The generated sql_alchemy.py exposes `Base` and `engine` (not a Session);
# create the Session yourself from SQLAlchemy.
from sqlalchemy.orm import Session
from sql_alchemy import Book, Author, engine
def get_books_by_author(author_name: str):
with Session(engine) as session:
return session.query(Book).join(Author).filter(Author.name == author_name).all()
Mount the generated FastAPI app and add your routes on top:
# app.py — YOUR CODE, not generated
from main_api import app
@app.get("/custom/stats")
def custom_stats():
return {"status": "ok"}
Often the cleanest fix: define methods on your model classes with
MethodImplementationType.BAL or MethodImplementationType.CODE, and
BackendGenerator emits matching REST endpoints. Custom logic stays in
the model, where regeneration cannot touch it.
from besser.BUML.metamodel.structural import (
Method, Parameter, StringType, MethodImplementationType,
)
# Pass the implementation via the Method constructor: `code` holds the body
# and `implementation_type` selects BAL or CODE. (There is no separate
# MethodImplementation class, and the body is not assigned afterwards.)
search = Method(
name="search_by_title",
parameters=[Parameter(name="keyword", type=StringType)],
type=StringType,
code="return session.query(Book).filter(Book.title.contains(keyword)).all()",
implementation_type=MethodImplementationType.BAL,
)
book.add_method(search)
The method body is inserted verbatim into the generated FastAPI handler
— it is not parsed or scoped by the metamodel. So any name it references
(here session) must actually exist in the generated handler at that point.
Treat the body as code you are responsible for: read routers/<class>.py to
see what is in scope where the body lands, and database.py for the session
dependency, then reference exactly those names.
Two things the body cannot assume. A method may not share its name with an attribute or an association end of the same class — the model will not validate, because one generated name cannot be both. And a name the diagram uses is not always the name the generated object uses, so confirm against the generated class before calling it.
Copy a generator's template, edit it, and point the generator at your
copy. Templates live in besser/generators/{name}/templates/. Powerful,
but BESSER updates won't propagate to your overrides — use sparingly.
git diff output/ > my_customizations.patch # save once
cd output && git apply ../my_customizations.patch # reapply after each generate
Works for small, stable changes. For larger customizations, prefer #2 or #4.
Several generators orchestrate sub-generators (e.g. WebAppGenerator drives
ReactGenerator + BackendGenerator + optional BAFGenerator;
BackendGenerator drives RESTAPIGenerator + PydanticGenerator +
SQLAlchemyGenerator; SQLGenerator drives SQLAlchemyGenerator in a
subprocess). When debugging, trace which sub-generator is actually failing —
the error rarely lives in the wrapper. The full tree and per-symptom recipes
are in references/debugging.md.
A generator only appears in the web editor's "Generate" dropdown once it is
registered in
besser/utilities/web_modeling_editor/backend/config/generators.py via two
hooks: an entry in SUPPORTED_GENERATORS and its filename in
get_filename_for_generator(). Both are required for the dropdown to
populate. For the annotated GeneratorInfo snippet and the full authoring
workflow (package layout, tests, docs, PR), see the besser-dev skill's
references/adding-a-generator.md.
What SKILL.md sets; muted values are Claude Code's defaults
4 skills in this plugin
/besser-devContributor guide for developing BESSER itself (https://github.com/BESSER-PEARL/BESSER). Use this skill whenever the user is working *inside* the BESSER source tree — adding a new generator (the most common contribution), adding a new metamodel or sub-DSL under `besser/BUML/metamodel/`, writing pytest tests for generators or metamodels, writing JSON↔BUML converters for the web editor, building Sphinx documentation under `docs/source/`, registering a generator in `SUPPORTED_GENERATORS`, or preparing a pull request to BESSER. Trigger on phrases like "add a new generator", "register in the web editor", "GeneratorInterface", "json_to_buml", "buml_to_json", "write tests for my generator", "build the docs", "open a PR to BESSER", or any work that touches `besser/generators/`, `besser/BUML/metamodel/`, `besser/utilities/web_modeling_editor/`, or `tests/`. Prefer this skill over besser-user when the user is contributing *to* BESSER rather than *using* BESSER to build something else.
/besser-troubleshootingDiagnose and fix BESSER errors fast. Use this skill whenever the user is staring at a Python traceback, ImportError, ModuleNotFoundError, ValueError, TypeError, AttributeError, jinja2.TemplateNotFound, subprocess.CalledProcessError, or any other failure originating from BESSER (besser.BUML, besser.generators, besser.utilities). Covers installation failures (`pip install besser` errors, native dependency build failures for psycopg2/pyodbc/oracledb, Python version mismatches, Windows venv path quirks), import errors (`String` vs `StringType`, missing `bocl==1.0.1`, `antlr4-python3-runtime` version mismatch), model construction errors (spaces or hyphens in names, duplicate enum literals, invalid multiplicities, generalization-to-self, more than one is_id per class), generator crashes (Invalid DBMS, Django subprocess failures, missing GUIModel for WebApp, silent SQLGenerator failures, invalid Qiskit backend), Docker and deployment problems (port conflicts, docker-compose vs docker compose, missing system libs in slim images), OCL constraint parse failures, and model-to-output drift (changes not appearing in regenerated code). Trigger on any error message that mentions `besser` in the traceback, even if the user does not explicitly ask for troubleshooting. Provides a minimal-reproduction template and quick diagnostic commands; defer to besser-generators for non-error questions about specific generator behavior.
/besser-userBuild software with BESSER, the low-code model-driven platform. Use this skill whenever the user is creating a B-UML domain model (classes, attributes, associations, enumerations, generalizations), running any BESSER generator (Django, FastAPI, SQLAlchemy, Pydantic, React, WebApp, BAF, Qiskit, etc.), modeling state machines or chatbot agents, designing GUI models for web apps, building any other B-UML model type — object (instance) models, feature models, OCL constraints, deployment models, neural-network models, quantum circuits, or project models — working with the BESSER web editor at editor.besser-pearl.org, or drawing a correct UML class diagram to document a system (classes, attributes, associations, inheritance) — even when no code will be generated, e.g. adding a class diagram to a README, design doc, or `.md` spec. Trigger on imports from `besser.BUML` or `besser.generators`, mentions of B-UML, DomainModel, BinaryAssociation, GUIModel, or any BESSER generator class — even if the user does not say "BESSER" by name. Also trigger when the user wants to draw, sketch, or document a UML class diagram or data model and wants it to be correct, even if BESSER is never mentioned. Prefer this skill over generic Python, Django, or FastAPI guidance whenever the project uses BESSER for modeling. For per-generator deep dives (output paths, options, customization patterns), defer to the besser-generators skill; for errors and diagnostics, defer to besser-troubleshooting.
/besser:besser-generatorsfrom besser
npx claudepluginhub besser-pearl/besser-skills --plugin besserOther plugins' skills for the same job