Skip to content

eldermoraes/quarkus-agentic-scaffolding / skills/scaffold-project

scaffold-project

Verified

Scaffold 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.

templates/Guardrails.java.template

View on GitHub
package org.acme.guardrails;

import dev.langchain4j.data.message.AiMessage;
import dev.langchain4j.guardrail.InputGuardrail;
import dev.langchain4j.guardrail.InputGuardrailRequest;
import dev.langchain4j.guardrail.InputGuardrailResult;
import dev.langchain4j.guardrail.OutputGuardrail;
import dev.langchain4j.guardrail.OutputGuardrailResult;
import jakarta.enterprise.context.ApplicationScoped;
import java.util.List;
import java.util.Map;
import java.util.regex.Pattern;

/*
 * Guardrails — beans that validate what goes into and comes out of an AI service.
 * They are ordinary CDI beans; use the upstream dev.langchain4j.guardrail API (the older
 * Quarkus-specific io.quarkiverse.langchain4j.guardrails API was removed).
 *
 * Attach them on the AI-service method or interface:
 *   @InputGuardrails(PromptInjectionGuard.class)     // dev.langchain4j.service.guardrail
 *   @OutputGuardrails(EmptyResponseGuard.class)
 *
 * An output guardrail may force the model to answer again with reprompt(...); cap the attempts
 * with quarkus.langchain4j.guardrails.max-retries (Quarkus default 3, 0 disables retries).
 * For a service that returns a record, use CompleteAnswerGuard from Agent.java.template: it
 * rejects an answer with a missing, null or blank field, which a JSON schema alone does not.
 *
 * The script names this file after the first public type; both guards live here for that reason.
 */
@ApplicationScoped
public class PromptInjectionGuard implements InputGuardrail {

    /** Limit on the caller's text alone; the REST and WebSocket edges use the same number. */
    private static final int MAX_INPUT_CHARS = 4_000;

    /**
     * The delimiters the prompts in this repo's templates wrap free text in. A closing tag
     * smuggled inside the text would end the delimited region early and let the rest read as
     * instructions, so the markup is rejected outright. Extend the alternation whenever you
     * add a delimiter of your own.
     */
    private static final Pattern DELIMITER_MARKUP =
            Pattern.compile("</?(ticket|problem|request|question|text)>", Pattern.CASE_INSENSITIVE);

    /**
     * Checks what the caller supplied, not the prompt rendered around it. The rendered user
     * message already holds the delimiters the template itself wrote (and, with RAG, retrieved
     * documents), so checking it would reject every call. The caller's text arrives as the
     * template variables: the values bound to {problem}, {ticket}, {question}, ...
     */
    @Override
    public InputGuardrailResult validate(InputGuardrailRequest request) {
        for (String text : callerSuppliedTexts(request)) {
            if (text.length() > MAX_INPUT_CHARS) {
                return failure("Input exceeds the " + MAX_INPUT_CHARS + "-character limit.");
            }
            if (DELIMITER_MARKUP.matcher(text).find()) {
                return failure("Input rejected: it contains reserved delimiter markup.");
            }
            // Honest heuristic — real projects tune this (allow-lists, a classifier model, ...).
            if (text.toLowerCase().contains("ignore previous instructions")) {
                return failure("Input rejected: possible prompt-injection marker.");
            }
        }
        return success();
    }

    /**
     * Every template variable as text (one parameter can appear under more than one key;
     * checking each value covers them all). A value that is not a String, such as a record or
     * a list, is checked in the form the template renders it. Only a method with no template
     * variables at all falls back to the user message: it has no delimiters of its own, so the
     * whole message is the caller's text.
     */
    private static List<String> callerSuppliedTexts(InputGuardrailRequest request) {
        Map<String, Object> variables = request.requestParams().variables();
        if (variables == null || variables.isEmpty()) {
            return List.of(request.userMessage().singleText());
        }
        return variables.values().stream().map(String::valueOf).toList();
    }
}

@ApplicationScoped
class EmptyResponseGuard implements OutputGuardrail {

    @Override
    public OutputGuardrailResult validate(AiMessage responseFromLLM) {
        String text = responseFromLLM.text();
        if (text == null || text.isBlank()) {
            // reprompt(message, reprompt): retry the call with an added instruction.
            return reprompt("The model returned an empty response.",
                    "Provide a complete, non-empty answer.");
        }
        return success();
    }
}
writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deploymentStars: 322kUpdated Claude CodeCodexVerifiedInstall
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: 198kUpdated Claude CodeCodexVerifiedInstall
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: 119kUpdated Claude CodeCodexVerifiedInstall
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: 118kUpdated Claude CodeCodexVerifiedInstall