@el-j/magic-helix-core 4.0.0-beta.2 → 4.0.0-beta.4
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/dist/index-B88j4AyE.js +13 -0
- package/dist/index-B88j4AyE.js.map +1 -0
- package/dist/index-CY-pQbuu.cjs +2 -0
- package/dist/index-CY-pQbuu.cjs.map +1 -0
- package/dist/index.cjs +75 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.mjs +2214 -51
- package/dist/index.mjs.map +1 -1
- package/dist/pattern-combiner.d.ts +1 -1
- package/dist/plugin-loader.d.ts +2 -1
- package/package.json +4 -4
- package/dist/BasePlugin-6wv0hYJ9.js +0 -98
- package/dist/BasePlugin-6wv0hYJ9.js.map +0 -1
- package/dist/BasePlugin-odQJAKA-.cjs +0 -2
- package/dist/BasePlugin-odQJAKA-.cjs.map +0 -1
- package/dist/builtin-plugins/base/BasePlugin.d.ts +0 -69
- package/dist/builtin-plugins/cpp/index.d.ts +0 -46
- package/dist/builtin-plugins/csharp/index.d.ts +0 -20
- package/dist/builtin-plugins/go/index.d.ts +0 -23
- package/dist/builtin-plugins/index.d.ts +0 -16
- package/dist/builtin-plugins/java/index.d.ts +0 -22
- package/dist/builtin-plugins/nodejs/index.d.ts +0 -44
- package/dist/builtin-plugins/php/index.d.ts +0 -20
- package/dist/builtin-plugins/python/index.d.ts +0 -27
- package/dist/builtin-plugins/ruby/index.d.ts +0 -20
- package/dist/builtin-plugins/rust/index.d.ts +0 -53
- package/dist/builtin-plugins/swift/index.d.ts +0 -22
- package/dist/default_templates/angular/angular-core.md +0 -19
- package/dist/default_templates/architecture/codeowners.md +0 -123
- package/dist/default_templates/architecture/monorepo.md +0 -146
- package/dist/default_templates/architecture/nx.md +0 -122
- package/dist/default_templates/architecture/turborepo.md +0 -114
- package/dist/default_templates/ci/github-actions.md +0 -268
- package/dist/default_templates/ci/gitlab-ci.md +0 -330
- package/dist/default_templates/containers/docker-multistage.md +0 -120
- package/dist/default_templates/containers/kubernetes-deploy.md +0 -210
- package/dist/default_templates/devops/docker-compose.md +0 -111
- package/dist/default_templates/devops/docker-dockerfile.md +0 -94
- package/dist/default_templates/devops/github-actions.md +0 -160
- package/dist/default_templates/devops/gitlab-ci.md +0 -210
- package/dist/default_templates/dotnet/framework-aspnetcore.md +0 -205
- package/dist/default_templates/dotnet/framework-blazor.md +0 -271
- package/dist/default_templates/dotnet/lang-csharp.md +0 -162
- package/dist/default_templates/generic/lang-typescript.md +0 -57
- package/dist/default_templates/generic/state-redux.md +0 -21
- package/dist/default_templates/generic/state-rxjs.md +0 -6
- package/dist/default_templates/generic/style-mui.md +0 -23
- package/dist/default_templates/generic/style-tailwind.md +0 -76
- package/dist/default_templates/generic/test-cypress.md +0 -21
- package/dist/default_templates/generic/test-jest.md +0 -20
- package/dist/default_templates/generic/test-playwright.md +0 -21
- package/dist/default_templates/generic/test-vitest.md +0 -131
- package/dist/default_templates/go/lang-go.md +0 -571
- package/dist/default_templates/java/build-gradle.md +0 -102
- package/dist/default_templates/java/build-maven.md +0 -86
- package/dist/default_templates/java/framework-spring-boot.md +0 -179
- package/dist/default_templates/java/lang-java.md +0 -78
- package/dist/default_templates/java/lang-kotlin.md +0 -88
- package/dist/default_templates/meta/magic-helix-meta.md +0 -213
- package/dist/default_templates/meta/meta-debug.md +0 -459
- package/dist/default_templates/meta/meta-implement.md +0 -450
- package/dist/default_templates/meta/meta-roadmap.md +0 -265
- package/dist/default_templates/nestjs/nestjs-core.md +0 -7
- package/dist/default_templates/patterns/architecture/clean-architecture.md +0 -469
- package/dist/default_templates/patterns/architecture/dependency-injection.md +0 -517
- package/dist/default_templates/patterns/architecture/domain-driven-design.md +0 -621
- package/dist/default_templates/patterns/architecture/layered-architecture.md +0 -382
- package/dist/default_templates/patterns/architecture/repository-pattern.md +0 -408
- package/dist/default_templates/patterns/domain-expertise/nextjs-rules.md +0 -115
- package/dist/default_templates/patterns/domain-expertise/react-patterns.md +0 -181
- package/dist/default_templates/patterns/domain-expertise/server-components.md +0 -212
- package/dist/default_templates/patterns/domain-expertise/shadcn-ui.md +0 -52
- package/dist/default_templates/patterns/domain-expertise/tailwind-patterns.md +0 -52
- package/dist/default_templates/patterns/environment/container-awareness.md +0 -17
- package/dist/default_templates/patterns/environment/ide-features.md +0 -17
- package/dist/default_templates/patterns/environment/os-commands.md +0 -17
- package/dist/default_templates/patterns/organization/heading-hierarchy.md +0 -103
- package/dist/default_templates/patterns/organization/sequential-workflows.md +0 -102
- package/dist/default_templates/patterns/organization/xml-rule-groups.md +0 -64
- package/dist/default_templates/patterns/reasoning/agent-loop.md +0 -151
- package/dist/default_templates/patterns/reasoning/confirmation-gates.md +0 -141
- package/dist/default_templates/patterns/reasoning/dependency-analysis.md +0 -132
- package/dist/default_templates/patterns/reasoning/one-tool-per-iteration.md +0 -152
- package/dist/default_templates/patterns/reasoning/preview-before-action.md +0 -194
- package/dist/default_templates/patterns/reasoning/reflection-checkpoints.md +0 -166
- package/dist/default_templates/patterns/reasoning/result-verification.md +0 -157
- package/dist/default_templates/patterns/reasoning/subtask-breakdown.md +0 -131
- package/dist/default_templates/patterns/reasoning/thinking-tags.md +0 -100
- package/dist/default_templates/patterns/role-definition/capability-declarations.md +0 -72
- package/dist/default_templates/patterns/role-definition/expert-identity.md +0 -45
- package/dist/default_templates/patterns/role-definition/scope-boundaries.md +0 -61
- package/dist/default_templates/patterns/safety/code-safety-rules.md +0 -17
- package/dist/default_templates/patterns/safety/credential-handling.md +0 -17
- package/dist/default_templates/patterns/safety/destructive-warnings.md +0 -17
- package/dist/default_templates/patterns/safety/refusal-messages.md +0 -17
- package/dist/default_templates/patterns/tone/adaptive-tone.md +0 -17
- package/dist/default_templates/patterns/tone/concise-communication.md +0 -17
- package/dist/default_templates/patterns/tone/forbidden-phrases.md +0 -17
- package/dist/default_templates/patterns/tool-guidelines/function-schemas.md +0 -143
- package/dist/default_templates/patterns/tool-guidelines/parameter-examples.md +0 -137
- package/dist/default_templates/patterns/tool-guidelines/usage-policies.md +0 -105
- package/dist/default_templates/php/framework-laravel.md +0 -112
- package/dist/default_templates/php/lang-php.md +0 -94
- package/dist/default_templates/python/lang-python.md +0 -508
- package/dist/default_templates/react/react-core.md +0 -677
- package/dist/default_templates/react/react-zustand.md +0 -7
- package/dist/default_templates/ruby/framework-rails.md +0 -309
- package/dist/default_templates/ruby/framework-sinatra.md +0 -227
- package/dist/default_templates/ruby/lang-ruby.md +0 -216
- package/dist/default_templates/rust/lang-rust.md +0 -89
- package/dist/default_templates/swift/framework-vapor.md +0 -352
- package/dist/default_templates/swift/lang-swift.md +0 -291
- package/dist/default_templates/vue/style-primevue.md +0 -6
- package/dist/default_templates/vue/style-quasar.md +0 -22
- package/dist/default_templates/vue/vue-core.md +0 -108
- package/dist/default_templates/vue/vue-pinia.md +0 -5
- package/dist/index-0GK4RlUx.js +0 -1748
- package/dist/index-0GK4RlUx.js.map +0 -1
- package/dist/index-AkVwRl-r.js +0 -92
- package/dist/index-AkVwRl-r.js.map +0 -1
- package/dist/index-B6BeG1yT.cjs +0 -68
- package/dist/index-B6BeG1yT.cjs.map +0 -1
- package/dist/index-B8pyjKdF.js +0 -94
- package/dist/index-B8pyjKdF.js.map +0 -1
- package/dist/index-BQ6v041y.js +0 -13
- package/dist/index-BQ6v041y.js.map +0 -1
- package/dist/index-Baxb1vI_.js +0 -210
- package/dist/index-Baxb1vI_.js.map +0 -1
- package/dist/index-Bg8DD8ku.js +0 -216
- package/dist/index-Bg8DD8ku.js.map +0 -1
- package/dist/index-BqTqxCpG.cjs +0 -89
- package/dist/index-BqTqxCpG.cjs.map +0 -1
- package/dist/index-Bv4Q1Pr7.cjs +0 -33
- package/dist/index-Bv4Q1Pr7.cjs.map +0 -1
- package/dist/index-CN8J45Nc.cjs +0 -24
- package/dist/index-CN8J45Nc.cjs.map +0 -1
- package/dist/index-CPbv2Od1.js +0 -62
- package/dist/index-CPbv2Od1.js.map +0 -1
- package/dist/index-Cf-MC6Al.js +0 -63
- package/dist/index-Cf-MC6Al.js.map +0 -1
- package/dist/index-DDPXXXDy.cjs +0 -19
- package/dist/index-DDPXXXDy.cjs.map +0 -1
- package/dist/index-DO30AzDe.cjs +0 -19
- package/dist/index-DO30AzDe.cjs.map +0 -1
- package/dist/index-DkvW5yBY.js +0 -2249
- package/dist/index-DkvW5yBY.js.map +0 -1
- package/dist/index-Dn1ehjIj.cjs +0 -80
- package/dist/index-Dn1ehjIj.cjs.map +0 -1
- package/dist/index-DqHvgoXJ.cjs +0 -19
- package/dist/index-DqHvgoXJ.cjs.map +0 -1
- package/dist/index-K39pdw94.cjs +0 -31
- package/dist/index-K39pdw94.cjs.map +0 -1
- package/dist/index-OT2XAJkc.js +0 -117
- package/dist/index-OT2XAJkc.js.map +0 -1
- package/dist/index-TPAX4XKg.cjs +0 -30
- package/dist/index-TPAX4XKg.cjs.map +0 -1
- package/dist/index-WmVSB57y.js +0 -107
- package/dist/index-WmVSB57y.js.map +0 -1
- package/dist/index-mYXvc3Fs.js +0 -68
- package/dist/index-mYXvc3Fs.js.map +0 -1
- package/dist/index-nioXOg4m.cjs +0 -76
- package/dist/index-nioXOg4m.cjs.map +0 -1
- package/dist/index-okhY3fWD.cjs +0 -2
- package/dist/index-okhY3fWD.cjs.map +0 -1
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
# Maven Build Tool Instructions
|
|
2
|
-
|
|
3
|
-
## Project Structure
|
|
4
|
-
```
|
|
5
|
-
project/
|
|
6
|
-
├── pom.xml
|
|
7
|
-
├── src/
|
|
8
|
-
│ ├── main/
|
|
9
|
-
│ │ ├── java/
|
|
10
|
-
│ │ └── resources/
|
|
11
|
-
│ └── test/
|
|
12
|
-
│ ├── java/
|
|
13
|
-
│ └── resources/
|
|
14
|
-
└── target/
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
## Common Commands
|
|
18
|
-
|
|
19
|
-
```bash
|
|
20
|
-
# Build lifecycle
|
|
21
|
-
./mvnw clean # Clean build artifacts
|
|
22
|
-
./mvnw compile # Compile source code
|
|
23
|
-
./mvnw test # Run tests
|
|
24
|
-
./mvnw package # Package as JAR/WAR
|
|
25
|
-
./mvnw install # Install to local repo
|
|
26
|
-
./mvnw deploy # Deploy to remote repo
|
|
27
|
-
|
|
28
|
-
# Spring Boot
|
|
29
|
-
./mvnw spring-boot:run # Run application
|
|
30
|
-
|
|
31
|
-
# Dependency management
|
|
32
|
-
./mvnw dependency:tree # Show dependency tree
|
|
33
|
-
./mvnw dependency:resolve # Download dependencies
|
|
34
|
-
./mvnw versions:display-dependency-updates # Check for updates
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
## Docker Optimization
|
|
38
|
-
|
|
39
|
-
### Layer Caching Strategy
|
|
40
|
-
```dockerfile
|
|
41
|
-
# Download dependencies in separate layer
|
|
42
|
-
FROM maven:3.9-eclipse-temurin-17 AS deps
|
|
43
|
-
WORKDIR /app
|
|
44
|
-
COPY pom.xml .
|
|
45
|
-
RUN mvn dependency:go-offline
|
|
46
|
-
|
|
47
|
-
# Build application
|
|
48
|
-
FROM deps AS build
|
|
49
|
-
COPY src ./src
|
|
50
|
-
RUN mvn package -DskipTests
|
|
51
|
-
|
|
52
|
-
# Runtime
|
|
53
|
-
FROM eclipse-temurin:17-jre-alpine
|
|
54
|
-
COPY --from=build /app/target/*.jar app.jar
|
|
55
|
-
CMD ["java", "-jar", "app.jar"]
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
## Best Practices
|
|
59
|
-
|
|
60
|
-
- Use Maven Wrapper (./mvnw) for consistent builds
|
|
61
|
-
- Define dependency versions in `<dependencyManagement>`
|
|
62
|
-
- Use Spring Boot BOM for version management
|
|
63
|
-
- Leverage profiles for different environments
|
|
64
|
-
- Keep plugins up to date
|
|
65
|
-
|
|
66
|
-
## POM Configuration Tips
|
|
67
|
-
|
|
68
|
-
```xml
|
|
69
|
-
<properties>
|
|
70
|
-
<java.version>17</java.version>
|
|
71
|
-
<maven.compiler.source>17</maven.compiler.source>
|
|
72
|
-
<maven.compiler.target>17</maven.compiler.target>
|
|
73
|
-
</properties>
|
|
74
|
-
|
|
75
|
-
<dependencyManagement>
|
|
76
|
-
<dependencies>
|
|
77
|
-
<dependency>
|
|
78
|
-
<groupId>org.springframework.boot</groupId>
|
|
79
|
-
<artifactId>spring-boot-dependencies</artifactId>
|
|
80
|
-
<version>${spring-boot.version}</version>
|
|
81
|
-
<type>pom</type>
|
|
82
|
-
<scope>import</scope>
|
|
83
|
-
</dependency>
|
|
84
|
-
</dependencies>
|
|
85
|
-
</dependencyManagement>
|
|
86
|
-
```
|
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
# Spring Boot Framework Instructions
|
|
2
|
-
|
|
3
|
-
## Architecture Patterns
|
|
4
|
-
|
|
5
|
-
### Layered Architecture
|
|
6
|
-
```
|
|
7
|
-
Controller → Service → Repository → Database
|
|
8
|
-
```
|
|
9
|
-
|
|
10
|
-
### Controller Layer
|
|
11
|
-
```java
|
|
12
|
-
@RestController
|
|
13
|
-
@RequestMapping("/api/users")
|
|
14
|
-
public class UserController {
|
|
15
|
-
|
|
16
|
-
private final UserService userService;
|
|
17
|
-
|
|
18
|
-
public UserController(UserService userService) {
|
|
19
|
-
this.userService = userService;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
@GetMapping("/{id}")
|
|
23
|
-
public ResponseEntity<User> getUser(@PathVariable Long id) {
|
|
24
|
-
return userService.findById(id)
|
|
25
|
-
.map(ResponseEntity::ok)
|
|
26
|
-
.orElse(ResponseEntity.notFound().build());
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
### Service Layer
|
|
32
|
-
```java
|
|
33
|
-
@Service
|
|
34
|
-
public class UserService {
|
|
35
|
-
|
|
36
|
-
private final UserRepository repository;
|
|
37
|
-
|
|
38
|
-
@Transactional
|
|
39
|
-
public User createUser(User user) {
|
|
40
|
-
return repository.save(user);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
### Repository Layer
|
|
46
|
-
```java
|
|
47
|
-
@Repository
|
|
48
|
-
public interface UserRepository extends JpaRepository<User, Long> {
|
|
49
|
-
Optional<User> findByEmail(String email);
|
|
50
|
-
}
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
## Configuration
|
|
54
|
-
|
|
55
|
-
### application.yml
|
|
56
|
-
```yaml
|
|
57
|
-
spring:
|
|
58
|
-
datasource:
|
|
59
|
-
url: jdbc:postgresql://localhost:5432/mydb
|
|
60
|
-
username: ${DB_USER}
|
|
61
|
-
password: ${DB_PASSWORD}
|
|
62
|
-
jpa:
|
|
63
|
-
hibernate:
|
|
64
|
-
ddl-auto: validate
|
|
65
|
-
properties:
|
|
66
|
-
hibernate:
|
|
67
|
-
dialect: org.hibernate.dialect.PostgreSQLDialect
|
|
68
|
-
|
|
69
|
-
server:
|
|
70
|
-
port: 8080
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
## Docker Best Practices
|
|
74
|
-
|
|
75
|
-
### Optimized Dockerfile
|
|
76
|
-
```dockerfile
|
|
77
|
-
FROM eclipse-temurin:17-jre-alpine
|
|
78
|
-
WORKDIR /app
|
|
79
|
-
|
|
80
|
-
# Add non-root user
|
|
81
|
-
RUN addgroup -S spring && adduser -S spring -G spring
|
|
82
|
-
USER spring:spring
|
|
83
|
-
|
|
84
|
-
COPY --chown=spring:spring target/*.jar app.jar
|
|
85
|
-
|
|
86
|
-
# JVM optimization for containers
|
|
87
|
-
ENV JAVA_OPTS="-XX:+UseContainerSupport -XX:MaxRAMPercentage=75.0"
|
|
88
|
-
|
|
89
|
-
EXPOSE 8080
|
|
90
|
-
ENTRYPOINT ["sh", "-c", "java $JAVA_OPTS -jar app.jar"]
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
### Health Checks
|
|
94
|
-
```yaml
|
|
95
|
-
# docker-compose.yml
|
|
96
|
-
services:
|
|
97
|
-
app:
|
|
98
|
-
healthcheck:
|
|
99
|
-
test: ["CMD", "curl", "-f", "http://localhost:8080/actuator/health"]
|
|
100
|
-
interval: 30s
|
|
101
|
-
timeout: 3s
|
|
102
|
-
retries: 3
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
## Production Readiness
|
|
106
|
-
|
|
107
|
-
### Actuator Endpoints
|
|
108
|
-
```xml
|
|
109
|
-
<dependency>
|
|
110
|
-
<groupId>org.springframework.boot</groupId>
|
|
111
|
-
<artifactId>spring-boot-starter-actuator</artifactId>
|
|
112
|
-
</dependency>
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
### Security
|
|
116
|
-
```java
|
|
117
|
-
@Configuration
|
|
118
|
-
@EnableWebSecurity
|
|
119
|
-
public class SecurityConfig {
|
|
120
|
-
|
|
121
|
-
@Bean
|
|
122
|
-
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
|
|
123
|
-
http
|
|
124
|
-
.authorizeHttpRequests(auth -> auth
|
|
125
|
-
.requestMatchers("/actuator/health").permitAll()
|
|
126
|
-
.anyRequest().authenticated()
|
|
127
|
-
)
|
|
128
|
-
.oauth2ResourceServer(OAuth2ResourceServerConfigurer::jwt);
|
|
129
|
-
return http.build();
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
## Testing
|
|
135
|
-
|
|
136
|
-
### Integration Tests
|
|
137
|
-
```java
|
|
138
|
-
@SpringBootTest
|
|
139
|
-
@AutoConfigureMockMvc
|
|
140
|
-
class UserControllerIntegrationTest {
|
|
141
|
-
|
|
142
|
-
@Autowired
|
|
143
|
-
private MockMvc mockMvc;
|
|
144
|
-
|
|
145
|
-
@Test
|
|
146
|
-
void shouldGetUser() throws Exception {
|
|
147
|
-
mockMvc.perform(get("/api/users/1"))
|
|
148
|
-
.andExpect(status().isOk())
|
|
149
|
-
.andExpect(jsonPath("$.name").value("John"));
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
### Test Containers
|
|
155
|
-
```java
|
|
156
|
-
@Testcontainers
|
|
157
|
-
@SpringBootTest
|
|
158
|
-
class RepositoryIntegrationTest {
|
|
159
|
-
|
|
160
|
-
@Container
|
|
161
|
-
static PostgreSQLContainer<?> postgres = new PostgreSQLContainer<>("postgres:15-alpine");
|
|
162
|
-
|
|
163
|
-
@DynamicPropertySource
|
|
164
|
-
static void configureProperties(DynamicPropertyRegistry registry) {
|
|
165
|
-
registry.add("spring.datasource.url", postgres::getJdbcUrl);
|
|
166
|
-
registry.add("spring.datasource.username", postgres::getUsername);
|
|
167
|
-
registry.add("spring.datasource.password", postgres::getPassword);
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
## Performance
|
|
173
|
-
|
|
174
|
-
- Use connection pooling (HikariCP is default)
|
|
175
|
-
- Enable HTTP/2
|
|
176
|
-
- Use caching (@Cacheable, @CacheEvict)
|
|
177
|
-
- Implement pagination for large datasets
|
|
178
|
-
- Use async processing with @Async where appropriate
|
|
179
|
-
- Monitor with Micrometer metrics
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
# Java/Kotlin Language Instructions
|
|
2
|
-
|
|
3
|
-
## Project Type
|
|
4
|
-
- Language: Java/Kotlin
|
|
5
|
-
- Build Tool: {Maven|Gradle}
|
|
6
|
-
- Framework: {Spring Boot|Micronaut|Quarkus|None}
|
|
7
|
-
|
|
8
|
-
## Build Commands
|
|
9
|
-
|
|
10
|
-
### Maven
|
|
11
|
-
```bash
|
|
12
|
-
./mvnw clean install # Build project
|
|
13
|
-
./mvnw test # Run tests
|
|
14
|
-
./mvnw spring-boot:run # Run Spring Boot app
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
### Gradle
|
|
18
|
-
```bash
|
|
19
|
-
./gradlew build # Build project
|
|
20
|
-
./gradlew test # Run tests
|
|
21
|
-
./gradlew bootRun # Run Spring Boot app
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
## Code Conventions
|
|
25
|
-
|
|
26
|
-
### Java
|
|
27
|
-
- Follow Java naming conventions (PascalCase for classes, camelCase for methods)
|
|
28
|
-
- Use meaningful variable names
|
|
29
|
-
- Prefer immutability where possible
|
|
30
|
-
- Use Optional for nullable values
|
|
31
|
-
- Handle exceptions appropriately
|
|
32
|
-
|
|
33
|
-
### Kotlin
|
|
34
|
-
- Use data classes for DTOs
|
|
35
|
-
- Leverage null safety features
|
|
36
|
-
- Use extension functions appropriately
|
|
37
|
-
- Prefer immutability (val over var)
|
|
38
|
-
- Use scope functions (let, apply, run, with)
|
|
39
|
-
|
|
40
|
-
## Docker Optimization
|
|
41
|
-
|
|
42
|
-
### Multi-stage Dockerfile Example (Maven)
|
|
43
|
-
```dockerfile
|
|
44
|
-
FROM maven:3.9-eclipse-temurin-17 AS build
|
|
45
|
-
WORKDIR /app
|
|
46
|
-
COPY pom.xml .
|
|
47
|
-
RUN mvn dependency:go-offline
|
|
48
|
-
COPY src ./src
|
|
49
|
-
RUN mvn clean package -DskipTests
|
|
50
|
-
|
|
51
|
-
FROM eclipse-temurin:17-jre-alpine
|
|
52
|
-
WORKDIR /app
|
|
53
|
-
COPY --from=build /app/target/*.jar app.jar
|
|
54
|
-
EXPOSE 8080
|
|
55
|
-
ENTRYPOINT ["java", "-jar", "app.jar"]
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
### JVM Tuning for Containers
|
|
59
|
-
```bash
|
|
60
|
-
# Use container-aware JVM flags
|
|
61
|
-
java -XX:+UseContainerSupport \
|
|
62
|
-
-XX:MaxRAMPercentage=75.0 \
|
|
63
|
-
-XX:InitialRAMPercentage=50.0 \
|
|
64
|
-
-jar app.jar
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
## Testing
|
|
68
|
-
|
|
69
|
-
- Use JUnit 5 for unit tests
|
|
70
|
-
- Use Mockito for mocking
|
|
71
|
-
- Use Testcontainers for integration tests
|
|
72
|
-
- Maintain test coverage >80%
|
|
73
|
-
|
|
74
|
-
## Dependencies
|
|
75
|
-
|
|
76
|
-
- Keep dependencies up to date
|
|
77
|
-
- Use dependency management (Maven BOM, Gradle platform)
|
|
78
|
-
- Scan for vulnerabilities regularly
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
# Kotlin Specific Instructions
|
|
2
|
-
|
|
3
|
-
## Language Features
|
|
4
|
-
|
|
5
|
-
### Null Safety
|
|
6
|
-
```kotlin
|
|
7
|
-
// Use nullable types explicitly
|
|
8
|
-
val name: String? = null
|
|
9
|
-
val length = name?.length ?: 0
|
|
10
|
-
|
|
11
|
-
// Safe calls
|
|
12
|
-
user?.address?.city
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
### Data Classes
|
|
16
|
-
```kotlin
|
|
17
|
-
data class User(
|
|
18
|
-
val id: Long,
|
|
19
|
-
val name: String,
|
|
20
|
-
val email: String
|
|
21
|
-
)
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
### Extension Functions
|
|
25
|
-
```kotlin
|
|
26
|
-
fun String.toSnakeCase(): String =
|
|
27
|
-
this.replace(Regex("([a-z])([A-Z])"), "$1_$2").lowercase()
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
### Coroutines (Async)
|
|
31
|
-
```kotlin
|
|
32
|
-
suspend fun fetchData(): Data {
|
|
33
|
-
return withContext(Dispatchers.IO) {
|
|
34
|
-
// IO operation
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
## Spring Boot with Kotlin
|
|
40
|
-
|
|
41
|
-
### Controller Example
|
|
42
|
-
```kotlin
|
|
43
|
-
@RestController
|
|
44
|
-
@RequestMapping("/api/users")
|
|
45
|
-
class UserController(private val userService: UserService) {
|
|
46
|
-
|
|
47
|
-
@GetMapping("/{id}")
|
|
48
|
-
fun getUser(@PathVariable id: Long): User {
|
|
49
|
-
return userService.findById(id)
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
### Service with Coroutines
|
|
55
|
-
```kotlin
|
|
56
|
-
@Service
|
|
57
|
-
class UserService(private val repository: UserRepository) {
|
|
58
|
-
|
|
59
|
-
suspend fun findAllAsync(): List<User> =
|
|
60
|
-
withContext(Dispatchers.IO) {
|
|
61
|
-
repository.findAll()
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
## Best Practices
|
|
67
|
-
|
|
68
|
-
- Use `val` over `var` for immutability
|
|
69
|
-
- Leverage sealed classes for state management
|
|
70
|
-
- Use `when` expressions instead of multiple `if-else`
|
|
71
|
-
- Apply scope functions appropriately (let, run, apply, also, with)
|
|
72
|
-
- Use destructuring for data classes
|
|
73
|
-
- Prefer sequences for large collections
|
|
74
|
-
|
|
75
|
-
## Build Configuration
|
|
76
|
-
|
|
77
|
-
### build.gradle.kts
|
|
78
|
-
```kotlin
|
|
79
|
-
plugins {
|
|
80
|
-
kotlin("jvm") version "1.9.20"
|
|
81
|
-
kotlin("plugin.spring") version "1.9.20"
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
dependencies {
|
|
85
|
-
implementation("org.jetbrains.kotlin:kotlin-stdlib")
|
|
86
|
-
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core")
|
|
87
|
-
}
|
|
88
|
-
```
|
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
# 🪄 Magic Helix: Universal AI Agent Optimization
|
|
2
|
-
|
|
3
|
-
This instruction file teaches AI agents to work more efficiently with your codebase.
|
|
4
|
-
|
|
5
|
-
## Core Principles for Effective Agent Work
|
|
6
|
-
|
|
7
|
-
### 1. Task Management & Progress Tracking
|
|
8
|
-
|
|
9
|
-
**Create structured todo lists** for multi-step work:
|
|
10
|
-
- Break complex requests into 3-7 concrete, actionable steps
|
|
11
|
-
- Mark tasks `in-progress` before starting
|
|
12
|
-
- Mark tasks `completed` immediately after finishing
|
|
13
|
-
- Update progress frequently for user visibility
|
|
14
|
-
|
|
15
|
-
**Example workflow:**
|
|
16
|
-
```
|
|
17
|
-
User: "Add authentication to the app"
|
|
18
|
-
|
|
19
|
-
Agent creates:
|
|
20
|
-
1. [ ] Research existing auth patterns in codebase
|
|
21
|
-
2. [ ] Create authentication middleware
|
|
22
|
-
3. [ ] Add login/logout routes
|
|
23
|
-
4. [ ] Update user model with auth fields
|
|
24
|
-
5. [ ] Write tests for auth flows
|
|
25
|
-
6. [ ] Update documentation
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
### 2. Efficient Context Gathering
|
|
29
|
-
|
|
30
|
-
**Batch parallel operations** to minimize latency:
|
|
31
|
-
- Read multiple files simultaneously, not sequentially
|
|
32
|
-
- Search multiple patterns in one query using alternation: `(pattern1|pattern2|pattern3)`
|
|
33
|
-
- Deduplicate file paths before reading to avoid redundant operations
|
|
34
|
-
|
|
35
|
-
**Smart search strategies:**
|
|
36
|
-
- Use `semantic_search` for high-level code discovery (finding similar implementations)
|
|
37
|
-
- Use `grep_search` for specific strings/patterns in known areas
|
|
38
|
-
- Use alternation in regex: `function|method|class` instead of multiple searches
|
|
39
|
-
|
|
40
|
-
**Get enough context to act, then proceed** - don't over-research before implementation.
|
|
41
|
-
|
|
42
|
-
### 3. Code Editing Best Practices
|
|
43
|
-
|
|
44
|
-
**Read surrounding context** before editing:
|
|
45
|
-
- Include 3-5 lines before and after the target code
|
|
46
|
-
- Ensure `oldString` is unique enough to match only once
|
|
47
|
-
- Verify the change won't break surrounding logic
|
|
48
|
-
|
|
49
|
-
**Prefer batch edits** for independent changes:
|
|
50
|
-
- Use `multi_replace_string_in_file` for multiple unrelated edits
|
|
51
|
-
- One tool call is faster than sequential calls
|
|
52
|
-
- Only works for truly independent changes (no dependencies between edits)
|
|
53
|
-
|
|
54
|
-
**Verify after editing:**
|
|
55
|
-
- Check for compilation/lint errors immediately
|
|
56
|
-
- Run tests if modifying critical code
|
|
57
|
-
- Read the file back if the change was complex
|
|
58
|
-
|
|
59
|
-
### 4. Communication Style
|
|
60
|
-
|
|
61
|
-
**Be concise and direct:**
|
|
62
|
-
- Match response length to task complexity
|
|
63
|
-
- No unnecessary preamble: avoid "I will now...", "Here's the...", "Let me..."
|
|
64
|
-
- Confirm completions briefly: "Updated 3 files" not explaining each edit
|
|
65
|
-
- Get straight to the point
|
|
66
|
-
|
|
67
|
-
**Use proper formatting:**
|
|
68
|
-
- Wrap code symbols in backticks: `functionName`, `fileName.ts`
|
|
69
|
-
- Use code blocks for multi-line code
|
|
70
|
-
- Use bullet points for lists
|
|
71
|
-
- Bold important terms
|
|
72
|
-
|
|
73
|
-
**Forbidden phrases:**
|
|
74
|
-
- "Great!", "Certainly!", "Sure!", "Of course!"
|
|
75
|
-
- "Let me help you with that"
|
|
76
|
-
- Unnecessary apologies or enthusiasm
|
|
77
|
-
- Redundant confirmations
|
|
78
|
-
|
|
79
|
-
### 5. Tool Usage Guidelines
|
|
80
|
-
|
|
81
|
-
**Check tool availability** before using:
|
|
82
|
-
- Tools may be disabled or unavailable
|
|
83
|
-
- Don't reference tools that aren't currently accessible
|
|
84
|
-
|
|
85
|
-
**Never announce tool names** to users:
|
|
86
|
-
- Say "I'll run the command" not "I'll use run_in_terminal"
|
|
87
|
-
- Say "I'll search the codebase" not "I'll use semantic_search"
|
|
88
|
-
- Focus on what you're doing, not how
|
|
89
|
-
|
|
90
|
-
**Use absolute paths** for file operations:
|
|
91
|
-
- Always resolve to full paths
|
|
92
|
-
- Don't rely on relative paths
|
|
93
|
-
- Handle URI schemes (untitled:, vscode-userdata:) correctly
|
|
94
|
-
|
|
95
|
-
**Parallelize wisely:**
|
|
96
|
-
- ✅ DO parallelize: file reads, searches, analysis
|
|
97
|
-
- ❌ DON'T parallelize: terminal commands, sequential workflows
|
|
98
|
-
|
|
99
|
-
### 6. Project Understanding
|
|
100
|
-
|
|
101
|
-
**Start with high-level discovery:**
|
|
102
|
-
1. Use `semantic_search` to understand codebase architecture
|
|
103
|
-
2. Use `grep_search` for specific strings once you know where to look
|
|
104
|
-
3. List directories to understand structure before making assumptions
|
|
105
|
-
4. Check for errors with `get_errors` after making changes
|
|
106
|
-
|
|
107
|
-
**Understand before implementing:**
|
|
108
|
-
- Search for similar existing implementations
|
|
109
|
-
- Identify patterns and conventions in the codebase
|
|
110
|
-
- Match existing code style and architecture
|
|
111
|
-
- Ask clarifying questions if requirements are ambiguous
|
|
112
|
-
|
|
113
|
-
## Task-Specific Strategies
|
|
114
|
-
|
|
115
|
-
### When Creating Roadmaps or Plans
|
|
116
|
-
|
|
117
|
-
1. **Clarify the request**: Rephrase to confirm understanding
|
|
118
|
-
2. **Research existing architecture**: Find similar features/patterns
|
|
119
|
-
3. **Create phased plan**: Break into logical phases with dependencies
|
|
120
|
-
4. **Define success criteria**: How will we know each phase is done?
|
|
121
|
-
5. **Identify risks**: What could go wrong?
|
|
122
|
-
|
|
123
|
-
### When Implementing Features
|
|
124
|
-
|
|
125
|
-
1. **Search for similar implementations**: Learn from existing code
|
|
126
|
-
2. **Identify all affected files**: Types, logic, tests, docs
|
|
127
|
-
3. **Plan changes in logical order**: Types → interfaces → implementation → tests
|
|
128
|
-
4. **Make incremental changes**: One logical unit at a time
|
|
129
|
-
5. **Verify compilation**: Check after each major change
|
|
130
|
-
6. **Update tests**: Ensure existing tests pass, add new ones
|
|
131
|
-
|
|
132
|
-
### When Debugging Issues
|
|
133
|
-
|
|
134
|
-
1. **Reproduce the error**: Verify it happens consistently
|
|
135
|
-
2. **Read error messages completely**: Don't skim, read fully
|
|
136
|
-
3. **Check recent changes**: Use git diff, check what changed
|
|
137
|
-
4. **Form hypotheses**: List possible causes
|
|
138
|
-
5. **Test incrementally**: Verify each hypothesis systematically
|
|
139
|
-
6. **Fix root cause**: Don't just treat symptoms
|
|
140
|
-
|
|
141
|
-
### When Refactoring Code
|
|
142
|
-
|
|
143
|
-
1. **Understand current behavior**: Read and comprehend existing code
|
|
144
|
-
2. **Ensure test coverage**: Write tests if missing
|
|
145
|
-
3. **Make small changes**: Incremental refactors are safer
|
|
146
|
-
4. **Verify tests pass**: After each refactor step
|
|
147
|
-
5. **Maintain backwards compatibility**: Unless explicitly breaking
|
|
148
|
-
6. **Update documentation**: Keep docs in sync
|
|
149
|
-
|
|
150
|
-
## Error Handling & Recovery
|
|
151
|
-
|
|
152
|
-
**When errors occur:**
|
|
153
|
-
- Read the full error message (don't skip details)
|
|
154
|
-
- Check the file and line number referenced
|
|
155
|
-
- Look for stack traces or additional context
|
|
156
|
-
- Try the obvious fix first
|
|
157
|
-
- If stuck, ask for clarification
|
|
158
|
-
|
|
159
|
-
**Never:**
|
|
160
|
-
- Ignore compiler/lint errors
|
|
161
|
-
- Assume success without verification
|
|
162
|
-
- Continue with broken code
|
|
163
|
-
- Skip error checking
|
|
164
|
-
|
|
165
|
-
## File Operations Safety
|
|
166
|
-
|
|
167
|
-
**Before modifying files:**
|
|
168
|
-
1. Explain what you're about to change
|
|
169
|
-
2. Show preview of changes when significant
|
|
170
|
-
3. Wait for confirmation if potentially destructive
|
|
171
|
-
4. Never assume success—verify the result
|
|
172
|
-
|
|
173
|
-
**Never do without explicit permission:**
|
|
174
|
-
- Delete files outside project directory
|
|
175
|
-
- Modify system files
|
|
176
|
-
- Install packages without showing changes
|
|
177
|
-
- Execute shell commands with `sudo`
|
|
178
|
-
- Include API keys or secrets in code
|
|
179
|
-
|
|
180
|
-
## Performance & Efficiency
|
|
181
|
-
|
|
182
|
-
**Minimize tool calls:**
|
|
183
|
-
- Read once, not multiple times
|
|
184
|
-
- Batch parallel operations
|
|
185
|
-
- Search smart, not exhaustively
|
|
186
|
-
- Cache information you've already retrieved
|
|
187
|
-
|
|
188
|
-
**Respect token budgets:**
|
|
189
|
-
- Be concise in responses
|
|
190
|
-
- Don't repeat information unnecessarily
|
|
191
|
-
- Summarize large outputs
|
|
192
|
-
- Use code references instead of copying full files
|
|
193
|
-
|
|
194
|
-
## Quality Standards
|
|
195
|
-
|
|
196
|
-
**All code changes should:**
|
|
197
|
-
- Follow existing code style
|
|
198
|
-
- Include error handling
|
|
199
|
-
- Be properly typed (if applicable)
|
|
200
|
-
- Have meaningful names
|
|
201
|
-
- Include comments for complex logic
|
|
202
|
-
- Pass linting and formatting checks
|
|
203
|
-
|
|
204
|
-
**All features should:**
|
|
205
|
-
- Have tests
|
|
206
|
-
- Update documentation
|
|
207
|
-
- Handle edge cases
|
|
208
|
-
- Provide good error messages
|
|
209
|
-
- Be backwards compatible (unless breaking intentionally)
|
|
210
|
-
|
|
211
|
-
---
|
|
212
|
-
|
|
213
|
-
*This meta-instruction file helps AI agents work more efficiently with your codebase. It's always included to improve agent performance.*
|