eldermoraes/quarkus-agentic-scaffolding / skills/scaffold-project
scaffold-project
VerifiedScaffold Quarkus + LangChain4j projects end-to-end and add agentic components to existing ones — AI services, tools, agents and multi-agent workflows, RAG pipelines, MCP clients and servers (Model Context Protocol), guardrails, and embedding store setups. Use this whenever the user wants a new Quarkus + LangChain4j project or module created, or an agentic component added to an existing project in this stack, including a baseline pom.xml, application.properties, project layout, or starter classes.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 20.9 KB |
| agents/openai.yaml | config | 669 B |
| templates/Agent.java.template | other | 28.4 KB |
| templates/AiService.java.template | other | 6.1 KB |
| templates/AiServiceTest.java.template | other | 6.2 KB |
| templates/ApplicationIT.java.template | other | 2.7 KB |
| templates/Guardrails.java.template | other | 4.5 KB |
| templates/McpClient.java.template | other | 2.5 KB |
| templates/McpServer.java.template | other | 2.6 KB |
| templates/RagSetup.java.template | other | 9.1 KB |
| templates/RestResource.java.template | other | 3.1 KB |
| templates/Tools.java.template | other | 2.3 KB |
| templates/application.properties.template | other | 12.6 KB |
| templates/pom.xml.template | other | 7.6 KB |
templates/RestResource.java.template
View on GitHubpackage org.acme.rest;
import org.acme.ai.ChatAssistant;
import dev.langchain4j.guardrail.InputGuardrailException;
import io.smallrye.common.annotation.RunOnVirtualThread;
import jakarta.inject.Inject;
import jakarta.ws.rs.BadRequestException;
import jakarta.ws.rs.Consumes;
import jakarta.ws.rs.POST;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.MediaType;
import org.jboss.logging.Logger;
/*
* REST edge for the ChatAssistant AI service (pairs with AiService.java.template).
*
* Threading (project conventions section 2): this method returns a plain value, so Quarkus
* REST treats it as blocking and would run it on a pooled platform worker thread. An AI-service
* call blocks for the whole model round-trip (and every tool round-trip), so @RunOnVirtualThread
* moves it onto a fresh virtual thread instead. Keep the annotation on every synchronous
* endpoint that calls an AI service, a tool, or other blocking I/O; a method returning
* Uni/Multi stays reactive and must not block at all.
*
* Validation at the edge: blank or over-long input is rejected before any model call. Keep the
* limit in step with PromptInjectionGuard.MAX_INPUT_CHARS (Guardrails.java.template). Anything
* that escapes becomes an RFC 9457 problem response when quarkus-http-problem is present.
*
* Guardrail rejections: when PromptInjectionGuard refuses the caller's text the AI service
* throws InputGuardrailException. That is the caller's error, so it leaves here as a 400 with a
* message written in this class. The exception's own message names the guard class, so it is
* not passed on; left uncaught it would be a 500.
*/
@Path("/chat")
public class ChatResource {
/** Request body: a record keeps the DTO immutable and the native-image surface small. */
public record ChatRequest(String problem) {}
/** Response body. */
public record ChatResponse(String answer) {}
private static final Logger LOG = Logger.getLogger(ChatResource.class);
private static final int MAX_PROBLEM_CHARS = 4_000;
private static final String REJECTED_BY_GUARDRAIL =
"problem was rejected: it contains text this endpoint does not accept";
@Inject
ChatAssistant assistant;
@POST
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@RunOnVirtualThread
public ChatResponse chat(ChatRequest request) {
if (request == null || request.problem() == null || request.problem().isBlank()) {
throw new BadRequestException("problem must not be empty");
}
if (request.problem().length() > MAX_PROBLEM_CHARS) {
throw new BadRequestException("problem exceeds " + MAX_PROBLEM_CHARS + " characters");
}
try {
return new ChatResponse(assistant.answer(request.problem()));
} catch (InputGuardrailException rejected) {
// A rejection, not a failure: log the guard's reason (it holds no caller text).
LOG.infof("Chat input rejected by the input guardrail: %s", rejected.getMessage());
throw new BadRequestException(REJECTED_BY_GUARDRAIL);
}
}
}
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deployment | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy. | Stars: 119k | Updated | Claude CodeCodex | Verified | Install |
| childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release. | Stars: 118k | Updated | Claude CodeCodex | Verified | Install |