agentleFS
quarkiversequarkiverse/quarkus-langchain4j/.agents/skills/writing-build-steps/SKILL.md

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

Week of Sep 20: 0 new projectsWeek of Sep 27: 0 new projectsWeek of Oct 4: 0 new projectsWeek of Oct 11: 0 new projectsWeek of Oct 18: 0 new projectsWeek of Oct 25: 0 new projectsWeek of Nov 1: 0 new projectsWeek of Nov 8: 1 new project
Sep 2026Oct 2026Nov 2026
New projects taking a version of this file each week, over the 8 weeks our latest run read: only 1 in all, so this is a hint, not a trend.

Most recently taken up by

  • Other versions1 project uses a version of this.

    Word for word · 1

    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.

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
  1. Very specific:

    If a step consumes a BuildItem, it runs after all producers of that item

    line 39
  2. Very specific:

    Use Optional<T> for optional consumption of build items

    line 44
  3. Very specific:

    Use List<T> to consume all instances of a MultiBuildItem

    line 45
  4. Distinctive:

    Avoid unnecessary I/O or computation — leverage existing build items rather than duplicating work

    line 47
  5. Distinctive:

    Use typed services when other services need to depend on the value produced.

    line 81
  6. Distinctive:

    Use void services for side effects like initialization tasks.

    line 82

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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 final classes.

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 a MultiBuildItem
  • 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 (before main()). 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 as Optional<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_FIXED config, Constable values, records
  • Unsupported: mutable collections, BUILD_TIME config, RUN_TIME config (use .require() instead), arbitrary runtime objects (use .require())
  • Never reference deployment classes in the lambda body — this causes ClassNotFoundException at runtime

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.