@corbat-tech/coding-standards-mcp 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.
Files changed (89) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +371 -0
  3. package/assets/demo.gif +0 -0
  4. package/dist/agent.d.ts +53 -0
  5. package/dist/agent.d.ts.map +1 -0
  6. package/dist/agent.js +629 -0
  7. package/dist/agent.js.map +1 -0
  8. package/dist/cli/init.d.ts +3 -0
  9. package/dist/cli/init.d.ts.map +1 -0
  10. package/dist/cli/init.js +651 -0
  11. package/dist/cli/init.js.map +1 -0
  12. package/dist/config.d.ts +73 -0
  13. package/dist/config.d.ts.map +1 -0
  14. package/dist/config.js +105 -0
  15. package/dist/config.js.map +1 -0
  16. package/dist/index.d.ts +3 -0
  17. package/dist/index.d.ts.map +1 -0
  18. package/dist/index.js +73 -0
  19. package/dist/index.js.map +1 -0
  20. package/dist/profiles.d.ts +39 -0
  21. package/dist/profiles.d.ts.map +1 -0
  22. package/dist/profiles.js +526 -0
  23. package/dist/profiles.js.map +1 -0
  24. package/dist/prompts-legacy.d.ts +25 -0
  25. package/dist/prompts-legacy.d.ts.map +1 -0
  26. package/dist/prompts-legacy.js +600 -0
  27. package/dist/prompts-legacy.js.map +1 -0
  28. package/dist/prompts-v2.d.ts +30 -0
  29. package/dist/prompts-v2.d.ts.map +1 -0
  30. package/dist/prompts-v2.js +310 -0
  31. package/dist/prompts-v2.js.map +1 -0
  32. package/dist/prompts.d.ts +30 -0
  33. package/dist/prompts.d.ts.map +1 -0
  34. package/dist/prompts.js +310 -0
  35. package/dist/prompts.js.map +1 -0
  36. package/dist/resources.d.ts +18 -0
  37. package/dist/resources.d.ts.map +1 -0
  38. package/dist/resources.js +95 -0
  39. package/dist/resources.js.map +1 -0
  40. package/dist/tools-legacy.d.ts +196 -0
  41. package/dist/tools-legacy.d.ts.map +1 -0
  42. package/dist/tools-legacy.js +1230 -0
  43. package/dist/tools-legacy.js.map +1 -0
  44. package/dist/tools-v2.d.ts +92 -0
  45. package/dist/tools-v2.d.ts.map +1 -0
  46. package/dist/tools-v2.js +410 -0
  47. package/dist/tools-v2.js.map +1 -0
  48. package/dist/tools.d.ts +92 -0
  49. package/dist/tools.d.ts.map +1 -0
  50. package/dist/tools.js +410 -0
  51. package/dist/tools.js.map +1 -0
  52. package/dist/types.d.ts +3054 -0
  53. package/dist/types.d.ts.map +1 -0
  54. package/dist/types.js +515 -0
  55. package/dist/types.js.map +1 -0
  56. package/dist/utils/index.d.ts +6 -0
  57. package/dist/utils/index.d.ts.map +1 -0
  58. package/dist/utils/index.js +5 -0
  59. package/dist/utils/index.js.map +1 -0
  60. package/dist/utils/retry.d.ts +44 -0
  61. package/dist/utils/retry.d.ts.map +1 -0
  62. package/dist/utils/retry.js +74 -0
  63. package/dist/utils/retry.js.map +1 -0
  64. package/package.json +79 -0
  65. package/profiles/README.md +199 -0
  66. package/profiles/custom/.gitkeep +2 -0
  67. package/profiles/templates/_template.yaml +159 -0
  68. package/profiles/templates/angular.yaml +494 -0
  69. package/profiles/templates/java-spring-backend.yaml +512 -0
  70. package/profiles/templates/minimal.yaml +102 -0
  71. package/profiles/templates/nodejs.yaml +338 -0
  72. package/profiles/templates/python.yaml +340 -0
  73. package/profiles/templates/react.yaml +331 -0
  74. package/profiles/templates/vue.yaml +598 -0
  75. package/standards/architecture/ddd.md +173 -0
  76. package/standards/architecture/hexagonal.md +97 -0
  77. package/standards/cicd/github-actions.md +567 -0
  78. package/standards/clean-code/naming.md +175 -0
  79. package/standards/clean-code/principles.md +179 -0
  80. package/standards/containerization/dockerfile.md +419 -0
  81. package/standards/database/selection-guide.md +443 -0
  82. package/standards/documentation/guidelines.md +189 -0
  83. package/standards/event-driven/domain-events.md +527 -0
  84. package/standards/kubernetes/deployment.md +518 -0
  85. package/standards/observability/guidelines.md +665 -0
  86. package/standards/project-setup/initialization-checklist.md +650 -0
  87. package/standards/spring-boot/best-practices.md +598 -0
  88. package/standards/testing/guidelines.md +559 -0
  89. package/standards/workflow/llm-development-workflow.md +542 -0
