codymaster 4.4.4 → 4.5.1

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 (190) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/README.md +29 -14
  3. package/commands/demo.md +1 -1
  4. package/dist/context-bus.js +70 -0
  5. package/dist/context-db.js +265 -0
  6. package/dist/continuity.js +12 -0
  7. package/dist/file-watcher.js +79 -0
  8. package/dist/index.js +152 -1
  9. package/dist/l0-indexer.js +158 -0
  10. package/dist/mcp-context-server.js +400 -0
  11. package/dist/migrate-json-to-sqlite.js +126 -0
  12. package/dist/skill-chain.js +19 -3
  13. package/dist/token-budget.js +108 -0
  14. package/dist/uri-resolver.js +203 -0
  15. package/package.json +7 -1
  16. package/skills/_shared/helpers.md +50 -14
  17. package/skills/cm-autopilot/SKILL.md +29 -0
  18. package/skills/cm-autopilot/scripts/autopilot.py +190 -0
  19. package/skills/cm-continuity/SKILL.md +90 -28
  20. package/skills/cm-quality-gate/SKILL.md +11 -1
  21. package/skills/cm-safe-deploy/SKILL.md +38 -2
  22. package/skills/cm-security-gate/SKILL.md +158 -34
  23. package/skills/cm-skill-chain/SKILL.md +47 -1
  24. package/skills/cm-start/SKILL.md +11 -2
  25. package/skills/cm-test-gate/SKILL.md +3 -0
  26. package/skills/boxme-git-config/SKILL.md +0 -56
  27. package/skills/boxme-local-dev/SKILL.md +0 -66
  28. package/skills/jobs-to-be-done/SKILL.md +0 -266
  29. package/skills/jobs-to-be-done/references/case-studies.md +0 -154
  30. package/skills/jobs-to-be-done/references/competitive-strategy.md +0 -280
  31. package/skills/jobs-to-be-done/references/diagnostics.md +0 -158
  32. package/skills/jobs-to-be-done/references/innovation-process.md +0 -392
  33. package/skills/jobs-to-be-done/references/organizational-change.md +0 -328
  34. package/skills/marketplace-report-crawler/SKILL.md +0 -176
  35. package/skills/marketplace-report-crawler/config/accounts.json +0 -41
  36. package/skills/marketplace-report-crawler/config/report-types.json +0 -422
  37. package/skills/marketplace-report-crawler/config/sessions.json +0 -3
  38. package/skills/marketplace-report-crawler/scripts/ab-wrapper.sh +0 -102
  39. package/skills/marketplace-report-crawler/scripts/browser-actions/lazada/lazada-actions.js +0 -114
  40. package/skills/marketplace-report-crawler/scripts/browser-actions/shopee/shopee-actions.js +0 -94
  41. package/skills/marketplace-report-crawler/scripts/browser-actions/tiktok/tiktok-actions.js +0 -272
  42. package/skills/marketplace-report-crawler/scripts/crawl-runner.js +0 -281
  43. package/skills/marketplace-report-crawler/scripts/session-check.sh +0 -72
  44. package/skills/marketplace-report-crawler/scripts/session-manager.sh +0 -349
  45. package/skills/marketplace-report-crawler/scripts/setup-folders.sh +0 -83
  46. package/skills/medical-research/SKILL.md +0 -194
  47. package/skills/medical-research/scripts/evidence_checker.py +0 -288
  48. package/skills/mom-test/SKILL.md +0 -267
  49. package/skills/mom-test/references/avoiding-bad-data.md +0 -221
  50. package/skills/mom-test/references/case-studies.md +0 -306
  51. package/skills/mom-test/references/commitment-advancement.md +0 -219
  52. package/skills/mom-test/references/finding-conversations.md +0 -251
  53. package/skills/mom-test/references/processing-learning.md +0 -256
  54. package/skills/mom-test/references/question-patterns.md +0 -198
  55. package/skills/pandasai-analytics/SKILL.md +0 -251
  56. package/skills/release-it/SKILL.md +0 -235
  57. package/skills/release-it/references/anti-patterns.md +0 -279
  58. package/skills/release-it/references/capacity-planning.md +0 -285
  59. package/skills/release-it/references/chaos-engineering.md +0 -325
  60. package/skills/release-it/references/deployment-strategies.md +0 -331
  61. package/skills/release-it/references/observability.md +0 -301
  62. package/skills/release-it/references/stability-patterns.md +0 -355
  63. package/skills/skill-creator-ultra/.agents/workflows/skill-audit.md +0 -37
  64. package/skills/skill-creator-ultra/.agents/workflows/skill-compare.md +0 -34
  65. package/skills/skill-creator-ultra/.agents/workflows/skill-export.md +0 -51
  66. package/skills/skill-creator-ultra/.agents/workflows/skill-generate.md +0 -39
  67. package/skills/skill-creator-ultra/.agents/workflows/skill-scaffold.md +0 -52
  68. package/skills/skill-creator-ultra/.agents/workflows/skill-simulate.md +0 -25
  69. package/skills/skill-creator-ultra/.agents/workflows/skill-stats.md +0 -31
  70. package/skills/skill-creator-ultra/.agents/workflows/skill-validate.md +0 -25
  71. package/skills/skill-creator-ultra/README.md +0 -1242
  72. package/skills/skill-creator-ultra/SKILL.md +0 -388
  73. package/skills/skill-creator-ultra/agents/analyzer.md +0 -274
  74. package/skills/skill-creator-ultra/agents/comparator.md +0 -202
  75. package/skills/skill-creator-ultra/agents/grader.md +0 -223
  76. package/skills/skill-creator-ultra/assets/eval_review.html +0 -146
  77. package/skills/skill-creator-ultra/eval-viewer/generate_review.py +0 -471
  78. package/skills/skill-creator-ultra/eval-viewer/viewer.html +0 -1325
  79. package/skills/skill-creator-ultra/examples/example_anthropic_frontend.md +0 -109
  80. package/skills/skill-creator-ultra/examples/example_anthropic_pdf.md +0 -116
  81. package/skills/skill-creator-ultra/examples/example_api_docs.md +0 -189
  82. package/skills/skill-creator-ultra/examples/example_db_migration.md +0 -253
  83. package/skills/skill-creator-ultra/examples/example_git_commit.md +0 -111
  84. package/skills/skill-creator-ultra/install.ps1 +0 -289
  85. package/skills/skill-creator-ultra/install.sh +0 -313
  86. package/skills/skill-creator-ultra/phases/phase1_interview.md +0 -202
  87. package/skills/skill-creator-ultra/phases/phase2_extract.md +0 -55
  88. package/skills/skill-creator-ultra/phases/phase3_detect.md +0 -57
  89. package/skills/skill-creator-ultra/phases/phase4_generate.md +0 -543
  90. package/skills/skill-creator-ultra/phases/phase5_test.md +0 -319
  91. package/skills/skill-creator-ultra/phases/phase6_eval.md +0 -301
  92. package/skills/skill-creator-ultra/phases/phase7_iterate.md +0 -103
  93. package/skills/skill-creator-ultra/phases/phase8_optimize.md +0 -113
  94. package/skills/skill-creator-ultra/resources/advanced_patterns.md +0 -499
  95. package/skills/skill-creator-ultra/resources/anti_patterns.md +0 -376
  96. package/skills/skill-creator-ultra/resources/blueprints.md +0 -498
  97. package/skills/skill-creator-ultra/resources/checklist.md +0 -243
  98. package/skills/skill-creator-ultra/resources/composition_cookbook.md +0 -291
  99. package/skills/skill-creator-ultra/resources/description_optimization.md +0 -90
  100. package/skills/skill-creator-ultra/resources/eval_guide.md +0 -133
  101. package/skills/skill-creator-ultra/resources/industry_questions.md +0 -189
  102. package/skills/skill-creator-ultra/resources/interview_questions.md +0 -200
  103. package/skills/skill-creator-ultra/resources/pattern_detection.md +0 -200
  104. package/skills/skill-creator-ultra/resources/prompt_engineering.md +0 -531
  105. package/skills/skill-creator-ultra/resources/schemas.md +0 -430
  106. package/skills/skill-creator-ultra/resources/script_integration.md +0 -593
  107. package/skills/skill-creator-ultra/resources/scripts_guide.md +0 -339
  108. package/skills/skill-creator-ultra/resources/skill_template.md +0 -124
  109. package/skills/skill-creator-ultra/resources/skill_writing_guide.md +0 -634
  110. package/skills/skill-creator-ultra/resources/versioning_guide.md +0 -193
  111. package/skills/skill-creator-ultra/scripts/ci_eval.py +0 -200
  112. package/skills/skill-creator-ultra/scripts/package_skill.py +0 -165
  113. package/skills/skill-creator-ultra/scripts/simulate_skill.py +0 -398
  114. package/skills/skill-creator-ultra/scripts/skill_audit.py +0 -611
  115. package/skills/skill-creator-ultra/scripts/skill_compare.py +0 -265
  116. package/skills/skill-creator-ultra/scripts/skill_export.py +0 -334
  117. package/skills/skill-creator-ultra/scripts/skill_scaffold.py +0 -403
  118. package/skills/skill-creator-ultra/scripts/skill_stats.py +0 -339
  119. package/skills/skill-creator-ultra/scripts/validate_skill.py +0 -411
  120. package/skills/tailwind-mastery/SKILL.md +0 -229
  121. package/skills/vercel-react-best-practices/AGENTS.md +0 -3373
  122. package/skills/vercel-react-best-practices/README.md +0 -123
  123. package/skills/vercel-react-best-practices/SKILL.md +0 -143
  124. package/skills/vercel-react-best-practices/rules/_sections.md +0 -46
  125. package/skills/vercel-react-best-practices/rules/_template.md +0 -28
  126. package/skills/vercel-react-best-practices/rules/advanced-event-handler-refs.md +0 -55
  127. package/skills/vercel-react-best-practices/rules/advanced-init-once.md +0 -42
  128. package/skills/vercel-react-best-practices/rules/advanced-use-latest.md +0 -39
  129. package/skills/vercel-react-best-practices/rules/async-api-routes.md +0 -38
  130. package/skills/vercel-react-best-practices/rules/async-defer-await.md +0 -80
  131. package/skills/vercel-react-best-practices/rules/async-dependencies.md +0 -51
  132. package/skills/vercel-react-best-practices/rules/async-parallel.md +0 -28
  133. package/skills/vercel-react-best-practices/rules/async-suspense-boundaries.md +0 -99
  134. package/skills/vercel-react-best-practices/rules/bundle-barrel-imports.md +0 -59
  135. package/skills/vercel-react-best-practices/rules/bundle-conditional.md +0 -31
  136. package/skills/vercel-react-best-practices/rules/bundle-defer-third-party.md +0 -49
  137. package/skills/vercel-react-best-practices/rules/bundle-dynamic-imports.md +0 -35
  138. package/skills/vercel-react-best-practices/rules/bundle-preload.md +0 -50
  139. package/skills/vercel-react-best-practices/rules/client-event-listeners.md +0 -74
  140. package/skills/vercel-react-best-practices/rules/client-localstorage-schema.md +0 -71
  141. package/skills/vercel-react-best-practices/rules/client-passive-event-listeners.md +0 -48
  142. package/skills/vercel-react-best-practices/rules/client-swr-dedup.md +0 -56
  143. package/skills/vercel-react-best-practices/rules/js-batch-dom-css.md +0 -107
  144. package/skills/vercel-react-best-practices/rules/js-cache-function-results.md +0 -80
  145. package/skills/vercel-react-best-practices/rules/js-cache-property-access.md +0 -28
  146. package/skills/vercel-react-best-practices/rules/js-cache-storage.md +0 -70
  147. package/skills/vercel-react-best-practices/rules/js-combine-iterations.md +0 -32
  148. package/skills/vercel-react-best-practices/rules/js-early-exit.md +0 -50
  149. package/skills/vercel-react-best-practices/rules/js-flatmap-filter.md +0 -60
  150. package/skills/vercel-react-best-practices/rules/js-hoist-regexp.md +0 -45
  151. package/skills/vercel-react-best-practices/rules/js-index-maps.md +0 -37
  152. package/skills/vercel-react-best-practices/rules/js-length-check-first.md +0 -49
  153. package/skills/vercel-react-best-practices/rules/js-min-max-loop.md +0 -82
  154. package/skills/vercel-react-best-practices/rules/js-set-map-lookups.md +0 -24
  155. package/skills/vercel-react-best-practices/rules/js-tosorted-immutable.md +0 -57
  156. package/skills/vercel-react-best-practices/rules/rendering-activity.md +0 -26
  157. package/skills/vercel-react-best-practices/rules/rendering-animate-svg-wrapper.md +0 -47
  158. package/skills/vercel-react-best-practices/rules/rendering-conditional-render.md +0 -40
  159. package/skills/vercel-react-best-practices/rules/rendering-content-visibility.md +0 -38
  160. package/skills/vercel-react-best-practices/rules/rendering-hoist-jsx.md +0 -46
  161. package/skills/vercel-react-best-practices/rules/rendering-hydration-no-flicker.md +0 -82
  162. package/skills/vercel-react-best-practices/rules/rendering-hydration-suppress-warning.md +0 -30
  163. package/skills/vercel-react-best-practices/rules/rendering-resource-hints.md +0 -85
  164. package/skills/vercel-react-best-practices/rules/rendering-script-defer-async.md +0 -68
  165. package/skills/vercel-react-best-practices/rules/rendering-svg-precision.md +0 -28
  166. package/skills/vercel-react-best-practices/rules/rendering-usetransition-loading.md +0 -75
  167. package/skills/vercel-react-best-practices/rules/rerender-defer-reads.md +0 -39
  168. package/skills/vercel-react-best-practices/rules/rerender-dependencies.md +0 -45
  169. package/skills/vercel-react-best-practices/rules/rerender-derived-state-no-effect.md +0 -40
  170. package/skills/vercel-react-best-practices/rules/rerender-derived-state.md +0 -29
  171. package/skills/vercel-react-best-practices/rules/rerender-functional-setstate.md +0 -74
  172. package/skills/vercel-react-best-practices/rules/rerender-lazy-state-init.md +0 -58
  173. package/skills/vercel-react-best-practices/rules/rerender-memo-with-default-value.md +0 -38
  174. package/skills/vercel-react-best-practices/rules/rerender-memo.md +0 -44
  175. package/skills/vercel-react-best-practices/rules/rerender-move-effect-to-event.md +0 -45
  176. package/skills/vercel-react-best-practices/rules/rerender-no-inline-components.md +0 -82
  177. package/skills/vercel-react-best-practices/rules/rerender-simple-expression-in-memo.md +0 -35
  178. package/skills/vercel-react-best-practices/rules/rerender-split-combined-hooks.md +0 -64
  179. package/skills/vercel-react-best-practices/rules/rerender-transitions.md +0 -40
  180. package/skills/vercel-react-best-practices/rules/rerender-use-deferred-value.md +0 -59
  181. package/skills/vercel-react-best-practices/rules/rerender-use-ref-transient-values.md +0 -73
  182. package/skills/vercel-react-best-practices/rules/server-after-nonblocking.md +0 -73
  183. package/skills/vercel-react-best-practices/rules/server-auth-actions.md +0 -96
  184. package/skills/vercel-react-best-practices/rules/server-cache-lru.md +0 -41
  185. package/skills/vercel-react-best-practices/rules/server-cache-react.md +0 -76
  186. package/skills/vercel-react-best-practices/rules/server-dedup-props.md +0 -65
  187. package/skills/vercel-react-best-practices/rules/server-hoist-static-io.md +0 -142
  188. package/skills/vercel-react-best-practices/rules/server-parallel-fetching.md +0 -83
  189. package/skills/vercel-react-best-practices/rules/server-serialization.md +0 -38
  190. package/skills/web-design-guidelines/SKILL.md +0 -39
