AGENT SKILL

micronaut-scaffold

Scaffold a Micronaut service with @Controller, @Singleton DI, health indicators, compile-time DI, Dockerfile, and integration tests.

License 许可
MIT
最近更新
2026-10-27
Stars
★ 0
Forks
1

01 前言 Front Matter

name
micronaut-scaffold
model
sonnet
visibility
public
description
Scaffold a Micronaut service with @Controller, @Singleton DI, health indicators, compile-time DI, Dockerfile, and integration tests.
allowed-tools
[ "Read", "Write", "Edit", "Bash", "Skill" ]
context-budget
light
requires-capabilities
[ "web.micronaut.framework" ]

03 SKILL.md 正文

Skill: Micronaut Scaffold Generator

Purpose

Scaffolds a complete Micronaut service module following the hexagonal architecture pattern. Produces:

  1. Application.java entrypoint
  2. @Controller class with endpoints
  3. @Singleton service and port wiring
  4. HealthIndicator implementation
  5. Configuration (application.yml)
  6. Dockerfile (multi-stage build)
  7. Integration tests (@MicronautTest)

Triggers

  • /micronaut-scaffold <ServiceName> — scaffold Micronaut service
  • /micronaut-scaffold <ServiceName> --graalvm — include GraalVM native hints

Parameters

Parameter Required Description
ServiceName Yes PascalCase service name
--graalvm No Add @ReflectiveAccess and reflect-config.json for native image
--port No HTTP port (default: 8080)

Artifacts Generated

  1. src/main/java/.../Application.java — Application entrypoint
  2. src/main/java/.../adapter/inbound/rest/{ServiceName}Controller.java — HTTP controller
  3. src/main/java/.../adapter/inbound/health/{ServiceName}HealthIndicator.java — Health indicator
  4. src/main/java/.../config/AppConfig.java — Configuration binding
  5. src/main/resources/application.yml — Service configuration
  6. Dockerfile — Multi-stage Docker build
  7. src/test/java/.../adapter/inbound/rest/{ServiceName}ControllerTest.java — Integration test

Workflow

Step 1 — Read Project Context

  • knowledge/stack-patterns/micronaut/index.md — Micronaut patterns
  • knowledge/layer-templates.md — Layer templates
  • knowledge/architecture-hexagonal.md — Hexagonal conventions

Step 2 — Generate Application Entrypoint

public class Application {
    public static void main(String[] args) {
        Micronaut.run(Application.class, args);
    }
}

Step 3 — Generate Controller

Follow knowledge/stack-patterns/micronaut/index.md §1 Controller pattern:

@Controller("/api/v1/{resource}")
public class {ServiceName}Controller {
    private final {Port} port;

    public {ServiceName}Controller({Port} port) {
        this.port = port;
    }

    @Get
    public List<{Response}> list() { ... }

    @Post
    @Status(HttpStatus.CREATED)
    public {Response} create(@Valid @Body {Request} request) { ... }
}

Step 4 — Generate Health Indicator

Follow knowledge/stack-patterns/micronaut/index.md §6 Health Checks pattern.

Step 5 — Generate Configuration

# src/main/resources/application.yml
micronaut:
  application:
    name: {service-name}
  server:
    port: 8080
app:
  feature:
    enabled: true
    max-items: 100

Step 6 — Generate Dockerfile

FROM eclipse-temurin:21-jdk-alpine AS build
WORKDIR /app
COPY . .
RUN mvn -B package -DskipTests

FROM eclipse-temurin:21-jre-alpine
WORKDIR /app
COPY --from=build /app/target/*.jar app.jar
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
USER appuser
EXPOSE 8080
ENTRYPOINT ["java", "-jar", "app.jar"]

Step 7 — Generate Tests

@MicronautTest
class {ServiceName}ControllerTest {

    @Inject
    {ServiceName}Client client;  // Declarative HTTP client injected

    @MockBean({Port}.class)
    {Port} port() { return mock({Port}.class); }

    @Test
    void list_returnsOk() {
        var result = client.list();
        assertThat(result).isNotNull();
    }
}

Output Checklist

  • [ ] Compile-time DI — no reflection-based injection
  • [ ] No @Autowired (Spring annotation — forbidden)
  • [ ] Constructor injection without extra annotations (@Inject not needed in Micronaut)
  • [ ] @Valid on controller request parameters
  • [ ] Health endpoint at /health/liveness and /health/readiness
  • [ ] Config via application.yml (no hardcoded values)
  • [ ] Dockerfile uses non-root user

Knowledge Pack References

  • knowledge/stack-patterns/micronaut/index.md — Micronaut patterns
  • knowledge/layer-templates.md — Layer templates

04 同仓库更多 Skills

review-bench
review-bench/edercnj_ia-dev-environment

x-parallel-eval

Detects and classifies file-collision risks between work units (tasks, stories, or epic phases) before parallel execution. Reads ## File Footprint blocks produced by x-task-plan / x-story-plan, applies the parallelism-heuristics knowledge pack (hard / regen / soft categories + hotspot overrides), and emits a collision matrix + serialization recommendation in Markdown (default) or JSON.

★ 0
review-bench
review-bench/edercnj_ia-dev-environment

parallelism-heuristics

Canonical catalog of file-collision heuristics for parallel task, story, and epic execution. Defines the File Footprint block format, the three Conflict Categories (hard / regen / soft), a hotspot list of high-contention paths, and the degrade-with-warning policy. Consumed by x-task-plan, x-story-plan, x-epic-map, x-parallel-eval, and x-dev-*-implement.

★ 0
review-bench
review-bench/edercnj_ia-dev-environment

x-watch-pr-ci

Polls a PR's CI checks and Copilot review status, blocking until checks complete or timeout. Returns one of 8 stable exit codes (SUCCESS=0, CI_PENDING_PROCEED=10, CI_FAILED=20, TIMEOUT=30, PR_ALREADY_MERGED=40, NO_CI_CONFIGURED=50, PR_CLOSED=60, PR_NOT_FOUND=70). Writes a versioned state-file for session resume.

★ 0
review-bench
review-bench/edercnj_ia-dev-environment

x-validate-docs

Documentation freshness gate: validates 6 dimensions (readme, api-specs, grpc-proto, adr, skill-docs, system-architecture) against code changes in a PR. Stack-aware — only validates targets declared/auto-detected from ProjectConfig.documentation.targets. Returns exit non-zero on staleness; produces structured report.

★ 0
review-bench
review-bench/edercnj_ia-dev-environment

x-update-system-architecture

Incrementally updates docs/architecture/system.md after an epic completes. Appends new entries to the Decision Log (§11) using x-internal-write-report --append (dedup by ## ID: marker) and surgically inserts component/integration changes into sections 1-10 via Edit. Idempotent: re-running with the same epic produces a byte-identical system.md.

★ 0
review-bench
review-bench/edercnj_ia-dev-environment

x-update-architecture

Incrementally updates the service architecture document with changes from architecture plans. Adds new components, integrations, flows, and ADR references without rewriting existing content. Use after implementation to keep architecture documentation current.

★ 0