@@ -0,0 +1,175 @@
1
+ # Naming Conventions
2
+
3
+ ## Overview
4
+
5
+ Consistent naming is crucial for code readability. These conventions apply to Java/Kotlin development but principles extend to other languages.
6
+
7
+ ## General Rules
8
+
9
+ 1. **Be descriptive**: Names should reveal intent
10
+ 2. **Be consistent**: Same concept = same name throughout codebase
11
+ 3. **Be searchable**: Avoid single-letter names except for loops
12
+ 4. **Avoid abbreviations**: Use `customerId` not `custId`
13
+ 5. **Use domain language**: Names from the ubiquitous language
14
+
15
+ ## Case Conventions
16
+
17
+ | Element | Convention | Example |
18
+ |---------|------------|---------|
19
+ | Class | PascalCase | `OrderService` |
20
+ | Interface | PascalCase | `OrderRepository` |
21
+ | Method | camelCase | `calculateTotal()` |
22
+ | Variable | camelCase | `orderTotal` |
23
+ | Constant | SCREAMING_SNAKE_CASE | `MAX_RETRY_COUNT` |
24
+ | Package | lowercase.separated | `com.company.domain` |
25
+ | Enum | PascalCase | `OrderStatus` |
26
+ | Enum Value | SCREAMING_SNAKE_CASE | `PENDING_PAYMENT` |
27
+
28
+ ## Class Naming
29
+
30
+ ### Entities
31
+ Name after the domain concept:
32
+ ```java
33
+ Order, Customer, Product, Invoice
34
+ ```
35
+
36
+ ### Value Objects
37
+ Name after what they represent:
38
+ ```java
39
+ Money, Email, PhoneNumber, Address, OrderId
40
+ ```
41
+
42
+ ### Services
43
+ `[Domain][Action]Service`:
44
+ ```java
45
+ OrderPlacementService, PaymentProcessingService
46
+ ```
47
+
48
+ ### Repositories
49
+ `[Aggregate]Repository`:
50
+ ```java
51
+ OrderRepository, CustomerRepository
52
+ ```
53
+
54
+ ### Controllers
55
+ `[Resource]Controller`:
56
+ ```java
57
+ OrderController, CustomerController
58
+ ```
59
+
60
+ ### Use Cases
61
+ `[Action][Subject]UseCase`:
62
+ ```java
63
+ PlaceOrderUseCase, CancelOrderUseCase, GetCustomerUseCase
64
+ ```
65
+
66
+ ### DTOs
67
+ `[Purpose][Subject]Dto` or `[Subject][Purpose]`:
68
+ ```java
69
+ CreateOrderRequest, OrderResponse, CustomerDto
70
+ ```
71
+
72
+ ### Exceptions
73
+ `[Problem]Exception`:
74
+ ```java
75
+ OrderNotFoundException, InsufficientFundsException
76
+ ```
77
+
78
+ ## Method Naming
79
+
80
+ ### Query Methods (return data, no side effects)
81
+ ```java
82
+ findById(), getCustomer(), calculateTotal()
83
+ findAllByStatus(), existsById(), countByType()
84
+ ```
85
+
86
+ ### Command Methods (perform actions)
87
+ ```java
88
+ save(), delete(), process(), execute()
89
+ placeOrder(), cancelSubscription(), sendNotification()
90
+ ```
91
+
92
+ ### Boolean Methods
93
+ Use `is`, `has`, `can`, `should`:
94
+ ```java
95
+ isValid(), hasPermission(), canExecute(), shouldRetry()
96
+ isEmpty(), isEnabled(), hasItems()
97
+ ```
98
+
99
+ ### Factory Methods
100
+ ```java
101
+ of(), from(), create(), valueOf()
102
+ Money.of(100, "USD")
103
+ Order.from(orderDto)
104
+ ```
105
+
106
+ ## Variable Naming
107
+
108
+ ### Collections
109
+ Use plural nouns:
110
+ ```java
111
+ List<Order> orders;
112
+ Set<Customer> customers;
113
+ Map<OrderId, Order> ordersById;
114
+ ```
115
+
116
+ ### Booleans
117
+ Use affirmative names:
118
+ ```java
119
+ boolean isActive; // not: isNotActive
120
+ boolean hasAccess; // not: noAccess
121
+ boolean enabled; // not: disabled
122
+ ```
123
+
124
+ ### Avoid Noise Words
125
+ ```java
126
+ // Bad
127
+ String nameString;
128
+ Customer customerObject;
129
+ List<Order> orderList;
130
+
131
+ // Good
132
+ String name;
133
+ Customer customer;
134
+ List<Order> orders;
135
+ ```
136
+
137
+ ## Test Naming
138
+
139
+ Use descriptive pattern `should_ExpectedBehavior_When_Condition`:
140
+
141
+ ```java
142
+ @Test
143
+ void should_ThrowException_When_OrderIsEmpty() { }
144
+
145
+ @Test
146
+ void should_ApplyDiscount_When_CustomerIsPremium() { }
147
+
148
+ @Test
149
+ void should_ReturnEmptyList_When_NoOrdersExist() { }
150
+ ```
151
+
152
+ Alternative patterns:
153
+ - `givenX_whenY_thenZ`
154
+ - `methodName_StateUnderTest_ExpectedBehavior`
155
+
156
+ ## Package Naming
157
+
158
+ Follow architecture layers:
159
+ ```
160
+ com.company.project.domain.order
161
+ com.company.project.domain.customer
162
+ com.company.project.application.usecase
163
+ com.company.project.infrastructure.persistence
164
+ com.company.project.infrastructure.web
165
+ ```
166
+
167
+ ## Anti-Patterns
168
+
169
+ ### Avoid
170
+ - `Manager`, `Handler`, `Processor` (too generic)
171
+ - `Utils`, `Helper`, `Common` (often becomes a dumping ground)
172
+ - `Data`, `Info` (noise words)
173
+ - Hungarian notation (`strName`, `iCount`)
174
+ - Single letters (except `i`, `j`, `k` in loops)
175
+ - Acronyms unless universal (`HTML`, `URL` are OK)
@@ -0,0 +1,179 @@
1
+ # Clean Code Principles
2
+
3
+ ## Overview
4
+
5
+ Clean code is code that is easy to read, understand, and maintain. These principles, largely from Robert C. Martin, guide the creation of high-quality code.
6
+
7
+ ## Core Principles
8
+
9
+ ### 1. Meaningful Names
10
+
11
+ Names should reveal intent:
12
+
13
+ ```java
14
+ // Bad
15
+ int d; // elapsed time in days
16
+
17
+ // Good
18
+ int elapsedTimeInDays;
19
+ ```
20
+
21
+ **Rules:**
22
+ - Use intention-revealing names
23
+ - Avoid disinformation
24
+ - Make meaningful distinctions
25
+ - Use pronounceable names
26
+ - Use searchable names
27
+ - Avoid encodings (Hungarian notation)
28
+
29
+ ### 2. Functions
30
+
31
+ Functions should be small and do one thing:
32
+
33
+ ```java
34
+ // Bad
35
+ public void processOrder(Order order) {
36
+ validateOrder(order);
37
+ calculateTotals(order);
38
+ applyDiscounts(order);
39
+ saveOrder(order);
40
+ sendConfirmationEmail(order);
41
+ updateInventory(order);
42
+ notifyWarehouse(order);
43
+ }
44
+
45
+ // Good
46
+ public void processOrder(Order order) {
47
+ Order validatedOrder = validateOrder(order);
48
+ Order pricedOrder = applyPricing(validatedOrder);
49
+ placeOrder(pricedOrder);
50
+ }
51
+
52
+ private void placeOrder(Order order) {
53
+ orderRepository.save(order);
54
+ eventPublisher.publish(new OrderPlaced(order));
55
+ }
56
+ ```
57
+
58
+ **Rules:**
59
+ - Small (max 20 lines)
60
+ - Do one thing
61
+ - One level of abstraction
62
+ - Max 3-4 parameters
63
+ - No side effects
64
+ - Command-Query Separation
65
+
66
+ ### 3. Comments
67
+
68
+ Good code is self-documenting. Comments should explain "why", not "what":
69
+
70
+ ```java
71
+ // Bad - explains what (obvious from code)
72
+ // increment counter by one
73
+ counter++;
74
+
75
+ // Good - explains why
76
+ // We retry 3 times because the external service has transient failures
77
+ private static final int MAX_RETRIES = 3;
78
+ ```
79
+
80
+ **When to comment:**
81
+ - Legal/license headers
82
+ - Explanation of intent
83
+ - Clarification of obscure code
84
+ - Warning of consequences
85
+ - TODO (sparingly)
86
+ - Public API documentation
87
+
88
+ ### 4. Formatting
89
+
90
+ Consistent formatting improves readability:
91
+
92
+ - **Vertical**: Related code together, separate concepts with blank lines
93
+ - **Horizontal**: Max 120 characters per line
94
+ - **Indentation**: Consistent (2 or 4 spaces)
95
+
96
+ ### 5. Error Handling
97
+
98
+ Exceptions over error codes:
99
+
100
+ ```java
101
+ // Bad
102
+ public int withdraw(Money amount) {
103
+ if (balance.lessThan(amount)) {
104
+ return -1; // Error code
105
+ }
106
+ balance = balance.subtract(amount);
107
+ return 0;
108
+ }
109
+
110
+ // Good
111
+ public void withdraw(Money amount) {
112
+ if (balance.lessThan(amount)) {
113
+ throw new InsufficientFundsException(balance, amount);
114
+ }
115
+ balance = balance.subtract(amount);
116
+ }
117
+ ```
118
+
119
+ **Rules:**
120
+ - Use exceptions, not error codes
121
+ - Create informative error messages
122
+ - Define exception classes by caller's needs
123
+ - Don't return null
124
+ - Don't pass null
125
+
126
+ ### 6. Classes
127
+
128
+ Classes should be small and focused:
129
+
130
+ ```java
131
+ // Bad - multiple responsibilities
132
+ public class UserService {
133
+ public void createUser() { }
134
+ public void sendEmail() { }
135
+ public void generateReport() { }
136
+ public void validatePayment() { }
137
+ }
138
+
139
+ // Good - single responsibility
140
+ public class UserRegistrationService {
141
+ public void register(UserRegistrationCommand command) { }
142
+ }
143
+ ```
144
+
145
+ **Rules:**
146
+ - Small (max 200 lines)
147
+ - Single Responsibility Principle
148
+ - High cohesion
149
+ - Low coupling
150
+
151
+ ## SOLID Principles
152
+
153
+ ### S - Single Responsibility
154
+ A class should have only one reason to change.
155
+
156
+ ### O - Open/Closed
157
+ Open for extension, closed for modification.
158
+
159
+ ### L - Liskov Substitution
160
+ Subtypes must be substitutable for their base types.
161
+
162
+ ### I - Interface Segregation
163
+ Many specific interfaces are better than one general interface.
164
+
165
+ ### D - Dependency Inversion
166
+ Depend on abstractions, not concretions.
167
+
168
+ ## Code Smells to Avoid
169
+
170
+ 1. **Long Method**: Methods over 20 lines
171
+ 2. **Large Class**: Classes over 200 lines
172
+ 3. **Long Parameter List**: More than 4 parameters
173
+ 4. **Duplicate Code**: Same code in multiple places
174
+ 5. **Dead Code**: Unused code
175
+ 6. **Speculative Generality**: Code for "future" needs
176
+ 7. **Feature Envy**: Method uses another class's data more than its own
177
+ 8. **Data Clumps**: Same data groups appearing together
178
+ 9. **Primitive Obsession**: Using primitives instead of small objects
179
+ 10. **Switch Statements**: Often indicate missing polymorphism