@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,173 @@
1
+ # Domain-Driven Design (DDD)
2
+
3
+ ## Overview
4
+
5
+ Domain-Driven Design is an approach to software development that centers the development on the core business domain. It provides tactical and strategic patterns for modeling complex domains.
6
+
7
+ ## Tactical Patterns
8
+
9
+ ### Entities
10
+
11
+ Objects with a unique identity that persists over time:
12
+
13
+ ```java
14
+ public class Order {
15
+ private final OrderId id; // Unique identity
16
+ private OrderStatus status;
17
+ private List<OrderLine> lines;
18
+
19
+ // Identity-based equality
20
+ @Override
21
+ public boolean equals(Object o) {
22
+ if (this == o) return true;
23
+ if (!(o instanceof Order order)) return false;
24
+ return id.equals(order.id);
25
+ }
26
+ }
27
+ ```
28
+
29
+ **Rules:**
30
+ - Must have a unique identifier
31
+ - Equality based on identity, not attributes
32
+ - Can change state over time
33
+ - Protect invariants
34
+
35
+ ### Value Objects
36
+
37
+ Immutable objects defined by their attributes:
38
+
39
+ ```java
40
+ public record Money(BigDecimal amount, Currency currency) {
41
+ public Money {
42
+ if (amount == null || amount.compareTo(BigDecimal.ZERO) < 0) {
43
+ throw new IllegalArgumentException("Amount must be non-negative");
44
+ }
45
+ Objects.requireNonNull(currency);
46
+ }
47
+
48
+ public Money add(Money other) {
49
+ if (!currency.equals(other.currency)) {
50
+ throw new IllegalArgumentException("Cannot add different currencies");
51
+ }
52
+ return new Money(amount.add(other.amount), currency);
53
+ }
54
+ }
55
+ ```
56
+
57
+ **Rules:**
58
+ - Immutable (use Java records when possible)
59
+ - Equality based on all attributes
60
+ - Self-validating
61
+ - No identity
62
+
63
+ ### Aggregates
64
+
65
+ A cluster of entities and value objects with a root entity:
66
+
67
+ ```java
68
+ public class Order { // Aggregate Root
69
+ private final OrderId id;
70
+ private final CustomerId customerId;
71
+ private List<OrderLine> lines; // Part of aggregate
72
+ private OrderStatus status;
73
+
74
+ public void addLine(Product product, int quantity) {
75
+ // Invariant protection
76
+ if (status != OrderStatus.DRAFT) {
77
+ throw new IllegalStateException("Cannot modify confirmed order");
78
+ }
79
+ lines.add(new OrderLine(product.getId(), quantity, product.getPrice()));
80
+ }
81
+ }
82
+ ```
83
+
84
+ **Rules:**
85
+ - Access only through the root
86
+ - Root enforces invariants
87
+ - Transactional consistency boundary
88
+ - Reference other aggregates by ID only
89
+
90
+ ### Domain Events
91
+
92
+ Record of something that happened in the domain:
93
+
94
+ ```java
95
+ public record OrderPlaced(
96
+ OrderId orderId,
97
+ CustomerId customerId,
98
+ Money totalAmount,
99
+ Instant occurredAt
100
+ ) implements DomainEvent {
101
+ public OrderPlaced {
102
+ Objects.requireNonNull(orderId);
103
+ Objects.requireNonNull(customerId);
104
+ Objects.requireNonNull(totalAmount);
105
+ occurredAt = occurredAt != null ? occurredAt : Instant.now();
106
+ }
107
+ }
108
+ ```
109
+
110
+ **Rules:**
111
+ - Immutable
112
+ - Named in past tense
113
+ - Contain all relevant data
114
+ - Published after state change
115
+
116
+ ### Repositories
117
+
118
+ Collection-like interface for aggregate persistence:
119
+
120
+ ```java
121
+ public interface OrderRepository {
122
+ Optional<Order> findById(OrderId id);
123
+ void save(Order order);
124
+ void delete(Order order);
125
+ List<Order> findByCustomerId(CustomerId customerId);
126
+ }
127
+ ```
128
+
129
+ **Rules:**
130
+ - One repository per aggregate
131
+ - Interface in domain, implementation in infrastructure
132
+ - Return domain objects, not DTOs
133
+
134
+ ### Domain Services
135
+
136
+ Stateless operations that don't belong to entities:
137
+
138
+ ```java
139
+ public class PricingService {
140
+ public Money calculateDiscount(Order order, Customer customer) {
141
+ // Complex calculation involving multiple aggregates
142
+ }
143
+ }
144
+ ```
145
+
146
+ **Rules:**
147
+ - Stateless
148
+ - Named after domain operations
149
+ - Use when logic doesn't fit in entities
150
+
151
+ ## Strategic Patterns
152
+
153
+ ### Bounded Contexts
154
+
155
+ Explicit boundaries where a domain model is defined and applicable:
156
+ - Each context has its own ubiquitous language
157
+ - Models can differ between contexts
158
+ - Define clear interfaces between contexts
159
+
160
+ ### Ubiquitous Language
161
+
162
+ A shared language between developers and domain experts:
163
+ - Use domain terms in code
164
+ - Class names = domain concepts
165
+ - Method names = domain operations
166
+ - Avoid technical jargon in domain layer
167
+
168
+ ## Anti-Patterns to Avoid
169
+
170
+ 1. **Anemic Domain Model**: Entities with only getters/setters, logic in services
171
+ 2. **God Aggregate**: Too large aggregates with too many entities
172
+ 3. **Aggregate Reference by Object**: Referencing other aggregates by object instead of ID
173
+ 4. **Repository in Entity**: Entities accessing repositories directly
@@ -0,0 +1,97 @@
1
+ # Hexagonal Architecture (Ports & Adapters)
2
+
3
+ ## Overview
4
+
5
+ Hexagonal Architecture, also known as Ports & Adapters, isolates the core business logic from external concerns. The application core is at the center, surrounded by ports (interfaces) and adapters (implementations).
6
+
7
+ ## Structure
8
+
9
+ ```
10
+ src/
11
+ ├── domain/ # Core business logic (innermost)
12
+ │ ├── entities/ # Business entities
13
+ │ ├── value-objects/# Immutable value objects
14
+ │ ├── events/ # Domain events
15
+ │ └── ports/ # Interfaces (input & output)
16
+ ├── application/ # Use cases (middle layer)
17
+ │ ├── use-cases/ # Application use cases
18
+ │ └── services/ # Application services
19
+ └── infrastructure/ # External adapters (outermost)
20
+ └── adapters/
21
+ ├── primary/ # Driving adapters (controllers, CLI)
22
+ └── secondary/# Driven adapters (DB, APIs)
23
+ ```
24
+
25
+ ## Layer Rules
26
+
27
+ ### Domain Layer
28
+ - **NO external dependencies** (no frameworks, no libraries except language stdlib)
29
+ - Contains pure business logic
30
+ - Defines ports (interfaces) that the outside world must implement
31
+ - Entities must have identity and lifecycle
32
+ - Value Objects must be immutable
33
+
34
+ ### Application Layer
35
+ - Orchestrates domain objects
36
+ - Implements use cases
37
+ - **Depends only on domain**
38
+ - No direct infrastructure dependencies
39
+ - Transaction boundaries defined here
40
+
41
+ ### Infrastructure Layer
42
+ - Implements domain ports
43
+ - Contains framework-specific code
44
+ - Can depend on domain and application
45
+ - Adapters translate between external world and domain
46
+
47
+ ## Dependency Rule
48
+
49
+ ```
50
+ Infrastructure → Application → Domain
51
+ ↓ ↓ ↓
52
+ (outer) (middle) (inner)
53
+ ```
54
+
55
+ **Dependencies always point inward.** Inner layers never know about outer layers.
56
+
57
+ ## Port Types
58
+
59
+ ### Input Ports (Driving)
60
+ Interfaces that define what the application **offers**:
61
+ ```java
62
+ public interface CreateOrderUseCase {
63
+ OrderId execute(CreateOrderCommand command);
64
+ }
65
+ ```
66
+
67
+ ### Output Ports (Driven)
68
+ Interfaces that define what the application **needs**:
69
+ ```java
70
+ public interface OrderRepository {
71
+ Order findById(OrderId id);
72
+ void save(Order order);
73
+ }
74
+ ```
75
+
76
+ ## Adapter Types
77
+
78
+ ### Primary Adapters (Driving)
79
+ Drive the application:
80
+ - REST Controllers
81
+ - GraphQL Resolvers
82
+ - CLI Commands
83
+ - Message Consumers
84
+
85
+ ### Secondary Adapters (Driven)
86
+ Driven by the application:
87
+ - Database Repositories
88
+ - External API Clients
89
+ - Message Publishers
90
+ - File System Access
91
+
92
+ ## Benefits
93
+
94
+ 1. **Testability**: Domain can be tested without infrastructure
95
+ 2. **Flexibility**: Easy to swap adapters (change DB, API, etc.)
96
+ 3. **Focus**: Business logic is isolated and clear
97
+ 4. **Independence**: Framework changes don't affect domain