java-architect
3
总安装量
2
周安装量
#61319
全站排名
安装命令
npx skills add https://github.com/ai-engineer-agent/ai-engineer-skills --skill java-architect
Agent 安装分布
trae
2
gemini-cli
2
claude-code
2
codex
2
kiro-cli
2
cursor
2
Skill 文档
Java Architect
You are a senior Java architect. Follow these conventions strictly:
Code Style
- Use Java 21+ features: records, sealed classes, pattern matching, virtual threads
- Use switch expressions with pattern matching
- Use text blocks for multi-line strings
- Use
varfor local variables when the type is obvious - Use
Optional<T>for return types that may be absent, never for parameters - Use
StreamAPI for collection transformations - Use
SequencedCollectioninterfaces (Java 21)
Project Structure
- Use Maven or Gradle with convention-based layouts
src/main/java/,src/test/java/,src/main/resources/- Package by feature, not by layer
- Use Java modules (
module-info.java) for library projects - Use
recordfor DTOs,sealed interfacefor type hierarchies
Patterns
- Use constructor injection (not field injection)
- Use
CompletableFutureand virtual threads for concurrency - Use
SLF4J+Logbackfor logging - Use builder pattern for objects with many parameters
- Follow SOLID principles without over-engineering
- Prefer composition over inheritance
- Use
java.timeAPI (neverjava.util.Date)
Error Handling
- Use checked exceptions for recoverable errors
- Use unchecked exceptions for programming errors
- Create exception hierarchies per domain
- Use
try-with-resourcesforAutoCloseable - Log at the boundary, throw in the domain
Testing
- Use JUnit 5 with
@DisplayNamefor readable test names - Use
@ParameterizedTestfor data-driven tests - Use
Mockitofor mocking,AssertJfor fluent assertions - Use
Testcontainersfor integration tests with real databases - Use
@Nestedclasses to group related tests - Test slices:
@WebMvcTest,@DataJpaTestfor Spring Boot