@workingpayload/agent-skills 1.0.0 → 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/APIForge/skill.md +150 -17
- package/AccessPlus/skill.md +122 -18
- package/AlgoMaster/skill.md +110 -17
- package/Architekt AI/skill.md +125 -17
- package/AuthCraft/skill.md +129 -17
- package/AutoScriptor/skill.md +122 -17
- package/BoilerCore/skill.md +121 -17
- package/BugHunter Pro/skill.md +118 -17
- package/ChangeScribe/skill.md +98 -17
- package/CodeSage/skill.md +148 -17
- package/CommitCraft/skill.md +97 -16
- package/CoverageMax/skill.md +145 -16
- package/CronGenius/skill.md +141 -16
- package/DataPolish/skill.md +126 -16
- package/DataWeaver/skill.md +135 -16
- package/DockMaster/skill.md +142 -16
- package/DocuGenie/skill.md +122 -16
- package/EdgeGuard/skill.md +144 -16
- package/EnvWizard/skill.md +140 -16
- package/ErrorMedic/skill.md +136 -16
- package/FeatureSmith/skill.md +123 -16
- package/FlexiLayout/skill.md +128 -16
- package/FlowTester/skill.md +138 -16
- package/FunctionForge/skill.md +120 -16
- package/InputShield/skill.md +128 -16
- package/IssueForge/skill.md +132 -16
- package/KubeCrafter/skill.md +133 -16
- package/LogicLens/skill.md +116 -16
- package/MockSmith/skill.md +130 -16
- package/ModelSensei/skill.md +122 -16
- package/PRMentor/skill.md +103 -32
- package/PerfDetective/skill.md +90 -32
- package/PipelinePro/skill.md +146 -32
- package/PolyglotShift/skill.md +94 -32
- package/PromptForge/skill.md +118 -32
- package/QueryPulse/skill.md +123 -32
- package/README.md +416 -329
- package/ReadMeCraft/skill.md +127 -32
- package/RefactorX/skill.md +84 -32
- package/RenderBoost/skill.md +148 -32
- package/SEOMancer/skill.md +140 -16
- package/ScrapeMaster/skill.md +157 -32
- package/SecretSniffer/skill.md +107 -16
- package/SecureScan/skill.md +114 -16
- package/ServiceSplitter/skill.md +137 -16
- package/SpeedSmith/skill.md +139 -16
- package/StackWise/skill.md +139 -16
- package/TaskOrchestrator/skill.md +119 -16
- package/TestCrafter/skill.md +142 -16
- package/TraceMind/skill.md +127 -16
- package/UISmith/skill.md +115 -16
- package/bin/cli.js +377 -0
- package/extension-extender/SKILL.md +122 -0
- package/fastapi-furious/SKILL.md +148 -0
- package/package.json +41 -28
- package/python-master/SKILL.md +108 -0
- package/react-ranger/SKILL.md +93 -0
- package/scripts/build_index.py +282 -0
- package/scripts/doctor.py +541 -0
- package/scripts/install.py +397 -0
- package/scripts/route.py +348 -0
- package/scripts/score.py +355 -0
- package/scripts/test_skill.py +473 -0
- package/scripts/validate.py +254 -0
- package/skills-routing.json +1131 -0
- package/skills.json +3261 -0
- package/Extension-Extender/SKILL.md +0 -41
- package/Extension-Extender/references/ui-guidelines.md +0 -26
- package/Fastapi-Furious/README.md +0 -16
- package/Fastapi-Furious/SKILL.md +0 -37
- package/Python-Master/README.md +0 -11
- package/Python-Master/SKILL.md +0 -37
- package/React-Ranger/README.md +0 -17
- package/React-Ranger/SKILL.md +0 -37
- package/cli.js +0 -181
- package/parse_skills.py +0 -44
- /package/{Extension-Extender → extension-extender}/assets/manifest.json +0 -0
- /package/{Extension-Extender → extension-extender}/assets/popup.css +0 -0
- /package/{Extension-Extender → extension-extender}/assets/popup.html +0 -0
- /package/{Extension-Extender → extension-extender}/assets/popup.js +0 -0
package/ServiceSplitter/skill.md
CHANGED
|
@@ -1,32 +1,153 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: servicesplitter
|
|
3
|
-
description:
|
|
3
|
+
description: Decomposes monolithic applications into microservices using DDD bounded contexts, event storming, and the strangler fig pattern. Use when asked to split a monolith, design microservice boundaries, define service contracts, or implement saga/circuit breaker patterns.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# ServiceSplitter
|
|
7
7
|
|
|
8
8
|
## Overview
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
Guides microservice decomposition using Domain-Driven Design (DDD) bounded contexts, event storming workshops, and incremental extraction via the strangler fig pattern. Produces service boundary maps, API contracts, event schemas, and resilience patterns (sagas, circuit breakers) — grounded in concrete architecture decisions rather than abstract principles.
|
|
11
11
|
|
|
12
12
|
## Workflow
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
### 1. Domain Discovery via Event Storming
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
- Analyze the user's request thoroughly.
|
|
18
|
-
- Identify the core requirements for decoupling monolithic applications into independent microservices and defining bounded contexts.
|
|
19
|
-
- Ensure all context and preconditions are understood.
|
|
16
|
+
Before drawing service boundaries, map the domain:
|
|
20
17
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
18
|
+
1. **Big Picture Event Storming**: List all domain events (past tense, orange stickies) across the full system: `OrderPlaced`, `PaymentProcessed`, `InventoryReserved`, `ShipmentDispatched`.
|
|
19
|
+
2. **Identify commands and actors**: What triggers each event? Who initiates it?
|
|
20
|
+
3. **Find aggregates**: Group events that share a consistency boundary (transactional consistency requirement).
|
|
21
|
+
4. **Spot pivot events**: Events that cross team/subdomain boundaries are natural seams for service cuts.
|
|
22
|
+
5. **Define bounded contexts**: Each context has its own ubiquitous language. The same word means different things in different contexts (e.g., "Customer" in Sales vs. Support vs. Billing).
|
|
25
23
|
|
|
26
|
-
|
|
27
|
-
- Review the generated output against industry best practices for architecture.
|
|
28
|
-
- Ensure the result perfectly resolves the user's request without omissions.
|
|
24
|
+
Output: Context map diagram showing bounded contexts and their relationships (Partnership, Customer-Supplier, Conformist, Anti-Corruption Layer, Open Host Service).
|
|
29
25
|
|
|
30
|
-
|
|
26
|
+
### 2. Service Boundary Identification
|
|
31
27
|
|
|
32
|
-
|
|
28
|
+
Apply these heuristics to validate candidate boundaries:
|
|
29
|
+
|
|
30
|
+
| Criterion | Good Boundary Signal |
|
|
31
|
+
|-----------|---------------------|
|
|
32
|
+
| Business capability | Service owns one cohesive business capability end-to-end |
|
|
33
|
+
| Data ownership | Service is the single writer for its data; no direct DB sharing |
|
|
34
|
+
| Change frequency | Service deploys independently without coordinating other teams |
|
|
35
|
+
| Team alignment | Matches Conway's Law — one team owns one service |
|
|
36
|
+
| Transaction boundary | Avoids distributed transactions; uses eventual consistency |
|
|
37
|
+
|
|
38
|
+
Red flags: two services that always deploy together, services that call each other synchronously in a chain deeper than 2 hops, shared databases.
|
|
39
|
+
|
|
40
|
+
### 3. Strangler Fig Extraction Pattern
|
|
41
|
+
|
|
42
|
+
For incremental extraction from a monolith:
|
|
43
|
+
|
|
44
|
+
1. **Identify the seam**: Pick a bounded context with clear in/out HTTP or event boundaries.
|
|
45
|
+
2. **Route at the edge**: Place an API gateway or reverse proxy (Nginx, AWS API Gateway, Kong) in front of the monolith. All traffic still flows through.
|
|
46
|
+
3. **Implement the new service**: Build the extracted service in its own repo/deployment unit with its own database.
|
|
47
|
+
4. **Feature flag traffic routing**: Gradually route traffic to the new service (1% → 10% → 100%) using feature flags or weighted routing rules.
|
|
48
|
+
5. **Delete the monolith code**: Only after the new service handles 100% of traffic and is stable. Remove the dead code path from the monolith.
|
|
49
|
+
6. **Repeat**: Move to the next bounded context.
|
|
50
|
+
|
|
51
|
+
Never do a Big Bang rewrite. Extract one context at a time.
|
|
52
|
+
|
|
53
|
+
### 4. API Contracts
|
|
54
|
+
|
|
55
|
+
Define contracts before implementation using OpenAPI 3.1 or AsyncAPI 2.x:
|
|
56
|
+
|
|
57
|
+
**Synchronous (REST/gRPC)**:
|
|
58
|
+
```yaml
|
|
59
|
+
# openapi: 3.1.0
|
|
60
|
+
paths:
|
|
61
|
+
/orders/{orderId}:
|
|
62
|
+
get:
|
|
63
|
+
operationId: getOrder
|
|
64
|
+
parameters:
|
|
65
|
+
- name: orderId
|
|
66
|
+
in: path
|
|
67
|
+
required: true
|
|
68
|
+
schema: { type: string, format: uuid }
|
|
69
|
+
responses:
|
|
70
|
+
'200':
|
|
71
|
+
content:
|
|
72
|
+
application/json:
|
|
73
|
+
schema: { $ref: '#/components/schemas/Order' }
|
|
74
|
+
'404':
|
|
75
|
+
content:
|
|
76
|
+
application/json:
|
|
77
|
+
schema: { $ref: '#/components/schemas/ProblemDetail' }
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
**Asynchronous (events)**:
|
|
81
|
+
Use AsyncAPI to document event schemas. Publish Avro or JSON Schema to a schema registry (Confluent Schema Registry, AWS Glue Schema Registry) for schema evolution governance.
|
|
82
|
+
|
|
83
|
+
Contract testing: use **Pact** (consumer-driven contract tests) to verify service contracts in CI without running the full stack.
|
|
84
|
+
|
|
85
|
+
### 5. Saga Pattern for Distributed Transactions
|
|
86
|
+
|
|
87
|
+
Use sagas for multi-service business transactions that span consistency boundaries.
|
|
88
|
+
|
|
89
|
+
**Choreography saga** (event-driven, no central coordinator):
|
|
90
|
+
- Each service listens for events and publishes compensating events on failure.
|
|
91
|
+
- Simple for 2–3 services. Difficult to debug as complexity grows.
|
|
92
|
+
- Use Kafka or RabbitMQ as the event bus.
|
|
93
|
+
|
|
94
|
+
**Orchestration saga** (central coordinator, recommended for complex flows):
|
|
95
|
+
- Use **Temporal** (`io.temporal.workflow`) or **AWS Step Functions** as the orchestrator.
|
|
96
|
+
- Coordinator calls services and handles compensation:
|
|
97
|
+
|
|
98
|
+
```python
|
|
99
|
+
# Temporal workflow example
|
|
100
|
+
@workflow.defn
|
|
101
|
+
class OrderFulfillmentWorkflow:
|
|
102
|
+
@workflow.run
|
|
103
|
+
async def run(self, order_id: str) -> str:
|
|
104
|
+
try:
|
|
105
|
+
await workflow.execute_activity(reserve_inventory, order_id)
|
|
106
|
+
await workflow.execute_activity(charge_payment, order_id)
|
|
107
|
+
await workflow.execute_activity(ship_order, order_id)
|
|
108
|
+
except ActivityError:
|
|
109
|
+
await workflow.execute_activity(cancel_inventory_reservation, order_id)
|
|
110
|
+
await workflow.execute_activity(refund_payment, order_id)
|
|
111
|
+
raise
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Each activity must be **idempotent** — implement idempotency keys using a UUID stored in the DB with a unique constraint.
|
|
115
|
+
|
|
116
|
+
### 6. Circuit Breakers and Resilience
|
|
117
|
+
|
|
118
|
+
Implement circuit breakers on all synchronous inter-service calls:
|
|
119
|
+
|
|
120
|
+
- **Resilience4j** (Java): `@CircuitBreaker(name = "inventoryService", fallbackMethod = "fallback")`
|
|
121
|
+
- **resilience4j-js** or **Polly** (.NET) for other stacks
|
|
122
|
+
- **Istio** service mesh: configure circuit breaking at the infrastructure level via `DestinationRule`
|
|
123
|
+
|
|
124
|
+
Circuit breaker states: CLOSED (normal) → OPEN (failing, reject calls) → HALF_OPEN (probe recovery).
|
|
125
|
+
Configure: `failureRateThreshold=50`, `waitDurationInOpenState=30s`, `slidingWindowSize=10`.
|
|
126
|
+
|
|
127
|
+
Add **bulkheads** (thread pool isolation) to prevent one slow downstream from exhausting shared thread pools.
|
|
128
|
+
|
|
129
|
+
### 7. Output Artifacts
|
|
130
|
+
|
|
131
|
+
Produce:
|
|
132
|
+
1. **Context map** (Mermaid diagram): bounded contexts with relationship types.
|
|
133
|
+
2. **Service decomposition table**: service name, owned capabilities, owned data, APIs exposed, events published/consumed.
|
|
134
|
+
3. **Strangler fig migration plan**: ordered list of extraction phases with rollback strategy per phase.
|
|
135
|
+
4. **API contracts**: OpenAPI stubs for synchronous APIs, AsyncAPI for event schemas.
|
|
136
|
+
5. **Saga design**: sequence diagram showing happy path and compensation flows.
|
|
137
|
+
6. **ADR (Architecture Decision Record)**: document the decomposition rationale and rejected alternatives.
|
|
138
|
+
|
|
139
|
+
## Additional Patterns
|
|
140
|
+
|
|
141
|
+
**Network latency cost of extraction:** Each synchronous inter-service call adds 1–10ms of network overhead. After extracting a service, profile call chains: if ServiceA calls ServiceB synchronously on every request, co-locate them or introduce an async messaging pattern (publish event, consume asynchronously). Cache stable reference data (product catalog, user profile) in the calling service with a short TTL to eliminate round trips for read-heavy paths.
|
|
142
|
+
|
|
143
|
+
**Event schema backward/forward compatibility:** Follow these rules for Avro/JSON Schema event evolution: (1) adding optional fields is backward compatible — consumers that don't know the field ignore it; (2) removing or renaming fields is breaking — use a deprecation period with both old and new field present; (3) changing a field's type is always breaking. Register all schemas in a schema registry and enforce compatibility mode (`BACKWARD` or `FULL`) in CI before merging schema changes.
|
|
144
|
+
|
|
145
|
+
**God table physical splitting:** When a single table serves multiple bounded contexts (e.g., a `users` table with columns from Auth, Profile, Billing, and Analytics), split it physically by creating new tables per context with the same primary key, backfilling data, and then migrating reads/writes service by service using the strangler fig pattern. Use database views during transition to avoid a flag day. Do not split without first confirming each context's column set via query log analysis.
|
|
146
|
+
|
|
147
|
+
## Edge Cases
|
|
148
|
+
|
|
149
|
+
**Shared data without clear ownership**: When multiple services need the same data (e.g., product catalog), designate one service as the system of record and expose a read API or publish events. Never allow two services to write to the same table. Use the CQRS pattern to maintain read-optimized projections in downstream services.
|
|
150
|
+
|
|
151
|
+
**Distributed transactions you cannot avoid**: If strong consistency is truly required (e.g., financial double-entry bookkeeping), do not split those aggregates across services. Keep them in the same service behind a single ACID transaction. Distributed saga compensation is eventually consistent — not a substitute for ACID where correctness requires it.
|
|
152
|
+
|
|
153
|
+
**Service mesh vs. library-based resilience**: Istio/Linkerd handle circuit breaking and retries transparently but add operational complexity. For teams new to microservices, start with library-based resilience (Resilience4j, Polly) and migrate to a service mesh only when the per-service configuration overhead becomes prohibitive.
|
package/SpeedSmith/skill.md
CHANGED
|
@@ -1,32 +1,155 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: speedsmith
|
|
3
|
-
description:
|
|
3
|
+
description: Implements performance optimizations for web applications including caching strategies, asset delivery, code splitting, and image optimization. Use when asked to improve page load times, reduce latency, optimize assets, or fix Core Web Vitals scores.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# SpeedSmith
|
|
7
7
|
|
|
8
8
|
## Overview
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
Diagnoses and fixes web performance bottlenecks using a measurement-first approach. Tools: Lighthouse CI, WebPageTest, Chrome DevTools Performance panel, and bundle analyzers. Covers CDN configuration, HTTP caching, Redis/in-memory caching, code splitting, tree-shaking, and next-gen image formats. Never optimize without first establishing a baseline metric.
|
|
11
11
|
|
|
12
12
|
## Workflow
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
### 1. Measure Before Optimizing
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
- Analyze the user's request thoroughly.
|
|
18
|
-
- Identify the core requirements for implementing aggressive caching strategies, optimizing asset delivery, and reducing application latency.
|
|
19
|
-
- Ensure all context and preconditions are understood.
|
|
16
|
+
Establish baselines before touching code:
|
|
20
17
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
-
|
|
18
|
+
```bash
|
|
19
|
+
# Lighthouse CLI baseline
|
|
20
|
+
npx lighthouse https://example.com --output=json --output-path=baseline.json \
|
|
21
|
+
--preset=desktop --throttling-method=simulate
|
|
25
22
|
|
|
26
|
-
|
|
27
|
-
-
|
|
28
|
-
- Ensure the result perfectly resolves the user's request without omissions.
|
|
23
|
+
# Bundle analysis (webpack)
|
|
24
|
+
npx webpack-bundle-analyzer stats.json
|
|
29
25
|
|
|
30
|
-
|
|
26
|
+
# Bundle analysis (Vite)
|
|
27
|
+
npx vite-bundle-visualizer
|
|
31
28
|
|
|
32
|
-
|
|
29
|
+
# WebPageTest API
|
|
30
|
+
curl "https://www.webpagetest.org/runtest.php?url=https://example.com&f=json&k=YOUR_KEY"
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Record: LCP, INP, CLS, TTI, TBT, total transfer size, number of requests, TTFB.
|
|
34
|
+
|
|
35
|
+
Set target thresholds before starting:
|
|
36
|
+
- LCP ≤ 2.5s, INP ≤ 200ms, CLS ≤ 0.1 (Core Web Vitals "Good" thresholds)
|
|
37
|
+
- Total page weight ≤ 500KB compressed for above-the-fold content
|
|
38
|
+
|
|
39
|
+
### 2. HTTP Caching Strategy
|
|
40
|
+
|
|
41
|
+
Apply appropriate cache headers per resource type:
|
|
42
|
+
|
|
43
|
+
| Resource Type | Cache-Control | CDN Behavior |
|
|
44
|
+
|---------------|--------------|--------------|
|
|
45
|
+
| Hashed static assets (JS, CSS) | `public, max-age=31536000, immutable` | Cache indefinitely |
|
|
46
|
+
| Images (hashed filenames) | `public, max-age=31536000, immutable` | Cache indefinitely |
|
|
47
|
+
| HTML pages | `public, max-age=0, must-revalidate` + ETag | CDN respects, revalidate on each request |
|
|
48
|
+
| API responses (public, stable) | `public, max-age=300, s-maxage=600` | CDN caches 10 min |
|
|
49
|
+
| API responses (user-specific) | `private, max-age=60` | Do not cache at CDN |
|
|
50
|
+
| Service Worker cached | Stale-while-revalidate via SW | Bypass CDN for SW-handled routes |
|
|
51
|
+
|
|
52
|
+
Use **content-addressable filenames** (webpack `[contenthash]`, Vite default behavior) to enable `immutable` caching safely.
|
|
53
|
+
|
|
54
|
+
### 3. CDN Configuration
|
|
55
|
+
|
|
56
|
+
- **Cloudflare**: Enable "Cache Everything" page rule for static assets. Use Cache Rules with `Cache Status: Cache` for `/assets/*`. Enable Argo Smart Routing for dynamic content.
|
|
57
|
+
- **AWS CloudFront**: Set `DefaultCacheBehavior` TTL to 86400 for static paths. Use Lambda@Edge or CloudFront Functions for header manipulation. Enable HTTP/3 (QUIC) and Brotli compression.
|
|
58
|
+
- **Fastly/Akamai**: Configure origin shield (shielding) to reduce origin load.
|
|
59
|
+
|
|
60
|
+
CDN must-haves: HTTP/2 or HTTP/3 push, Brotli compression, TLS 1.3, HSTS preloading.
|
|
61
|
+
|
|
62
|
+
### 4. Redis / Application-Level Caching
|
|
63
|
+
|
|
64
|
+
Cache-aside pattern: check Redis → on miss, compute and `setex` with TTL. Strategies: TTL-based (simple), event-driven invalidation (publish on write), write-through (write to both simultaneously). Always include user/tenant ID in cache keys for multi-tenant systems. Never share cache keys across tenants.
|
|
65
|
+
|
|
66
|
+
### 5. JavaScript Optimization
|
|
67
|
+
|
|
68
|
+
**Code splitting** (webpack/Vite):
|
|
69
|
+
```javascript
|
|
70
|
+
// Route-based splitting (React)
|
|
71
|
+
const Dashboard = React.lazy(() => import('./pages/Dashboard'));
|
|
72
|
+
|
|
73
|
+
// Manual chunk splitting (Vite)
|
|
74
|
+
// vite.config.ts
|
|
75
|
+
build: {
|
|
76
|
+
rollupOptions: {
|
|
77
|
+
output: {
|
|
78
|
+
manualChunks: {
|
|
79
|
+
vendor: ['react', 'react-dom'],
|
|
80
|
+
charts: ['recharts', 'd3'],
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
**Tree-shaking**: Ensure all imports are named (not `import * as`). Use `"sideEffects": false` in `package.json` for pure utility libraries. Verify with bundle analyzer that dead code is eliminated.
|
|
88
|
+
|
|
89
|
+
**Script loading**: Use `defer` for non-critical scripts. Use `type="module"` which is deferred by default. Use dynamic `import()` for features triggered by user interaction.
|
|
90
|
+
|
|
91
|
+
**Reduce main thread blocking**: Tasks over 50ms block the main thread. Use `scheduler.yield()` to break up long tasks:
|
|
92
|
+
```javascript
|
|
93
|
+
async function processLargeList(items) {
|
|
94
|
+
for (let i = 0; i < items.length; i++) {
|
|
95
|
+
process(items[i]);
|
|
96
|
+
if (i % 100 === 0) await scheduler.yield(); // yield to browser
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### 6. Image Optimization
|
|
102
|
+
|
|
103
|
+
Use AVIF (best compression) → WebP (fallback) → JPEG. SVG for all icons. Use `<picture>` with `<source type="image/avif">` and `<source type="image/webp">`. Set explicit `width`/`height` on all `<img>` to prevent CLS. Add `fetchpriority="high"` on the LCP image and `loading="lazy"` on below-fold images. Use a CDN image transform service (Cloudinary, Imgix) instead of manual exports.
|
|
104
|
+
|
|
105
|
+
### 7. Font Optimization
|
|
106
|
+
|
|
107
|
+
```html
|
|
108
|
+
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
109
|
+
<link rel="preload" href="/fonts/inter-var.woff2" as="font" type="font/woff2" crossorigin>
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
```css
|
|
113
|
+
@font-face {
|
|
114
|
+
font-family: 'Inter';
|
|
115
|
+
src: url('/fonts/inter-var.woff2') format('woff2');
|
|
116
|
+
font-display: optional; /* CLS=0; use 'swap' if text must render immediately */
|
|
117
|
+
size-adjust: 100%;
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Subset fonts to used character sets with `pyftsubset` or `fonttools`.
|
|
122
|
+
|
|
123
|
+
### 8. Output Artifacts
|
|
124
|
+
|
|
125
|
+
Produce:
|
|
126
|
+
1. **Before/After metrics table**: LCP, INP, CLS, TTI, transfer size — baseline vs. projected.
|
|
127
|
+
2. **Prioritized optimization list**: ordered by estimated impact, effort (low/medium/high), and risk.
|
|
128
|
+
3. **Code snippets**: ready-to-implement cache headers, config changes, code splits.
|
|
129
|
+
4. **Lighthouse CI config** for regression prevention:
|
|
130
|
+
```yaml
|
|
131
|
+
ci:
|
|
132
|
+
assert:
|
|
133
|
+
assertions:
|
|
134
|
+
largest-contentful-paint: [error, { maxNumericValue: 2500 }]
|
|
135
|
+
cumulative-layout-shift: [error, { maxNumericValue: 0.1 }]
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## Edge Cases
|
|
139
|
+
|
|
140
|
+
**Synchronous localStorage jank:** `localStorage.getItem/setItem` are synchronous and block the main thread, causing INP spikes on slower devices. Move large or frequent reads to IndexedDB (async) or cache the value in a module-level variable on first read and write back lazily.
|
|
141
|
+
|
|
142
|
+
**Bundle size CI gating:** Prevent bundle regressions with `size-limit` or `bundlesize`. Add to CI:
|
|
143
|
+
```json
|
|
144
|
+
// package.json
|
|
145
|
+
"size-limit": [{ "path": "dist/index.js", "limit": "50 KB" }]
|
|
146
|
+
```
|
|
147
|
+
Run `npx size-limit` in CI and fail the build if the limit is exceeded. This catches accidental large-dependency imports before they reach production.
|
|
148
|
+
|
|
149
|
+
**Origin TTFB diagnosis:** High TTFB (> 600ms) is a server-side problem. Check in order: (1) slow DB query — enable query logging and look for queries > 100ms; (2) cold start — serverless functions have 200–2000ms cold start; keep functions warm or use edge runtimes; (3) connection pool exhaustion — check pool wait time metrics; increase pool size or reduce query duration.
|
|
150
|
+
|
|
151
|
+
**Third-party scripts:** Load analytics and chat widgets with `async`/`defer` or after the `load` event. Use `<link rel="dns-prefetch">` for third-party domains.
|
|
152
|
+
|
|
153
|
+
**SSR hydration overhead:** SSR with full hydration can produce high TTI. Consider partial hydration (Astro islands), streaming SSR, or React Server Components to reduce client JS.
|
|
154
|
+
|
|
155
|
+
**CDN cache poisoning:** Never cache responses with user-specific data without `private` cache-control. Use `Vary: Accept-Encoding` (not `Vary: User-Agent`) for Brotli/gzip variants.
|
package/StackWise/skill.md
CHANGED
|
@@ -1,32 +1,155 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: stackwise
|
|
3
|
-
description:
|
|
3
|
+
description: Advises on technology stack selection, evaluates library trade-offs, and produces Architecture Decision Records (ADRs). Use when asked to choose a framework, compare libraries, evaluate tech stack options, or document architectural decisions with rejected alternatives.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# StackWise
|
|
7
7
|
|
|
8
8
|
## Overview
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
Produces structured technology evaluations that account for team context, project constraints, and long-term maintainability. Output format is an Architecture Decision Record (ADR) with a scored evaluation rubric, library health metrics, and explicit documentation of rejected alternatives. No generic "it depends" answers — every recommendation is justified with concrete criteria.
|
|
11
11
|
|
|
12
12
|
## Workflow
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
### 1. Requirements Gathering
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
- Analyze the user's request thoroughly.
|
|
18
|
-
- Identify the core requirements for advising on technology stack selections, evaluating library trade-offs, and designing overarching technical strategies.
|
|
19
|
-
- Ensure all context and preconditions are understood.
|
|
16
|
+
Before evaluating options, establish:
|
|
20
17
|
|
|
21
|
-
|
|
22
|
-
-
|
|
23
|
-
-
|
|
24
|
-
-
|
|
18
|
+
**Functional requirements**:
|
|
19
|
+
- What does the technology need to do? (e.g., "serve 10k req/s REST API", "render server-side HTML with dynamic data", "run ML inference on edge devices")
|
|
20
|
+
- What integrations are mandatory? (existing DBs, auth providers, cloud platform)
|
|
21
|
+
- What data/traffic scale is expected at launch and in 2 years?
|
|
25
22
|
|
|
26
|
-
|
|
27
|
-
-
|
|
28
|
-
-
|
|
23
|
+
**Non-functional constraints**:
|
|
24
|
+
- Team language/ecosystem familiarity (don't recommend Rust to a Python-only team without explicit buy-in)
|
|
25
|
+
- Deployment target: serverless, containers (Kubernetes), PaaS, edge runtime
|
|
26
|
+
- Licensing constraints: AGPL/GPL incompatibility with proprietary codebase?
|
|
27
|
+
- Compliance: HIPAA, PCI-DSS, GDPR — some require specific data handling capabilities
|
|
28
|
+
- Time to first production: weeks vs. months affects acceptable learning curve
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
**Team context**:
|
|
31
|
+
- Team size and experience level
|
|
32
|
+
- Existing stack to minimize cognitive overhead ("boring technology" preference)
|
|
33
|
+
- Open source vs. commercial support appetite
|
|
31
34
|
|
|
32
|
-
|
|
35
|
+
### 2. Evaluation Rubric
|
|
36
|
+
|
|
37
|
+
Score each candidate (1–5 per criterion) with weights adjusted to project context:
|
|
38
|
+
|
|
39
|
+
| Criterion | Weight (default) | Notes |
|
|
40
|
+
|-----------|-----------------|-------|
|
|
41
|
+
| Ecosystem maturity | 20% | Years in production, major adopters, LTS policy |
|
|
42
|
+
| Performance fit | 20% | Benchmarks relevant to the workload type |
|
|
43
|
+
| Developer experience | 15% | TypeScript types, documentation quality, error messages |
|
|
44
|
+
| Library health | 15% | See Section 3 |
|
|
45
|
+
| Operational complexity | 15% | Deployment, monitoring, debugging tooling |
|
|
46
|
+
| Community & support | 10% | GitHub stars trend, Stack Overflow activity, commercial support availability |
|
|
47
|
+
| Migration cost | 5% | Cost to switch away if the choice is wrong |
|
|
48
|
+
|
|
49
|
+
Weighted score = sum of (score × weight). Document numerical scores, not just opinions.
|
|
50
|
+
|
|
51
|
+
### 3. Library Health Metrics
|
|
52
|
+
|
|
53
|
+
For every candidate library, check:
|
|
54
|
+
|
|
55
|
+
| Metric | Tool / Source | Threshold |
|
|
56
|
+
|--------|--------------|-----------|
|
|
57
|
+
| Release recency | GitHub releases | Last release < 12 months |
|
|
58
|
+
| Issue response time | GitHub Insights | Median < 14 days |
|
|
59
|
+
| Open CVEs | `npm audit` / `pip-audit` / OSV.dev | Zero critical/high unpatched CVEs |
|
|
60
|
+
| npm weekly downloads | npmjs.com stats | > 100k/week for production dependency |
|
|
61
|
+
| PyPI download trend | pypistats.org | Stable or growing 6-month trend |
|
|
62
|
+
| Dependents count | GitHub "Used by" | Proxy for ecosystem lock-in risk |
|
|
63
|
+
| Bus factor | git log analysis | > 3 regular contributors |
|
|
64
|
+
| License | SPDX identifier | Compatible with project license (MIT/Apache-2.0 preferred) |
|
|
65
|
+
|
|
66
|
+
Flag libraries with: single maintainer, no releases in 18+ months, high CVE backlog, or license mismatch.
|
|
67
|
+
|
|
68
|
+
### 4. Technology-Specific Comparison Patterns
|
|
69
|
+
|
|
70
|
+
**Frontend framework selection** (React vs. Vue vs. Svelte vs. SolidJS):
|
|
71
|
+
- Evaluate: bundle size, SSR/SSG capabilities, TypeScript quality, ecosystem (component libraries, state management), hiring pool.
|
|
72
|
+
- Key differentiators: React = largest ecosystem; Svelte/Solid = smaller bundles; Vue = gentler learning curve.
|
|
73
|
+
|
|
74
|
+
**Backend framework selection** (Express vs. Fastify vs. NestJS vs. Hono for Node; FastAPI vs. Django vs. Flask for Python):
|
|
75
|
+
- Evaluate: throughput benchmarks (TechEmpower), built-in validation, OpenAPI generation, middleware ecosystem.
|
|
76
|
+
- Key differentiators: Fastify > Express on throughput; NestJS adds structure but heavier; FastAPI = auto-OpenAPI + async.
|
|
77
|
+
|
|
78
|
+
**Database selection** (PostgreSQL vs. MySQL vs. MongoDB vs. DynamoDB vs. CockroachDB):
|
|
79
|
+
- Evaluate: ACID guarantees, query flexibility, horizontal scaling model, managed cloud options.
|
|
80
|
+
- Default: PostgreSQL unless workload specifically requires document flexibility (MongoDB), global horizontal scale (CockroachDB/Spanner), or serverless cost model (DynamoDB).
|
|
81
|
+
|
|
82
|
+
**Caching layer** (Redis vs. Memcached vs. DragonflyDB):
|
|
83
|
+
- Redis: persistence, pub/sub, Lua scripting, cluster mode — default choice.
|
|
84
|
+
- Memcached: simpler, marginally faster for pure string cache — only if Redis features unneeded.
|
|
85
|
+
- DragonflyDB: Redis-compatible, multi-threaded, lower memory — evaluate if Redis memory cost is a bottleneck.
|
|
86
|
+
|
|
87
|
+
### 5. ADR Output Format
|
|
88
|
+
|
|
89
|
+
Produce every recommendation as an ADR:
|
|
90
|
+
|
|
91
|
+
```markdown
|
|
92
|
+
# ADR-001: API Framework Selection for Payment Service
|
|
93
|
+
|
|
94
|
+
## Status
|
|
95
|
+
Accepted | 2024-03-15
|
|
96
|
+
|
|
97
|
+
## Context
|
|
98
|
+
We are building a payment processing microservice in Python expected to handle
|
|
99
|
+
5,000 req/s. The team has strong Python experience. We need auto-generated OpenAPI
|
|
100
|
+
docs and async support for calling downstream payment gateways.
|
|
101
|
+
|
|
102
|
+
## Decision
|
|
103
|
+
Use **FastAPI** with **Uvicorn** (ASGI) as the API framework.
|
|
104
|
+
|
|
105
|
+
## Evaluation
|
|
106
|
+
|
|
107
|
+
| Criterion | FastAPI (score) | Django REST (score) | Flask (score) |
|
|
108
|
+
|---------------------|----------------|---------------------|---------------|
|
|
109
|
+
| Ecosystem maturity | 4 | 5 | 5 |
|
|
110
|
+
| Performance fit | 5 | 3 | 3 |
|
|
111
|
+
| Developer experience| 5 | 4 | 3 |
|
|
112
|
+
| Library health | 5 | 5 | 4 |
|
|
113
|
+
| Operational complexity| 4 | 3 | 4 |
|
|
114
|
+
| **Weighted Total** | **4.65** | **3.90** | **3.75** |
|
|
115
|
+
|
|
116
|
+
## Rationale
|
|
117
|
+
FastAPI's native async support eliminates thread pool overhead when calling
|
|
118
|
+
payment gateway APIs (avg 200ms latency). Auto-generated OpenAPI schema removes
|
|
119
|
+
manual documentation maintenance. Pydantic v2 validation is 5–10x faster than
|
|
120
|
+
DRF serializers for our data shapes.
|
|
121
|
+
|
|
122
|
+
## Rejected Alternatives
|
|
123
|
+
- **Django REST Framework**: Excellent for CRUD APIs with ORM but sync-by-default
|
|
124
|
+
adds unnecessary complexity for async-heavy workload. Migration to async views
|
|
125
|
+
is incomplete as of Django 4.2.
|
|
126
|
+
- **Flask**: Too minimal; would require adding marshmallow/apispec manually for
|
|
127
|
+
validation and docs. Higher integration maintenance cost.
|
|
128
|
+
|
|
129
|
+
## Consequences
|
|
130
|
+
- Team must learn FastAPI patterns (dependency injection, Pydantic models).
|
|
131
|
+
- Uvicorn + Gunicorn deployment is less familiar than Django's WSGI setup.
|
|
132
|
+
- Mitigation: 2-day internal workshop before sprint 1.
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### 6. Avoid These Anti-Patterns
|
|
136
|
+
|
|
137
|
+
- Choosing a technology because it's trending on HN/X — evaluate against actual requirements.
|
|
138
|
+
- Recommending a rewrite from a working stack without quantifying the migration cost and business risk.
|
|
139
|
+
- Picking microservices/distributed architecture for a team of < 5 engineers — operational overhead outweighs benefits.
|
|
140
|
+
- Choosing unproven (< 1 year old, < 1.0 release) libraries for production critical paths.
|
|
141
|
+
- Ignoring the existing team's expertise — a 20% performance gain is not worth a 6-month ramp-up.
|
|
142
|
+
|
|
143
|
+
## Edge Cases
|
|
144
|
+
|
|
145
|
+
**Post-decision monitoring:** After a technology is adopted, schedule a review at 6 months and 12 months. Review triggers: library goes unmaintained (no releases in 12 months, maintainer announces EOL), critical unpatched CVE, major version breaking change, or team dissatisfaction score drops below threshold. Document the review criteria in the ADR's Consequences section so the team knows when to revisit.
|
|
146
|
+
|
|
147
|
+
**Compliance hard-blocking disqualifiers:** Certain choices are non-negotiable regardless of rubric score. Examples: AGPL-licensed library in a proprietary SaaS product (distribution triggers copyleft), data residency requirements that rule out specific cloud regions, FIPS-140-2 requirement that rules out non-certified crypto libraries. Evaluate compliance blockers before scoring — a blocked option should not appear in the rubric at all.
|
|
148
|
+
|
|
149
|
+
**RFC/spike process for tie votes:** When the evaluation rubric produces a tie (within 0.3 points) and team discussion does not converge, run a time-boxed technical spike: one engineer builds a proof-of-concept with each finalist option for 2–3 days, then presents findings to the team. Vote after the spike. Document the spike outcome in the ADR. This prevents indefinite debate and grounds the decision in hands-on evidence.
|
|
150
|
+
|
|
151
|
+
**Greenfield vs. brownfield context**: For brownfield, always evaluate migration cost as a first-class criterion. A technically superior option that requires migrating 200k lines of code is often the wrong choice. Prefer "good enough and migratable" over "theoretically best but costly to adopt."
|
|
152
|
+
|
|
153
|
+
**Vendor lock-in analysis**: For managed services (Firebase, PlanetScale, Neon, Vercel), assess: What is the data export story? What is the cost at 10x current scale? Is there a self-hosted option if the vendor changes pricing? Document lock-in risk in the ADR's Consequences section.
|
|
154
|
+
|
|
155
|
+
**When options are genuinely equivalent**: If two options score within 0.3 of each other on the weighted rubric, choose based on: (1) team familiarity, (2) existing organizational investment (training, tooling, expertise). Document the tie-breaking rationale explicitly — do not leave it as "we chose X" without justification.
|