oh-my-customcode 0.8.0 → 0.9.0
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/README.md +10 -2
- package/dist/cli/index.js +517 -274
- package/dist/index.js +303 -101
- package/package.json +1 -1
- package/templates/.codex/agents/arch-documenter.md +97 -0
- package/templates/.codex/agents/arch-speckit-agent.md +134 -0
- package/templates/.codex/agents/be-express-expert.md +80 -0
- package/templates/.codex/agents/be-fastapi-expert.md +43 -0
- package/templates/.codex/agents/be-go-backend-expert.md +43 -0
- package/templates/.codex/agents/be-nestjs-expert.md +60 -0
- package/templates/.codex/agents/be-springboot-expert.md +85 -0
- package/templates/.codex/agents/db-postgres-expert.md +106 -0
- package/templates/.codex/agents/db-redis-expert.md +101 -0
- package/templates/.codex/agents/db-supabase-expert.md +71 -0
- package/templates/.codex/agents/de-airflow-expert.md +71 -0
- package/templates/.codex/agents/de-dbt-expert.md +72 -0
- package/templates/.codex/agents/de-kafka-expert.md +81 -0
- package/templates/.codex/agents/de-pipeline-expert.md +92 -0
- package/templates/.codex/agents/de-snowflake-expert.md +89 -0
- package/templates/.codex/agents/de-spark-expert.md +80 -0
- package/templates/.codex/agents/fe-svelte-agent.md +65 -0
- package/templates/.codex/agents/fe-vercel-agent.md +69 -0
- package/templates/.codex/agents/fe-vuejs-agent.md +65 -0
- package/templates/.codex/agents/infra-aws-expert.md +47 -0
- package/templates/.codex/agents/infra-docker-expert.md +47 -0
- package/templates/.codex/agents/lang-golang-expert.md +43 -0
- package/templates/.codex/agents/lang-java21-expert.md +65 -0
- package/templates/.codex/agents/lang-kotlin-expert.md +43 -0
- package/templates/.codex/agents/lang-python-expert.md +43 -0
- package/templates/.codex/agents/lang-rust-expert.md +43 -0
- package/templates/.codex/agents/lang-typescript-expert.md +43 -0
- package/templates/.codex/agents/mgr-claude-code-bible.md +246 -0
- package/templates/.codex/agents/mgr-creator.md +120 -0
- package/templates/.codex/agents/mgr-gitnerd.md +113 -0
- package/templates/.codex/agents/mgr-sauron.md +154 -0
- package/templates/.codex/agents/mgr-supplier.md +120 -0
- package/templates/.codex/agents/mgr-sync-checker.md +99 -0
- package/templates/.codex/agents/mgr-updater.md +103 -0
- package/templates/.codex/agents/qa-engineer.md +96 -0
- package/templates/.codex/agents/qa-planner.md +74 -0
- package/templates/.codex/agents/qa-writer.md +97 -0
- package/templates/.codex/agents/sys-memory-keeper.md +117 -0
- package/templates/.codex/agents/sys-naggy.md +90 -0
- package/templates/.codex/agents/tool-bun-expert.md +71 -0
- package/templates/.codex/agents/tool-npm-expert.md +88 -0
- package/templates/.codex/agents/tool-optimizer.md +87 -0
- package/templates/.codex/codex-native-hash.txt +1 -0
- package/templates/.codex/contexts/dev.md +20 -0
- package/templates/.codex/contexts/ecomode.md +63 -0
- package/templates/.codex/contexts/index.yaml +41 -0
- package/templates/.codex/contexts/research.md +28 -0
- package/templates/.codex/contexts/review.md +23 -0
- package/templates/.codex/hooks/hooks.json +151 -0
- package/templates/.codex/install-hooks.sh +100 -0
- package/templates/.codex/rules/MAY-optimization.md +93 -0
- package/templates/.codex/rules/MUST-agent-design.md +162 -0
- package/templates/.codex/rules/MUST-agent-identification.md +108 -0
- package/templates/.codex/rules/MUST-continuous-improvement.md +132 -0
- package/templates/.codex/rules/MUST-intent-transparency.md +199 -0
- package/templates/.codex/rules/MUST-language-policy.md +62 -0
- package/templates/.codex/rules/MUST-orchestrator-coordination.md +471 -0
- package/templates/.codex/rules/MUST-parallel-execution.md +469 -0
- package/templates/.codex/rules/MUST-permissions.md +84 -0
- package/templates/.codex/rules/MUST-safety.md +69 -0
- package/templates/.codex/rules/MUST-sync-verification.md +281 -0
- package/templates/.codex/rules/MUST-tool-identification.md +195 -0
- package/templates/.codex/rules/SHOULD-agent-teams.md +183 -0
- package/templates/.codex/rules/SHOULD-ecomode.md +145 -0
- package/templates/.codex/rules/SHOULD-error-handling.md +102 -0
- package/templates/.codex/rules/SHOULD-hud-statusline.md +112 -0
- package/templates/.codex/rules/SHOULD-interaction.md +103 -0
- package/templates/.codex/rules/SHOULD-memory-integration.md +132 -0
- package/templates/.codex/rules/index.yaml +141 -0
- package/templates/.codex/skills/airflow-best-practices/SKILL.md +56 -0
- package/templates/.codex/skills/audit-agents/SKILL.md +116 -0
- package/templates/.codex/skills/aws-best-practices/SKILL.md +280 -0
- package/templates/.codex/skills/claude-code-bible/SKILL.md +180 -0
- package/templates/.codex/skills/claude-code-bible/scripts/fetch-docs.js +244 -0
- package/templates/.codex/skills/create-agent/SKILL.md +91 -0
- package/templates/.codex/skills/dbt-best-practices/SKILL.md +54 -0
- package/templates/.codex/skills/de-lead-routing/SKILL.md +230 -0
- package/templates/.codex/skills/dev-lead-routing/SKILL.md +253 -0
- package/templates/.codex/skills/dev-refactor/SKILL.md +123 -0
- package/templates/.codex/skills/dev-review/SKILL.md +81 -0
- package/templates/.codex/skills/docker-best-practices/SKILL.md +275 -0
- package/templates/.codex/skills/fastapi-best-practices/SKILL.md +270 -0
- package/templates/.codex/skills/fix-refs/SKILL.md +107 -0
- package/templates/.codex/skills/go-backend-best-practices/SKILL.md +338 -0
- package/templates/.codex/skills/go-best-practices/CLAUDE.md +9 -0
- package/templates/.codex/skills/go-best-practices/SKILL.md +203 -0
- package/templates/.codex/skills/help/SKILL.md +125 -0
- package/templates/.codex/skills/intent-detection/SKILL.md +215 -0
- package/templates/.codex/skills/intent-detection/patterns/agent-triggers.yaml +349 -0
- package/templates/.codex/skills/kafka-best-practices/SKILL.md +52 -0
- package/templates/.codex/skills/kotlin-best-practices/SKILL.md +256 -0
- package/templates/.codex/skills/lists/SKILL.md +78 -0
- package/templates/.codex/skills/memory-management/SKILL.md +195 -0
- package/templates/.codex/skills/memory-recall/SKILL.md +152 -0
- package/templates/.codex/skills/memory-save/SKILL.md +126 -0
- package/templates/.codex/skills/monitoring-setup/SKILL.md +115 -0
- package/templates/.codex/skills/npm-audit/SKILL.md +72 -0
- package/templates/.codex/skills/npm-publish/SKILL.md +63 -0
- package/templates/.codex/skills/npm-version/SKILL.md +75 -0
- package/templates/.codex/skills/optimize-analyze/SKILL.md +55 -0
- package/templates/.codex/skills/optimize-bundle/SKILL.md +67 -0
- package/templates/.codex/skills/optimize-report/SKILL.md +74 -0
- package/templates/.codex/skills/pipeline-architecture-patterns/SKILL.md +83 -0
- package/templates/.codex/skills/postgres-best-practices/SKILL.md +66 -0
- package/templates/.codex/skills/python-best-practices/SKILL.md +222 -0
- package/templates/.codex/skills/qa-lead-routing/SKILL.md +277 -0
- package/templates/.codex/skills/react-best-practices/SKILL.md +101 -0
- package/templates/.codex/skills/redis-best-practices/SKILL.md +83 -0
- package/templates/.codex/skills/result-aggregation/SKILL.md +164 -0
- package/templates/.codex/skills/rust-best-practices/SKILL.md +267 -0
- package/templates/.codex/skills/sauron-watch/SKILL.md +144 -0
- package/templates/.codex/skills/secretary-routing/SKILL.md +190 -0
- package/templates/.codex/skills/snowflake-best-practices/SKILL.md +65 -0
- package/templates/.codex/skills/spark-best-practices/SKILL.md +52 -0
- package/templates/.codex/skills/springboot-best-practices/SKILL.md +357 -0
- package/templates/.codex/skills/status/SKILL.md +153 -0
- package/templates/.codex/skills/supabase-postgres-best-practices/SKILL.md +99 -0
- package/templates/.codex/skills/typescript-best-practices/SKILL.md +321 -0
- package/templates/.codex/skills/update-docs/SKILL.md +140 -0
- package/templates/.codex/skills/update-external/SKILL.md +149 -0
- package/templates/.codex/skills/vercel-deploy/SKILL.md +73 -0
- package/templates/.codex/skills/web-design-guidelines/SKILL.md +118 -0
- package/templates/.codex/skills/writing-clearly-and-concisely/SKILL.md +64 -0
- package/templates/.codex/uninstall-hooks.sh +52 -0
- package/templates/AGENTS.md.en +39 -0
- package/templates/AGENTS.md.ko +39 -0
- package/templates/manifest.codex.json +43 -0
- package/templates/manifest.json +5 -5
|
@@ -0,0 +1,357 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: springboot-best-practices
|
|
3
|
+
description: Spring Boot patterns for enterprise Java applications
|
|
4
|
+
user-invocable: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Purpose
|
|
8
|
+
|
|
9
|
+
Apply Spring Boot patterns for building enterprise-grade applications.
|
|
10
|
+
|
|
11
|
+
## Rules
|
|
12
|
+
|
|
13
|
+
### 1. Project Structure
|
|
14
|
+
|
|
15
|
+
```yaml
|
|
16
|
+
structure:
|
|
17
|
+
layout: layered architecture
|
|
18
|
+
packages:
|
|
19
|
+
- controller: REST endpoints
|
|
20
|
+
- service: Business logic
|
|
21
|
+
- repository: Data access
|
|
22
|
+
- model/entity: Domain objects
|
|
23
|
+
- dto: Data transfer objects
|
|
24
|
+
- config: Configuration classes
|
|
25
|
+
- exception: Custom exceptions
|
|
26
|
+
|
|
27
|
+
example: |
|
|
28
|
+
com.example.app/
|
|
29
|
+
├── controller/
|
|
30
|
+
│ └── UserController.java
|
|
31
|
+
├── service/
|
|
32
|
+
│ ├── UserService.java
|
|
33
|
+
│ └── impl/UserServiceImpl.java
|
|
34
|
+
├── repository/
|
|
35
|
+
│ └── UserRepository.java
|
|
36
|
+
├── model/
|
|
37
|
+
│ └── User.java
|
|
38
|
+
├── dto/
|
|
39
|
+
│ ├── UserRequest.java
|
|
40
|
+
│ └── UserResponse.java
|
|
41
|
+
├── config/
|
|
42
|
+
│ └── SecurityConfig.java
|
|
43
|
+
└── exception/
|
|
44
|
+
└── UserNotFoundException.java
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### 2. Dependency Injection
|
|
48
|
+
|
|
49
|
+
```yaml
|
|
50
|
+
prefer:
|
|
51
|
+
- Constructor injection over field injection
|
|
52
|
+
- Interface-based dependencies
|
|
53
|
+
- @RequiredArgsConstructor with final fields
|
|
54
|
+
|
|
55
|
+
patterns: |
|
|
56
|
+
// GOOD: Constructor injection
|
|
57
|
+
@Service
|
|
58
|
+
@RequiredArgsConstructor
|
|
59
|
+
public class UserService {
|
|
60
|
+
private final UserRepository userRepository;
|
|
61
|
+
private final EmailService emailService;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// AVOID: Field injection
|
|
65
|
+
@Service
|
|
66
|
+
public class UserService {
|
|
67
|
+
@Autowired
|
|
68
|
+
private UserRepository userRepository; // Not recommended
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### 3. REST API Design
|
|
73
|
+
|
|
74
|
+
```yaml
|
|
75
|
+
controller:
|
|
76
|
+
annotations:
|
|
77
|
+
- "@RestController"
|
|
78
|
+
- "@RequestMapping with base path"
|
|
79
|
+
- "@Validated for input validation"
|
|
80
|
+
|
|
81
|
+
patterns: |
|
|
82
|
+
@RestController
|
|
83
|
+
@RequestMapping("/api/v1/users")
|
|
84
|
+
@RequiredArgsConstructor
|
|
85
|
+
public class UserController {
|
|
86
|
+
|
|
87
|
+
private final UserService userService;
|
|
88
|
+
|
|
89
|
+
@GetMapping("/{id}")
|
|
90
|
+
public ResponseEntity<UserResponse> getUser(@PathVariable Long id) {
|
|
91
|
+
return ResponseEntity.ok(userService.findById(id));
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
@PostMapping
|
|
95
|
+
@ResponseStatus(HttpStatus.CREATED)
|
|
96
|
+
public UserResponse createUser(@Valid @RequestBody UserRequest request) {
|
|
97
|
+
return userService.create(request);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
@PutMapping("/{id}")
|
|
101
|
+
public UserResponse updateUser(
|
|
102
|
+
@PathVariable Long id,
|
|
103
|
+
@Valid @RequestBody UserRequest request
|
|
104
|
+
) {
|
|
105
|
+
return userService.update(id, request);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
@DeleteMapping("/{id}")
|
|
109
|
+
@ResponseStatus(HttpStatus.NO_CONTENT)
|
|
110
|
+
public void deleteUser(@PathVariable Long id) {
|
|
111
|
+
userService.delete(id);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### 4. Service Layer
|
|
117
|
+
|
|
118
|
+
```yaml
|
|
119
|
+
principles:
|
|
120
|
+
- Business logic in service layer
|
|
121
|
+
- Transaction boundaries at service level
|
|
122
|
+
- Interface + implementation pattern
|
|
123
|
+
|
|
124
|
+
patterns: |
|
|
125
|
+
public interface UserService {
|
|
126
|
+
UserResponse findById(Long id);
|
|
127
|
+
UserResponse create(UserRequest request);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
@Service
|
|
131
|
+
@Transactional(readOnly = true)
|
|
132
|
+
@RequiredArgsConstructor
|
|
133
|
+
public class UserServiceImpl implements UserService {
|
|
134
|
+
|
|
135
|
+
private final UserRepository userRepository;
|
|
136
|
+
private final UserMapper userMapper;
|
|
137
|
+
|
|
138
|
+
@Override
|
|
139
|
+
public UserResponse findById(Long id) {
|
|
140
|
+
User user = userRepository.findById(id)
|
|
141
|
+
.orElseThrow(() -> new UserNotFoundException(id));
|
|
142
|
+
return userMapper.toResponse(user);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
@Override
|
|
146
|
+
@Transactional
|
|
147
|
+
public UserResponse create(UserRequest request) {
|
|
148
|
+
User user = userMapper.toEntity(request);
|
|
149
|
+
return userMapper.toResponse(userRepository.save(user));
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### 5. Data Access
|
|
155
|
+
|
|
156
|
+
```yaml
|
|
157
|
+
repository:
|
|
158
|
+
use: Spring Data JPA
|
|
159
|
+
custom_queries: "@Query annotation or method naming"
|
|
160
|
+
|
|
161
|
+
patterns: |
|
|
162
|
+
public interface UserRepository extends JpaRepository<User, Long> {
|
|
163
|
+
|
|
164
|
+
Optional<User> findByEmail(String email);
|
|
165
|
+
|
|
166
|
+
@Query("SELECT u FROM User u WHERE u.status = :status")
|
|
167
|
+
List<User> findByStatus(@Param("status") UserStatus status);
|
|
168
|
+
|
|
169
|
+
@Query(value = "SELECT * FROM users WHERE created_at > :date",
|
|
170
|
+
nativeQuery = true)
|
|
171
|
+
List<User> findRecentUsers(@Param("date") LocalDateTime date);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
entity: |
|
|
175
|
+
@Entity
|
|
176
|
+
@Table(name = "users")
|
|
177
|
+
@Getter
|
|
178
|
+
@NoArgsConstructor(access = AccessLevel.PROTECTED)
|
|
179
|
+
public class User {
|
|
180
|
+
|
|
181
|
+
@Id
|
|
182
|
+
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
183
|
+
private Long id;
|
|
184
|
+
|
|
185
|
+
@Column(nullable = false, unique = true)
|
|
186
|
+
private String email;
|
|
187
|
+
|
|
188
|
+
@Enumerated(EnumType.STRING)
|
|
189
|
+
private UserStatus status;
|
|
190
|
+
|
|
191
|
+
@CreatedDate
|
|
192
|
+
private LocalDateTime createdAt;
|
|
193
|
+
}
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### 6. Exception Handling
|
|
197
|
+
|
|
198
|
+
```yaml
|
|
199
|
+
global_handler:
|
|
200
|
+
use: "@ControllerAdvice"
|
|
201
|
+
custom_exceptions: domain-specific
|
|
202
|
+
|
|
203
|
+
patterns: |
|
|
204
|
+
@RestControllerAdvice
|
|
205
|
+
public class GlobalExceptionHandler {
|
|
206
|
+
|
|
207
|
+
@ExceptionHandler(UserNotFoundException.class)
|
|
208
|
+
@ResponseStatus(HttpStatus.NOT_FOUND)
|
|
209
|
+
public ErrorResponse handleUserNotFound(UserNotFoundException ex) {
|
|
210
|
+
return new ErrorResponse("USER_NOT_FOUND", ex.getMessage());
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
@ExceptionHandler(MethodArgumentNotValidException.class)
|
|
214
|
+
@ResponseStatus(HttpStatus.BAD_REQUEST)
|
|
215
|
+
public ErrorResponse handleValidation(MethodArgumentNotValidException ex) {
|
|
216
|
+
List<String> errors = ex.getBindingResult()
|
|
217
|
+
.getFieldErrors()
|
|
218
|
+
.stream()
|
|
219
|
+
.map(e -> e.getField() + ": " + e.getDefaultMessage())
|
|
220
|
+
.toList();
|
|
221
|
+
return new ErrorResponse("VALIDATION_ERROR", errors);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
### 7. Configuration
|
|
227
|
+
|
|
228
|
+
```yaml
|
|
229
|
+
profiles:
|
|
230
|
+
use: application-{profile}.yml
|
|
231
|
+
externalize: sensitive values
|
|
232
|
+
|
|
233
|
+
patterns: |
|
|
234
|
+
# application.yml
|
|
235
|
+
spring:
|
|
236
|
+
profiles:
|
|
237
|
+
active: ${SPRING_PROFILES_ACTIVE:local}
|
|
238
|
+
datasource:
|
|
239
|
+
url: ${DATABASE_URL}
|
|
240
|
+
username: ${DATABASE_USERNAME}
|
|
241
|
+
password: ${DATABASE_PASSWORD}
|
|
242
|
+
|
|
243
|
+
# application-local.yml
|
|
244
|
+
spring:
|
|
245
|
+
datasource:
|
|
246
|
+
url: jdbc:h2:mem:testdb
|
|
247
|
+
driver-class-name: org.h2.Driver
|
|
248
|
+
|
|
249
|
+
configuration_class: |
|
|
250
|
+
@Configuration
|
|
251
|
+
@ConfigurationProperties(prefix = "app")
|
|
252
|
+
@Validated
|
|
253
|
+
public class AppProperties {
|
|
254
|
+
|
|
255
|
+
@NotBlank
|
|
256
|
+
private String name;
|
|
257
|
+
|
|
258
|
+
@Min(1)
|
|
259
|
+
private int maxConnections;
|
|
260
|
+
|
|
261
|
+
// getters, setters
|
|
262
|
+
}
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
### 8. Security
|
|
266
|
+
|
|
267
|
+
```yaml
|
|
268
|
+
principles:
|
|
269
|
+
- Use Spring Security
|
|
270
|
+
- Externalize secrets
|
|
271
|
+
- Implement proper authentication
|
|
272
|
+
|
|
273
|
+
patterns: |
|
|
274
|
+
@Configuration
|
|
275
|
+
@EnableWebSecurity
|
|
276
|
+
@RequiredArgsConstructor
|
|
277
|
+
public class SecurityConfig {
|
|
278
|
+
|
|
279
|
+
private final JwtTokenProvider tokenProvider;
|
|
280
|
+
|
|
281
|
+
@Bean
|
|
282
|
+
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
|
|
283
|
+
return http
|
|
284
|
+
.csrf(csrf -> csrf.disable())
|
|
285
|
+
.sessionManagement(session ->
|
|
286
|
+
session.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
|
|
287
|
+
.authorizeHttpRequests(auth -> auth
|
|
288
|
+
.requestMatchers("/api/v1/auth/**").permitAll()
|
|
289
|
+
.requestMatchers("/api/v1/admin/**").hasRole("ADMIN")
|
|
290
|
+
.anyRequest().authenticated())
|
|
291
|
+
.addFilterBefore(jwtFilter(), UsernamePasswordAuthenticationFilter.class)
|
|
292
|
+
.build();
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
### 9. Testing
|
|
298
|
+
|
|
299
|
+
```yaml
|
|
300
|
+
layers:
|
|
301
|
+
unit: "@MockBean, Mockito"
|
|
302
|
+
integration: "@SpringBootTest"
|
|
303
|
+
slice: "@WebMvcTest, @DataJpaTest"
|
|
304
|
+
|
|
305
|
+
patterns: |
|
|
306
|
+
// Controller test
|
|
307
|
+
@WebMvcTest(UserController.class)
|
|
308
|
+
class UserControllerTest {
|
|
309
|
+
|
|
310
|
+
@Autowired
|
|
311
|
+
private MockMvc mockMvc;
|
|
312
|
+
|
|
313
|
+
@MockBean
|
|
314
|
+
private UserService userService;
|
|
315
|
+
|
|
316
|
+
@Test
|
|
317
|
+
void getUser_shouldReturnUser() throws Exception {
|
|
318
|
+
given(userService.findById(1L))
|
|
319
|
+
.willReturn(new UserResponse(1L, "test@example.com"));
|
|
320
|
+
|
|
321
|
+
mockMvc.perform(get("/api/v1/users/1"))
|
|
322
|
+
.andExpect(status().isOk())
|
|
323
|
+
.andExpect(jsonPath("$.email").value("test@example.com"));
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
// Repository test
|
|
328
|
+
@DataJpaTest
|
|
329
|
+
class UserRepositoryTest {
|
|
330
|
+
|
|
331
|
+
@Autowired
|
|
332
|
+
private UserRepository userRepository;
|
|
333
|
+
|
|
334
|
+
@Test
|
|
335
|
+
void findByEmail_shouldReturnUser() {
|
|
336
|
+
User user = userRepository.save(new User("test@example.com"));
|
|
337
|
+
|
|
338
|
+
Optional<User> found = userRepository.findByEmail("test@example.com");
|
|
339
|
+
|
|
340
|
+
assertThat(found).isPresent();
|
|
341
|
+
assertThat(found.get().getEmail()).isEqualTo("test@example.com");
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
## Application
|
|
347
|
+
|
|
348
|
+
When writing Spring Boot code:
|
|
349
|
+
|
|
350
|
+
1. **Always** use constructor injection
|
|
351
|
+
2. **Always** use layered architecture
|
|
352
|
+
3. **Prefer** interface-based services
|
|
353
|
+
4. **Use** DTOs for API contracts
|
|
354
|
+
5. **Handle** exceptions globally
|
|
355
|
+
6. **Externalize** configuration
|
|
356
|
+
7. **Secure** endpoints properly
|
|
357
|
+
8. **Test** each layer appropriately
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: status
|
|
3
|
+
description: Show system status and health checks
|
|
4
|
+
argument-hint: "[--verbose] [--health]"
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# System Status Skill
|
|
8
|
+
|
|
9
|
+
Show comprehensive system status including agents, skills, guides, and health checks.
|
|
10
|
+
|
|
11
|
+
## Options
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
--verbose, -v Detailed status
|
|
15
|
+
--health, -h Health checks only
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Output Format
|
|
19
|
+
|
|
20
|
+
### Default Status
|
|
21
|
+
```
|
|
22
|
+
AI Agent System - Status
|
|
23
|
+
|
|
24
|
+
System:
|
|
25
|
+
Rules: 10 loaded (R000-R009)
|
|
26
|
+
|
|
27
|
+
Agents:
|
|
28
|
+
Orchestrator: 1 (secretary)
|
|
29
|
+
Manager: 3 (mgr-creator, mgr-updater, mgr-supplier)
|
|
30
|
+
SW Engineer: 6
|
|
31
|
+
Backend Engineer: 3
|
|
32
|
+
Infra Engineer: 2
|
|
33
|
+
Total: 15 agents
|
|
34
|
+
|
|
35
|
+
Skills:
|
|
36
|
+
Development: 8
|
|
37
|
+
Backend: 3
|
|
38
|
+
Infrastructure: 2
|
|
39
|
+
Total: 13 skills
|
|
40
|
+
|
|
41
|
+
Guides: 12 loaded
|
|
42
|
+
Commands: 10 available
|
|
43
|
+
|
|
44
|
+
Health: ✓ OK
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Verbose Status
|
|
48
|
+
```
|
|
49
|
+
status --verbose
|
|
50
|
+
|
|
51
|
+
AI Agent System - Detailed Status
|
|
52
|
+
|
|
53
|
+
Rules:
|
|
54
|
+
MUST:
|
|
55
|
+
✓ R000 language-policy
|
|
56
|
+
✓ R001 safety
|
|
57
|
+
✓ R002 permissions
|
|
58
|
+
✓ R006 agent-design
|
|
59
|
+
|
|
60
|
+
SHOULD:
|
|
61
|
+
✓ R003 interaction
|
|
62
|
+
✓ R004 error-handling
|
|
63
|
+
✓ R007 agent-identification
|
|
64
|
+
✓ R008 tool-identification
|
|
65
|
+
|
|
66
|
+
MAY:
|
|
67
|
+
✓ R005 optimization
|
|
68
|
+
✓ R009 parallel-execution
|
|
69
|
+
|
|
70
|
+
Agents:
|
|
71
|
+
orchestrator/
|
|
72
|
+
✓ secretary (internal)
|
|
73
|
+
|
|
74
|
+
manager/
|
|
75
|
+
✓ mgr-creator (internal)
|
|
76
|
+
✓ mgr-updater (internal)
|
|
77
|
+
✓ mgr-supplier (internal)
|
|
78
|
+
|
|
79
|
+
sw-engineer/
|
|
80
|
+
✓ lang-golang-expert (internal)
|
|
81
|
+
✓ lang-python-expert (internal)
|
|
82
|
+
✓ lang-rust-expert (internal)
|
|
83
|
+
✓ lang-kotlin-expert (internal)
|
|
84
|
+
✓ lang-typescript-expert (internal)
|
|
85
|
+
✓ fe-vercel-agent (external v1.0.0)
|
|
86
|
+
|
|
87
|
+
sw-engineer/backend/
|
|
88
|
+
✓ be-fastapi-expert (internal)
|
|
89
|
+
✓ be-springboot-expert (internal)
|
|
90
|
+
✓ be-go-backend-expert (internal)
|
|
91
|
+
|
|
92
|
+
infra-engineer/
|
|
93
|
+
✓ infra-docker-expert (internal)
|
|
94
|
+
✓ infra-aws-expert (internal)
|
|
95
|
+
|
|
96
|
+
Skills:
|
|
97
|
+
development/
|
|
98
|
+
✓ go-best-practices
|
|
99
|
+
✓ python-best-practices
|
|
100
|
+
✓ rust-best-practices
|
|
101
|
+
✓ kotlin-best-practices
|
|
102
|
+
✓ typescript-best-practices
|
|
103
|
+
✓ react-best-practices
|
|
104
|
+
✓ web-design-guidelines
|
|
105
|
+
✓ vercel-deploy
|
|
106
|
+
|
|
107
|
+
backend/
|
|
108
|
+
✓ fastapi-best-practices
|
|
109
|
+
✓ springboot-best-practices
|
|
110
|
+
✓ go-backend-best-practices
|
|
111
|
+
|
|
112
|
+
infrastructure/
|
|
113
|
+
✓ docker-best-practices
|
|
114
|
+
✓ aws-best-practices
|
|
115
|
+
|
|
116
|
+
Guides:
|
|
117
|
+
✓ claude-code, web-design
|
|
118
|
+
✓ golang, python, rust, kotlin, typescript
|
|
119
|
+
✓ fastapi, springboot, go-backend
|
|
120
|
+
✓ docker, aws
|
|
121
|
+
|
|
122
|
+
Commands:
|
|
123
|
+
system: lists, status, help
|
|
124
|
+
manager: create-agent, update-docs, update-external, audit-agents, fix-refs
|
|
125
|
+
dev: dev-review, dev-refactor
|
|
126
|
+
|
|
127
|
+
All systems operational.
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### Health Check
|
|
131
|
+
```
|
|
132
|
+
status --health
|
|
133
|
+
|
|
134
|
+
Health Checks:
|
|
135
|
+
|
|
136
|
+
Agents:
|
|
137
|
+
✓ 15/15 agents valid
|
|
138
|
+
✓ All agent files exist in .codex/agents/
|
|
139
|
+
|
|
140
|
+
Dependencies:
|
|
141
|
+
✓ All skill references valid
|
|
142
|
+
✓ All guide references valid
|
|
143
|
+
|
|
144
|
+
External Sources:
|
|
145
|
+
✓ fe-vercel-agent (github: reachable)
|
|
146
|
+
|
|
147
|
+
Documentation:
|
|
148
|
+
✓ AGENTS.md in sync
|
|
149
|
+
✓ All .codex/agents/*.md files valid
|
|
150
|
+
✓ All .codex/skills/*/SKILL.md files valid
|
|
151
|
+
|
|
152
|
+
Result: HEALTHY
|
|
153
|
+
```
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: supabase-postgres-best-practices
|
|
3
|
+
description: PostgreSQL performance optimization guidelines from Supabase. Apply when writing SQL, designing schemas, configuring RLS, or optimizing database performance.
|
|
4
|
+
user-invocable: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Supabase PostgreSQL Best Practices
|
|
8
|
+
|
|
9
|
+
> Source: https://github.com/supabase/agent-skills
|
|
10
|
+
|
|
11
|
+
### Rule Categories (Prioritized by Impact)
|
|
12
|
+
|
|
13
|
+
| Priority | Category | Impact | Prefix |
|
|
14
|
+
|----------|----------|--------|--------|
|
|
15
|
+
| 1 | Query Performance | CRITICAL | query- |
|
|
16
|
+
| 2 | Connection Management | CRITICAL | conn- |
|
|
17
|
+
| 3 | Security & RLS | CRITICAL | security- |
|
|
18
|
+
| 4 | Schema Design | HIGH | schema- |
|
|
19
|
+
| 5 | Concurrency & Locking | MEDIUM-HIGH | lock- |
|
|
20
|
+
| 6 | Data Access Patterns | MEDIUM | data- |
|
|
21
|
+
| 7 | Monitoring & Diagnostics | LOW-MEDIUM | monitor- |
|
|
22
|
+
| 8 | Advanced Features | LOW | advanced- |
|
|
23
|
+
|
|
24
|
+
### 1. Query Performance (CRITICAL)
|
|
25
|
+
|
|
26
|
+
- Always add indexes for columns used in WHERE, JOIN, and ORDER BY clauses
|
|
27
|
+
- Use partial indexes for filtered queries: `CREATE INDEX idx_active ON users(email) WHERE active = true`
|
|
28
|
+
- Prefer `EXISTS` over `IN` for subqueries
|
|
29
|
+
- Avoid `SELECT *` - specify only needed columns
|
|
30
|
+
- Use `EXPLAIN ANALYZE` to verify query plans
|
|
31
|
+
- Add composite indexes for multi-column queries (column order matters)
|
|
32
|
+
- Use covering indexes to avoid heap lookups
|
|
33
|
+
|
|
34
|
+
### 2. Connection Management (CRITICAL)
|
|
35
|
+
|
|
36
|
+
- Use Supabase connection pooler (PgBouncer) for serverless/edge functions
|
|
37
|
+
- Use transaction mode for short-lived queries
|
|
38
|
+
- Use session mode only when needed (prepared statements, advisory locks)
|
|
39
|
+
- Set appropriate pool size limits
|
|
40
|
+
- Release connections promptly - avoid holding connections during external calls
|
|
41
|
+
- Use connection timeouts to prevent leaks
|
|
42
|
+
|
|
43
|
+
### 3. Security & RLS (CRITICAL)
|
|
44
|
+
|
|
45
|
+
- Enable RLS on ALL tables exposed via Supabase API
|
|
46
|
+
- Write policies using `auth.uid()` and `auth.jwt()`
|
|
47
|
+
- Avoid functions marked `SECURITY DEFINER` unless necessary
|
|
48
|
+
- Use `SECURITY INVOKER` as default for functions
|
|
49
|
+
- Never trust client-side data - validate in policies
|
|
50
|
+
- Test RLS policies with different roles
|
|
51
|
+
- Use `USING` for read policies, `WITH CHECK` for write policies
|
|
52
|
+
|
|
53
|
+
### 4. Schema Design (HIGH)
|
|
54
|
+
|
|
55
|
+
- Use appropriate data types (e.g., `uuid` for IDs, `timestamptz` for times)
|
|
56
|
+
- Add `NOT NULL` constraints where applicable
|
|
57
|
+
- Use `CHECK` constraints for data validation
|
|
58
|
+
- Prefer `text` over `varchar(n)` unless length limit is meaningful
|
|
59
|
+
- Use partial indexes instead of filtered queries
|
|
60
|
+
- Design schemas for the access patterns, not just the data model
|
|
61
|
+
|
|
62
|
+
### 5. Concurrency & Locking (MEDIUM-HIGH)
|
|
63
|
+
|
|
64
|
+
- Use `SELECT ... FOR UPDATE SKIP LOCKED` for queue patterns
|
|
65
|
+
- Keep transactions short to minimize lock contention
|
|
66
|
+
- Avoid long-running transactions during migrations
|
|
67
|
+
- Use advisory locks for application-level coordination
|
|
68
|
+
- Be aware of lock ordering to prevent deadlocks
|
|
69
|
+
|
|
70
|
+
### 6. Data Access Patterns (MEDIUM)
|
|
71
|
+
|
|
72
|
+
- Use Supabase client libraries for standard CRUD
|
|
73
|
+
- Use RPC functions for complex operations
|
|
74
|
+
- Implement pagination with cursor-based approach (not OFFSET)
|
|
75
|
+
- Use realtime subscriptions judiciously
|
|
76
|
+
- Batch operations where possible
|
|
77
|
+
|
|
78
|
+
### 7. Monitoring & Diagnostics (LOW-MEDIUM)
|
|
79
|
+
|
|
80
|
+
- Monitor `pg_stat_statements` for slow queries
|
|
81
|
+
- Check `pg_stat_user_indexes` for unused indexes
|
|
82
|
+
- Monitor connection count and pool utilization
|
|
83
|
+
- Set up alerts for long-running queries
|
|
84
|
+
- Review lock waits periodically
|
|
85
|
+
|
|
86
|
+
### 8. Advanced Features (LOW)
|
|
87
|
+
|
|
88
|
+
- Use CTEs for readable complex queries (but note CTE materialization)
|
|
89
|
+
- Leverage PostgreSQL extensions (pgvector, pg_trgm, etc.)
|
|
90
|
+
- Use generated columns for computed values
|
|
91
|
+
- Consider table partitioning for very large tables
|
|
92
|
+
- Use LISTEN/NOTIFY for event-driven patterns
|
|
93
|
+
|
|
94
|
+
### References
|
|
95
|
+
- Supabase Documentation: https://supabase.com/docs
|
|
96
|
+
- PostgreSQL Official Docs: https://www.postgresql.org/docs/
|
|
97
|
+
- Supabase Agent Skills: https://github.com/supabase/agent-skills
|
|
98
|
+
|
|
99
|
+
For detailed rule files with specific examples, see guides/supabase-postgres/.
|