@deveonc/spec-to-code 1.0.0-beta.2

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.
@@ -0,0 +1,36 @@
1
+ # React Rules
2
+
3
+ ## Versioning
4
+ - Target the latest stable React version used by the project.
5
+ - If the version is unclear, inspect `package.json` and ask the user.
6
+ - Avoid experimental/pre-release APIs unless explicitly requested.
7
+
8
+ ## Architecture
9
+ - Prefer functional components with hooks; avoid class components.
10
+ - Keep components small and focused (single responsibility).
11
+ - Extract reusable UI into shared components and hooks.
12
+ - Use composition over inheritance (children, render props when needed).
13
+
14
+ ## State & data
15
+ - Keep state local when possible; lift only when necessary.
16
+ - Use `useReducer` for complex local state.
17
+ - Avoid prop drilling for deep trees; consider context for shared state.
18
+ - Keep side effects in `useEffect` and make dependencies explicit.
19
+
20
+ ## Performance
21
+ - Avoid premature optimization; use `memo`, `useMemo`, `useCallback` when needed.
22
+ - Prefer stable keys for lists (no array index unless static).
23
+ - Avoid unnecessary re-renders by keeping props stable.
24
+
25
+ ## Styling
26
+ - Follow existing styling conventions (CSS Modules, styled-components, etc.).
27
+ - Keep styles colocated with components when possible.
28
+
29
+ ## Testing
30
+ - Add tests for critical user flows.
31
+ - Prefer React Testing Library with user-centric assertions if available.
32
+
33
+ ## Quality
34
+ - Use strict TypeScript typing when available.
35
+ - Validate inputs and handle empty/error states explicitly.
36
+ - Maintain accessibility (semantic HTML, labels, ARIA as needed).
@@ -0,0 +1,134 @@
1
+ # Spring Boot Rules (2.7, 3.x, 4.x)
2
+
3
+ You are an AI assistant working in a Spring Boot codebase. Support
4
+ Spring Boot 2.7, 3.x, and 4.x based on the project version.
5
+
6
+ ## 0. Version detection
7
+
8
+ If the version is not explicit, check `pom.xml`, `build.gradle`, or
9
+ Gradle version catalogs. Ask the user when it is unclear.
10
+
11
+ ### Spring Boot 2.7 assumptions
12
+
13
+ - Spring Boot **2.7** built on **Spring Framework 5.3** and **Jakarta EE 8**.
14
+ - Default namespace is `javax.*` (Servlet 4+, JPA 2.2, Bean Validation 2.0).
15
+ - Runtime: Java 8/11/17 (prefer Java 11 unless the project states otherwise).
16
+
17
+ ### Spring Boot 3.x assumptions
18
+
19
+ - Spring Boot **3.x** built on **Spring Framework 6** and **Jakarta EE 10**.
20
+ - Namespace is `jakarta.*` (Servlet 6, JPA 3.1, Bean Validation 3.0).
21
+ - Runtime: Java 17+ (prefer Java 17).
22
+
23
+ ### Spring Boot 4.x assumptions
24
+
25
+ - Spring Boot **4.x** built on **Spring Framework 7** and **Jakarta EE 11**.
26
+ - Namespace is `jakarta.*` (Servlet 6.1, JPA 3.2, Bean Validation 3.1).
27
+ - Runtime: Java 21+ (prefer Java 21).
28
+
29
+ ## Version-specific guidance
30
+
31
+ - Boot 2.7: `WebSecurityConfigurerAdapter` may exist; keep it unless migrating.
32
+ - Boot 3.x/4.x: Use `SecurityFilterChain` + component-based security config.
33
+ - Boot 3.x/4.x: Prefer `jakarta.*` validation, JPA, and servlet APIs.
34
+ - Boot 2.7: Prefer `javax.*` and avoid Jakarta-only dependencies.
35
+ - Boot 4.x: Favor Java 21 features (records, sealed types, virtual threads) when appropriate.
36
+
37
+ Your goal is to:
38
+
39
+ 1. Generate **idiomatic Spring Boot code** for the detected version.
40
+ 2. Prefer **modern patterns** over legacy ones.
41
+ 3. Propose **incremental refactors** that move existing code toward the
42
+ target version’s best practices without unnecessary rewrites.
43
+
44
+
45
+ ---
46
+
47
+ ## 1. Project & Architecture Context
48
+
49
+ - Use the Spring Boot version detected in Section 0.
50
+ - Use `javax.*` only for Boot 2.7 projects; use `jakarta.*` for Boot 3.x/4.x.
51
+ - Target runtime: match the detected Boot version (11 for 2.7, 17 for 3.x, 21 for 4.x).
52
+ - The default architecture is **layered, domain-oriented**:
53
+
54
+ - API layer: REST controllers.
55
+ - Application / service layer: use cases and business logic.
56
+ - Domain layer: entities, value objects, domain services.
57
+ - Infrastructure layer: repositories, integration adapters, messaging, external services.
58
+
59
+ When generating or modifying code:
60
+
61
+ - Prefer **feature-/domain-based packages**, not purely technical (i.e. `customer`, `order`, etc., not only `controller`, `service`, `repository`).
62
+ - Stick to **Spring Boot conventions over configuration**: use starters and auto-configuration rather than custom boilerplate wherever reasonable.
63
+
64
+ ---
65
+
66
+ ## 2. Package & File Structure
67
+
68
+ When suggesting or creating new packages, follow this style:
69
+
70
+ - `com.example.app` (root)
71
+ - `config` – application configuration classes.
72
+ - `domain1` - domain feature package
73
+ - `api` – REST controllers, DTOs, request/response.
74
+ - `services` – use cases, services.
75
+ - `repositories` – repositories and entities (Spring Data).
76
+ - `exceptions` – custom exceptions.
77
+ - `mappers` – mappers (e.g. for DTOs).
78
+ - `domain2` - domain2 feature package
79
+ - ...
80
+ Rules:
81
+
82
+ - Use **lowercase package names**.
83
+ - Name classes clearly:
84
+ - `CustomerController`, `CustomerService`, `CustomerRepository`, `CustomerEntity`, `Customer`, `CustomerMapper`.
85
+ - Prefer **one public top-level class per file**.
86
+ - Use **record** classes for immutable DTOs when Java 17+ is available.
87
+
88
+
89
+ ---
90
+
91
+ ## 3. Dependencies, Build & Configuration
92
+
93
+ - Assume **Maven or Gradle** versions compatible with the detected Boot version.
94
+ - Use official **Spring Boot starters** matching the project version.
95
+ - Use `application.yml` (or `application-*.yml`) as the default for configuration examples.
96
+ - For Boot configuration:
97
+ - Prefer **type-safe configuration properties** (`@ConfigurationProperties`) over `@Value`.
98
+ - Group related config into dedicated properties classes.
99
+
100
+ When generating `pom.xml`/`build.gradle` snippets:
101
+
102
+ - Do **not** pin versions for Spring Boot and Spring dependencies manually; rely on the Boot BOM and plugin where possible.
103
+ - Use compiler settings that match the detected version:
104
+ - Boot 2.7: Java 11 (`<release>11</release>` / `VERSION_11`).
105
+ - Boot 3.x: Java 17 (`<release>17</release>` / `VERSION_17`).
106
+ - Boot 4.x: Java 21 (`<release>21</release>` / `VERSION_21`).
107
+
108
+
109
+ ---
110
+
111
+ ## 4. Web Layer & REST APIs
112
+
113
+ - Use **annotated controllers** (`@RestController`) for HTTP APIs.
114
+ - Map APIs with `@RequestMapping` / `@GetMapping` / `@PostMapping` etc.
115
+ - Always return **typed responses** (`ResponseEntity<T>` or directly `T`).
116
+ - Use **DTOs / records** for input and output instead of exposing JPA entities directly.
117
+
118
+ Rules:
119
+
120
+ - Use `javax.validation` annotations for Boot 2.7, `jakarta.validation` for Boot 3.x/4.x.
121
+
122
+ - Annotate controller methods’ arguments with:
123
+ - `@RequestBody` for JSON bodies.
124
+ - `@PathVariable` / `@RequestParam` / `@RequestHeader` as needed.
125
+ - Validate inputs using `@Valid` / `@Validated`.
126
+
127
+ Example DTO as record:
128
+
129
+ ```java
130
+ public record CreateCustomerRequest(
131
+ @NotBlank String name,
132
+ @Email String email
133
+ ) {}
134
+ ```