@chc880/everything-antigravity 1.0.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/LICENSE +21 -0
- package/README.md +54 -0
- package/assets/rules/common/coding-style.md +53 -0
- package/assets/rules/common/git-workflow.md +47 -0
- package/assets/rules/common/patterns.md +36 -0
- package/assets/rules/common/performance.md +21 -0
- package/assets/rules/common/security.md +34 -0
- package/assets/rules/common/testing.md +29 -0
- package/assets/rules/golang/coding-style.md +40 -0
- package/assets/rules/golang/patterns.md +44 -0
- package/assets/rules/golang/security.md +33 -0
- package/assets/rules/golang/testing.md +30 -0
- package/assets/rules/python/coding-style.md +52 -0
- package/assets/rules/python/patterns.md +39 -0
- package/assets/rules/python/security.md +30 -0
- package/assets/rules/python/testing.md +38 -0
- package/assets/rules/typescript/coding-style.md +44 -0
- package/assets/rules/typescript/patterns.md +50 -0
- package/assets/rules/typescript/security.md +27 -0
- package/assets/rules/typescript/testing.md +24 -0
- package/assets/skills/agent-guides/SKILL.md +40 -0
- package/assets/skills/agent-guides/references/architect.md +209 -0
- package/assets/skills/agent-guides/references/build-error-resolver.md +530 -0
- package/assets/skills/agent-guides/references/code-reviewer.md +102 -0
- package/assets/skills/agent-guides/references/database-reviewer.md +652 -0
- package/assets/skills/agent-guides/references/doc-updater.md +450 -0
- package/assets/skills/agent-guides/references/e2e-runner.md +795 -0
- package/assets/skills/agent-guides/references/go-build-resolver.md +366 -0
- package/assets/skills/agent-guides/references/go-reviewer.md +265 -0
- package/assets/skills/agent-guides/references/planner.md +117 -0
- package/assets/skills/agent-guides/references/python-reviewer.md +467 -0
- package/assets/skills/agent-guides/references/refactor-cleaner.md +304 -0
- package/assets/skills/agent-guides/references/security-reviewer.md +543 -0
- package/assets/skills/agent-guides/references/tdd-guide.md +278 -0
- package/assets/skills/backend-patterns/SKILL.md +587 -0
- package/assets/skills/clickhouse-io/SKILL.md +429 -0
- package/assets/skills/coding-standards/SKILL.md +520 -0
- package/assets/skills/cpp-testing/SKILL.md +322 -0
- package/assets/skills/django-patterns/SKILL.md +733 -0
- package/assets/skills/django-security/SKILL.md +592 -0
- package/assets/skills/django-tdd/SKILL.md +728 -0
- package/assets/skills/django-verification/SKILL.md +460 -0
- package/assets/skills/frontend-patterns/SKILL.md +631 -0
- package/assets/skills/golang-patterns/SKILL.md +673 -0
- package/assets/skills/golang-testing/SKILL.md +719 -0
- package/assets/skills/java-coding-standards/SKILL.md +138 -0
- package/assets/skills/jpa-patterns/SKILL.md +141 -0
- package/assets/skills/knowledge-management/SKILL.md +77 -0
- package/assets/skills/nutrient-document-processing/SKILL.md +165 -0
- package/assets/skills/postgres-patterns/SKILL.md +146 -0
- package/assets/skills/python-patterns/SKILL.md +749 -0
- package/assets/skills/python-testing/SKILL.md +815 -0
- package/assets/skills/security-hardening/SKILL.md +76 -0
- package/assets/skills/security-review/SKILL.md +494 -0
- package/assets/skills/security-review/cloud-infrastructure-security.md +361 -0
- package/assets/skills/springboot-patterns/SKILL.md +304 -0
- package/assets/skills/springboot-security/SKILL.md +119 -0
- package/assets/skills/springboot-tdd/SKILL.md +157 -0
- package/assets/skills/springboot-verification/SKILL.md +100 -0
- package/assets/skills/tdd-workflow/SKILL.md +409 -0
- package/assets/workflows/build-fix.md +50 -0
- package/assets/workflows/code-review.md +61 -0
- package/assets/workflows/e2e.md +65 -0
- package/assets/workflows/go-build.md +39 -0
- package/assets/workflows/go-review.md +44 -0
- package/assets/workflows/go-test.md +61 -0
- package/assets/workflows/plan.md +93 -0
- package/assets/workflows/python-review.md +95 -0
- package/assets/workflows/setup-pm.md +36 -0
- package/assets/workflows/tdd.md +75 -0
- package/assets/workflows/verify.md +81 -0
- package/bin/cli.js +69 -0
- package/lib/installer.js +301 -0
- package/package.json +34 -0
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: springboot-security
|
|
3
|
+
description: Spring Security best practices for authn/authz, validation, CSRF, secrets, headers, rate limiting, and dependency security in Java Spring Boot services.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Spring Boot Security Review
|
|
7
|
+
|
|
8
|
+
Use when adding auth, handling input, creating endpoints, or dealing with secrets.
|
|
9
|
+
|
|
10
|
+
## Authentication
|
|
11
|
+
|
|
12
|
+
- Prefer stateless JWT or opaque tokens with revocation list
|
|
13
|
+
- Use `httpOnly`, `Secure`, `SameSite=Strict` cookies for sessions
|
|
14
|
+
- Validate tokens with `OncePerRequestFilter` or resource server
|
|
15
|
+
|
|
16
|
+
```java
|
|
17
|
+
@Component
|
|
18
|
+
public class JwtAuthFilter extends OncePerRequestFilter {
|
|
19
|
+
private final JwtService jwtService;
|
|
20
|
+
|
|
21
|
+
public JwtAuthFilter(JwtService jwtService) {
|
|
22
|
+
this.jwtService = jwtService;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@Override
|
|
26
|
+
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response,
|
|
27
|
+
FilterChain chain) throws ServletException, IOException {
|
|
28
|
+
String header = request.getHeader(HttpHeaders.AUTHORIZATION);
|
|
29
|
+
if (header != null && header.startsWith("Bearer ")) {
|
|
30
|
+
String token = header.substring(7);
|
|
31
|
+
Authentication auth = jwtService.authenticate(token);
|
|
32
|
+
SecurityContextHolder.getContext().setAuthentication(auth);
|
|
33
|
+
}
|
|
34
|
+
chain.doFilter(request, response);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Authorization
|
|
40
|
+
|
|
41
|
+
- Enable method security: `@EnableMethodSecurity`
|
|
42
|
+
- Use `@PreAuthorize("hasRole('ADMIN')")` or `@PreAuthorize("@authz.canEdit(#id)")`
|
|
43
|
+
- Deny by default; expose only required scopes
|
|
44
|
+
|
|
45
|
+
## Input Validation
|
|
46
|
+
|
|
47
|
+
- Use Bean Validation with `@Valid` on controllers
|
|
48
|
+
- Apply constraints on DTOs: `@NotBlank`, `@Email`, `@Size`, custom validators
|
|
49
|
+
- Sanitize any HTML with a whitelist before rendering
|
|
50
|
+
|
|
51
|
+
## SQL Injection Prevention
|
|
52
|
+
|
|
53
|
+
- Use Spring Data repositories or parameterized queries
|
|
54
|
+
- For native queries, use `:param` bindings; never concatenate strings
|
|
55
|
+
|
|
56
|
+
## CSRF Protection
|
|
57
|
+
|
|
58
|
+
- For browser session apps, keep CSRF enabled; include token in forms/headers
|
|
59
|
+
- For pure APIs with Bearer tokens, disable CSRF and rely on stateless auth
|
|
60
|
+
|
|
61
|
+
```java
|
|
62
|
+
http
|
|
63
|
+
.csrf(csrf -> csrf.disable())
|
|
64
|
+
.sessionManagement(sm -> sm.sessionCreationPolicy(SessionCreationPolicy.STATELESS));
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Secrets Management
|
|
68
|
+
|
|
69
|
+
- No secrets in source; load from env or vault
|
|
70
|
+
- Keep `application.yml` free of credentials; use placeholders
|
|
71
|
+
- Rotate tokens and DB credentials regularly
|
|
72
|
+
|
|
73
|
+
## Security Headers
|
|
74
|
+
|
|
75
|
+
```java
|
|
76
|
+
http
|
|
77
|
+
.headers(headers -> headers
|
|
78
|
+
.contentSecurityPolicy(csp -> csp
|
|
79
|
+
.policyDirectives("default-src 'self'"))
|
|
80
|
+
.frameOptions(HeadersConfigurer.FrameOptionsConfig::sameOrigin)
|
|
81
|
+
.xssProtection(Customizer.withDefaults())
|
|
82
|
+
.referrerPolicy(rp -> rp.policy(ReferrerPolicyHeaderWriter.ReferrerPolicy.NO_REFERRER)));
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Rate Limiting
|
|
86
|
+
|
|
87
|
+
- Apply Bucket4j or gateway-level limits on expensive endpoints
|
|
88
|
+
- Log and alert on bursts; return 429 with retry hints
|
|
89
|
+
|
|
90
|
+
## Dependency Security
|
|
91
|
+
|
|
92
|
+
- Run OWASP Dependency Check / Snyk in CI
|
|
93
|
+
- Keep Spring Boot and Spring Security on supported versions
|
|
94
|
+
- Fail builds on known CVEs
|
|
95
|
+
|
|
96
|
+
## Logging and PII
|
|
97
|
+
|
|
98
|
+
- Never log secrets, tokens, passwords, or full PAN data
|
|
99
|
+
- Redact sensitive fields; use structured JSON logging
|
|
100
|
+
|
|
101
|
+
## File Uploads
|
|
102
|
+
|
|
103
|
+
- Validate size, content type, and extension
|
|
104
|
+
- Store outside web root; scan if required
|
|
105
|
+
|
|
106
|
+
## Checklist Before Release
|
|
107
|
+
|
|
108
|
+
- [ ] Auth tokens validated and expired correctly
|
|
109
|
+
- [ ] Authorization guards on every sensitive path
|
|
110
|
+
- [ ] All inputs validated and sanitized
|
|
111
|
+
- [ ] No string-concatenated SQL
|
|
112
|
+
- [ ] CSRF posture correct for app type
|
|
113
|
+
- [ ] Secrets externalized; none committed
|
|
114
|
+
- [ ] Security headers configured
|
|
115
|
+
- [ ] Rate limiting on APIs
|
|
116
|
+
- [ ] Dependencies scanned and up to date
|
|
117
|
+
- [ ] Logs free of sensitive data
|
|
118
|
+
|
|
119
|
+
**Remember**: Deny by default, validate inputs, least privilege, and secure-by-configuration first.
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: springboot-tdd
|
|
3
|
+
description: Test-driven development for Spring Boot using JUnit 5, Mockito, MockMvc, Testcontainers, and JaCoCo. Use when adding features, fixing bugs, or refactoring.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Spring Boot TDD Workflow
|
|
7
|
+
|
|
8
|
+
TDD guidance for Spring Boot services with 80%+ coverage (unit + integration).
|
|
9
|
+
|
|
10
|
+
## When to Use
|
|
11
|
+
|
|
12
|
+
- New features or endpoints
|
|
13
|
+
- Bug fixes or refactors
|
|
14
|
+
- Adding data access logic or security rules
|
|
15
|
+
|
|
16
|
+
## Workflow
|
|
17
|
+
|
|
18
|
+
1) Write tests first (they should fail)
|
|
19
|
+
2) Implement minimal code to pass
|
|
20
|
+
3) Refactor with tests green
|
|
21
|
+
4) Enforce coverage (JaCoCo)
|
|
22
|
+
|
|
23
|
+
## Unit Tests (JUnit 5 + Mockito)
|
|
24
|
+
|
|
25
|
+
```java
|
|
26
|
+
@ExtendWith(MockitoExtension.class)
|
|
27
|
+
class MarketServiceTest {
|
|
28
|
+
@Mock MarketRepository repo;
|
|
29
|
+
@InjectMocks MarketService service;
|
|
30
|
+
|
|
31
|
+
@Test
|
|
32
|
+
void createsMarket() {
|
|
33
|
+
CreateMarketRequest req = new CreateMarketRequest("name", "desc", Instant.now(), List.of("cat"));
|
|
34
|
+
when(repo.save(any())).thenAnswer(inv -> inv.getArgument(0));
|
|
35
|
+
|
|
36
|
+
Market result = service.create(req);
|
|
37
|
+
|
|
38
|
+
assertThat(result.name()).isEqualTo("name");
|
|
39
|
+
verify(repo).save(any());
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Patterns:
|
|
45
|
+
- Arrange-Act-Assert
|
|
46
|
+
- Avoid partial mocks; prefer explicit stubbing
|
|
47
|
+
- Use `@ParameterizedTest` for variants
|
|
48
|
+
|
|
49
|
+
## Web Layer Tests (MockMvc)
|
|
50
|
+
|
|
51
|
+
```java
|
|
52
|
+
@WebMvcTest(MarketController.class)
|
|
53
|
+
class MarketControllerTest {
|
|
54
|
+
@Autowired MockMvc mockMvc;
|
|
55
|
+
@MockBean MarketService marketService;
|
|
56
|
+
|
|
57
|
+
@Test
|
|
58
|
+
void returnsMarkets() throws Exception {
|
|
59
|
+
when(marketService.list(any())).thenReturn(Page.empty());
|
|
60
|
+
|
|
61
|
+
mockMvc.perform(get("/api/markets"))
|
|
62
|
+
.andExpect(status().isOk())
|
|
63
|
+
.andExpect(jsonPath("$.content").isArray());
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Integration Tests (SpringBootTest)
|
|
69
|
+
|
|
70
|
+
```java
|
|
71
|
+
@SpringBootTest
|
|
72
|
+
@AutoConfigureMockMvc
|
|
73
|
+
@ActiveProfiles("test")
|
|
74
|
+
class MarketIntegrationTest {
|
|
75
|
+
@Autowired MockMvc mockMvc;
|
|
76
|
+
|
|
77
|
+
@Test
|
|
78
|
+
void createsMarket() throws Exception {
|
|
79
|
+
mockMvc.perform(post("/api/markets")
|
|
80
|
+
.contentType(MediaType.APPLICATION_JSON)
|
|
81
|
+
.content("""
|
|
82
|
+
{"name":"Test","description":"Desc","endDate":"2030-01-01T00:00:00Z","categories":["general"]}
|
|
83
|
+
"""))
|
|
84
|
+
.andExpect(status().isCreated());
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Persistence Tests (DataJpaTest)
|
|
90
|
+
|
|
91
|
+
```java
|
|
92
|
+
@DataJpaTest
|
|
93
|
+
@AutoConfigureTestDatabase(replace = AutoConfigureTestDatabase.Replace.NONE)
|
|
94
|
+
@Import(TestContainersConfig.class)
|
|
95
|
+
class MarketRepositoryTest {
|
|
96
|
+
@Autowired MarketRepository repo;
|
|
97
|
+
|
|
98
|
+
@Test
|
|
99
|
+
void savesAndFinds() {
|
|
100
|
+
MarketEntity entity = new MarketEntity();
|
|
101
|
+
entity.setName("Test");
|
|
102
|
+
repo.save(entity);
|
|
103
|
+
|
|
104
|
+
Optional<MarketEntity> found = repo.findByName("Test");
|
|
105
|
+
assertThat(found).isPresent();
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Testcontainers
|
|
111
|
+
|
|
112
|
+
- Use reusable containers for Postgres/Redis to mirror production
|
|
113
|
+
- Wire via `@DynamicPropertySource` to inject JDBC URLs into Spring context
|
|
114
|
+
|
|
115
|
+
## Coverage (JaCoCo)
|
|
116
|
+
|
|
117
|
+
Maven snippet:
|
|
118
|
+
```xml
|
|
119
|
+
<plugin>
|
|
120
|
+
<groupId>org.jacoco</groupId>
|
|
121
|
+
<artifactId>jacoco-maven-plugin</artifactId>
|
|
122
|
+
<version>0.8.14</version>
|
|
123
|
+
<executions>
|
|
124
|
+
<execution>
|
|
125
|
+
<goals><goal>prepare-agent</goal></goals>
|
|
126
|
+
</execution>
|
|
127
|
+
<execution>
|
|
128
|
+
<id>report</id>
|
|
129
|
+
<phase>verify</phase>
|
|
130
|
+
<goals><goal>report</goal></goals>
|
|
131
|
+
</execution>
|
|
132
|
+
</executions>
|
|
133
|
+
</plugin>
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
## Assertions
|
|
137
|
+
|
|
138
|
+
- Prefer AssertJ (`assertThat`) for readability
|
|
139
|
+
- For JSON responses, use `jsonPath`
|
|
140
|
+
- For exceptions: `assertThatThrownBy(...)`
|
|
141
|
+
|
|
142
|
+
## Test Data Builders
|
|
143
|
+
|
|
144
|
+
```java
|
|
145
|
+
class MarketBuilder {
|
|
146
|
+
private String name = "Test";
|
|
147
|
+
MarketBuilder withName(String name) { this.name = name; return this; }
|
|
148
|
+
Market build() { return new Market(null, name, MarketStatus.ACTIVE); }
|
|
149
|
+
}
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## CI Commands
|
|
153
|
+
|
|
154
|
+
- Maven: `mvn -T 4 test` or `mvn verify`
|
|
155
|
+
- Gradle: `./gradlew test jacocoTestReport`
|
|
156
|
+
|
|
157
|
+
**Remember**: Keep tests fast, isolated, and deterministic. Test behavior, not implementation details.
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: springboot-verification
|
|
3
|
+
description: Verification loop for Spring Boot projects: build, static analysis, tests with coverage, security scans, and diff review before release or PR.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Spring Boot Verification Loop
|
|
7
|
+
|
|
8
|
+
Run before PRs, after major changes, and pre-deploy.
|
|
9
|
+
|
|
10
|
+
## Phase 1: Build
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
mvn -T 4 clean verify -DskipTests
|
|
14
|
+
# or
|
|
15
|
+
./gradlew clean assemble -x test
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
If build fails, stop and fix.
|
|
19
|
+
|
|
20
|
+
## Phase 2: Static Analysis
|
|
21
|
+
|
|
22
|
+
Maven (common plugins):
|
|
23
|
+
```bash
|
|
24
|
+
mvn -T 4 spotbugs:check pmd:check checkstyle:check
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Gradle (if configured):
|
|
28
|
+
```bash
|
|
29
|
+
./gradlew checkstyleMain pmdMain spotbugsMain
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Phase 3: Tests + Coverage
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
mvn -T 4 test
|
|
36
|
+
mvn jacoco:report # verify 80%+ coverage
|
|
37
|
+
# or
|
|
38
|
+
./gradlew test jacocoTestReport
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Report:
|
|
42
|
+
- Total tests, passed/failed
|
|
43
|
+
- Coverage % (lines/branches)
|
|
44
|
+
|
|
45
|
+
## Phase 4: Security Scan
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
# Dependency CVEs
|
|
49
|
+
mvn org.owasp:dependency-check-maven:check
|
|
50
|
+
# or
|
|
51
|
+
./gradlew dependencyCheckAnalyze
|
|
52
|
+
|
|
53
|
+
# Secrets (git)
|
|
54
|
+
git secrets --scan # if configured
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Phase 5: Lint/Format (optional gate)
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
mvn spotless:apply # if using Spotless plugin
|
|
61
|
+
./gradlew spotlessApply
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Phase 6: Diff Review
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
git diff --stat
|
|
68
|
+
git diff
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Checklist:
|
|
72
|
+
- No debugging logs left (`System.out`, `log.debug` without guards)
|
|
73
|
+
- Meaningful errors and HTTP statuses
|
|
74
|
+
- Transactions and validation present where needed
|
|
75
|
+
- Config changes documented
|
|
76
|
+
|
|
77
|
+
## Output Template
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
VERIFICATION REPORT
|
|
81
|
+
===================
|
|
82
|
+
Build: [PASS/FAIL]
|
|
83
|
+
Static: [PASS/FAIL] (spotbugs/pmd/checkstyle)
|
|
84
|
+
Tests: [PASS/FAIL] (X/Y passed, Z% coverage)
|
|
85
|
+
Security: [PASS/FAIL] (CVE findings: N)
|
|
86
|
+
Diff: [X files changed]
|
|
87
|
+
|
|
88
|
+
Overall: [READY / NOT READY]
|
|
89
|
+
|
|
90
|
+
Issues to Fix:
|
|
91
|
+
1. ...
|
|
92
|
+
2. ...
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Continuous Mode
|
|
96
|
+
|
|
97
|
+
- Re-run phases on significant changes or every 30–60 minutes in long sessions
|
|
98
|
+
- Keep a short loop: `mvn -T 4 test` + spotbugs for quick feedback
|
|
99
|
+
|
|
100
|
+
**Remember**: Fast feedback beats late surprises. Keep the gate strict—treat warnings as defects in production systems.
|