cursor-kit-cli 1.2.0-beta → 1.2.0-beta.3

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 (92) hide show
  1. package/bin/cursor-reinstall-instance.sh +102 -0
  2. package/dist/cli.cjs +366 -69
  3. package/dist/cli.cjs.map +1 -1
  4. package/dist/cli.js +367 -70
  5. package/dist/cli.js.map +1 -1
  6. package/dist/index.cjs +39 -1
  7. package/dist/index.cjs.map +1 -1
  8. package/dist/index.d.cts +9 -1
  9. package/dist/index.d.ts +9 -1
  10. package/dist/index.js +33 -2
  11. package/dist/index.js.map +1 -1
  12. package/package.json +1 -1
  13. package/templates/commands/docs.md +5 -3
  14. package/templates/commands/explain.md +5 -3
  15. package/templates/commands/fix.md +5 -3
  16. package/templates/commands/implement.md +5 -3
  17. package/templates/commands/refactor.md +5 -3
  18. package/templates/commands/review.md +5 -3
  19. package/templates/commands/test.md +5 -3
  20. package/templates/manifest.json +11 -8
  21. package/templates/rules/git.mdc +0 -2
  22. package/templates/rules/toc.mdc +17 -9
  23. package/templates/skills/aesthetic/SKILL.md +121 -0
  24. package/templates/skills/aesthetic/assets/design-guideline-template.md +163 -0
  25. package/templates/skills/aesthetic/assets/design-story-template.md +135 -0
  26. package/templates/skills/aesthetic/references/design-principles.md +62 -0
  27. package/templates/skills/aesthetic/references/design-resources.md +75 -0
  28. package/templates/skills/aesthetic/references/micro-interactions.md +53 -0
  29. package/templates/skills/aesthetic/references/storytelling-design.md +50 -0
  30. package/templates/skills/backend-development/SKILL.mdc +95 -0
  31. package/templates/skills/backend-development/references/backend-api-design.md +495 -0
  32. package/templates/skills/backend-development/references/backend-architecture.md +454 -0
  33. package/templates/skills/backend-development/references/backend-authentication.md +338 -0
  34. package/templates/skills/backend-development/references/backend-code-quality.md +659 -0
  35. package/templates/skills/backend-development/references/backend-debugging.md +904 -0
  36. package/templates/skills/backend-development/references/backend-devops.md +494 -0
  37. package/templates/skills/backend-development/references/backend-mindset.md +387 -0
  38. package/templates/skills/backend-development/references/backend-performance.md +397 -0
  39. package/templates/skills/backend-development/references/backend-security.md +290 -0
  40. package/templates/skills/backend-development/references/backend-technologies.md +256 -0
  41. package/templates/skills/backend-development/references/backend-testing.md +429 -0
  42. package/templates/skills/frontend-design/SKILL.mdc +41 -0
  43. package/templates/skills/frontend-design/references/animejs.md +396 -0
  44. package/templates/skills/frontend-development/SKILL.mdc +399 -0
  45. package/templates/skills/frontend-development/resources/common-patterns.md +331 -0
  46. package/templates/skills/frontend-development/resources/complete-examples.md +872 -0
  47. package/templates/skills/frontend-development/resources/component-patterns.md +502 -0
  48. package/templates/skills/frontend-development/resources/data-fetching.md +767 -0
  49. package/templates/skills/frontend-development/resources/file-organization.md +502 -0
  50. package/templates/skills/frontend-development/resources/loading-and-error-states.md +501 -0
  51. package/templates/skills/frontend-development/resources/performance.md +406 -0
  52. package/templates/skills/frontend-development/resources/routing-guide.md +364 -0
  53. package/templates/skills/frontend-development/resources/styling-guide.md +428 -0
  54. package/templates/skills/frontend-development/resources/typescript-standards.md +418 -0
  55. package/templates/skills/problem-solving/SKILL.mdc +96 -0
  56. package/templates/skills/problem-solving/references/attribution.md +69 -0
  57. package/templates/skills/problem-solving/references/collision-zone-thinking.md +79 -0
  58. package/templates/skills/problem-solving/references/inversion-exercise.md +91 -0
  59. package/templates/skills/problem-solving/references/meta-pattern-recognition.md +87 -0
  60. package/templates/skills/problem-solving/references/scale-game.md +95 -0
  61. package/templates/skills/problem-solving/references/simplification-cascades.md +80 -0
  62. package/templates/skills/problem-solving/references/when-stuck.md +72 -0
  63. package/templates/skills/research/SKILL.mdc +168 -0
  64. package/templates/skills/sequential-thinking/.env.example +8 -0
  65. package/templates/skills/sequential-thinking/README.md +183 -0
  66. package/templates/skills/sequential-thinking/SKILL.mdc +94 -0
  67. package/templates/skills/sequential-thinking/package.json +31 -0
  68. package/templates/skills/sequential-thinking/references/advanced-strategies.md +79 -0
  69. package/templates/skills/sequential-thinking/references/advanced-techniques.md +76 -0
  70. package/templates/skills/sequential-thinking/references/core-patterns.md +95 -0
  71. package/templates/skills/sequential-thinking/references/examples-api.md +88 -0
  72. package/templates/skills/sequential-thinking/references/examples-architecture.md +94 -0
  73. package/templates/skills/sequential-thinking/references/examples-debug.md +90 -0
  74. package/templates/skills/sequential-thinking/scripts/format-thought.js +159 -0
  75. package/templates/skills/sequential-thinking/scripts/process-thought.js +236 -0
  76. package/templates/skills/sequential-thinking/tests/format-thought.test.js +133 -0
  77. package/templates/skills/sequential-thinking/tests/process-thought.test.js +215 -0
  78. package/templates/skills/ui-styling/LICENSE.txt +202 -0
  79. package/templates/skills/ui-styling/SKILL.mdc +321 -0
  80. package/templates/skills/ui-styling/references/canvas-design-system.md +320 -0
  81. package/templates/skills/ui-styling/references/shadcn-accessibility.md +471 -0
  82. package/templates/skills/ui-styling/references/shadcn-components.md +424 -0
  83. package/templates/skills/ui-styling/references/shadcn-theming.md +373 -0
  84. package/templates/skills/ui-styling/references/tailwind-customization.md +483 -0
  85. package/templates/skills/ui-styling/references/tailwind-responsive.md +382 -0
  86. package/templates/skills/ui-styling/references/tailwind-utilities.md +455 -0
  87. package/templates/rules/frontend-design.mdc +0 -48
  88. package/templates/rules/performance.mdc +0 -54
  89. package/templates/rules/react.mdc +0 -58
  90. package/templates/rules/security.mdc +0 -50
  91. package/templates/rules/testing.mdc +0 -54
  92. package/templates/rules/typescript.mdc +0 -36
