@mark-gozner/aigile-method 0.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +26 -0
- package/README.md +300 -0
- package/core/agent-teams/team-all.yaml +24 -0
- package/core/agent-teams/team-company.yaml +17 -0
- package/core/agent-teams/team-enterprise.yaml +17 -0
- package/core/agent-teams/team-fullstack.yaml +16 -0
- package/core/agent-teams/team-ide-minimal.yaml +10 -0
- package/core/agents/aigile-master.md +476 -0
- package/core/agents/aigile-orchestrator.agent.md +200 -0
- package/core/agents/analyst.md +45 -0
- package/core/agents/architect.md +43 -0
- package/core/agents/code-tour.agent.md +208 -0
- package/core/agents/dev.agent.md +145 -0
- package/core/agents/dev.md +130 -0
- package/core/agents/expert-react-frontend-engineer.agent.md +741 -0
- package/core/agents/pm.md +33 -0
- package/core/agents/po.md +35 -0
- package/core/agents/qa.md +38 -0
- package/core/agents/sm.md +31 -0
- package/core/agents/ui-expert.md +39 -0
- package/core/agents/ux-expert.md +31 -0
- package/core/checklists/architect-checklist.md +246 -0
- package/core/checklists/change-checklist.md +182 -0
- package/core/checklists/pm-checklist.md +286 -0
- package/core/checklists/po-master-checklist.md +291 -0
- package/core/checklists/story-dod-checklist.md +94 -0
- package/core/checklists/story-draft-checklist.md +153 -0
- package/core/core-config.yaml +22 -0
- package/core/data/aigile-kb.md +112 -0
- package/core/data/brainstorming-techniques.md +73 -0
- package/core/data/elicitation-methods.md +42 -0
- package/core/data/technical-preferences.md +52 -0
- package/core/data/test-levels-framework.md +43 -0
- package/core/data/test-priorities-matrix.md +26 -0
- package/core/instructions/csharp.instructions.md +656 -0
- package/core/instructions/dotnet/csharp.instructions.md +656 -0
- package/core/instructions/java/java.instructions.md +67 -0
- package/core/instructions/java/spring-boot.instructions.md +122 -0
- package/core/instructions/java.instructions.md +67 -0
- package/core/instructions/spring-boot.instructions.md +122 -0
- package/core/prompts/README.md +11 -0
- package/core/prompts/architecture/architecture-blueprint-generator.prompt.md +322 -0
- package/core/prompts/architecture/architecture-validation.prompt.md +71 -0
- package/core/prompts/architecture/file-tree-generator.prompt.md +405 -0
- package/core/prompts/architecture/technical-project-analyze.prompt.md +43 -0
- package/core/prompts/architecture-blueprint-generator.prompt.md +322 -0
- package/core/prompts/architecture-validation.prompt.md +71 -0
- package/core/prompts/code-review.prompt.md +107 -0
- package/core/prompts/confluence-in-md.prompt.md +167 -0
- package/core/prompts/copilot-instructions-blueprint-generator.prompt.md +294 -0
- package/core/prompts/create-implementation-plan.prompt.md +157 -0
- package/core/prompts/create-oo-component-documentation.prompt.md +193 -0
- package/core/prompts/file-tree-generator.prompt.md +405 -0
- package/core/prompts/generate-unit-tests.prompt.md +291 -0
- package/core/prompts/java/java-doc.prompt.md +24 -0
- package/core/prompts/java/java-junit.prompt.md +64 -0
- package/core/prompts/java/junit-5.prompt.md +64 -0
- package/core/prompts/java-doc.prompt.md +24 -0
- package/core/prompts/java-junit.prompt.md +64 -0
- package/core/prompts/junit-5.prompt.md +64 -0
- package/core/prompts/release-notes/README.md +11 -0
- package/core/prompts/release-notes/release-notes.prompt.md +723 -0
- package/core/prompts/release-notes.prompt.md +723 -0
- package/core/prompts/technical-project-analyze.prompt.md +43 -0
- package/core/tasks/advanced-elicitation.md +119 -0
- package/core/tasks/check-story-implemented.md +44 -0
- package/core/tasks/code-arch-review-with-github.md +40 -0
- package/core/tasks/create-architecture-doc.md +55 -0
- package/core/tasks/create-jira-epic-from-confluence.md +70 -0
- package/core/tasks/create-jira-story-from-confluence.md +39 -0
- package/core/tasks/create-jira-story-from-text.md +39 -0
- package/core/tasks/create-next-story.md +35 -0
- package/core/tasks/create-prd-doc.md +54 -0
- package/core/tasks/create-stories-from-epic.md +66 -0
- package/core/tasks/create-tasks-for-story.md +60 -0
- package/core/tasks/document-project.md +69 -0
- package/core/tasks/execute-checklist.md +37 -0
- package/core/tasks/explain-story-from-jira.md +44 -0
- package/core/tasks/facilitate-brainstorming-session.md +69 -0
- package/core/tasks/figma-audit-design-system.md +20 -0
- package/core/tasks/front-end-spec-from-design.md +33 -0
- package/core/tasks/gate.md +64 -0
- package/core/tasks/groom-jira-story.md +52 -0
- package/core/tasks/help.md +27 -0
- package/core/tasks/implement-freeform-work-item.md +30 -0
- package/core/tasks/implement-story-from-jira.md +63 -0
- package/core/tasks/implement-unit-tests.md +45 -0
- package/core/tasks/market-research-from-context7.md +37 -0
- package/core/tasks/review-story.md +30 -0
- package/core/tasks/sonarqube-hotspot-review.md +39 -0
- package/core/tasks/standup-digest.md +21 -0
- package/core/tasks/sync-jira-backlog.md +32 -0
- package/core/tasks/test-design.md +68 -0
- package/core/tasks/validate-next-story.md +37 -0
- package/core/tasks/verify-jira-story-e2e.md +45 -0
- package/core/templates/architecture-tmpl.yaml +651 -0
- package/core/templates/brainstorming-output-tmpl.yaml +156 -0
- package/core/templates/brownfield-architecture-tmpl.yaml +477 -0
- package/core/templates/brownfield-prd-tmpl.yaml +281 -0
- package/core/templates/front-end-architecture-tmpl.yaml +219 -0
- package/core/templates/front-end-spec-tmpl.yaml +350 -0
- package/core/templates/fullstack-architecture-tmpl.yaml +824 -0
- package/core/templates/market-research-tmpl.yaml +253 -0
- package/core/templates/prd-tmpl.yaml +203 -0
- package/core/templates/project-brief-tmpl.yaml +222 -0
- package/core/templates/qa-gate-tmpl.yaml +103 -0
- package/core/templates/story-tmpl.yaml +138 -0
- package/core/workflows/brownfield-fullstack.yaml +298 -0
- package/core/workflows/brownfield-service.yaml +188 -0
- package/core/workflows/brownfield-ui.yaml +198 -0
- package/core/workflows/greenfield-fullstack.yaml +241 -0
- package/core/workflows/greenfield-service.yaml +207 -0
- package/core/workflows/greenfield-ui.yaml +236 -0
- package/dist/agents/aigile-master.txt +500 -0
- package/dist/agents/aigile-orchestrator.agent.txt +224 -0
- package/dist/agents/analyst.txt +69 -0
- package/dist/agents/architect.txt +67 -0
- package/dist/agents/code-tour.agent.txt +232 -0
- package/dist/agents/dev.agent.txt +169 -0
- package/dist/agents/dev.txt +154 -0
- package/dist/agents/expert-react-frontend-engineer.agent.txt +765 -0
- package/dist/agents/pm.txt +57 -0
- package/dist/agents/po.txt +59 -0
- package/dist/agents/qa.txt +62 -0
- package/dist/agents/sm.txt +55 -0
- package/dist/agents/ui-expert.txt +63 -0
- package/dist/agents/ux-expert.txt +55 -0
- package/dist/dev-agent-bundle.txt +154 -0
- package/dist/teams/team-company.txt +10789 -0
- package/docs/mcp-servers.md +102 -0
- package/docs/orchestrator-guide.md +526 -0
- package/mcp/servers.json +108 -0
- package/mcp/servers.yaml +124 -0
- package/package.json +72 -0
- package/tools/cli.js +1864 -0
- package/tools/installer/README.md +24 -0
- package/tools/installer/lib/ide-setup.js +295 -0
- package/tools/installer/lib/installer.js +131 -0
- package/tools/md-assets/web-agent-startup-instructions.md +21 -0
- package/tools/postinstall.js +72 -0
- package/tools/shared/bannerArt.js +68 -0
- package/tools/validate-bundles.js +54 -0
- package/tools/verify-publish-registry.js +34 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 'Guidelines for building Java base applications'
|
|
3
|
+
applyTo: '**/*.java'
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Java Development
|
|
7
|
+
|
|
8
|
+
## General Java Development Practices
|
|
9
|
+
- First, prompt the user if they want to integrate static analysis tools (SonarQube, PMD, Checkstyle)
|
|
10
|
+
into their project setup. If yes, provide guidance on tool selection and configuration.
|
|
11
|
+
- If the user declines static analysis tools or wants to proceed without them, continue with implementing the Best practices, bug patterns and code smell prevention guidelines outlined below.
|
|
12
|
+
- Address code smells proactively during development rather than accumulating technical debt.
|
|
13
|
+
- Focus on readability, maintainability, and performance when refactoring identified issues.
|
|
14
|
+
- Use IDE / Code editor reported warnings and suggestions to catch common patterns early in development.
|
|
15
|
+
- Always follow SOLID, DRY, KISS, and YAGNI principles.
|
|
16
|
+
- Adhere to OWASP security best practices.
|
|
17
|
+
- Break tasks into the smallest units and solve step by step.
|
|
18
|
+
|
|
19
|
+
## Best practices
|
|
20
|
+
|
|
21
|
+
- **Service Layer Pattern**: All business logic services must have an interface and an implementation. This enforces a clean definition of functionality, improves testability, and makes the codebase easier to understand and maintain. Example: `UserService` (interface) and `UserServiceImpl` (implementation).
|
|
22
|
+
- **Records**: For classes primarily intended to store data (e.g., DTOs, immutable data structures), **Java Records should be used instead of traditional classes**.
|
|
23
|
+
- **Pattern Matching**: Utilize pattern matching for `instanceof` and `switch` expression to simplify conditional logic and type casting.
|
|
24
|
+
- **Type Inference**: Use `var` for local variable declarations to improve readability, but only when the type is explicitly clear from the right-hand side of the expression.
|
|
25
|
+
- **Immutability**: Favor immutable objects. Make classes and fields `final` where possible. Use collections from `List.of()`/`Map.of()` for fixed data. Use `Stream.toList()` to create immutable lists.
|
|
26
|
+
- **Streams and Lambdas**: Use the Streams API and lambda expressions for collection processing. Employ method references (e.g., `stream.map(Foo::toBar)`).
|
|
27
|
+
- **Null Handling**: Avoid returning or accepting `null`. Use `Optional<T>` for possibly-absent values and `Objects` utility methods like `equals()` and `requireNonNull()`.
|
|
28
|
+
|
|
29
|
+
### Naming Conventions
|
|
30
|
+
|
|
31
|
+
- Follow Google's Java style guide:
|
|
32
|
+
- `UpperCamelCase` for class and interface names.
|
|
33
|
+
- `lowerCamelCase` for method and variable names.
|
|
34
|
+
- `UPPER_SNAKE_CASE` for constants.
|
|
35
|
+
- `lowercase` for package names.
|
|
36
|
+
- Use nouns for classes (`UserService`) and verbs for methods (`getUserById`).
|
|
37
|
+
- Avoid abbreviations and Hungarian notation.
|
|
38
|
+
|
|
39
|
+
### Bug Patterns
|
|
40
|
+
|
|
41
|
+
| Rule ID | Description | Example / Notes |
|
|
42
|
+
| ------- | ----------------------------------------------------------- | ------------------------------------------------------------------------------------------------ |
|
|
43
|
+
| `S2095` | Resources should be closed | Use try-with-resources when working with streams, files, sockets, etc. |
|
|
44
|
+
| `S1698` | Objects should be compared with `.equals()` instead of `==` | Especially important for Strings and boxed primitives. |
|
|
45
|
+
| `S1905` | Redundant casts should be removed | Clean up unnecessary or unsafe casts. |
|
|
46
|
+
| `S3518` | Conditions should not always evaluate to true or false | Watch for infinite loops or if-conditions that never change. |
|
|
47
|
+
| `S108` | Unreachable code should be removed | Code after `return`, `throw`, etc., must be cleaned up. |
|
|
48
|
+
|
|
49
|
+
## Code Smells
|
|
50
|
+
|
|
51
|
+
| Rule ID | Description | Example / Notes |
|
|
52
|
+
| ------- | ------------------------------------------------------ | ----------------------------------------------------------------------------- |
|
|
53
|
+
| `S107` | Methods should not have too many parameters | Refactor into helper classes or use builder pattern. |
|
|
54
|
+
| `S121` | Duplicated blocks of code should be removed | Consolidate logic into shared methods. |
|
|
55
|
+
| `S138` | Methods should not be too long | Break complex logic into smaller, testable units. |
|
|
56
|
+
| `S3776` | Cognitive complexity should be reduced | Simplify nested logic, extract methods, avoid deep `if` trees. |
|
|
57
|
+
| `S1192` | String literals should not be duplicated | Replace with constants or enums. |
|
|
58
|
+
| `S1854` | Unused assignments should be removed | Avoid dead variables—remove or refactor. |
|
|
59
|
+
| `S109` | Magic numbers should be replaced with constants | Improves readability and maintainability. |
|
|
60
|
+
| `S1188` | Catch blocks should not be empty | Always log or handle exceptions meaningfully. |
|
|
61
|
+
|
|
62
|
+
## Build and Verification
|
|
63
|
+
|
|
64
|
+
- After adding or modifying code, verify the project continues to build successfully.
|
|
65
|
+
- If the project uses Maven, run `mvn clean install`.
|
|
66
|
+
- If the project uses Gradle, run `./gradlew build` (or `gradlew.bat build` on Windows).
|
|
67
|
+
- Ensure all tests pass as part of the build.
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 'Guidelines for building Spring Boot base applications'
|
|
3
|
+
applyTo: '**/*.java, **/*.kt'
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Spring Boot Development
|
|
7
|
+
|
|
8
|
+
## General Spring Boot Instructions
|
|
9
|
+
|
|
10
|
+
- Make only high confidence suggestions when reviewing code changes.
|
|
11
|
+
- Write code with good maintainability practices, including comments on why certain design decisions were made.
|
|
12
|
+
- Handle edge cases and write clear exception handling.
|
|
13
|
+
- For libraries or external dependencies, mention their usage and purpose in comments.
|
|
14
|
+
|
|
15
|
+
### Dependency Injection
|
|
16
|
+
|
|
17
|
+
- Use constructor injection for all required dependencies.
|
|
18
|
+
- Declare dependency fields as `private final`.
|
|
19
|
+
|
|
20
|
+
### Configuration
|
|
21
|
+
|
|
22
|
+
- Use YAML files (`application.yml`) for externalized configuration.
|
|
23
|
+
- Environment Profiles: Use Spring profiles for different environments (dev, test, prod)
|
|
24
|
+
- Configuration Properties: Use @ConfigurationProperties for type-safe configuration binding
|
|
25
|
+
- Secrets Management: Externalize secrets using environment variables or secret management systems
|
|
26
|
+
|
|
27
|
+
### Code Organization
|
|
28
|
+
|
|
29
|
+
- Package Structure: Organize by feature/domain rather than by layer
|
|
30
|
+
- Separation of Concerns: Keep controllers thin, services focused, and repositories simple
|
|
31
|
+
- Utility Classes: Make utility classes final with private constructors
|
|
32
|
+
|
|
33
|
+
## Spring Boot Project Structure
|
|
34
|
+
|
|
35
|
+
- Use Java Spring Boot 3 (Maven, Java 21, Spring Web, Spring Data JPA, Lombok).
|
|
36
|
+
- RestControllers handle all request/response logic.
|
|
37
|
+
- ServiceImpl classes handle all database operation logic using Repository methods.
|
|
38
|
+
- RestControllers must not autowire Repositories directly unless absolutely necessary.
|
|
39
|
+
- ServiceImpl classes must not query the database directly (use Repositories).
|
|
40
|
+
- Use DTOs for data transfer between RestControllers and ServiceImpl classes.
|
|
41
|
+
- Entity classes are only for carrying data from database queries.
|
|
42
|
+
-
|
|
43
|
+
|
|
44
|
+
### RestController Conventions
|
|
45
|
+
|
|
46
|
+
- Annotate with @RestController and specify class-level @RequestMapping.
|
|
47
|
+
- Use best-practice HTTP method annotations (e.g., @PostMapping, @GetMapping).
|
|
48
|
+
- Autowire dependencies in class methods without constructors unless specified.
|
|
49
|
+
- Methods return ResponseEntity<ApiResponse>.
|
|
50
|
+
- Implement all logic in try-catch blocks; handle errors with GlobalExceptionHandler.
|
|
51
|
+
|
|
52
|
+
### ApiResponse & GlobalExceptionHandler
|
|
53
|
+
|
|
54
|
+
- ApiResponse and GlobalExceptionHandler classes must be present and follow best practices for structure and error handling.
|
|
55
|
+
|
|
56
|
+
### Service Layer
|
|
57
|
+
|
|
58
|
+
- Place business logic in `@Service`-annotated classes.
|
|
59
|
+
- Services should be stateless and testable.
|
|
60
|
+
- Inject repositories via the constructor.
|
|
61
|
+
- Service method signatures should use domain IDs or DTOs, not expose repository entities directly unless necessary.
|
|
62
|
+
- Service classes are interfaces; implementations are ServiceImpl classes annotated with @Service.
|
|
63
|
+
- Use Lombok's `@RequiredArgsConstructor` for constructor-based dependency injection in ServiceImpl classes. Declare all dependencies as `private final` fields.
|
|
64
|
+
- ServiceImpl methods return DTOs (not entities) unless necessary.
|
|
65
|
+
- Use repository methods with .orElseThrow for existence checks.
|
|
66
|
+
- Use @Transactional or transactionTemplate for multiple sequential DB operations.
|
|
67
|
+
|
|
68
|
+
### Repository Class Conventions
|
|
69
|
+
|
|
70
|
+
- Annotate with @Repository.
|
|
71
|
+
- Use interfaces extending JpaRepository<Entity, ID>.
|
|
72
|
+
- Use JPQL for @Query methods.
|
|
73
|
+
- Use @EntityGraph(attributePaths={...}) to avoid N+1 problems in relationship queries.
|
|
74
|
+
- Use DTOs for multi-join queries with @Query.
|
|
75
|
+
|
|
76
|
+
### Entity Class Conventions
|
|
77
|
+
|
|
78
|
+
- Annotate with @Entity and @Data (Lombok).
|
|
79
|
+
- Use @Id and @GeneratedValue(strategy=GenerationType.IDENTITY) for IDs.
|
|
80
|
+
- Use FetchType.LAZY for relationships.
|
|
81
|
+
- Annotate properties with validation annotations (e.g., @Size, @NotEmpty, @Email).
|
|
82
|
+
|
|
83
|
+
### DTO Conventions
|
|
84
|
+
|
|
85
|
+
- Use Java records for DTOs unless otherwise specified.
|
|
86
|
+
- Include a compact canonical constructor for parameter validation (not null, blank, etc.).
|
|
87
|
+
|
|
88
|
+
### Entity-DTO Mapping
|
|
89
|
+
|
|
90
|
+
- Use MapStruct for mapping between JPA entities and domain/API models.
|
|
91
|
+
- Create dedicated mapper interfaces annotated with `@Mapper(componentModel = "spring")` to enable Spring dependency injection.
|
|
92
|
+
- MapStruct mappers should be injected into services via constructor injection.
|
|
93
|
+
- Example: `@Mapper(componentModel = "spring") public interface UserMapper { UserDto toDto(User entity); User toEntity(UserDto dto); }`
|
|
94
|
+
- Avoid manual mapping code in services; delegate all mapping logic to MapStruct mappers.
|
|
95
|
+
|
|
96
|
+
### Logging
|
|
97
|
+
|
|
98
|
+
- Use SLF4J for all logging (`private static final Logger logger = LoggerFactory.getLogger(MyClass.class);`).
|
|
99
|
+
- Do not use concrete implementations (Logback, Log4j2) or `System.out.println()` directly.
|
|
100
|
+
- Use parameterized logging: `logger.info("User {} logged in", userId);`.
|
|
101
|
+
|
|
102
|
+
### Security & Input Handling
|
|
103
|
+
|
|
104
|
+
- Use parameterized queries | Always use Spring Data JPA or `NamedParameterJdbcTemplate` to prevent SQL injection.
|
|
105
|
+
- Validate request bodies and parameters using JSR-380 (`@NotNull`, `@Size`, etc.) annotations and `BindingResult`
|
|
106
|
+
|
|
107
|
+
## Build and Verification
|
|
108
|
+
|
|
109
|
+
- After adding or modifying code, verify the project continues to build successfully.
|
|
110
|
+
- If the project uses Maven, run `mvn clean package`.
|
|
111
|
+
- If the project uses Gradle, run `./gradlew build` (or `gradlew.bat build` on Windows).
|
|
112
|
+
- Ensure all tests pass as part of the build.
|
|
113
|
+
|
|
114
|
+
## Useful Commands
|
|
115
|
+
|
|
116
|
+
| Gradle Command | Maven Command | Description |
|
|
117
|
+
|:---------------------------|:---------------------------------|:----------------------------------------------|
|
|
118
|
+
| `./gradlew bootRun` | `./mvnw spring-boot:run` | Run the application. |
|
|
119
|
+
| `./gradlew build` | `./mvnw package` | Build the application. |
|
|
120
|
+
| `./gradlew test` | `./mvnw test` | Run tests. |
|
|
121
|
+
| `./gradlew bootJar` | `./mvnw spring-boot:repackage` | Package the application as a JAR. |
|
|
122
|
+
| `./gradlew bootBuildImage` | `./mvnw spring-boot:build-image` | Package the application as a container image. |
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 'Guidelines for building Java base applications'
|
|
3
|
+
applyTo: '**/*.java'
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Java Development
|
|
7
|
+
|
|
8
|
+
## General Java Development Practices
|
|
9
|
+
- First, prompt the user if they want to integrate static analysis tools (SonarQube, PMD, Checkstyle)
|
|
10
|
+
into their project setup. If yes, provide guidance on tool selection and configuration.
|
|
11
|
+
- If the user declines static analysis tools or wants to proceed without them, continue with implementing the Best practices, bug patterns and code smell prevention guidelines outlined below.
|
|
12
|
+
- Address code smells proactively during development rather than accumulating technical debt.
|
|
13
|
+
- Focus on readability, maintainability, and performance when refactoring identified issues.
|
|
14
|
+
- Use IDE / Code editor reported warnings and suggestions to catch common patterns early in development.
|
|
15
|
+
- Always follow SOLID, DRY, KISS, and YAGNI principles.
|
|
16
|
+
- Adhere to OWASP security best practices.
|
|
17
|
+
- Break tasks into the smallest units and solve step by step.
|
|
18
|
+
|
|
19
|
+
## Best practices
|
|
20
|
+
|
|
21
|
+
- **Service Layer Pattern**: All business logic services must have an interface and an implementation. This enforces a clean definition of functionality, improves testability, and makes the codebase easier to understand and maintain. Example: `UserService` (interface) and `UserServiceImpl` (implementation).
|
|
22
|
+
- **Records**: For classes primarily intended to store data (e.g., DTOs, immutable data structures), **Java Records should be used instead of traditional classes**.
|
|
23
|
+
- **Pattern Matching**: Utilize pattern matching for `instanceof` and `switch` expression to simplify conditional logic and type casting.
|
|
24
|
+
- **Type Inference**: Use `var` for local variable declarations to improve readability, but only when the type is explicitly clear from the right-hand side of the expression.
|
|
25
|
+
- **Immutability**: Favor immutable objects. Make classes and fields `final` where possible. Use collections from `List.of()`/`Map.of()` for fixed data. Use `Stream.toList()` to create immutable lists.
|
|
26
|
+
- **Streams and Lambdas**: Use the Streams API and lambda expressions for collection processing. Employ method references (e.g., `stream.map(Foo::toBar)`).
|
|
27
|
+
- **Null Handling**: Avoid returning or accepting `null`. Use `Optional<T>` for possibly-absent values and `Objects` utility methods like `equals()` and `requireNonNull()`.
|
|
28
|
+
|
|
29
|
+
### Naming Conventions
|
|
30
|
+
|
|
31
|
+
- Follow Google's Java style guide:
|
|
32
|
+
- `UpperCamelCase` for class and interface names.
|
|
33
|
+
- `lowerCamelCase` for method and variable names.
|
|
34
|
+
- `UPPER_SNAKE_CASE` for constants.
|
|
35
|
+
- `lowercase` for package names.
|
|
36
|
+
- Use nouns for classes (`UserService`) and verbs for methods (`getUserById`).
|
|
37
|
+
- Avoid abbreviations and Hungarian notation.
|
|
38
|
+
|
|
39
|
+
### Bug Patterns
|
|
40
|
+
|
|
41
|
+
| Rule ID | Description | Example / Notes |
|
|
42
|
+
| ------- | ----------------------------------------------------------- | ------------------------------------------------------------------------------------------------ |
|
|
43
|
+
| `S2095` | Resources should be closed | Use try-with-resources when working with streams, files, sockets, etc. |
|
|
44
|
+
| `S1698` | Objects should be compared with `.equals()` instead of `==` | Especially important for Strings and boxed primitives. |
|
|
45
|
+
| `S1905` | Redundant casts should be removed | Clean up unnecessary or unsafe casts. |
|
|
46
|
+
| `S3518` | Conditions should not always evaluate to true or false | Watch for infinite loops or if-conditions that never change. |
|
|
47
|
+
| `S108` | Unreachable code should be removed | Code after `return`, `throw`, etc., must be cleaned up. |
|
|
48
|
+
|
|
49
|
+
## Code Smells
|
|
50
|
+
|
|
51
|
+
| Rule ID | Description | Example / Notes |
|
|
52
|
+
| ------- | ------------------------------------------------------ | ----------------------------------------------------------------------------- |
|
|
53
|
+
| `S107` | Methods should not have too many parameters | Refactor into helper classes or use builder pattern. |
|
|
54
|
+
| `S121` | Duplicated blocks of code should be removed | Consolidate logic into shared methods. |
|
|
55
|
+
| `S138` | Methods should not be too long | Break complex logic into smaller, testable units. |
|
|
56
|
+
| `S3776` | Cognitive complexity should be reduced | Simplify nested logic, extract methods, avoid deep `if` trees. |
|
|
57
|
+
| `S1192` | String literals should not be duplicated | Replace with constants or enums. |
|
|
58
|
+
| `S1854` | Unused assignments should be removed | Avoid dead variables—remove or refactor. |
|
|
59
|
+
| `S109` | Magic numbers should be replaced with constants | Improves readability and maintainability. |
|
|
60
|
+
| `S1188` | Catch blocks should not be empty | Always log or handle exceptions meaningfully. |
|
|
61
|
+
|
|
62
|
+
## Build and Verification
|
|
63
|
+
|
|
64
|
+
- After adding or modifying code, verify the project continues to build successfully.
|
|
65
|
+
- If the project uses Maven, run `mvn clean install`.
|
|
66
|
+
- If the project uses Gradle, run `./gradlew build` (or `gradlew.bat build` on Windows).
|
|
67
|
+
- Ensure all tests pass as part of the build.
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 'Guidelines for building Spring Boot base applications'
|
|
3
|
+
applyTo: '**/*.java, **/*.kt'
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Spring Boot Development
|
|
7
|
+
|
|
8
|
+
## General Spring Boot Instructions
|
|
9
|
+
|
|
10
|
+
- Make only high confidence suggestions when reviewing code changes.
|
|
11
|
+
- Write code with good maintainability practices, including comments on why certain design decisions were made.
|
|
12
|
+
- Handle edge cases and write clear exception handling.
|
|
13
|
+
- For libraries or external dependencies, mention their usage and purpose in comments.
|
|
14
|
+
|
|
15
|
+
### Dependency Injection
|
|
16
|
+
|
|
17
|
+
- Use constructor injection for all required dependencies.
|
|
18
|
+
- Declare dependency fields as `private final`.
|
|
19
|
+
|
|
20
|
+
### Configuration
|
|
21
|
+
|
|
22
|
+
- Use YAML files (`application.yml`) for externalized configuration.
|
|
23
|
+
- Environment Profiles: Use Spring profiles for different environments (dev, test, prod)
|
|
24
|
+
- Configuration Properties: Use @ConfigurationProperties for type-safe configuration binding
|
|
25
|
+
- Secrets Management: Externalize secrets using environment variables or secret management systems
|
|
26
|
+
|
|
27
|
+
### Code Organization
|
|
28
|
+
|
|
29
|
+
- Package Structure: Organize by feature/domain rather than by layer
|
|
30
|
+
- Separation of Concerns: Keep controllers thin, services focused, and repositories simple
|
|
31
|
+
- Utility Classes: Make utility classes final with private constructors
|
|
32
|
+
|
|
33
|
+
## Spring Boot Project Structure
|
|
34
|
+
|
|
35
|
+
- Use Java Spring Boot 3 (Maven, Java 21, Spring Web, Spring Data JPA, Lombok).
|
|
36
|
+
- RestControllers handle all request/response logic.
|
|
37
|
+
- ServiceImpl classes handle all database operation logic using Repository methods.
|
|
38
|
+
- RestControllers must not autowire Repositories directly unless absolutely necessary.
|
|
39
|
+
- ServiceImpl classes must not query the database directly (use Repositories).
|
|
40
|
+
- Use DTOs for data transfer between RestControllers and ServiceImpl classes.
|
|
41
|
+
- Entity classes are only for carrying data from database queries.
|
|
42
|
+
-
|
|
43
|
+
|
|
44
|
+
### RestController Conventions
|
|
45
|
+
|
|
46
|
+
- Annotate with @RestController and specify class-level @RequestMapping.
|
|
47
|
+
- Use best-practice HTTP method annotations (e.g., @PostMapping, @GetMapping).
|
|
48
|
+
- Autowire dependencies in class methods without constructors unless specified.
|
|
49
|
+
- Methods return ResponseEntity<ApiResponse>.
|
|
50
|
+
- Implement all logic in try-catch blocks; handle errors with GlobalExceptionHandler.
|
|
51
|
+
|
|
52
|
+
### ApiResponse & GlobalExceptionHandler
|
|
53
|
+
|
|
54
|
+
- ApiResponse and GlobalExceptionHandler classes must be present and follow best practices for structure and error handling.
|
|
55
|
+
|
|
56
|
+
### Service Layer
|
|
57
|
+
|
|
58
|
+
- Place business logic in `@Service`-annotated classes.
|
|
59
|
+
- Services should be stateless and testable.
|
|
60
|
+
- Inject repositories via the constructor.
|
|
61
|
+
- Service method signatures should use domain IDs or DTOs, not expose repository entities directly unless necessary.
|
|
62
|
+
- Service classes are interfaces; implementations are ServiceImpl classes annotated with @Service.
|
|
63
|
+
- Use Lombok's `@RequiredArgsConstructor` for constructor-based dependency injection in ServiceImpl classes. Declare all dependencies as `private final` fields.
|
|
64
|
+
- ServiceImpl methods return DTOs (not entities) unless necessary.
|
|
65
|
+
- Use repository methods with .orElseThrow for existence checks.
|
|
66
|
+
- Use @Transactional or transactionTemplate for multiple sequential DB operations.
|
|
67
|
+
|
|
68
|
+
### Repository Class Conventions
|
|
69
|
+
|
|
70
|
+
- Annotate with @Repository.
|
|
71
|
+
- Use interfaces extending JpaRepository<Entity, ID>.
|
|
72
|
+
- Use JPQL for @Query methods.
|
|
73
|
+
- Use @EntityGraph(attributePaths={...}) to avoid N+1 problems in relationship queries.
|
|
74
|
+
- Use DTOs for multi-join queries with @Query.
|
|
75
|
+
|
|
76
|
+
### Entity Class Conventions
|
|
77
|
+
|
|
78
|
+
- Annotate with @Entity and @Data (Lombok).
|
|
79
|
+
- Use @Id and @GeneratedValue(strategy=GenerationType.IDENTITY) for IDs.
|
|
80
|
+
- Use FetchType.LAZY for relationships.
|
|
81
|
+
- Annotate properties with validation annotations (e.g., @Size, @NotEmpty, @Email).
|
|
82
|
+
|
|
83
|
+
### DTO Conventions
|
|
84
|
+
|
|
85
|
+
- Use Java records for DTOs unless otherwise specified.
|
|
86
|
+
- Include a compact canonical constructor for parameter validation (not null, blank, etc.).
|
|
87
|
+
|
|
88
|
+
### Entity-DTO Mapping
|
|
89
|
+
|
|
90
|
+
- Use MapStruct for mapping between JPA entities and domain/API models.
|
|
91
|
+
- Create dedicated mapper interfaces annotated with `@Mapper(componentModel = "spring")` to enable Spring dependency injection.
|
|
92
|
+
- MapStruct mappers should be injected into services via constructor injection.
|
|
93
|
+
- Example: `@Mapper(componentModel = "spring") public interface UserMapper { UserDto toDto(User entity); User toEntity(UserDto dto); }`
|
|
94
|
+
- Avoid manual mapping code in services; delegate all mapping logic to MapStruct mappers.
|
|
95
|
+
|
|
96
|
+
### Logging
|
|
97
|
+
|
|
98
|
+
- Use SLF4J for all logging (`private static final Logger logger = LoggerFactory.getLogger(MyClass.class);`).
|
|
99
|
+
- Do not use concrete implementations (Logback, Log4j2) or `System.out.println()` directly.
|
|
100
|
+
- Use parameterized logging: `logger.info("User {} logged in", userId);`.
|
|
101
|
+
|
|
102
|
+
### Security & Input Handling
|
|
103
|
+
|
|
104
|
+
- Use parameterized queries | Always use Spring Data JPA or `NamedParameterJdbcTemplate` to prevent SQL injection.
|
|
105
|
+
- Validate request bodies and parameters using JSR-380 (`@NotNull`, `@Size`, etc.) annotations and `BindingResult`
|
|
106
|
+
|
|
107
|
+
## Build and Verification
|
|
108
|
+
|
|
109
|
+
- After adding or modifying code, verify the project continues to build successfully.
|
|
110
|
+
- If the project uses Maven, run `mvn clean package`.
|
|
111
|
+
- If the project uses Gradle, run `./gradlew build` (or `gradlew.bat build` on Windows).
|
|
112
|
+
- Ensure all tests pass as part of the build.
|
|
113
|
+
|
|
114
|
+
## Useful Commands
|
|
115
|
+
|
|
116
|
+
| Gradle Command | Maven Command | Description |
|
|
117
|
+
|:---------------------------|:---------------------------------|:----------------------------------------------|
|
|
118
|
+
| `./gradlew bootRun` | `./mvnw spring-boot:run` | Run the application. |
|
|
119
|
+
| `./gradlew build` | `./mvnw package` | Build the application. |
|
|
120
|
+
| `./gradlew test` | `./mvnw test` | Run tests. |
|
|
121
|
+
| `./gradlew bootJar` | `./mvnw spring-boot:repackage` | Package the application as a JAR. |
|
|
122
|
+
| `./gradlew bootBuildImage` | `./mvnw spring-boot:build-image` | Package the application as a container image. |
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
1. Make sure you have Atlassin MCP set up and connected to your Jira instance via your token.
|
|
2
|
+
2. Ensure that Github MCP is set up and connected to your GitHub account via personal access token.
|
|
3
|
+
3. Change the variables in the prompt files to match your project settings:
|
|
4
|
+
|
|
5
|
+
````
|
|
6
|
+
{PROJECT_NAME} = your project name
|
|
7
|
+
{JIRA_PROJECT_KEY} = your Jira project key
|
|
8
|
+
````
|
|
9
|
+
|
|
10
|
+
Place the prompt file (release-notes.prompt.md) in a directory accessible to VS Code and Copilot extension - under `.github/prompts` is recommended.
|
|
11
|
+
Open Copilot extension select 'Agent' mode and type "/release-notes" to trigger the prompt.
|