I had Bob create a small Excel report with GridCraft and checked the saved workbook with Java and Apache POI. The report contained formulas, a chart, and the source file's hash. During a repair, my verifier rejected a valid row height of 40.5 typographic points because I had compared values expressed in different units.
When the check failed, Bob attempted three Python diagnostics and reached its tool-call limit. Our repository required Java validation, and the verifier was already beside the report. I corrected the unit check and named the Java validation path explicitly in the skill and prompt. A later read-only task reopened the file, inspected its values and formulas, and ran that verifier in nine tool calls, without Python.
The later task was smaller, so I can't compare the call counts as a performance improvement. I had to repair the verifier and tell Bob how to use it. The instruction only made sense once the tool accepted the right result.
I give a coding agent the build conventions, framework procedures, and checks it needs to change the repository. That is what I mean by teaching it Java here. These instructions don't change the model's weights; each new session can read them and retrieve the relevant knowledge again.
Most of my examples here use IBM Bob, with Quarkus Agent MCP supplying framework guidance. If you want to try the Bob examples, IBM offers a free trial. The same decisions about instructions, documentation, and validation apply to other coding agents.
Java gives the agent feedback it can act on
In Code LLM Language Support Is a Workflow Risk Question, I described the gap between generating a plausible class and changing an application. In a Java repository, the agent also has to account for the build, dependencies, generated sources, and framework conventions. A method that looks right in isolation can still belong to the wrong module or depend on an API the project doesn't have.
The Java toolchain gives the agent feedback on several of those assumptions. A language server can locate definitions and references; the compiler checks types, method signatures, and access. Maven or Gradle resolves dependencies and runs the configured checks. Tests exercise behavior, while Checkstyle and architecture tests can reject conventions we have encoded.
I want the agent to use this feedback while it is making the change. Compiling the affected module catches an invented library method before the agent builds more code around it. An architecture test can reject a persistence dependency in a domain package even when the classes compile. Both failures give the agent a specific place to investigate and the reviewer a result to inspect.
Of course, a compiler can't decide whether a refund should be approved. The method can compile and pass an incomplete test suite while implementing the wrong rule. For that decision, we need tests that describe the application's behavior. Java gives us a substantial set of tools for these checks, and I want the coding agent to use the ones our team already trusts. Evaluate it in that build and framework, with changes we would actually maintain.
Java can also run the agent application
The code around the model needs those checks too. If the team's business services already run on the JVM, a Java agent application can call them through the same code and dependencies, and follow the deployment conventions we already have.
Suppose a support assistant needs to search tickets. Our service already knows which tickets the current user can see and how to return a bounded result. A Java adapter can expose that operation to the model while retaining the service's access rules. The model supplies search arguments, and application code checks them before querying the visible tickets.
LangChain4j's tool API lets an AI Service call @Tool methods on a registered tool object. The tool's name, description, and parameter schema tell the model when to call it and which arguments to provide. We have to explain whether the search is case-sensitive and how many matches it returns, then enforce those rules in the implementation.
The adapter could construct this record before calling the service. Put it in TicketQuery.java; it carries the search input and rejects values outside the declared bounds:
public record TicketQuery(String phrase, int limit) {
public TicketQuery {
if (phrase == null || phrase.isBlank()) {
throw new IllegalArgumentException("phrase is required");
}
phrase = phrase.strip();
if (phrase.length() > 200) {
throw new IllegalArgumentException("phrase must be at most 200 UTF-16 code units");
}
if (limit < 1 || limit > 20) {
throw new IllegalArgumentException("limit must be between 1 and 20");
}
}
}A limit of 5 is accepted; 5,000 is rejected before the service query. The phrase bound uses String.length(), which counts UTF-16 code units, so a supplementary Unicode character occupies two. Describe the accepted inputs to the model as well. The constructor's checks don't automatically become schema constraints, and the service still has to check which tickets the caller can read.
We can test that adapter with ordinary Java tests and keep larger calculations in Java too. In the large Excel example, POI read the workbook and Java calculated the answer beside the file. Bob received selected results and evidence rows, so it could explain the calculation without receiving the million-row dataset in its context.
A model-training experiment or a library available only through Python can justify another runtime. For an assistant calling existing Java services, I can keep their rules and tests in the language the team maintains. A coding agent adding that adapter then needs to follow the same repository conventions as any other contributor.
Give it a Java path it can actually run
“Prefer Java” leaves the validation language open. The agent can write a Java application, then use Python to inspect the artifact or generate its test data. Our readers need to reproduce the checks with the tools the article introduces, so I make that requirement explicit.
In our preview repository, AGENTS.md requires Java validation for articles and companion projects, with delivered examples that build, run, and validate without Python. Temporary development helpers are permitted outside the delivered project, and the private Notes publishing tool has a separate authorized exception. Those scopes let me keep the article examples reproducible without applying their language rule to every private task.
For a smaller Java repository, keep the corresponding rules together:
## Java changes and validation
- Read the module POM or Gradle build before changing dependencies or APIs.
- Use the module's wrapper from its module root. Follow its documented goals.
- Use Java for application, packaged-artifact, and publication validation.
- Final examples and reader commands must run without Python.
- Use the supplied Java verifier before creating another validation helper.
- For small Java helpers, use the existing JBang setup and pin dependencies.
- Keep temporary development helpers outside delivered artifacts.
- Request a specific exception if a required reader step needs Python.
Explain the Java alternatives considered and the affected files or commands.Adapt the excerpt to your repository and state where any exception applies. Put the actual validation command and its directory in the module README. The agent needs to be able to follow the rule with the tools already provided.
JBang runs Java source files with dependencies declared beside the code. I can therefore give Bob a small verifier without creating another Maven module for it. In the GridCraft companion, run this command from gridcraft-agent-workflow:
jbang scripts/VerifyGridcraft.java verify build/bob-report-final.xlsxThe companion setup supplies the source workbook and report. The verifier reads the saved file through POI and checks its formulas, chart series, provenance, and unchanged source hash. When the command fails, Bob has a Java failure to investigate. Readers can inspect that same verifier and run it with the tools we introduced.
Keep framework procedures in skills
I keep stable repository constraints in the operating manual and retrieve detailed procedures when a task needs them. A Markdown edit shouldn't have to load the procedure for creating a Quarkus extension.
A skill packages a procedure with a description of when to use it and, where needed, supporting files. A REST-client skill can cover interface declarations, injection, configuration, and testing. An extension-development skill needs deployment modules, build items, and recorders. Both contain Java, but their instructions apply to different changes.
For our checkout-outbox application, I asked Quarkus Agent MCP for REST guidance through quarkus_skills. Its rest results covered REST and REST clients, including injection, timeouts, tests, and incompatible REST stacks. Asking for writing-build-steps found no match in that installation. We have the contributor skill locally, so I need to tell the agent where to find it instead of assuming the server exposes it.
The current upstream server can load extension skills from deployment JARs and combine them with user customizations. A project skill file replaces that combined content. If you keep a local copy, review it when the base guidance changes; otherwise the agent can keep following your older procedure after the framework has moved on.
The June revision of SkillsBench evaluates 87 tasks across eight domains and 18 model-harness configurations. Curated skills raised the average pass rate from about 34% to 51%, or 16.6 percentage points, and bundles with at most three modules outperformed larger collections. The study covers several domains; it doesn't measure the improvement in our Java repositories.
Keep each skill focused on a task, with a clear trigger and a check you can run. That also makes it easier to identify which instruction to change after an agent follows the wrong procedure.
Check what documentation search returned
During that procedure, the agent may need to check an API, configuration key, or annotation against the project's version. Quarkus Agent MCP provides quarkus_searchDocs for those questions. It accepts a project directory to select the requested Quarkus version and returns passages with source links and version metadata.
Our checkout-outbox POM declared Quarkus 3.39.4, so I passed its directory to the search. The server returned passages tagged 3.36.0 and explained that 3.39.4 documentation wasn't available. It had fallen back to its latest documentation. The request identified the version I wanted, but the returned corpus covered another one.
For a version-sensitive change, follow the source link and check the target release's documentation or code. The agent needs to retain that source version in its explanation, so a 3.36.0 passage doesn't become a claim that it verified 3.39.4. If the passage doesn't answer the question, open the relevant section before editing the API.
The first search also reported no available container runtime. I confirmed that Podman was reachable, and a later retry returned documentation. Include a fallback to official sources in the repository guidance, so the agent can verify the API when the preferred search tool is unavailable.
In AGENTS.md, route Quarkus questions to Quarkus Agent MCP and other dependencies to their appropriate documentation source. Require the agent to report a failed lookup and the source it used instead. That keeps the fallback visible to the person reviewing the change.
Teach the framework edges a Java parser can't explain
In the codebase-memory experiment, we asked Bob to trace how Quarkus finds configuration mappings and creates their instances. The graph located the deployment methods discoverConfigMappings and generateConfigMappings, both with in_degree = 0. It had no incoming call edges for them.
Deleting those methods as unused would remove framework entry points. Quarkus schedules @BuildStep methods through the build items they produce and consume, as the extension guide explains. That relationship doesn't require a normal Java call between the methods, so the agent needs the framework model to interpret what the graph found.
I keep application and extension guidance separate for the same reason. An application can inject an @ConfigMapping interface without creating an extension deployment module. Extension configuration roots have their own discovery and build-step rules. Establish which kind of module the agent is changing before loading that procedure.
A configuration change also needs its phase checked. Quarkus fixes some settings during augmentation, its build-time processing. Supplying a different runtime value won't change the behavior already built into the application. Use the configuration reference to identify those settings; making one dynamic may require another design, while applying a new fixed value requires rebuilding.
The test has to reach the changed behavior too. With @QuarkusTest, we can inject and call application beans in the test JVM. With @QuarkusIntegrationTest, the test launches the built artifact and calls it from outside. Use that second path to check whether the packaged application starts and serves the endpoint under its packaged configuration.
In our label-service POM, Failsafe is configured but skipITs defaults to true. Run ./mvnw verify -DskipITs=false from that module and check the integration-test report. The build can succeed with those tests skipped, and test doesn't reach Failsafe's later phases. The Maven guide describes the plugin setup.
If serialization fails in the native artifact, check whether dynamically accessed classes need explicit registration. The native application guide covers reflection registration. Inspect what the extension already supplies and exercise the affected native path; the passing JVM test hasn't tested that behavior.
There are smaller Java edges as well. In the label-service example, toUpperCase() would follow the machine's default locale. We use toUpperCase(Locale.ROOT) for the SKU and change the default locale in a test to check that the identifier stays consistent. Both method calls compile; the test records which behavior we need.
Keep these failures in tests and link their explanations from the relevant procedure. The main instruction file only needs enough guidance to send the agent there when its change reaches that part of the application.
Move repeated checks into the build
Once a rule is executable, we can run it at a predictable point. In Deterministic Islands in Probabilistic Workflows, I described using parsers, schemas, and tests to check model decisions. Java gives us places for several of these checks in the build, and a hook can return a failure while the agent is still editing.
Our Bobshell example runs a JBang handler after selected edit tools. It returns the Checkstyle finding to Bob, which can then repair the rejected wildcard import. Calling the checker is part of that tool's lifecycle, so it no longer depends on Bob remembering the instruction after every edit.
A hook attached to selected tools only sees those actions. The tutorial's command-matching examples don't cover every shell command or indirect script, so keep the required checks in CI too. And when a checker rejects a result, inspect its assertion before asking the agent for another repair. In GridCraft, the valid row height needed no further repair; my unit check needed correcting.
Test the instructions as well as the code
I want to check whether the instructions change the agent's behavior, just as I check the resulting code. The September revision of Evaluating AGENTS.md finds no general improvement in task success across its tested settings, with inference cost rising by more than 20% on average. Agents followed instructions, but repository overviews didn't improve completion. The authors identify non-standard coding practices as a reason to retain context files and recommend evaluating performance changes.
A separate study of instruction-file efficiency covers ten repositories and 124 pull requests. It reports about 29% lower median runtime and 17% fewer output tokens with AGENTS.md, alongside comparable completion behavior. The studies use different tasks and measurements, and neither measures our Java validation rule.
Our module roots, Java verifier, and Podman convention tell the agent which command to run and where. I keep those concrete instructions in the file. If a longer repository overview is meant to improve completion, test that claim before making it part of every session.
Seeing a skill-load event isn't enough either. The September Skill Following study evaluates 17 models on coding and mathematics tasks. It finds cases where an aggregate benefit from retrieval conceals worse results on the tasks where a skill was retrieved. The agent can read the procedure and still apply it incorrectly, so inspect the actions that follow the lookup.
For a local comparison, keep the task, starting commit, agent configuration, and acceptance criteria fixed. Repeat it in fresh sessions with the existing guidance, then with one change. Check whether the agent inspected the build, used the relevant source version, followed the Java validation path, and completed the required checks. Track cost and elapsed time alongside those results. Our GridCraft repair changed the verifier and narrowed the task as well, so it can't isolate the effect of the instruction.
Start with a failure you can reproduce
The example sources are in the GridCraft report companion, Quarkus codebase-memory experiment, Java hook tutorial, and in-process and packaged testing example. The operating-manual article covers the broader repository agreement.
Start with a failure your team can reproduce. Give the agent the relevant procedure and a Java command that checks its change, then keep that check in the repository. In my report example, this meant fixing the verifier and making its command explicit. I want the same arrangement for a Java service or an agent application: the model can propose the change, while the team's tools return a result we can inspect and reproduce after the conversation is gone.