@@ -1,355 +0,0 @@
1
- # Stability Patterns
2
-
3
- Stability patterns are the countermeasures to the anti-patterns that cause production failures. Each pattern addresses specific failure modes and, when combined, creates a defense-in-depth strategy that allows systems to absorb shocks, degrade gracefully, and recover automatically.
4
-
5
- These patterns are not theoretical -- they are battle-tested responses to the recurring failure modes described in the anti-patterns reference.
6
-
7
- ## 1. Circuit Breaker
8
-
9
- The Circuit Breaker is the single most important stability pattern. It prevents a failing downstream dependency from taking down the calling service by short-circuiting requests when failures exceed a threshold.
10
-
11
- ### State Machine
12
-
13
- ```
14
- success failure count
15
- ┌───────┐ exceeds threshold
16
- │ │ │
17
- ▼ │ ▼
18
- ┌────────┐ │ ┌────────┐
19
- │ CLOSED │─┘ │ OPEN │
20
- └────────┘ └────────┘
21
- ▲ │
22
- │ success │ timeout expires
23
- │ ▼
24
- │ ┌──────────┐
25
- └────────────────────│HALF-OPEN │
26
- (trial request └──────────┘
27
- succeeds) │
28
- │ trial request fails
29
- └──────────────────┐
30
-
31
- ┌────────┐
32
- │ OPEN │
33
- └────────┘
34
- ```
35
-
36
- ### States Explained
37
-
38
- | State | Behavior | Transitions |
39
- |-------|----------|-------------|
40
- | **Closed** | Requests pass through normally; failures are counted | Transitions to Open when failure count exceeds threshold within time window |
41
- | **Open** | All requests fail immediately without calling downstream | Transitions to Half-Open after a recovery timeout expires |
42
- | **Half-Open** | A limited number of trial requests are allowed through | Transitions to Closed if trials succeed; back to Open if trials fail |
43
-
44
- ### Configuration Parameters
45
-
46
- | Parameter | Description | Typical Range |
47
- |-----------|-------------|---------------|
48
- | **Failure threshold** | Number of failures before opening | 5-20 failures |
49
- | **Time window** | Period over which failures are counted | 30-120 seconds |
50
- | **Recovery timeout** | Time to wait in Open state before trying Half-Open | 15-60 seconds |
51
- | **Trial requests** | Number of requests allowed in Half-Open | 1-5 requests |
52
- | **Success threshold** | Consecutive successes needed to close | 3-5 successes |
53
-
54
- ### What Counts as a Failure
55
-
56
- Not every error should trip the circuit breaker. Configure what counts:
57
-
58
- | Should Trip | Should Not Trip |
59
- |------------|----------------|
60
- | Connection timeout | 400 Bad Request (client error) |
61
- | Read timeout | 404 Not Found |
62
- | 5xx server error | 429 Too Many Requests (handle with retry/backoff) |
63
- | Connection refused | Business logic validation errors |
64
- | Circuit breaker open on downstream | Request cancellation by client |
65
-
66
- ### Implementation Considerations
67
-
68
- - **Granularity:** One circuit breaker per downstream service, or per endpoint within a service? Per-endpoint gives finer control but more complexity.
69
- - **Fallback behavior:** When the circuit is open, what do you return? Cached data? Default value? Error response? The right answer depends on the use case.
70
- - **Monitoring:** Every circuit breaker state change should emit a metric and a log entry. An open circuit breaker is a critical signal.
71
- - **Coordination:** In a fleet of instances, each has its own circuit breaker state. Consider whether this is acceptable or if you need coordinated state (usually independent is fine).
72
- - **Half-open thundering herd:** When the recovery timeout expires, only let one or two trial requests through -- not the full backlog.
73
-
74
- ### Code Pattern (Pseudocode)
75
-
76
- ```
77
- class CircuitBreaker:
78
- state = CLOSED
79
- failure_count = 0
80
- last_failure_time = null
81
-
82
- function call(operation):
83
- if state == OPEN:
84
- if now() - last_failure_time > recovery_timeout:
85
- state = HALF_OPEN
86
- else:
87
- raise CircuitOpenException()
88
-
89
- try:
90
- result = operation()
91
- on_success()
92
- return result
93
- catch Exception:
94
- on_failure()
95
- raise
96
-
97
- function on_success():
98
- if state == HALF_OPEN:
99
- state = CLOSED
100
- failure_count = 0
101
-
102
- function on_failure():
103
- failure_count += 1
104
- last_failure_time = now()
105
- if failure_count >= threshold:
106
- state = OPEN
107
- ```
108
-
109
- ---
110
-
111
- ## 2. Bulkheads
112
-
113
- Named after the watertight compartments in a ship's hull, bulkheads partition system resources so that a failure in one partition does not sink the entire system.
114
-
115
- ### Types of Bulkheads
116
-
117
- | Type | Mechanism | Use Case |
118
- |------|-----------|----------|
119
- | **Thread pool isolation** | Separate thread pools per dependency | Service A gets 20 threads, Service B gets 20 threads; A's failure cannot exhaust B's pool |
120
- | **Connection pool isolation** | Separate connection pools per downstream | Payment DB pool separate from analytics DB pool |
121
- | **Process isolation** | Separate OS processes per workload | Background jobs in separate processes from request handling |
122
- | **Container isolation** | Separate containers per service | Each microservice in its own container with resource limits |
123
- | **Swim lanes** | Complete stack isolation for critical paths | Checkout flow runs on entirely separate infrastructure from browsing |
124
-
125
- ### Swim Lanes
126
-
127
- Swim lanes are the most rigorous form of bulkheading. A swim lane is a complete, isolated stack -- from load balancer to database -- dedicated to a specific function.
128
-
129
- **When to use swim lanes:**
130
- - Revenue-critical paths (checkout, payment processing)
131
- - Compliance-critical paths (authentication, audit logging)
132
- - When a non-critical feature has historically caused outages affecting critical features
133
-
134
- **Design rules for swim lanes:**
135
- - No synchronous calls across swim lane boundaries
136
- - No shared databases, caches, or message queues
137
- - Asynchronous replication of data between lanes if needed
138
- - Each lane has independent scaling, deployment, and monitoring
139
-
140
- ### Sizing Bulkheads
141
-
142
- The key question: how many resources does each partition get?
143
-
144
- - **Too generous:** Wasted resources; the partition rarely uses its full allocation
145
- - **Too tight:** The partition cannot handle legitimate load spikes
146
- - **Right-sized:** Based on measured throughput at p99 load, plus 20-30% headroom
147
-
148
- **Approach:** Measure the actual concurrency for each dependency under peak load. Set the bulkhead size to p99 concurrency + 20% headroom. Set a queue/reject policy for requests beyond the limit.
149
-
150
- ---
151
-
152
- ## 3. Timeouts
153
-
154
- Every outbound call needs a timeout. Every. Single. One. A missing timeout is a thread leak waiting to happen.
155
-
156
- ### Types of Timeouts
157
-
158
- | Type | What It Controls | Typical Range |
159
- |------|-----------------|---------------|
160
- | **Connect timeout** | Time to establish a TCP connection | 500ms - 2s |
161
- | **Read timeout** | Time to receive a response after connecting | 1s - 30s (depends on operation) |
162
- | **Write timeout** | Time to send the request body | 1s - 10s |
163
- | **Idle timeout** | Time a connection can sit unused in the pool | 30s - 5 min |
164
- | **Request timeout** | Overall deadline for the entire operation | Varies by use case |
165
-
166
- ### Timeout Propagation
167
-
168
- When Service A calls Service B, which calls Service C, timeouts must propagate down the chain. If the user's request has a 5-second deadline, Service A should not start a 10-second operation.
169
-
170
- ```
171
- User request: 10s deadline
172
- → Service A: 8s deadline (2s for own processing)
173
- → Service B: 5s deadline (3s for A's processing)
174
- → Service C: 3s deadline (2s for B's processing)
175
- ```
176
-
177
- **Implementation:** Pass the remaining deadline in a request header (e.g., `X-Request-Deadline` or gRPC deadline propagation). Each service subtracts its own processing time and passes the remainder downstream.
178
-
179
- ### Common Timeout Mistakes
180
-
181
- | Mistake | Consequence | Fix |
182
- |---------|-------------|-----|
183
- | Using default OS timeout (120-300s) | Threads blocked for minutes | Set explicit timeouts on every call |
184
- | Same timeout for all operations | Fast reads wait too long; slow writes fail prematurely | Tune timeouts per operation type |
185
- | No timeout on DNS resolution | DNS failure blocks thread for OS default (30s+) | Use async DNS or set DNS timeout |
186
- | Not timing out connection pool acquisition | Thread waits forever for a connection from the pool | Set pool checkout timeout (500ms-2s) |
187
- | Timeout too aggressive | Legitimate slow responses treated as failures | Set timeout based on p99 latency + margin |
188
-
189
- ### Setting Timeout Values
190
-
191
- 1. Measure the p99 latency of the operation under normal load
192
- 2. Add a margin (typically 2-3x p99)
193
- 3. Consider the user-facing deadline -- if the user will wait only 5 seconds, your timeout must be less than 5 seconds
194
- 4. Monitor timeout rates -- if timeouts fire frequently, the downstream is degrading
195
-
196
- ---
197
-
198
- ## 4. Retry with Backoff
199
-
200
- Retries are necessary because transient failures are real -- network blips, momentary overloads, and garbage collection pauses cause temporary unavailability that resolves on its own. But naive retries (immediate, unlimited) cause more harm than good.
201
-
202
- ### Retry Strategy Components
203
-
204
- | Component | Purpose | Implementation |
205
- |-----------|---------|----------------|
206
- | **Exponential backoff** | Increase delay between retries to give the downstream time to recover | Delay = base * 2^attempt (e.g., 100ms, 200ms, 400ms, 800ms) |
207
- | **Jitter** | Randomize the delay to prevent all clients from retrying at the same instant | Delay = random(0, base * 2^attempt) |
208
- | **Maximum retries** | Limit total attempts to prevent infinite retry loops | Typically 3-5 retries |
209
- | **Retry budget** | Limit the percentage of requests that are retries across the entire fleet | No more than 10-20% of total requests should be retries |
210
- | **Idempotency** | Ensure the operation is safe to retry without side effects | Use idempotency keys for mutations |
211
-
212
- ### When to Retry
213
-
214
- | Retry | Do Not Retry |
215
- |-------|-------------|
216
- | 503 Service Unavailable | 400 Bad Request |
217
- | 429 Too Many Requests (with backoff) | 401/403 Authentication/Authorization |
218
- | Connection timeout | 404 Not Found |
219
- | Connection reset | 422 Validation Error |
220
- | Read timeout (for idempotent operations) | Read timeout (for non-idempotent operations without idempotency key) |
221
-
222
- ### Retry Budget
223
-
224
- A retry budget limits the total percentage of retried requests across your entire fleet. Without a budget, a fleet of 100 instances each retrying 3 times can amplify load on a struggling downstream by 300x.
225
-
226
- **Implementation:**
227
- - Track the ratio of retries to original requests over a sliding window (e.g., 1 minute)
228
- - If retry ratio exceeds the budget (e.g., 20%), stop retrying and fail fast
229
- - This provides fleet-level protection that per-instance retry limits cannot
230
-
231
- ### The Thundering Herd Problem with Retries
232
-
233
- When a downstream service recovers, all clients retry simultaneously, overwhelming it again. Jitter solves this:
234
-
235
- - **No jitter:** All 1,000 clients retry at exactly t+100ms, t+200ms, t+400ms
236
- - **Full jitter:** Each client retries at random(0, 100ms), random(0, 200ms), random(0, 400ms) -- spreading the load evenly
237
-
238
- ---
239
-
240
- ## 5. Steady State
241
-
242
- Production systems accumulate cruft over time. Log files grow. Sessions pile up. Temporary files linger. Database tables bloat. Without active management, this accumulation eventually exhausts a resource -- disk space, memory, database capacity -- and the system fails.
243
-
244
- ### What Accumulates
245
-
246
- | Resource | Growth Mechanism | Consequence of Neglect |
247
- |----------|-----------------|----------------------|
248
- | **Log files** | Application logging, access logs | Disk full; application cannot write; crash |
249
- | **Database rows** | Event logs, audit trails, temp records | Slow queries; backup failures; storage costs |
250
- | **Sessions** | User sessions stored server-side | Memory exhaustion; swap thrashing |
251
- | **Temp files** | Upload processing, report generation | Disk full |
252
- | **Cache entries** | Application cache without TTL | Memory exhaustion |
253
- | **Message queues** | Unprocessed or dead-letter messages | Queue backpressure; memory/disk exhaustion |
254
-
255
- ### Steady State Design
256
-
257
- Every resource that grows must have a corresponding mechanism to shrink:
258
-
259
- - **Log rotation:** Rotate by size (500MB) and time (daily); retain N files; compress rotated files
260
- - **Data purging:** Delete or archive records older than retention period; run during off-peak hours
261
- - **Session cleanup:** Set maximum session duration and idle timeout; evict expired sessions automatically
262
- - **Cache eviction:** Use TTL-based expiration; implement LRU or LFU eviction when memory limit is reached
263
- - **Queue management:** Set maximum queue depth; dead-letter after N delivery attempts; alert on growing queue size
264
-
265
- ---
266
-
267
- ## 6. Fail Fast
268
-
269
- If a system knows it cannot process a request successfully, it should reject the request immediately rather than consuming resources in a doomed attempt.
270
-
271
- ### When to Fail Fast
272
-
273
- | Condition | Fail-Fast Response |
274
- |-----------|-------------------|
275
- | Circuit breaker is open | Return 503 immediately |
276
- | Required parameter missing | Return 400 immediately |
277
- | User not authenticated | Return 401 immediately |
278
- | Resource limit exceeded (rate limit) | Return 429 immediately |
279
- | Request deadline already expired | Return 504 immediately |
280
- | Required downstream service unavailable | Return 503 with degraded response |
281
-
282
- ### Why Fail Fast Is Kind
283
-
284
- Failing fast is not hostile -- it is kind. A fast rejection lets the caller know immediately that this request will not work, freeing the caller to retry elsewhere, display an error, or degrade gracefully. A slow failure wastes the caller's time, threads, and hope.
285
-
286
- ---
287
-
288
- ## 7. Let It Crash
289
-
290
- Borrowed from Erlang's "let it crash" philosophy: when a process enters an unrecoverable or uncertain state, it is safer to terminate and restart from a known-good state than to attempt in-process recovery.
291
-
292
- ### When to Let It Crash
293
-
294
- - Corrupted in-memory state that cannot be validated
295
- - Resource handles (file descriptors, connections) in an unknown state
296
- - Unhandled exception in a critical path where recovery logic is complex and error-prone
297
- - Process consuming excessive memory or CPU with no clear cause
298
-
299
- ### Prerequisites for Let It Crash
300
-
301
- - **Fast restart:** Process must start in seconds, not minutes
302
- - **Supervision:** A supervisor must detect the crash and restart the process
303
- - **State recovery:** Critical state must be externalized (database, distributed cache) -- not lost on crash
304
- - **Health checks:** Load balancer must detect the restart and route traffic away during startup
305
- - **Crash budget:** Monitor crash frequency; excessive crashes indicate a deeper problem, not a healthy recovery mechanism
306
-
307
- ---
308
-
309
- ## 8. Handshaking
310
-
311
- Handshaking is a protocol-level mechanism where the server tells the client whether it is ready to accept work before the client sends a full request. This prevents the server from being overwhelmed when it is already overloaded.
312
-
313
- ### Handshaking Mechanisms
314
-
315
- | Level | Mechanism | Example |
316
- |-------|-----------|---------|
317
- | **TCP** | SYN/ACK with backlog queue | OS rejects connections when listen queue is full |
318
- | **HTTP** | 100 Continue response | Server tells client to proceed with request body, or rejects early |
319
- | **Application** | Health check + load shedding | Load balancer checks `/ready` endpoint; server returns 503 when overloaded |
320
- | **gRPC** | Flow control with window updates | Server signals how much data it can receive |
321
- | **Custom** | Pre-flight capacity check | Client asks "can you handle this request?" before sending payload |
322
-
323
- ### Application-Level Handshaking
324
-
325
- Implement a readiness check that reflects actual capacity:
326
-
327
- ```
328
- GET /ready
329
-
330
- 200 OK → Server can accept work
331
- 503 Unavailable → Server is overloaded; do not send requests
332
-
333
- Readiness considers:
334
- - Thread pool utilization < 80%
335
- - Connection pool utilization < 80%
336
- - Response latency < SLO threshold
337
- - No critical dependency failures
338
- ```
339
-
340
- This allows load balancers and service meshes to route traffic away from overloaded instances before they fail, rather than after.
341
-
342
- ## Pattern Combinations
343
-
344
- These patterns are most effective in combination. Common pairings:
345
-
346
- | Combination | Effect |
347
- |-------------|--------|
348
- | **Timeout + Circuit Breaker** | Timeout detects slow failures; circuit breaker prevents repeated attempts |
349
- | **Circuit Breaker + Fallback** | Circuit breaker trips; fallback provides degraded response |
350
- | **Bulkhead + Circuit Breaker** | Bulkhead limits blast radius; circuit breaker stops the bleeding |
351
- | **Retry + Timeout + Circuit Breaker** | Retry handles transient failures; timeout limits wait; circuit breaker stops persistent failures |
352
- | **Fail Fast + Handshaking** | Server signals overload; client fails fast without sending work |
353
- | **Steady State + Let It Crash** | Cleanup prevents resource exhaustion; crash recovers from unknown states |
354
-
355
- The key principle: no single pattern is sufficient. Production-ready systems layer multiple patterns to create defense in depth.
@@ -1,37 +0,0 @@
1
- ---
2
- description: 🔍 Audit skill theo 7 nguyên tắc hoàn hảo
3
- ---
4
-
5
- # Skill Audit — Chấm điểm Skill
6
-
7
- ## Cách dùng
8
-
9
- Hỏi user: "Anh muốn audit skill nào? Cho em đường dẫn tới thư mục skill hoặc file SKILL.md"
10
-
11
- ## Chạy audit
12
-
13
- // turbo
14
-
15
- 1. Chạy lệnh audit:
16
-
17
- ```bash
18
- python "$env:USERPROFILE\.gemini\antigravity\skills\skill-generator\scripts\skill_audit.py" <đường_dẫn_skill>
19
- ```
20
-
21
- 1. Nếu user muốn output JSON:
22
-
23
- ```bash
24
- python "$env:USERPROFILE\.gemini\antigravity\skills\skill-generator\scripts\skill_audit.py" <đường_dẫn_skill> --json
25
- ```
26
-
27
- 1. Nếu user muốn chấm khắt khe:
28
-
29
- ```bash
30
- python "$env:USERPROFILE\.gemini\antigravity\skills\skill-generator\scripts\skill_audit.py" <đường_dẫn_skill> --strict
31
- ```
32
-
33
- ## Sau khi chạy
34
-
35
- - Hiển thị kết quả cho user
36
- - Nếu điểm thấp (<70%) → gợi ý sửa các nguyên tắc bị điểm thấp
37
- - Nếu điểm cao (≥85%) → khen và gợi ý export ra các nền tảng khác
@@ -1,34 +0,0 @@
1
- ---
2
- description: 🔄 So sánh 2 phiên bản skill
3
- ---
4
-
5
- # Skill Compare — So sánh phiên bản
6
-
7
- ## Cách dùng
8
-
9
- Hỏi user 2 đường dẫn:
10
-
11
- 1. "Đường dẫn tới skill phiên bản CŨ?"
12
- 2. "Đường dẫn tới skill phiên bản MỚI?"
13
-
14
- ## Chạy compare
15
-
16
- // turbo
17
-
18
- 1. So sánh 2 thư mục:
19
-
20
- ```bash
21
- python "$env:USERPROFILE\.gemini\antigravity\skills\skill-generator\scripts\skill_compare.py" <đường_dẫn_cũ> <đường_dẫn_mới>
22
- ```
23
-
24
- 1. Output JSON:
25
-
26
- ```bash
27
- python "$env:USERPROFILE\.gemini\antigravity\skills\skill-generator\scripts\skill_compare.py" <đường_dẫn_cũ> <đường_dẫn_mới> --json
28
- ```
29
-
30
- ## Sau khi chạy
31
-
32
- - Hiển thị bảng so sánh metrics
33
- - Cho biết phiên bản mới tốt hơn hay tệ hơn
34
- - Gợi ý cải thiện nếu cần
@@ -1,51 +0,0 @@
1
- ---
2
- description: 📦 Export skill ra các nền tảng (Cursor, Claude, Windsurf, OpenClaw...)
3
- ---
4
-
5
- # Skill Export — Chuyển đổi đa nền tảng
6
-
7
- ## Cách dùng
8
-
9
- Hỏi user 2 thông tin:
10
-
11
- 1. "Đường dẫn tới skill muốn export?"
12
- 2. "Export sang nền tảng nào?" (cursor / claude / windsurf / cline / copilot / openclaw / all)
13
-
14
- ## Chạy export
15
-
16
- // turbo
17
-
18
- 1. Export sang 1 nền tảng:
19
-
20
- ```bash
21
- python "$env:USERPROFILE\.gemini\antigravity\skills\skill-generator\scripts\skill_export.py" <đường_dẫn_skill> --platform <nền_tảng>
22
- ```
23
-
24
- 1. Export tất cả:
25
-
26
- ```bash
27
- python "$env:USERPROFILE\.gemini\antigravity\skills\skill-generator\scripts\skill_export.py" <đường_dẫn_skill> --platform all
28
- ```
29
-
30
- 1. Chỉ định thư mục output:
31
-
32
- ```bash
33
- python "$env:USERPROFILE\.gemini\antigravity\skills\skill-generator\scripts\skill_export.py" <đường_dẫn_skill> --platform all --output <thư_mục>
34
- ```
35
-
36
- ## Nền tảng hỗ trợ
37
-
38
- | Nền tảng | Flag | File output |
39
- | --- | --- | --- |
40
- | Cursor | `cursor` | `.mdc` |
41
- | Claude Code | `claude` | `.md` |
42
- | Windsurf | `windsurf` | `.md` |
43
- | Cline | `cline` | `.md` |
44
- | GitHub Copilot | `copilot` | `.md` |
45
- | OpenClaw | `openclaw` | `.txt` |
46
- | Tất cả | `all` | Mỗi nền tảng 1 file |
47
-
48
- ## Sau khi chạy
49
-
50
- - Hiển thị danh sách files đã export
51
- - Hướng dẫn user copy file vào đúng vị trí cho từng nền tảng
@@ -1,39 +0,0 @@
1
- ---
2
- description: 🧠 Tạo Skill mới từ ý tưởng (phỏng vấn 5 Phase → sinh full package)
3
- ---
4
-
5
- # Skill Generator — Tạo Skill từ ý tưởng
6
-
7
- Khi user gõ `/skill-generate`, thực hiện quy trình sau:
8
-
9
- ## Bước 1: Kích hoạt Skill Generator
10
-
11
- Đọc file `SKILL.md` trong skill `skill-generator` và bắt đầu quy trình tạo skill mới.
12
-
13
- AI sẽ đóng vai **Skill Architect** và thực hiện pipeline 5 Phase:
14
-
15
- ```
16
- Phase 1: 🎤 Phỏng vấn thông minh → Hiểu công việc user
17
- Phase 2: 🔬 Trích xuất thông tin → Cấu trúc hóa
18
- Phase 3: 🔎 Phát hiện pattern → Chọn kiến trúc
19
- Phase 4: 🏗️ Sinh skill package → Tạo đầy đủ files
20
- Phase 5: 🧪 Test & refine → Đảm bảo chất lượng
21
- ```
22
-
23
- ## Bước 2: Bắt đầu phỏng vấn
24
-
25
- Hỏi user câu mở đầu:
26
-
27
- > "Anh/chị mô tả cho em nghe công việc mà anh/chị muốn AI tự động hóa đi.
28
- > Nói tự nhiên thôi, như đang hướng dẫn một đồng nghiệp mới vậy."
29
-
30
- ## Bước 3: Hoàn thành
31
-
32
- Sau khi chạy xong 5 Phase:
33
-
34
- - Tạo **full skill package** (SKILL.md + README + resources + examples + scripts + workflows)
35
- - Hiển thị cấu trúc thư mục
36
- - Chạy dry run test
37
- - Hướng dẫn sử dụng
38
-
39
- > 💡 **Lưu ý:** Nếu user đã cung cấp flow rõ ràng → AI tự nhận diện Fast Track, skip phỏng vấn.
@@ -1,52 +0,0 @@
1
- ---
2
- description: 🧩 Tạo skeleton skill mới từ 1 lệnh
3
- ---
4
-
5
- # Skill Scaffold — Tạo skill mới
6
-
7
- ## Cách dùng
8
-
9
- Hỏi user:
10
-
11
- 1. "Tên skill mới là gì? (kebab-case, ví dụ: price-quoter)"
12
- 2. "Muốn tạo cơ bản hay đầy đủ?" (cơ bản = chỉ SKILL.md / đầy đủ = kèm scripts + resources + examples)
13
-
14
- ## Chạy scaffold
15
-
16
- // turbo
17
-
18
- 1. Tạo cơ bản:
19
-
20
- ```bash
21
- python "$env:USERPROFILE\.gemini\antigravity\skills\skill-generator\scripts\skill_scaffold.py" <tên_skill>
22
- ```
23
-
24
- 1. Tạo đầy đủ:
25
-
26
- ```bash
27
- python "$env:USERPROFILE\.gemini\antigravity\skills\skill-generator\scripts\skill_scaffold.py" <tên_skill> --full
28
- ```
29
-
30
- 1. Tạo kèm scripts:
31
-
32
- ```bash
33
- python "$env:USERPROFILE\.gemini\antigravity\skills\skill-generator\scripts\skill_scaffold.py" <tên_skill> --with-scripts
34
- ```
35
-
36
- 1. Chế độ tương tác (hỏi từng bước):
37
-
38
- ```bash
39
- python "$env:USERPROFILE\.gemini\antigravity\skills\skill-generator\scripts\skill_scaffold.py" <tên_skill> --interactive
40
- ```
41
-
42
- 1. Chỉ định thư mục output:
43
-
44
- ```bash
45
- python "$env:USERPROFILE\.gemini\antigravity\skills\skill-generator\scripts\skill_scaffold.py" <tên_skill> --full --output <thư_mục>
46
- ```
47
-
48
- ## Sau khi chạy
49
-
50
- - Hiển thị cấu trúc thư mục đã tạo
51
- - Mở file SKILL.md cho user điền nội dung
52
- - Gợi ý chạy /skill-audit sau khi viết xong
@@ -1,25 +0,0 @@
1
- ---
2
- description: 🧪 Mô phỏng chạy thử skill
3
- ---
4
-
5
- # Skill Simulate — Mô phỏng dry-run
6
-
7
- ## Cách dùng
8
-
9
- Hỏi user: "Anh muốn simulate skill nào? Cho em đường dẫn."
10
-
11
- ## Chạy simulate
12
-
13
- // turbo
14
-
15
- 1. Mô phỏng skill:
16
-
17
- ```bash
18
- python "$env:USERPROFILE\.gemini\antigravity\skills\skill-generator\scripts\simulate_skill.py" <đường_dẫn_skill>
19
- ```
20
-
21
- ## Sau khi chạy
22
-
23
- - Hiển thị từng bước đã mô phỏng
24
- - Cảnh báo các bước mơ hồ cần sửa
25
- - Gợi ý thay thế từ mơ hồ bằng từ chính xác
@@ -1,31 +0,0 @@
1
- ---
2
- description: 📊 Xem thống kê + Cognitive Load của skill
3
- ---
4
-
5
- # Skill Stats — Phân tích thống kê
6
-
7
- ## Cách dùng
8
-
9
- Hỏi user: "Anh muốn xem thống kê skill nào? Cho em đường dẫn."
10
-
11
- ## Chạy stats
12
-
13
- // turbo
14
-
15
- 1. Thống kê bình thường:
16
-
17
- ```bash
18
- python "$env:USERPROFILE\.gemini\antigravity\skills\skill-generator\scripts\skill_stats.py" <đường_dẫn_skill>
19
- ```
20
-
21
- 1. Output JSON:
22
-
23
- ```bash
24
- python "$env:USERPROFILE\.gemini\antigravity\skills\skill-generator\scripts\skill_stats.py" <đường_dẫn_skill> --json
25
- ```
26
-
27
- ## Sau khi chạy
28
-
29
- - Hiển thị kết quả cho user
30
- - Nếu Cognitive Load > 75 → cảnh báo skill quá phức tạp
31
- - Nếu thiếu examples hoặc constraints → gợi ý thêm
@@ -1,25 +0,0 @@
1
- ---
2
- description: ✅ Kiểm tra SKILL.md có hợp lệ không
3
- ---
4
-
5
- # Skill Validate — Kiểm tra hợp lệ
6
-
7
- ## Cách dùng
8
-
9
- Hỏi user: "Anh muốn validate skill nào? Cho em đường dẫn."
10
-
11
- ## Chạy validate
12
-
13
- // turbo
14
-
15
- 1. Kiểm tra file hoặc thư mục:
16
-
17
- ```bash
18
- python "$env:USERPROFILE\.gemini\antigravity\skills\skill-generator\scripts\validate_skill.py" <đường_dẫn_skill>
19
- ```
20
-
21
- ## Sau khi chạy
22
-
23
- - Hiển thị kết quả pass/fail
24
- - Nếu có lỗi → gợi ý cách sửa
25
- - Nếu tất cả pass → gợi ý chạy /skill-audit để chấm điểm chi tiết