@corbat-tech/coding-standards-mcp 1.0.3 → 2.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/README.md +233 -337
- package/dist/agent.d.ts +5 -6
- package/dist/agent.d.ts.map +1 -1
- package/dist/agent.js +95 -217
- package/dist/agent.js.map +1 -1
- package/dist/analysis/code-analyzer.d.ts +44 -0
- package/dist/analysis/code-analyzer.d.ts.map +1 -0
- package/dist/analysis/code-analyzer.js +528 -0
- package/dist/analysis/code-analyzer.js.map +1 -0
- package/dist/errors.d.ts +58 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +112 -0
- package/dist/errors.js.map +1 -0
- package/dist/guardrails.d.ts +35 -0
- package/dist/guardrails.d.ts.map +1 -0
- package/dist/guardrails.js +303 -0
- package/dist/guardrails.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/logger.d.ts +36 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +63 -0
- package/dist/logger.js.map +1 -0
- package/dist/metrics.d.ts +40 -0
- package/dist/metrics.d.ts.map +1 -0
- package/dist/metrics.js +97 -0
- package/dist/metrics.js.map +1 -0
- package/dist/profiles.d.ts +1 -1
- package/dist/profiles.d.ts.map +1 -1
- package/dist/profiles.js +239 -108
- package/dist/profiles.js.map +1 -1
- package/dist/prompts.js +1 -1
- package/dist/prompts.js.map +1 -1
- package/dist/tools/definitions.d.ts +143 -0
- package/dist/tools/definitions.d.ts.map +1 -0
- package/dist/tools/definitions.js +229 -0
- package/dist/tools/definitions.js.map +1 -0
- package/dist/tools/handlers/get-context.d.ts +12 -0
- package/dist/tools/handlers/get-context.d.ts.map +1 -0
- package/dist/tools/handlers/get-context.js +233 -0
- package/dist/tools/handlers/get-context.js.map +1 -0
- package/dist/tools/handlers/health.d.ts +11 -0
- package/dist/tools/handlers/health.d.ts.map +1 -0
- package/dist/tools/handlers/health.js +57 -0
- package/dist/tools/handlers/health.js.map +1 -0
- package/dist/tools/handlers/index.d.ts +12 -0
- package/dist/tools/handlers/index.d.ts.map +1 -0
- package/dist/tools/handlers/index.js +12 -0
- package/dist/tools/handlers/index.js.map +1 -0
- package/dist/tools/handlers/init.d.ts +12 -0
- package/dist/tools/handlers/init.d.ts.map +1 -0
- package/dist/tools/handlers/init.js +102 -0
- package/dist/tools/handlers/init.js.map +1 -0
- package/dist/tools/handlers/profiles.d.ts +11 -0
- package/dist/tools/handlers/profiles.d.ts.map +1 -0
- package/dist/tools/handlers/profiles.js +25 -0
- package/dist/tools/handlers/profiles.js.map +1 -0
- package/dist/tools/handlers/search.d.ts +12 -0
- package/dist/tools/handlers/search.d.ts.map +1 -0
- package/dist/tools/handlers/search.js +58 -0
- package/dist/tools/handlers/search.js.map +1 -0
- package/dist/tools/handlers/validate.d.ts +15 -0
- package/dist/tools/handlers/validate.d.ts.map +1 -0
- package/dist/tools/handlers/validate.js +71 -0
- package/dist/tools/handlers/validate.js.map +1 -0
- package/dist/tools/handlers/verify.d.ts +38 -0
- package/dist/tools/handlers/verify.d.ts.map +1 -0
- package/dist/tools/handlers/verify.js +172 -0
- package/dist/tools/handlers/verify.js.map +1 -0
- package/dist/tools/index.d.ts +22 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +75 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/schemas.d.ts +29 -0
- package/dist/tools/schemas.d.ts.map +1 -0
- package/dist/tools/schemas.js +20 -0
- package/dist/tools/schemas.js.map +1 -0
- package/dist/tools.js +2 -2
- package/dist/tools.js.map +1 -1
- package/dist/types.d.ts +141 -71
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +92 -40
- package/dist/types.js.map +1 -1
- package/package.json +2 -2
- package/profiles/examples/microservice-kafka.yaml +122 -0
- package/profiles/examples/startup-fast.yaml +67 -0
- package/profiles/examples/strict-enterprise.yaml +62 -0
- package/profiles/templates/angular.yaml +614 -0
- package/profiles/templates/csharp-dotnet.yaml +529 -0
- package/profiles/templates/flutter.yaml +547 -0
- package/profiles/templates/go.yaml +1276 -0
- package/profiles/templates/java-spring-backend.yaml +326 -0
- package/profiles/templates/kotlin-spring.yaml +417 -0
- package/profiles/templates/nextjs.yaml +536 -0
- package/profiles/templates/nodejs.yaml +594 -0
- package/profiles/templates/python.yaml +546 -0
- package/profiles/templates/react.yaml +456 -0
- package/profiles/templates/rust.yaml +508 -0
- package/profiles/templates/vue.yaml +483 -0
package/README.md
CHANGED
|
@@ -1,455 +1,351 @@
|
|
|
1
1
|
<div align="center">
|
|
2
2
|
|
|
3
3
|
# CORBAT MCP
|
|
4
|
-
#### Coding Standards Server
|
|
4
|
+
#### AI Coding Standards Server
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
**The only MCP that makes Claude generate professional-grade code — with proper architecture, comprehensive tests, and zero code smells.**
|
|
6
|
+
**AI-generated code that passes code review on the first try.**
|
|
9
7
|
|
|
10
8
|
[](https://www.npmjs.com/package/@corbat-tech/coding-standards-mcp)
|
|
11
9
|
[](https://github.com/corbat-tech/coding-standards-mcp/actions/workflows/ci.yml)
|
|
10
|
+
[](https://github.com/corbat-tech/coding-standards-mcp)
|
|
12
11
|
[](LICENSE)
|
|
13
12
|
[](https://modelcontextprotocol.io/)
|
|
14
13
|
|
|
15
|
-
</div>
|
|
16
|
-
|
|
17
|
-
<p align="center">
|
|
18
|
-
<img src="assets/demo.gif" alt="CORBAT Demo" width="800">
|
|
19
|
-
</p>
|
|
20
|
-
|
|
21
14
|
---
|
|
22
15
|
|
|
23
|
-
|
|
16
|
+
[](docs/setup.md#cursor)
|
|
17
|
+
[](docs/setup.md#vs-code)
|
|
18
|
+
[](docs/setup.md#windsurf)
|
|
19
|
+
[](docs/setup.md#jetbrains-ides)
|
|
20
|
+
[](docs/setup.md#zed)
|
|
21
|
+
[](docs/setup.md#claude-desktop)
|
|
24
22
|
|
|
25
|
-
|
|
23
|
+
**Works with GitHub Copilot, Continue, Cline, Tabnine, Amazon Q, and [25+ more tools](docs/compatibility.md)**
|
|
26
24
|
|
|
27
|
-
|
|
28
|
-
❌ No dependency injection
|
|
29
|
-
❌ Missing error handling
|
|
30
|
-
❌ Basic tests (if any)
|
|
31
|
-
❌ No input validation
|
|
32
|
-
❌ God classes and long methods
|
|
33
|
-
❌ Fails SonarQube quality gates
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
**You spend hours fixing AI-generated code to meet your team's standards.**
|
|
25
|
+
</div>
|
|
37
26
|
|
|
38
27
|
---
|
|
39
28
|
|
|
40
|
-
##
|
|
29
|
+
## The Problem
|
|
41
30
|
|
|
42
|
-
|
|
43
|
-
<tr>
|
|
44
|
-
<td width="50%">
|
|
31
|
+
AI-generated code works, but rarely passes code review:
|
|
45
32
|
|
|
46
|
-
|
|
33
|
+
| Without Corbat | With Corbat |
|
|
34
|
+
|----------------|-------------|
|
|
35
|
+
| No dependency injection | Proper DI with interfaces |
|
|
36
|
+
| Missing error handling | Custom error types with context |
|
|
37
|
+
| Basic tests (if any) | 80%+ coverage with TDD |
|
|
38
|
+
| God classes, long methods | SOLID, max 20 lines/method |
|
|
39
|
+
| Fails SonarQube | Passes quality gates |
|
|
47
40
|
|
|
48
|
-
|
|
49
|
-
class UserService {
|
|
50
|
-
private users: User[] = [];
|
|
51
|
-
|
|
52
|
-
getUser(id: string) {
|
|
53
|
-
return this.users.find(u => u.id === id);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
createUser(name: string, email: string) {
|
|
57
|
-
const user = { id: Date.now(), name, email };
|
|
58
|
-
this.users.push(user);
|
|
59
|
-
return user;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
```
|
|
41
|
+
**Result:** Production-ready code that passes code review.
|
|
63
42
|
|
|
64
|
-
|
|
65
|
-
- No validation
|
|
66
|
-
- No error types
|
|
67
|
-
- No interfaces
|
|
68
|
-
- 6 basic tests
|
|
69
|
-
|
|
70
|
-
</td>
|
|
71
|
-
<td width="50%">
|
|
72
|
-
|
|
73
|
-
### With Corbat MCP
|
|
74
|
-
|
|
75
|
-
```typescript
|
|
76
|
-
interface UserRepository {
|
|
77
|
-
findById(id: UserId): User | null;
|
|
78
|
-
save(user: User): void;
|
|
79
|
-
}
|
|
43
|
+
---
|
|
80
44
|
|
|
81
|
-
|
|
82
|
-
constructor(
|
|
83
|
-
private readonly repository: UserRepository,
|
|
84
|
-
private readonly idGenerator: IdGenerator
|
|
85
|
-
) {}
|
|
45
|
+
## Quick Start
|
|
86
46
|
|
|
87
|
-
|
|
88
|
-
const user = this.repository.findById(id);
|
|
89
|
-
if (!user) throw new UserNotFoundError(id);
|
|
90
|
-
return user;
|
|
91
|
-
}
|
|
47
|
+
**1. Add to your MCP config:**
|
|
92
48
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
this.repository.save(user);
|
|
101
|
-
return user;
|
|
49
|
+
```json
|
|
50
|
+
{
|
|
51
|
+
"mcpServers": {
|
|
52
|
+
"corbat": {
|
|
53
|
+
"command": "npx",
|
|
54
|
+
"args": ["-y", "@corbat-tech/coding-standards-mcp"]
|
|
55
|
+
}
|
|
102
56
|
}
|
|
103
57
|
}
|
|
104
58
|
```
|
|
105
59
|
|
|
106
|
-
|
|
107
|
-
- Custom error types
|
|
108
|
-
- Input validation & normalization
|
|
109
|
-
- Repository pattern (ports & adapters)
|
|
110
|
-
- 15 comprehensive tests
|
|
60
|
+
**2. Config file location:**
|
|
111
61
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
62
|
+
| Tool | Location |
|
|
63
|
+
|------|----------|
|
|
64
|
+
| Cursor | `.cursor/mcp.json` |
|
|
65
|
+
| VS Code | `.vscode/mcp.json` |
|
|
66
|
+
| Windsurf | `~/.codeium/windsurf/mcp_config.json` |
|
|
67
|
+
| JetBrains | Settings → AI Assistant → MCP |
|
|
68
|
+
| Claude Desktop | `~/.config/Claude/claude_desktop_config.json` |
|
|
69
|
+
| Claude Code | `claude mcp add corbat -- npx -y @corbat-tech/coding-standards-mcp` |
|
|
115
70
|
|
|
116
|
-
|
|
71
|
+
> [Complete setup guide](docs/setup.md) for all 25+ tools
|
|
117
72
|
|
|
118
|
-
|
|
73
|
+
**3. Done!** Corbat auto-detects your stack.
|
|
119
74
|
|
|
120
|
-
|
|
75
|
+
```
|
|
76
|
+
You: "Create a payment service"
|
|
121
77
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
<th>Improvement</th>
|
|
128
|
-
</tr>
|
|
129
|
-
<tr>
|
|
130
|
-
<td><b>Quality Score</b></td>
|
|
131
|
-
<td>63/100</td>
|
|
132
|
-
<td>93/100</td>
|
|
133
|
-
<td><b>+48%</b></td>
|
|
134
|
-
</tr>
|
|
135
|
-
<tr>
|
|
136
|
-
<td><b>Code Smells</b></td>
|
|
137
|
-
<td>43</td>
|
|
138
|
-
<td>0</td>
|
|
139
|
-
<td><b>-100%</b></td>
|
|
140
|
-
</tr>
|
|
141
|
-
<tr>
|
|
142
|
-
<td><b>SOLID Compliance</b></td>
|
|
143
|
-
<td>50%</td>
|
|
144
|
-
<td>89%</td>
|
|
145
|
-
<td><b>+78%</b></td>
|
|
146
|
-
</tr>
|
|
147
|
-
<tr>
|
|
148
|
-
<td><b>Test Coverage</b></td>
|
|
149
|
-
<td>219 tests</td>
|
|
150
|
-
<td>558 tests</td>
|
|
151
|
-
<td><b>+155%</b></td>
|
|
152
|
-
</tr>
|
|
153
|
-
<tr>
|
|
154
|
-
<td><b>SonarQube Gate</b></td>
|
|
155
|
-
<td>FAIL</td>
|
|
156
|
-
<td>PASS</td>
|
|
157
|
-
<td><b>Fixed</b></td>
|
|
158
|
-
</tr>
|
|
159
|
-
</table>
|
|
78
|
+
Corbat: ✓ Detected: Java 21, Spring Boot 3, Maven
|
|
79
|
+
✓ Profile: java-spring-backend
|
|
80
|
+
✓ Architecture: Hexagonal + DDD
|
|
81
|
+
✓ Testing: TDD, 80%+ coverage
|
|
82
|
+
```
|
|
160
83
|
|
|
161
|
-
|
|
84
|
+
---
|
|
162
85
|
|
|
163
|
-
|
|
86
|
+
## Benchmark Results v2.0
|
|
164
87
|
|
|
165
|
-
|
|
88
|
+
### Overall Impact
|
|
166
89
|
|
|
167
|
-
|
|
90
|
+
<div align="center">
|
|
168
91
|
|
|
169
|
-
|
|
|
170
|
-
|
|
171
|
-
| **
|
|
172
|
-
|
|
|
173
|
-
|
|
|
174
|
-
|
|
|
92
|
+
| Metric | Without Corbat | With Corbat | **Improvement** |
|
|
93
|
+
|--------|:--------------:|:-----------:|:---------------:|
|
|
94
|
+
| **Quality Score** | 4.6/10 | 7.7/10 | **+67%** |
|
|
95
|
+
| **Custom Errors** | 3 | 18 | **+500%** |
|
|
96
|
+
| **Interfaces/Ports** | 19 | 41 | **+116%** |
|
|
97
|
+
| **Files (modularity)** | 55 | 95 | **+73%** |
|
|
175
98
|
|
|
176
|
-
|
|
99
|
+
</div>
|
|
177
100
|
|
|
178
|
-
###
|
|
101
|
+
### By Complexity Level
|
|
179
102
|
|
|
180
|
-
|
|
|
181
|
-
|
|
182
|
-
|
|
|
183
|
-
|
|
|
184
|
-
|
|
|
185
|
-
| Comprehensive benchmark data | **Yes** | No |
|
|
186
|
-
| 7 production-ready profiles | **Yes** | Basic |
|
|
103
|
+
| Category | Scenarios | Without | With | **Improvement** |
|
|
104
|
+
|----------|-----------|:-------:|:----:|:---------------:|
|
|
105
|
+
| **Basic** | UserService, REST API, React Form | 4.0 | 7.6 | **+90%** |
|
|
106
|
+
| **Intermediate** | Kafka Consumer, FastAPI, Go HTTP | 4.3 | 7.2 | **+67%** |
|
|
107
|
+
| **Advanced** | Saga, Circuit Breaker, Event Sourcing | 5.6 | 8.2 | **+46%** |
|
|
187
108
|
|
|
188
|
-
|
|
109
|
+
### Pattern Detection
|
|
189
110
|
|
|
190
|
-
|
|
111
|
+
| Pattern | Without Corbat | With Corbat |
|
|
112
|
+
|---------|:--------------:|:-----------:|
|
|
113
|
+
| Hexagonal Architecture | 0/10 scenarios | **10/10** |
|
|
114
|
+
| Repository Pattern | 2/10 | **7/10** |
|
|
115
|
+
| Custom Error Types | 1/10 | **8/10** |
|
|
116
|
+
| Dependency Injection | 2/10 | **10/10** |
|
|
117
|
+
| Saga Pattern | 0/10 | **1/1** (when needed) |
|
|
191
118
|
|
|
192
|
-
|
|
119
|
+
### Real Example: Saga Pattern (Scenario 07)
|
|
193
120
|
|
|
194
121
|
<table>
|
|
195
122
|
<tr>
|
|
196
|
-
<
|
|
123
|
+
<th>Without Corbat</th>
|
|
124
|
+
<th>With Corbat</th>
|
|
125
|
+
</tr>
|
|
126
|
+
<tr>
|
|
197
127
|
<td>
|
|
198
128
|
|
|
199
|
-
```
|
|
200
|
-
|
|
129
|
+
```java
|
|
130
|
+
// Hardcoded rollback, not extensible
|
|
131
|
+
try {
|
|
132
|
+
targetAccount.credit(amount);
|
|
133
|
+
} catch (Exception e) {
|
|
134
|
+
rollbackDebit(sourceAccount, amount);
|
|
135
|
+
throw new TransferException(...);
|
|
136
|
+
}
|
|
201
137
|
```
|
|
202
138
|
|
|
203
139
|
</td>
|
|
204
|
-
</tr>
|
|
205
|
-
<tr>
|
|
206
|
-
<td><b>Claude Desktop</b></td>
|
|
207
140
|
<td>
|
|
208
141
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
{
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
142
|
+
```java
|
|
143
|
+
// Reusable Saga Pattern
|
|
144
|
+
public interface SagaStep<T> {
|
|
145
|
+
void execute(T context);
|
|
146
|
+
void compensate(T context);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
public class SagaOrchestrator<T> {
|
|
150
|
+
public void execute(T context) {
|
|
151
|
+
for (SagaStep<T> step : steps) {
|
|
152
|
+
step.execute(context);
|
|
153
|
+
executedSteps.add(step);
|
|
216
154
|
}
|
|
217
155
|
}
|
|
156
|
+
// Auto-rollback on failure
|
|
218
157
|
}
|
|
219
158
|
```
|
|
220
159
|
|
|
221
160
|
</td>
|
|
222
161
|
</tr>
|
|
162
|
+
<tr>
|
|
163
|
+
<td>9 files, 292 LOC, manual rollback</td>
|
|
164
|
+
<td><b>17 files, 707 LOC, orchestrated compensation</b></td>
|
|
165
|
+
</tr>
|
|
223
166
|
</table>
|
|
224
167
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
```
|
|
228
|
-
You: "Create a payment service"
|
|
229
|
-
|
|
230
|
-
Corbat: ✓ Detected Java/Spring project
|
|
231
|
-
✓ Loaded java-spring-backend profile
|
|
232
|
-
✓ Applied hexagonal architecture rules
|
|
233
|
-
✓ Enforced TDD workflow
|
|
234
|
-
✓ Set 80%+ coverage requirement
|
|
235
|
-
```
|
|
236
|
-
|
|
237
|
-
**That's it.** Claude now generates code that passes code review.
|
|
168
|
+
[View full benchmark analysis with 10 scenarios](benchmarks/v2/ANALYSIS.md)
|
|
238
169
|
|
|
239
170
|
---
|
|
240
171
|
|
|
241
|
-
##
|
|
242
|
-
|
|
243
|
-
When you ask Claude to create code, Corbat MCP injects professional standards:
|
|
244
|
-
|
|
245
|
-
```markdown
|
|
246
|
-
## Detected
|
|
247
|
-
- Stack: Java 21 · Spring Boot 3 · Maven
|
|
248
|
-
- Task type: FEATURE
|
|
249
|
-
- Profile: java-spring-backend
|
|
250
|
-
|
|
251
|
-
## MUST
|
|
252
|
-
✓ Write tests BEFORE implementation (TDD)
|
|
253
|
-
✓ Use hexagonal architecture (domain → application → infrastructure)
|
|
254
|
-
✓ Apply SOLID principles
|
|
255
|
-
✓ Ensure 80%+ test coverage
|
|
256
|
-
✓ Create custom error types with context
|
|
257
|
-
✓ Validate all inputs at boundaries
|
|
258
|
-
|
|
259
|
-
## AVOID
|
|
260
|
-
✗ God classes (>200 lines) or god methods (>20 lines)
|
|
261
|
-
✗ Hard-coded configuration values
|
|
262
|
-
✗ Mixing business logic with infrastructure
|
|
263
|
-
✗ Returning null/undefined (use Result types or throw)
|
|
264
|
-
```
|
|
265
|
-
|
|
266
|
-
---
|
|
172
|
+
## Code Comparison
|
|
267
173
|
|
|
268
|
-
|
|
174
|
+
### Before: Without Corbat MCP
|
|
269
175
|
|
|
270
|
-
|
|
176
|
+
```typescript
|
|
177
|
+
class UserService {
|
|
178
|
+
private users: Map<string, User> = new Map();
|
|
271
179
|
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
| **Bugfix** | Write failing test first, minimal changes, document root cause |
|
|
276
|
-
| **Refactor** | Tests pass before AND after, no behavior changes, incremental |
|
|
277
|
-
| **Test** | AAA pattern, one assertion per test, descriptive names |
|
|
180
|
+
getById(id: string): User | undefined {
|
|
181
|
+
return this.users.get(id);
|
|
182
|
+
}
|
|
278
183
|
|
|
184
|
+
createUser(input: CreateUserInput): User {
|
|
185
|
+
if (!input.name) throw new Error('Name is required');
|
|
186
|
+
const user = { id: uuidv4(), ...input };
|
|
187
|
+
this.users.set(user.id, user);
|
|
188
|
+
return user;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
// ✗ Returns undefined ✗ Generic errors ✗ No DI ✗ Hardcoded storage
|
|
279
192
|
```
|
|
280
|
-
You: "Fix the login timeout bug"
|
|
281
193
|
|
|
282
|
-
|
|
283
|
-
Applies: Failing test first → Minimal fix → Verify no regressions
|
|
284
|
-
```
|
|
194
|
+
### After: With Corbat MCP
|
|
285
195
|
|
|
286
|
-
|
|
196
|
+
```typescript
|
|
197
|
+
// Port (interface)
|
|
198
|
+
interface UserRepository {
|
|
199
|
+
findById(id: string): User | null;
|
|
200
|
+
save(user: User): void;
|
|
201
|
+
existsByEmail(email: string): boolean;
|
|
202
|
+
}
|
|
287
203
|
|
|
288
|
-
|
|
204
|
+
// Custom errors
|
|
205
|
+
class UserNotFoundError extends Error { /*...*/ }
|
|
206
|
+
class UserAlreadyExistsError extends Error { /*...*/ }
|
|
207
|
+
class InvalidUserInputError extends Error { /*...*/ }
|
|
289
208
|
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
| `angular` | Angular 19+ | Feature-based + Signals |
|
|
297
|
-
| `vue` | Vue 3.5+ | Composition API |
|
|
298
|
-
| `minimal` | Any | Basic quality standards |
|
|
209
|
+
// Service with DI
|
|
210
|
+
class UserService {
|
|
211
|
+
constructor(
|
|
212
|
+
private readonly repository: UserRepository,
|
|
213
|
+
private readonly idGenerator: IdGenerator
|
|
214
|
+
) {}
|
|
299
215
|
|
|
300
|
-
|
|
216
|
+
getUserById(id: string): User {
|
|
217
|
+
const user = this.repository.findById(id);
|
|
218
|
+
if (!user) throw new UserNotFoundError(id);
|
|
219
|
+
return user;
|
|
220
|
+
}
|
|
301
221
|
|
|
302
|
-
|
|
222
|
+
createUser(input: CreateUserInput): User {
|
|
223
|
+
this.validateInput(input);
|
|
224
|
+
this.ensureEmailNotTaken(input.email);
|
|
225
|
+
const user = createUser(this.idGenerator.generate(), input);
|
|
226
|
+
this.repository.save(user);
|
|
227
|
+
return user;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
// ✓ Repository interface ✓ 3 custom errors ✓ DI ✓ 11 tests ✓ Testable
|
|
231
|
+
```
|
|
303
232
|
|
|
304
|
-
|
|
233
|
+
**Result:** 3 files → 7 files | 129 LOC → 308 LOC | 0 interfaces → 4 interfaces | 0 custom errors → 3
|
|
305
234
|
|
|
306
|
-
|
|
235
|
+
---
|
|
307
236
|
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
|
311
|
-
|
|
312
|
-
|
|
|
313
|
-
|
|
|
314
|
-
|
|
|
237
|
+
## Built-in Profiles
|
|
238
|
+
|
|
239
|
+
| Profile | Stack | Architecture | Testing |
|
|
240
|
+
|---------|-------|--------------|---------|
|
|
241
|
+
| `java-spring-backend` | Java 21 + Spring Boot 3 | Hexagonal + DDD + CQRS | TDD, 80%+ coverage |
|
|
242
|
+
| `kotlin-spring` | Kotlin + Spring Boot 3 | Hexagonal + Coroutines | Kotest, MockK |
|
|
243
|
+
| `nodejs` | Node.js + TypeScript | Clean Architecture | Vitest |
|
|
244
|
+
| `nextjs` | Next.js 14+ | Feature-based + RSC | Vitest, Playwright |
|
|
245
|
+
| `react` | React 18+ | Feature-based | Testing Library |
|
|
246
|
+
| `vue` | Vue 3.5+ | Feature-based | Vitest |
|
|
247
|
+
| `angular` | Angular 19+ | Feature modules | Jest |
|
|
248
|
+
| `python` | Python + FastAPI | Hexagonal + async | pytest |
|
|
249
|
+
| `go` | Go 1.22+ | Clean + idiomatic | Table-driven tests |
|
|
250
|
+
| `rust` | Rust + Axum | Clean + ownership | Built-in + proptest |
|
|
251
|
+
| `csharp-dotnet` | C# 12 + ASP.NET Core 8 | Clean + CQRS | xUnit, FluentAssertions |
|
|
252
|
+
| `flutter` | Dart 3 + Flutter | Clean + BLoC/Riverpod | flutter_test |
|
|
253
|
+
| `minimal` | Any | Basic quality rules | Optional |
|
|
254
|
+
|
|
255
|
+
**Auto-detection:** Corbat reads `pom.xml`, `package.json`, `go.mod`, `Cargo.toml`, `pubspec.yaml`, `*.csproj` to select the right profile.
|
|
256
|
+
|
|
257
|
+
### Architecture Patterns Enforced
|
|
258
|
+
|
|
259
|
+
- **Hexagonal Architecture** — Ports & Adapters, infrastructure isolation
|
|
260
|
+
- **Domain-Driven Design** — Aggregates, Value Objects, Domain Events
|
|
261
|
+
- **SOLID Principles** — Single responsibility, dependency inversion
|
|
262
|
+
- **Clean Code** — Max 20 lines/method, meaningful names, no magic numbers
|
|
263
|
+
- **Error Handling** — Custom exceptions with context, no generic catches
|
|
264
|
+
- **Testing** — TDD workflow, unit + integration, mocking strategies
|
|
315
265
|
|
|
316
266
|
---
|
|
317
267
|
|
|
318
|
-
##
|
|
268
|
+
## Customize
|
|
319
269
|
|
|
320
|
-
|
|
321
|
-
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
|
|
322
|
-
│ Your Prompt │────▶│ Corbat MCP │────▶│ Claude + Rules │
|
|
323
|
-
│ │ │ │ │ │
|
|
324
|
-
│ "Create user │ │ 1. Detect stack │ │ Generates code │
|
|
325
|
-
│ service" │ │ 2. Classify task│ │ that passes │
|
|
326
|
-
│ │ │ 3. Load profile │ │ code review │
|
|
327
|
-
│ │ │ 4. Inject rules │ │ │
|
|
328
|
-
└─────────────────┘ └─────────────────┘ └─────────────────┘
|
|
329
|
-
```
|
|
270
|
+
### Ready-to-use templates
|
|
330
271
|
|
|
331
|
-
|
|
332
|
-
1. **Detects** your project's technology stack
|
|
333
|
-
2. **Classifies** the type of task (feature, bugfix, refactor, test)
|
|
334
|
-
3. **Loads** the appropriate profile with architecture rules
|
|
335
|
-
4. **Injects** guardrails before Claude generates any code
|
|
272
|
+
Copy a production-ready configuration for your stack:
|
|
336
273
|
|
|
337
|
-
|
|
274
|
+
**[Browse 14 templates](docs/templates.md)** — Java, Python, Node.js, React, Vue, Angular, Go, Kotlin, Rust, Flutter, and more.
|
|
338
275
|
|
|
339
|
-
|
|
276
|
+
### Generate a custom profile
|
|
340
277
|
|
|
341
|
-
### Interactive Setup
|
|
342
278
|
```bash
|
|
343
279
|
npx corbat-init
|
|
344
280
|
```
|
|
345
281
|
|
|
346
|
-
|
|
282
|
+
Interactive wizard that auto-detects your stack and lets you configure architecture, DDD patterns, and quality metrics.
|
|
283
|
+
|
|
284
|
+
### Manual config
|
|
347
285
|
|
|
348
286
|
Create `.corbat.json` in your project root:
|
|
349
287
|
|
|
350
288
|
```json
|
|
351
289
|
{
|
|
352
|
-
"profile": "
|
|
290
|
+
"profile": "java-spring-backend",
|
|
291
|
+
"architecture": {
|
|
292
|
+
"pattern": "hexagonal",
|
|
293
|
+
"layers": ["domain", "application", "infrastructure", "api"]
|
|
294
|
+
},
|
|
295
|
+
"ddd": {
|
|
296
|
+
"aggregates": true,
|
|
297
|
+
"valueObjects": true,
|
|
298
|
+
"domainEvents": true
|
|
299
|
+
},
|
|
300
|
+
"quality": {
|
|
301
|
+
"maxMethodLines": 20,
|
|
302
|
+
"maxClassLines": 200,
|
|
303
|
+
"minCoverage": 80
|
|
304
|
+
},
|
|
353
305
|
"rules": {
|
|
354
|
-
"always": [
|
|
355
|
-
|
|
356
|
-
"Prefer functional programming"
|
|
357
|
-
],
|
|
358
|
-
"never": [
|
|
359
|
-
"Use any type"
|
|
360
|
-
]
|
|
306
|
+
"always": ["Use records for DTOs", "Prefer Optional over null"],
|
|
307
|
+
"never": ["Use field injection", "Catch generic Exception"]
|
|
361
308
|
}
|
|
362
309
|
}
|
|
363
310
|
```
|
|
364
311
|
|
|
365
312
|
---
|
|
366
313
|
|
|
367
|
-
##
|
|
368
|
-
|
|
369
|
-
| Tool | Purpose |
|
|
370
|
-
|------|---------|
|
|
371
|
-
| `get_context` | **Primary** — Returns all standards for your task |
|
|
372
|
-
| `validate` | Check code against standards (returns compliance score) |
|
|
373
|
-
| `search` | Search 15 standards documents |
|
|
374
|
-
| `profiles` | List all available profiles |
|
|
375
|
-
| `health` | Server status and diagnostics |
|
|
376
|
-
|
|
377
|
-
---
|
|
378
|
-
|
|
379
|
-
## Compatibility
|
|
380
|
-
|
|
381
|
-
| Client | Status |
|
|
382
|
-
|--------|:------:|
|
|
383
|
-
| Claude Code (CLI) | ✅ Tested |
|
|
384
|
-
| Claude Desktop | ✅ Tested |
|
|
385
|
-
| Cursor | ⚠️ Experimental |
|
|
386
|
-
| Windsurf | ⚠️ Experimental |
|
|
387
|
-
| Other MCP clients | ✅ Standard protocol |
|
|
388
|
-
|
|
389
|
-
---
|
|
390
|
-
|
|
391
|
-
## Included Documentation
|
|
392
|
-
|
|
393
|
-
Corbat MCP comes with 15 searchable standards documents:
|
|
394
|
-
|
|
395
|
-
- **Architecture:** Hexagonal, DDD, Clean Architecture
|
|
396
|
-
- **Code Quality:** SOLID principles, Clean Code, Naming Conventions
|
|
397
|
-
- **Testing:** TDD workflow, Unit/Integration/E2E guidelines
|
|
398
|
-
- **DevOps:** Docker, Kubernetes, CI/CD best practices
|
|
399
|
-
- **Observability:** Structured logging, Metrics, Distributed tracing
|
|
400
|
-
|
|
401
|
-
Use the search tool: `"search kafka"` → Returns event-driven architecture guidelines.
|
|
402
|
-
|
|
403
|
-
---
|
|
404
|
-
|
|
405
|
-
## Troubleshooting
|
|
406
|
-
|
|
407
|
-
<details>
|
|
408
|
-
<summary><b>Claude can't find corbat</b></summary>
|
|
409
|
-
|
|
410
|
-
1. Verify npm/npx is in PATH: `which npx`
|
|
411
|
-
2. Test manually: `npx @corbat-tech/coding-standards-mcp`
|
|
412
|
-
3. Restart Claude completely
|
|
413
|
-
4. Check Claude's MCP logs
|
|
414
|
-
|
|
415
|
-
</details>
|
|
416
|
-
|
|
417
|
-
<details>
|
|
418
|
-
<summary><b>Wrong stack detected</b></summary>
|
|
314
|
+
## How It Works
|
|
419
315
|
|
|
420
|
-
Override with `.corbat.json`:
|
|
421
|
-
```json
|
|
422
|
-
{ "profile": "nodejs" }
|
|
423
316
|
```
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
1. Check if `.corbat.json` exists in project root
|
|
433
|
-
2. Verify profile exists
|
|
434
|
-
3. Try explicit: *"Use corbat get_context for: your task"*
|
|
435
|
-
|
|
436
|
-
</details>
|
|
317
|
+
Your Prompt ──▶ Corbat MCP ──▶ AI + Standards
|
|
318
|
+
│
|
|
319
|
+
├─ 1. Detect stack (pom.xml, package.json...)
|
|
320
|
+
├─ 2. Classify task (feature, bugfix, refactor)
|
|
321
|
+
├─ 3. Load profile with architecture rules
|
|
322
|
+
└─ 4. Inject guardrails before code generation
|
|
323
|
+
```
|
|
437
324
|
|
|
438
325
|
---
|
|
439
326
|
|
|
440
|
-
##
|
|
327
|
+
## Documentation
|
|
441
328
|
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
329
|
+
| Resource | Description |
|
|
330
|
+
|----------|-------------|
|
|
331
|
+
| [Setup Guide](docs/setup.md) | Installation for all 25+ tools |
|
|
332
|
+
| [Templates](docs/templates.md) | Ready-to-use `.corbat.json` configurations |
|
|
333
|
+
| [Compatibility](docs/compatibility.md) | Full list of supported tools |
|
|
334
|
+
| [Benchmark v2 Analysis](benchmarks/v2/ANALYSIS.md) | 10 scenarios with detailed comparison |
|
|
335
|
+
| [API Reference](docs/full-documentation.md) | Tools, prompts, and configuration |
|
|
446
336
|
|
|
447
337
|
---
|
|
448
338
|
|
|
449
339
|
<div align="center">
|
|
450
340
|
|
|
451
|
-
**Stop fixing AI
|
|
341
|
+
**Stop fixing AI code. Start shipping it.**
|
|
342
|
+
|
|
343
|
+
| Without Corbat | With Corbat |
|
|
344
|
+
|:--------------:|:-----------:|
|
|
345
|
+
| 4.6/10 quality | **7.7/10 quality** |
|
|
346
|
+
| 3 custom errors | **18 custom errors** |
|
|
347
|
+
| 0% hexagonal | **100% hexagonal** |
|
|
452
348
|
|
|
453
|
-
|
|
349
|
+
*Recommended by [corbat-tech](https://corbat.tech) — We use Claude Code internally, but Corbat MCP works with any MCP-compatible tool.*
|
|
454
350
|
|
|
455
351
|
</div>
|