4 ms·
Ask HN: How do you give AI enough Java-specific context before code generation?
I’ve been writing Java for 25+ years (mostly enterprise; created pf4j and pippo).
When using AI for code generation, I kept seeing the same issues:
N+1 queries, poor exception handling, Spring pitfalls, and concurrency problems.
The output is often almost right, but misses language-specific details.
Instead of iterating prompts, I experimented with pre-loading the model
with Java-specific guidelines (JPA, Spring, testing, security) as plain
markdown files, so it has domain context upfront.
Curious how others handle language-specific context for code generation tools.
Repo:
https://github.com/decebals/claude-code-java
- decebals 8mo agoFor context, the guidelines are split into standalone markdown files (one for the model, one human-readable README per topic).