java-helidon
它能做什么
这个智能体可以按照最佳实践,帮你编写 Helidon 代码。Helidon 是一个 Java 框架。它能确保你的代码使用最新版本(Helidon 4),并且结构清晰。
适用场景
- ✓当你用 Helidon 4 开始一个新项目时。
- ✓当你要把旧项目迁移到 Helidon 4 时。
- ✓当你需要遵循最佳实践的代码示例时。
技能链接
https://github.com/github/awesome-copilot/blob/main/skills/java-helidon/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“我该如何用 Maven 搭建一个 Helidon 4 项目?”
每周 5 个新技能,1 分钟读完。
工作原理
它会将你的代码与最新的 Helidon 4 规则进行对比,并建议最佳的项目组织方式、依赖配置方式,以及让代码更好运行的写法。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Helidon Best Practices
Your goal is to help me write high-quality Helidon applications by following established best practices.
Helidon 3 → 4 API changes
Helidon 4 renamed or resignatured APIs that appear widely in their Helidon 3 form. The left column does not compile on Helidon 4. Check generated code against this table before returning it.
| Do not use (Helidon 3) | Use (Helidon 4) |
|---|---|
io.helidon.common.http.Http.Status |
io.helidon.http.Status |
io.helidon.webserver.Service |
io.helidon.webserver.http.HttpService |
Routing.Rules, update(Routing.Rules) |
HttpRules, routing(HttpRules) |
request.path().param("id") |
request.path().pathParameters().get("id") |
String s = column.as(String.class) |
column.getString() or column.get(String.class) |
dbClient.execute(exec -> ...) returning Single/Multi |
dbClient.execute() returning Optional<DbRow> / Stream<DbRow> |
javax.* |
jakarta.* |
helidon-microprofile-tests-junit5 |
helidon-microprofile-testing-junit5 |
Value.as(Class) in Helidon 4 returns OptionalValue<T>, not T. This is the single
most common Helidon 4 compile error in generated code.
Project Setup & Structure
- Programming Model: Determine whether the project uses Helidon SE or Helidon MP before generating code. Do not mix the two programming models unless explicitly required.
- Java Version: Use Java 21 or later for Helidon 4 applications.
- Build Tool: Use Maven (
pom.xml) or Gradle (build.gradle) for dependency management. - Dependency Management: Use the Helidon BOM or platform to keep Helidon module versions aligned.
- Package Structure: Organize code by feature or domain, such as
com.example.app.orderandcom.example.app.customer, rather than only by technical layer.
Helidon SE
- Explicit Composition: Construct services and dependencies explicitly in the application bootstrap layer.
- Constructor Injection: Pass required dependencies through constructors and declare dependency fields as
private final. - HTTP Services: Group related routes in focused
HttpServiceimplementations. - Business Logic: Keep business logic outside route handlers.
- Virtual Threads: Prefer straightforward blocking code with Helidon 4 virtual-thread-based request handling. Do not introduce reactive complexity without a clear reason. Helidon 4 is not reactive; do not generate
Single,Multi, orCompletionStagechains.
Helidon MP
- Jakarta and MicroProfile: Prefer standard Jakarta EE and Eclipse MicroProfile APIs when available.
- Dependency Injection: Use CDI with constructor injection for required dependencies.
- Bean Scopes: Use CDI scopes such as
@ApplicationScopedand@RequestScopedintentionally. - Normal-Scoped Beans: Add a non-private no-argument constructor to normal-scoped beans that use constructor injection, so the CDI client proxy can be created portably.
- Business Logic: Keep Jakarta REST resource classes thin and delegate business operations to service classes.
- Portability: Prefer portable Jakarta and MicroProfile APIs over Helidon-specific APIs when portability is important.
Configuration
- Externalized Configuration: Store non-secret configuration in
application.yamlorapplication.properties. - Helidon SE Configuration: Use Helidon Config and pass configuration values or typed configuration objects to components.
- Helidon MP Configuration: Use MicroProfile Config for injected application settings.
- Environment Overrides: Use environment variables or deployment-specific configuration sources for environment-dependent values.
- Secrets Management: Never hardcode credentials, API keys, tokens, or private certificates.
Web Layer
…
常见问题
Helidon SE 和 Helidon MP 有什么区别?
Helidon SE(标准版)更基础、更灵活;Helidon MP(MicroProfile)则使用 CDI 和 JAX-RS 等较成熟的标准来构建应用。
为什么要使用 Helidon 4 的 API?
Helidon 4 的 API 经过更新,效率更高,也更安全。使用它们可以避免常见错误,并确保与新版本兼容。
什么是“最佳实践”?
指编写代码的推荐方式和最高效的方法,能让程序更容易理解、更便于维护,也更不容易出错。
详情
作者的原始描述
Get best practices for developing applications with Helidon 4 (SE and MP). Use when working with Helidon SE or Helidon MP, HttpService routing, Helidon DB Client, MicroProfile Config, Helidon Security, or Helidon testing in Java 21+ projects.
repo: github/awesome-copilot
热度
- GitHub 星标
- 40k
- 排名
- #7255
- 许可证
- MIT
- 更新时间
- 2026/10/15
评论
- …
同一仓库的更多技能
acquire-codebase-knowledge
40k帮你的智能体理解并编写现有代码项目的文档。它有助于新成员快速上手,或者快速了解项目架构。
acreadiness-assess
40k让你的智能体评估一个项目对 AI 的准备程度,并生成报告。它有助于了解项目在使用 AI 工具方面的准备情况。
acreadiness-generate-instructions
40k帮你的智能体根据评估结果编写 AI 工具的指令文件。它有助于改善 AI 与代码的交互方式,并弥补已发现的不足。
acreadiness-policy
40k让你的智能体协助制定或应用 AI 项目评估的政策。它有助于规范项目的评估方式,并确保合规。