@@ -0,0 +1,454 @@
1
+ # Backend Architecture Patterns
2
+
3
+ Microservices, event-driven architecture, and scalability patterns (2025).
4
+
5
+ ## Monolith vs Microservices
6
+
7
+ ### Monolithic Architecture
8
+
9
+ ```
10
+ ┌─────────────────────────────────┐
11
+ │ Single Application │
12
+ │ │
13
+ │ ┌─────────┐ ┌──────────┐ │
14
+ │ │ Users │ │ Products │ │
15
+ │ └─────────┘ └──────────┘ │
16
+ │ ┌─────────┐ ┌──────────┐ │
17
+ │ │ Orders │ │ Payments │ │
18
+ │ └─────────┘ └──────────┘ │
19
+ │ │
20
+ │ Single Database │
21
+ └─────────────────────────────────┘
22
+ ```
23
+
24
+ **Pros:**
25
+ - Simple to develop and deploy
26
+ - Easy local testing
27
+ - Single codebase
28
+ - Strong consistency (ACID transactions)
29
+
30
+ **Cons:**
31
+ - Tight coupling
32
+ - Scaling limitations
33
+ - Deployment risk (all-or-nothing)
34
+ - Tech stack lock-in
35
+
36
+ **When to Use:** Startups, MVPs, small teams, unclear domain boundaries
37
+
38
+ ### Microservices Architecture
39
+
40
+ ```
41
+ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐
42
+ │ User │ │ Product │ │ Order │ │ Payment │
43
+ │ Service │ │ Service │ │ Service │ │ Service │
44
+ └────┬─────┘ └────┬─────┘ └────┬─────┘ └────┬─────┘
45
+ │ │ │ │
46
+ ┌──▼──┐ ┌──▼──┐ ┌──▼──┐ ┌──▼──┐
47
+ │ DB │ │ DB │ │ DB │ │ DB │
48
+ └─────┘ └─────┘ └─────┘ └─────┘
49
+ ```
50
+
51
+ **Pros:**
52
+ - Independent deployment
53
+ - Technology flexibility
54
+ - Fault isolation
55
+ - Easier scaling (scale services independently)
56
+
57
+ **Cons:**
58
+ - Complex deployment
59
+ - Distributed system challenges (network latency, partial failures)
60
+ - Data consistency (eventual consistency)
61
+ - Operational overhead
62
+
63
+ **When to Use:** Large teams, clear domain boundaries, need independent scaling, tech diversity
64
+
65
+ ## Microservices Patterns
66
+
67
+ ### Database per Service Pattern
68
+
69
+ **Concept:** Each service owns its database
70
+
71
+ ```
72
+ User Service → User DB (PostgreSQL)
73
+ Product Service → Product DB (MongoDB)
74
+ Order Service → Order DB (PostgreSQL)
75
+ ```
76
+
77
+ **Benefits:**
78
+ - Service independence
79
+ - Technology choice per service
80
+ - Fault isolation
81
+
82
+ **Challenges:**
83
+ - No joins across services
84
+ - Distributed transactions
85
+ - Data duplication
86
+
87
+ ### API Gateway Pattern
88
+
89
+ ```
90
+ Client
91
+
92
+
93
+ ┌─────────────────┐
94
+ │ API Gateway │ - Authentication
95
+ │ (Kong/NGINX) │ - Rate limiting
96
+ └────────┬────────┘ - Request routing
97
+
98
+ ┌────┴────┬────────┬────────┐
99
+ ▼ ▼ ▼ ▼
100
+ User Product Order Payment
101
+ Service Service Service Service
102
+ ```
103
+
104
+ **Responsibilities:**
105
+ - Request routing
106
+ - Authentication/authorization
107
+ - Rate limiting
108
+ - Request/response transformation
109
+ - Caching
110
+
111
+ **Implementation (Kong):**
112
+ ```yaml
113
+ services:
114
+ - name: user-service
115
+ url: http://user-service:3000
116
+ routes:
117
+ - name: user-route
118
+ paths:
119
+ - /api/users
120
+
121
+ - name: product-service
122
+ url: http://product-service:3001
123
+ routes:
124
+ - name: product-route
125
+ paths:
126
+ - /api/products
127
+
128
+ plugins:
129
+ - name: rate-limiting
130
+ config:
131
+ minute: 100
132
+ - name: jwt
133
+ ```
134
+
135
+ ### Service Discovery
136
+
137
+ **Concept:** Services find each other dynamically
138
+
139
+ ```typescript
140
+ // Consul service discovery
141
+ import Consul from 'consul';
142
+
143
+ const consul = new Consul();
144
+
145
+ // Register service
146
+ await consul.agent.service.register({
147
+ name: 'user-service',
148
+ address: '192.168.1.10',
149
+ port: 3000,
150
+ check: {
151
+ http: 'http://192.168.1.10:3000/health',
152
+ interval: '10s',
153
+ },
154
+ });
155
+
156
+ // Discover service
157
+ const services = await consul.catalog.service.nodes('product-service');
158
+ const productServiceUrl = `http://${services[0].ServiceAddress}:${services[0].ServicePort}`;
159
+ ```
160
+
161
+ ### Circuit Breaker Pattern
162
+
163
+ **Concept:** Stop calling failing service, prevent cascade failures
164
+
165
+ ```typescript
166
+ import CircuitBreaker from 'opossum';
167
+
168
+ const breaker = new CircuitBreaker(callExternalService, {
169
+ timeout: 3000, // 3s timeout
170
+ errorThresholdPercentage: 50, // Open circuit after 50% failures
171
+ resetTimeout: 30000, // Try again after 30s
172
+ });
173
+
174
+ breaker.on('open', () => {
175
+ console.log('Circuit breaker opened!');
176
+ });
177
+
178
+ breaker.fallback(() => ({
179
+ data: 'fallback-response',
180
+ source: 'cache',
181
+ }));
182
+
183
+ const result = await breaker.fire(requestParams);
184
+ ```
185
+
186
+ **States:**
187
+ - **Closed:** Normal operation, requests go through
188
+ - **Open:** Too many failures, requests fail immediately
189
+ - **Half-Open:** Testing if service recovered
190
+
191
+ ### Saga Pattern (Distributed Transactions)
192
+
193
+ **Choreography-Based Saga:**
194
+ ```
195
+ Order Service: Create Order → Publish "OrderCreated"
196
+
197
+ Payment Service: Reserve Payment → Publish "PaymentReserved"
198
+
199
+ Inventory Service: Reserve Stock → Publish "StockReserved"
200
+
201
+ Shipping Service: Create Shipment → Publish "ShipmentCreated"
202
+
203
+ If any step fails → Compensating transactions (rollback)
204
+ ```
205
+
206
+ **Orchestration-Based Saga:**
207
+ ```
208
+ Saga Orchestrator
209
+ ↓ Create Order
210
+ Order Service
211
+ ↓ Reserve Payment
212
+ Payment Service
213
+ ↓ Reserve Stock
214
+ Inventory Service
215
+ ↓ Create Shipment
216
+ Shipping Service
217
+ ```
218
+
219
+ ## Event-Driven Architecture
220
+
221
+ **Impact:** 85% organizations recognize business value
222
+
223
+ ### Event Sourcing
224
+
225
+ **Concept:** Store events, not current state
226
+
227
+ ```typescript
228
+ // Traditional: Store current state
229
+ {
230
+ userId: '123',
231
+ balance: 500
232
+ }
233
+
234
+ // Event Sourcing: Store events
235
+ [
236
+ { type: 'AccountCreated', userId: '123', timestamp: '...' },
237
+ { type: 'MoneyDeposited', amount: 1000, timestamp: '...' },
238
+ { type: 'MoneyWithdrawn', amount: 500, timestamp: '...' },
239
+ ]
240
+
241
+ // Reconstruct state by replaying events
242
+ const balance = events
243
+ .filter(e => e.userId === '123')
244
+ .reduce((acc, event) => {
245
+ if (event.type === 'MoneyDeposited') return acc + event.amount;
246
+ if (event.type === 'MoneyWithdrawn') return acc - event.amount;
247
+ return acc;
248
+ }, 0);
249
+ ```
250
+
251
+ **Benefits:**
252
+ - Complete audit trail
253
+ - Temporal queries (state at any point in time)
254
+ - Event replay for debugging
255
+ - Flexible projections
256
+
257
+ ### Message Broker Patterns
258
+
259
+ **Kafka (Event Streaming):**
260
+ ```typescript
261
+ import { Kafka } from 'kafkajs';
262
+
263
+ const kafka = new Kafka({
264
+ clientId: 'order-service',
265
+ brokers: ['kafka:9092'],
266
+ });
267
+
268
+ // Producer
269
+ const producer = kafka.producer();
270
+ await producer.send({
271
+ topic: 'order-events',
272
+ messages: [
273
+ {
274
+ key: order.id,
275
+ value: JSON.stringify({
276
+ type: 'OrderCreated',
277
+ orderId: order.id,
278
+ userId: order.userId,
279
+ total: order.total,
280
+ }),
281
+ },
282
+ ],
283
+ });
284
+
285
+ // Consumer
286
+ const consumer = kafka.consumer({ groupId: 'inventory-service' });
287
+ await consumer.subscribe({ topic: 'order-events' });
288
+ await consumer.run({
289
+ eachMessage: async ({ topic, partition, message }) => {
290
+ const event = JSON.parse(message.value.toString());
291
+ if (event.type === 'OrderCreated') {
292
+ await reserveInventory(event.orderId);
293
+ }
294
+ },
295
+ });
296
+ ```
297
+
298
+ **RabbitMQ (Task Queues):**
299
+ ```typescript
300
+ import amqp from 'amqplib';
301
+
302
+ const connection = await amqp.connect('amqp://localhost');
303
+ const channel = await connection.createChannel();
304
+
305
+ // Producer
306
+ await channel.assertQueue('email-queue', { durable: true });
307
+ channel.sendToQueue('email-queue', Buffer.from(JSON.stringify({
308
+ to: user.email,
309
+ subject: 'Welcome!',
310
+ body: 'Thank you for signing up',
311
+ })));
312
+
313
+ // Consumer
314
+ await channel.consume('email-queue', async (msg) => {
315
+ const emailData = JSON.parse(msg.content.toString());
316
+ await sendEmail(emailData);
317
+ channel.ack(msg);
318
+ });
319
+ ```
320
+
321
+ ## CQRS (Command Query Responsibility Segregation)
322
+
323
+ **Concept:** Separate read and write models
324
+
325
+ ```
326
+ Write Side (Commands): Read Side (Queries):
327
+ CreateOrder GetOrderById
328
+ UpdateOrder GetUserOrders
329
+ ↓ ↑
330
+ ┌─────────┐ ┌─────────┐
331
+ │ Write │ → Events → │ Read │
332
+ │ DB │ (sync) │ DB │
333
+ │(Postgres) │(MongoDB)│
334
+ └─────────┘ └─────────┘
335
+ ```
336
+
337
+ **Benefits:**
338
+ - Optimized read models
339
+ - Scalable (scale reads independently)
340
+ - Flexible (different DB for reads/writes)
341
+
342
+ **Implementation:**
343
+ ```typescript
344
+ // Command (Write)
345
+ class CreateOrderCommand {
346
+ constructor(public userId: string, public items: OrderItem[]) {}
347
+ }
348
+
349
+ class CreateOrderHandler {
350
+ async execute(command: CreateOrderCommand) {
351
+ const order = await Order.create(command);
352
+ await eventBus.publish(new OrderCreatedEvent(order));
353
+ return order.id;
354
+ }
355
+ }
356
+
357
+ // Query (Read)
358
+ class GetOrderQuery {
359
+ constructor(public orderId: string) {}
360
+ }
361
+
362
+ class GetOrderHandler {
363
+ async execute(query: GetOrderQuery) {
364
+ // Read from optimized read model
365
+ return await OrderReadModel.findById(query.orderId);
366
+ }
367
+ }
368
+ ```
369
+
370
+ ## Scalability Patterns
371
+
372
+ ### Horizontal Scaling (Scale Out)
373
+
374
+ ```
375
+ Load Balancer
376
+
377
+ ┌───┴───┬───────┬───────┐
378
+ │ App 1 │ App 2 │ App 3 │ ... App N
379
+ └───┬───┴───┬───┴───┬───┘
380
+ └───────┴───────┘
381
+
382
+ Shared Database
383
+ (with read replicas)
384
+ ```
385
+
386
+ ### Database Sharding
387
+
388
+ **Range-Based Sharding:**
389
+ ```
390
+ Users 1-1M → Shard 1
391
+ Users 1M-2M → Shard 2
392
+ Users 2M-3M → Shard 3
393
+ ```
394
+
395
+ **Hash-Based Sharding:**
396
+ ```typescript
397
+ function getShardId(userId: string): number {
398
+ const hash = crypto.createHash('md5').update(userId).digest('hex');
399
+ return parseInt(hash.substring(0, 8), 16) % SHARD_COUNT;
400
+ }
401
+
402
+ const shardId = getShardId(userId);
403
+ const db = shards[shardId];
404
+ const user = await db.users.findById(userId);
405
+ ```
406
+
407
+ ### Caching Layers
408
+
409
+ ```
410
+ Client
411
+ → CDN (static assets)
412
+ → API Gateway Cache (public endpoints)
413
+ → Application Cache (Redis - user sessions, hot data)
414
+ → Database Query Cache
415
+ → Database
416
+ ```
417
+
418
+ ## Architecture Decision Matrix
419
+
420
+ | Pattern | When to Use | Complexity | Benefits |
421
+ |---------|-------------|------------|----------|
422
+ | **Monolith** | Small team, MVP, unclear boundaries | Low | Simple, fast development |
423
+ | **Microservices** | Large team, clear domains, need scaling | High | Independent deployment, fault isolation |
424
+ | **Event-Driven** | Async workflows, audit trail needed | Moderate | Decoupling, scalability |
425
+ | **CQRS** | Different read/write patterns | High | Optimized queries, scalability |
426
+ | **Serverless** | Spiky traffic, event-driven | Low | Auto-scaling, pay-per-use |
427
+
428
+ ## Anti-Patterns to Avoid
429
+
430
+ 1. **Distributed Monolith** - Microservices that all depend on each other
431
+ 2. **Chatty Services** - Too many inter-service calls (network overhead)
432
+ 3. **Shared Database** - Microservices sharing same DB (tight coupling)
433
+ 4. **Over-Engineering** - Using microservices for small apps
434
+ 5. **No Circuit Breakers** - Cascade failures in distributed systems
435
+
436
+ ## Architecture Checklist
437
+
438
+ - [ ] Clear service boundaries (domain-driven design)
439
+ - [ ] Database per service (no shared databases)
440
+ - [ ] API Gateway for client requests
441
+ - [ ] Service discovery configured
442
+ - [ ] Circuit breakers for resilience
443
+ - [ ] Event-driven communication (Kafka/RabbitMQ)
444
+ - [ ] CQRS for read-heavy systems
445
+ - [ ] Distributed tracing (Jaeger/OpenTelemetry)
446
+ - [ ] Health checks for all services
447
+ - [ ] Horizontal scaling capability
448
+
449
+ ## Resources
450
+
451
+ - **Microservices Patterns:** https://microservices.io/patterns/
452
+ - **Martin Fowler - Microservices:** https://martinfowler.com/articles/microservices.html
453
+ - **Event-Driven Architecture:** https://aws.amazon.com/event-driven-architecture/
454
+ - **CQRS Pattern:** https://martinfowler.com/bliki/CQRS.html