writing-build-steps
Skill325 starsChanged 8 days agoApache-2.0View on GitHub
Patterns for creating and modifying Quarkus @BuildStep methods, build items, and recorders in extension deployment modules.
1 other project uses a version of this; 1 new project in the last 4 weeks, against 0 the 4 before.
Adopted by
Surging: 1 new project took it in the last 4 weeks, none the 4 weeks before.thin data
Most recently taken up by
- quarkusio/quarkusword for word, first seen Oct 8, 2026
Other versions1 project uses a version of this.
Word for word · 1
- quarkusio/quarkus★ 16k100% same
Edited · 0
None found.
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository5 other files it gives its agents.
- AGENTS.mdAGENTS.md
- coding-styleSkill
- pull-requestsSkill
- working-with-configSkill
- writing-testsSkill
The file
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 3 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 39
If a step consumes a BuildItem, it runs after all producers of that item
- Very specific: line 44
Use Optional<T> for optional consumption of build items
- Very specific: line 45
Use List<T> to consume all instances of a MultiBuildItem
- Distinctive: line 47
Avoid unnecessary I/O or computation — leverage existing build items rather than duplicating work
- Distinctive: line 81
Use typed services when other services need to depend on the value produced.
- Distinctive: line 82
Use void services for side effects like initialization tasks.
≈ “Common” is an estimate: at least 1 in 5 of the 372,429 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Writing Build Steps
Quarkus extensions perform work at build time through build steps that produce and consume build items. This is the core extension mechanism.
Build Steps
A build step is a method annotated with @BuildStep in a processor class
(by convention <Feature>Processor.java in the deployment module).
@BuildStep
SomeBuildItem produce(AnotherBuildItem input) {
// Build-time logic
return new SomeBuildItem(...);
}Build Items
Build items extend BuildItem (or a subclass) and are the data objects passed
between build steps.
SimpleBuildItem— Exactly one instance. Use for single values.MultiBuildItem— Multiple instances. Use when collecting contributions from multiple extensions (e.g., registering beans, routes).- Build items should be
finalclasses.
Key Rules
- Build steps are ordered by input/output dependencies, NOT declaration order
- If a step consumes a
BuildItem, it runs after all producers of that item - Prefer producing a single build item per step. A step that produces
multiple different item types is a sign it should be split. Use
BuildProducer<T>when you need to produce multiple instances of the same item type or produce items conditionally - Use
Optional<T>for optional consumption of build items - Use
List<T>to consume all instances of aMultiBuildItem - Build steps run during augmentation (build time), NOT at runtime
- Avoid unnecessary I/O or computation — leverage existing build items rather than duplicating work
Config Mappings in Build Steps
@ConfigMapping/@ConfigRoot interfaces are only registered as CDI beans when
they appear as a parameter in at least one @BuildStep. If a runtime bean
injects a config mapping, you must reference that config mapping in a build
step — otherwise the injection will fail with UnsatisfiedResolutionException.
See the working-with-config skill for details.
Services
To execute code at runtime from a build step, register a service using
ServiceRegistrar. Services are lightweight startup tasks that form a
dependency graph. The service lambda is defined in the deployment build step
but executes at runtime.
@BuildStep
void setupAtRuntime(ServiceRegistrar serviceRegistrar, SomeBuildItem item) {
serviceRegistrar.forService("io.quarkus.my-feature.setup")
.onStart(ctx -> {
// This lambda runs at runtime
MyFeature.initialize(item.getValue());
});
}Service Types
- Typed services produce a value:
serviceRegistrar.forService(MyService.class) - Void services produce no value, identified by name:
serviceRegistrar.forService("io.quarkus.feature.setup")
Use typed services when other services need to depend on the value produced. Use void services for side effects like initialization tasks.
Phases
Services execute in ordered phases. The default is Phase.APPLICATION. Use
.atPhase(Phase) to customize:
STATIC_INIT— Runs during static initialization (beforemain()). Results are baked into the native image heap when building a native image.CONFIG— Registers configuration property classes.LOGGING— Reconfigures the log manager.INFRASTRUCTURE— Creates foundational infrastructure (executors, event loops).BINDING— Binds server sockets.DATA— Establishes database connections.INIT— Performs one-time initialization (migrations, validation).APPLICATION— Registers request-handling logic (default).SERVING— Starts accepting requests.
Dependencies
Declare all dependencies explicitly on the service itself:
.require(SomeService.class)— depends on and consumes a service value.request(SomeService.class)— optional dependency, injected asOptional<T>.after(SomeService.class)— ordering-only dependency.before(SomeService.class)— this service must start before the specified service
Build step graph dependencies have zero influence on service execution order.
Lambda Capture Constraints
Service lambda bodies run at runtime and can only reference runtime classes:
- Supported captures: primitives,
String,Class, enum values, immutable collections,BUILD_AND_RUN_TIME_FIXEDconfig,Constablevalues, records - Unsupported: mutable collections,
BUILD_TIMEconfig,RUN_TIMEconfig (use.require()instead), arbitrary runtime objects (use.require()) - Never reference deployment classes in the lambda body — this causes
ClassNotFoundExceptionat runtime
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

