java-architect
它能做什么
它指导 AI 智能体用 Spring Boot 3 构建企业级 Java 服务。适用于需要安全性和良好数据库性能的 Java 后端开发者。
适用场景
- ✓当你要构建或调试 Spring Boot 3 应用时。
- ✓当你需要用 OAuth2 或 JWT 设置 Spring Security 时。
- ✓当 JPA 应用中的数据库查询很慢,需要调优时。
技能链接
https://github.com/Jeffallan/claude-skills/blob/main/skills/java-architect/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请为我的 Spring Boot 3 应用设置带 JWT 登录的 Spring Security,并检查端点是否受到保护。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会审查项目结构和配置,设计领域模型,并实现各项服务。然后,它运行 Maven 或 Gradle 构建,检查测试覆盖率和查询的正确性。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Java Architect
Enterprise Java specialist focused on Spring Boot 3.x, microservices architecture, and cloud-native development using Java 21 LTS.
Core Workflow
- Architecture analysis - Review project structure, dependencies, Spring config
- Domain design - Create models following DDD and Clean Architecture; verify domain boundaries before proceeding. If boundaries are unclear, resolve ambiguities before moving to implementation.
- Implementation - Build services with Spring Boot best practices
- Data layer - Optimize JPA queries, implement repositories; run
./mvnw verify -pl <module>to confirm query correctness. If integration tests fail: review Hibernate SQL logs, fix queries or mappings, re-run before proceeding. - Security & config - Apply Spring Security, externalize configuration, add observability; run
./mvnw verifyafter security changes to confirm filter chain and JWT wiring. If tests fail: checkSecurityFilterChainbean order and token validation config, then re-run. - Quality assurance - Run
./mvnw verify(Maven) or./gradlew check(Gradle) to confirm all tests pass and coverage reaches 85%+ before closing. If coverage is below threshold: identify untested branches via JaCoCo report (target/site/jacoco/index.html), add missing test cases, re-run.
Reference Guide
Load detailed guidance based on context:
| Topic | Reference | Load When |
|---|---|---|
| Spring Boot | references/spring-boot-setup.md |
Project setup, configuration, starters |
| Reactive | references/reactive-webflux.md |
WebFlux, Project Reactor, R2DBC |
| Data Access | references/jpa-optimization.md |
JPA, Hibernate, query tuning |
| Security | references/spring-security.md |
OAuth2, JWT, method security |
| Testing | references/testing-patterns.md |
JUnit 5, TestContainers, Mockito |
Constraints
MUST DO
- Use Java 21 LTS features (records, sealed classes, pattern matching)
- Apply database migrations (Flyway/Liquibase)
- Document APIs with OpenAPI/Swagger
- Use proper exception handling hierarchy
- Externalize all configuration (never hardcode values)
MUST NOT DO
- Use deprecated Spring APIs
- Skip input validation
- Store sensitive data unencrypted
- Use blocking code in reactive applications
- Ignore transaction boundaries
Output Templates
When implementing Java features, provide:
- Domain models (entities, DTOs, records)
- Service layer (business logic, transactions)
- Repository interfaces (Spring Data)
- Controller/REST endpoints
- Test classes with comprehensive coverage
- Brief explanation of architectural decisions
Code Examples
Minimal WebFlux REST Endpoint
@RestController
@RequestMapping("/api/v1/orders")
@RequiredArgsConstructor
public class OrderController {
private final OrderService orderService;
@GetMapping("/{id}")
public Mono<ResponseEntity<OrderDto>> getOrder(@PathVariable UUID id) {
return orderService.findById(id)
.map(ResponseEntity::ok)
.defaultIfEmpty(ResponseEntity.notFound().build());
}
@PostMapping
@ResponseStatus(HttpStatus.CREATED)
public Mono<OrderDto> createOrder(@Valid @RequestBody CreateOrderRequest request) {
return orderService.create(request);
}
}
JPA Repository with Optimized Query
public interface OrderRepository extends JpaRepository<Order, UUID> {
// Avoid N+1: fetch association in one query
@Query("SELECT o FROM Order o JOIN FETCH o.items WHERE o.customerId = :customerId")
List<Order> findByCustomerIdWithItems(@Param("customerId") UUID customerId);
// Projection to limit fetched columns
@Query("SELECT new com.example.dto.OrderSummary(o.id, o.status, o.total) FROM Order o WHERE o.status = :status")
Page<OrderSummary> findSummariesByStatus(@Param("status") OrderStatus status, Pageable pageable);
}
Spring Security OAuth2 JWT Configuration
@Configuration
@EnableMethodSecurity
public class SecurityConfig {
@Bean
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
return http
.csrf(AbstractHttpConfigurer::disable)
.sessionManagement(s -> s.sessionCreationPolicy(STATELESS))
.authorizeHttpRequests(auth -> auth
.requestMatchers("/actuator/health").permitAll()
.anyRequest().authenticated())
常见问题
它使用哪个 Java 版本?
它适用于 Java 21 LTS 和 Spring Boot 3.x。
它的覆盖率目标是多少?
目标是 85% 或以上的测试覆盖率,并使用 JaCoCo 报告找出缺口。
它涵盖响应式编程吗?
涵盖。它涵盖 WebFlux 端点和异步处理。
详情
作者的原始描述
Use when building, configuring, or debugging enterprise Java applications with Spring Boot 3.x, microservices, or reactive programming. Invoke to implement WebFlux endpoints, optimize JPA queries and database performance, configure Spring Security with OAuth2/JWT, or resolve authentication issues and async processing challenges in cloud-native Spring applications.
repo: Jeffallan/claude-skills
热度
- GitHub 星标
- 12k
- 排名
- #11430
- 许可证
- MIT
- 更新时间
- 2026/10/30
评论
- …
同一仓库的更多技能
angular-architect
12k帮你的智能体构建 Angular 17 及更新版本的应用,包括独立组件、懒加载路由、NgRx 状态管理、RxJS 模式和性能优化。
api-designer
12k帮你的智能体设计 REST 或 GraphQL API,并编写 OpenAPI 3.1 规范,包括资源、分页、错误格式和版本控制规则。
architecture-designer
12k帮你的智能体设计系统架构、比较模式和技术,并编写架构决策记录,解释每个选择的理由。
atlassian-mcp
12k帮你的智能体通过 MCP 搜索和更新 Jira 问题及 Confluence 页面,包括 JQL 和 CQL 查询、冲刺和文档同步。