everything-gemini 1.2.0 → 1.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/.github/ISSUE_TEMPLATE/bug_report.md +29 -0
  2. package/.github/ISSUE_TEMPLATE/feature_request.md +27 -0
  3. package/.github/ISSUE_TEMPLATE/subagent_proposal.md +29 -0
  4. package/.github/workflows/ci.yml +72 -1
  5. package/.github/workflows/release.yml +17 -2
  6. package/CHANGELOG.md +178 -0
  7. package/CONTRIBUTING.md +90 -4
  8. package/README.md +147 -23
  9. package/action.yml +35 -0
  10. package/agents/browser-qa.md +1 -1
  11. package/agents/database-migrator.md +26 -0
  12. package/agents/documentation-writer.md +27 -0
  13. package/agents/incident-responder.md +34 -0
  14. package/agents/performance-tuner.md +27 -0
  15. package/agents/platform-engineer.md +33 -0
  16. package/agents/release-engineer.md +34 -0
  17. package/bin/everything-gemini +1791 -142
  18. package/docs/COMMUNITY_SUBMISSIONS.md +88 -0
  19. package/docs/LAUNCH_KIT.md +138 -13
  20. package/docs/architecture/progressive-disclosure.md +3 -3
  21. package/docs/index.html +410 -40
  22. package/docs/launch-kit.md +163 -0
  23. package/examples/cli-workflows/demo_workflow.sh +15 -7
  24. package/examples/python-sdk/README.md +32 -5
  25. package/examples/python-sdk/documentation_audit_pipeline.py +83 -0
  26. package/examples/python-sdk/incident_triage_pipeline.py +170 -0
  27. package/examples/python-sdk/multi_agent_pipeline.py +95 -0
  28. package/examples/python-sdk/platform_provisioning_pipeline.py +193 -0
  29. package/examples/python-sdk/release_readiness_audit.py +144 -0
  30. package/hooks/secret-scrubber/hooks.json +16 -0
  31. package/hooks/secret-scrubber/scripts/scrub-secrets.sh +62 -0
  32. package/mcp/README.md +21 -0
  33. package/mcp/mcp_config.example.json +39 -0
  34. package/package.json +3 -1
  35. package/plugins/core/rules/core-practices.md +63 -4
  36. package/plugins/python-ai/rules/ai-agent-patterns.md +67 -4
  37. package/plugins/security-shield/rules/zero-trust.md +60 -4
  38. package/plugins/web-fullstack/rules/frontend-standards.md +74 -4
  39. package/rules/paradigms/security-hardened.md +53 -10
  40. package/rules/paradigms/tdd.md +65 -8
  41. package/scripts/install.ps1 +14 -0
  42. package/scripts/install.sh +15 -1
  43. package/scripts/validate.sh +103 -12
  44. package/skills/apache-kafka-streams/SKILL.md +152 -0
  45. package/skills/argo-workflows/SKILL.md +151 -0
  46. package/skills/axum-web-service/SKILL.md +159 -0
  47. package/skills/cilium-ebpf-networking/SKILL.md +145 -0
  48. package/skills/clickhouse-analytics/SKILL.md +128 -0
  49. package/skills/cloudflare-r2-object-storage/SKILL.md +143 -0
  50. package/skills/dbt-transformation/SKILL.md +179 -0
  51. package/skills/debezium-cdc/SKILL.md +166 -0
  52. package/skills/distributed-rate-limiting/SKILL.md +138 -0
  53. package/skills/duckdb-local-olap/SKILL.md +134 -0
  54. package/skills/fastapi-production/SKILL.md +157 -0
  55. package/skills/grpc-connect-rpc/SKILL.md +176 -0
  56. package/skills/langgraph-orchestrator/SKILL.md +144 -0
  57. package/skills/litellm-proxy-gateway/SKILL.md +154 -0
  58. package/skills/milvus-vector-clustering/SKILL.md +134 -0
  59. package/skills/nats-jetstream/SKILL.md +122 -0
  60. package/skills/open-telemetry-tracing/SKILL.md +151 -0
  61. package/skills/playwright-visual-regression/SKILL.md +124 -0
  62. package/skills/redis-cache-patterns/SKILL.md +159 -0
  63. package/skills/svelte-kit-architect/SKILL.md +190 -0
  64. package/skills/temporal-workflows/SKILL.md +158 -0
  65. package/skills/trpc-react-query/SKILL.md +169 -0
  66. package/skills/turborepo-monorepo/SKILL.md +199 -0
  67. package/skills/vault-secrets-management/SKILL.md +129 -0
  68. package/skills/vllm-inference/SKILL.md +144 -0
  69. package/skills/wasm-rust-optimizer/SKILL.md +130 -0
  70. package/templates/full-power/hooks.json +14 -0
  71. package/templates/full-power/mcp_config.json +47 -0
  72. package/templates/recommended/hooks.json +14 -0
  73. package/tests/cli.test.js +447 -0
@@ -0,0 +1,199 @@
1
+ ---
2
+ name: turborepo-monorepo
3
+ description: >-
4
+ Architects, configures, and optimizes high-performance monorepo build systems using Turborepo, fine-grained task pipelines (turbo.json), remote caching, package boundary isolation, and Docker pruning.
5
+ ---
6
+
7
+ # Turborepo Monorepo Architecture & Task Pipelines
8
+
9
+ This skill guides structuring, optimizing, and maintaining multi-package JavaScript/TypeScript monorepos with Turborepo, leveraging incremental computation, hash-based task caching, remote cache synchronization, and isolated Docker container pruning.
10
+
11
+ ---
12
+
13
+ ## ⚡ Core Patterns
14
+
15
+ ### 1. Production `turbo.json` Pipeline Specification
16
+
17
+ Define task dependencies, input hashes, cache retention, and environment variable tracking in root `turbo.json`:
18
+
19
+ ```json
20
+ {
21
+ "$schema": "https://turbo.build/schema.json",
22
+ "ui": "tui",
23
+ "tasks": {
24
+ "topo": {
25
+ "dependsOn": ["^topo"]
26
+ },
27
+ "build": {
28
+ "dependsOn": ["^build"],
29
+ "inputs": ["$TURBO_DEFAULT$", ".env*", "!**/*.test.*"],
30
+ "outputs": [".next/**", "!.next/cache/**", "dist/**", "build/**"],
31
+ "env": ["NODE_ENV", "NEXT_PUBLIC_*", "API_BASE_URL"]
32
+ },
33
+ "test": {
34
+ "dependsOn": ["build"],
35
+ "inputs": ["src/**/*.tsx", "src/**/*.ts", "test/**/*.ts"],
36
+ "outputs": ["coverage/**"]
37
+ },
38
+ "lint": {
39
+ "dependsOn": ["^topo"],
40
+ "outputs": []
41
+ },
42
+ "dev": {
43
+ "cache": false,
44
+ "persistent": true
45
+ },
46
+ "typecheck": {
47
+ "dependsOn": ["^build"],
48
+ "outputs": []
49
+ }
50
+ },
51
+ "globalEnv": ["CI", "PORT"],
52
+ "globalDependencies": [
53
+ "tsconfig.base.json",
54
+ ".eslintrc.js",
55
+ "pnpm-lock.yaml"
56
+ ]
57
+ }
58
+ ```
59
+
60
+ ---
61
+
62
+ ### 2. Monorepo Workspace Directory Structure
63
+
64
+ Maintain strict package boundaries between deployable applications (`apps/*`) and shared internal libraries (`packages/*`):
65
+
66
+ ```text
67
+ my-monorepo/
68
+ ├── apps/
69
+ │ ├── web/ # Next.js / SvelteKit / React SPA
70
+ │ │ ├── package.json
71
+ │ │ └── tsconfig.json
72
+ │ └── api/ # Node.js / Express / Nest / Fastify
73
+ │ ├── package.json
74
+ │ └── tsconfig.json
75
+ ├── packages/
76
+ │ ├── ui/ # Shared React design system
77
+ │ ├── database/ # Drizzle / Prisma / SQL migrations
78
+ │ ├── config-eslint/ # Internal shared ESLint rules
79
+ │ └── config-typescript/ # tsconfig.base.json definitions
80
+ ├── turbo.json # Pipeline DAG orchestration
81
+ ├── pnpm-workspace.yaml # Package manager workspaces
82
+ └── package.json # Root scripts and dev dependencies
83
+ ```
84
+
85
+ ---
86
+
87
+ ### 3. Internal Package Definition with `package.json` Exports
88
+
89
+ Configure shared internal libraries using modern TypeScript `exports` without premature bundler compilation:
90
+
91
+ ```json
92
+ {
93
+ "name": "@workspace/ui",
94
+ "version": "0.1.0",
95
+ "private": true,
96
+ "type": "module",
97
+ "exports": {
98
+ "./button": {
99
+ "types": "./src/button.tsx",
100
+ "default": "./src/button.tsx"
101
+ },
102
+ "./theme": {
103
+ "types": "./src/theme.ts",
104
+ "default": "./src/theme.ts"
105
+ }
106
+ },
107
+ "scripts": {
108
+ "lint": "eslint src/",
109
+ "typecheck": "tsc --noEmit"
110
+ },
111
+ "devDependencies": {
112
+ "@workspace/config-typescript": "workspace:*",
113
+ "typescript": "^5.4.0"
114
+ },
115
+ "peerDependencies": {
116
+ "react": "^18.0.0 || ^19.0.0"
117
+ }
118
+ }
119
+ ```
120
+
121
+ ---
122
+
123
+ ### 4. Remote Caching & CI/CD Acceleration
124
+
125
+ Enable zero-redundancy CI builds with Vercel or self-hosted Remote Cache (e.g. AWS S3 or MinIO):
126
+
127
+ ```bash
128
+ # 1. Authenticate with remote cache provider
129
+ npx turbo login
130
+
131
+ # 2. Link repository to team space
132
+ npx turbo link
133
+
134
+ # 3. In CI environments, provide token and team identifier via environment
135
+ export TURBO_TOKEN="your-cache-secret-token"
136
+ export TURBO_TEAM="your-team-slug"
137
+
138
+ # 4. Run targeted pipeline with cache hit verification
139
+ turbo run build test lint --filter=...[origin/main]
140
+ ```
141
+
142
+ ---
143
+
144
+ ### 5. Multi-Stage Docker Build Optimization via `turbo prune`
145
+
146
+ Generate a minimal build context containing only the target application and its direct internal dependencies:
147
+
148
+ ```dockerfile
149
+ # Stage 1: Prune monorepo for target app
150
+ FROM node:20-alpine AS pruner
151
+ RUN apk add --no-cache libc6-compat
152
+ WORKDIR /app
153
+ RUN npm install -g turbo
154
+ COPY . .
155
+ RUN turbo prune web --docker
156
+
157
+ # Stage 2: Install dependencies from pruned lockfile
158
+ FROM node:20-alpine AS installer
159
+ RUN apk add --no-cache libc6-compat
160
+ WORKDIR /app
161
+ COPY .gitignore .gitignore
162
+ COPY --from=pruner /app/out/json/ .
163
+ COPY --from=pruner /app/out/pnpm-lock.yaml ./pnpm-lock.yaml
164
+ RUN corepack enable && pnpm install --frozen-lockfile
165
+
166
+ # Stage 3: Build application
167
+ COPY --from=pruner /app/out/full/ .
168
+ COPY turbo.json turbo.json
169
+ RUN pnpm turbo run build --filter=web...
170
+
171
+ # Stage 4: Production Runner
172
+ FROM node:20-alpine AS runner
173
+ WORKDIR /app
174
+ ENV NODE_ENV=production
175
+ RUN addgroup --system --gid 1001 nodejs && adduser --system --uid 1001 nextjs
176
+ COPY --from=installer --chown=nextjs:nodejs /app/apps/web/.next/standalone ./
177
+ COPY --from=installer --chown=nextjs:nodejs /app/apps/web/.next/static ./apps/web/.next/static
178
+ USER nextjs
179
+ EXPOSE 3000
180
+ CMD ["node", "apps/web/server.js"]
181
+ ```
182
+
183
+ ---
184
+
185
+ ## 🎯 Verification & Diagnostics
186
+
187
+ 1. **Inspect Task Graph**:
188
+ ```bash
189
+ turbo run build --graph=build-graph.html
190
+ ```
191
+ 2. **Dry Run Pipeline**:
192
+ ```bash
193
+ turbo run test --dry-run
194
+ ```
195
+ 3. **Targeted Subtree Execution**:
196
+ ```bash
197
+ turbo run build --filter=web... # web and all its internal dependencies
198
+ turbo run test --filter=...api # api and all packages that depend on it
199
+ ```
@@ -0,0 +1,129 @@
1
+ ---
2
+ name: vault-secrets-management
3
+ description: >-
4
+ Architects and automates HashiCorp Vault secrets management, AppRole machine authentication, dynamic ephemeral database credentials, and PKI mTLS certificate rotation.
5
+ ---
6
+
7
+ # HashiCorp Vault Secrets Management & Ephemeral Credentials
8
+
9
+ This skill guides the design, automation, and operational patterns for HashiCorp Vault enterprise secrets orchestration, dynamic credential generation, and PKI certificate authority workflows.
10
+
11
+ ---
12
+
13
+ ## ⚡ Secret Engine Capabilities Matrix
14
+
15
+ | Secret Engine | Purpose | Lifecycle Behavior |
16
+ | :--- | :--- | :--- |
17
+ | **`kv-v2`** | Static credentials & API keys | Versioned key-value store with soft delete and rollback. |
18
+ | **`database`** | Ephemeral DB access (Postgres, MySQL) | Generates short-lived user credentials and revokes upon lease expiry. |
19
+ | **`pki`** | Internal mTLS & TLS certificates | Acts as CA/sub-CA; dynamically issues certificates in milliseconds. |
20
+ | **`transit`** | Cryptography as a service | Encrypts/decrypts data without exposing raw encryption keys. |
21
+
22
+ ---
23
+
24
+ ## 🔐 AppRole Machine Authentication Workflow
25
+
26
+ Applications authenticate using decoupled `role_id` and short-lived `secret_id`:
27
+
28
+ ```bash
29
+ # 1. Enable AppRole auth method
30
+ vault auth enable approle
31
+
32
+ # 2. Configure service role with strict CIDR and token policies
33
+ vault write auth/approle/role/api-service \
34
+ secret_id_ttl=60m \
35
+ token_ttl=30m \
36
+ token_max_ttl=4h \
37
+ secret_id_num_uses=10 \
38
+ token_policies="api-service-policy" \
39
+ bind_secret_id=true
40
+
41
+ # 3. Retrieve Role ID (stored in deployment manifest)
42
+ vault read auth/approle/role/api-service/role-id
43
+
44
+ # 4. Generate Secret ID (delivered securely via CI/CD or orchestrator)
45
+ vault write -f auth/approle/role/api-service/secret-id
46
+ ```
47
+
48
+ Node.js / Python authentication client:
49
+
50
+ ```typescript
51
+ import axios from 'axios';
52
+
53
+ export async function loginWithAppRole(vaultAddr: string, roleId: string, secretId: string) {
54
+ const response = await axios.post(`${vaultAddr}/v1/auth/approle/login`, {
55
+ role_id: roleId,
56
+ secret_id: secretId,
57
+ });
58
+
59
+ const clientToken = response.data.auth.client_token;
60
+ const leaseDuration = response.data.auth.lease_duration;
61
+ return { clientToken, leaseDuration };
62
+ }
63
+ ```
64
+
65
+ ---
66
+
67
+ ## ⏳ Dynamic Ephemeral Database Credentials
68
+
69
+ Configure Vault to create temporary, unique PostgreSQL roles for each application instance:
70
+
71
+ ```bash
72
+ # 1. Mount database engine
73
+ vault secrets enable database
74
+
75
+ # 2. Configure connection to PostgreSQL
76
+ vault write database/config/production-postgres \
77
+ plugin_name=postgresql-database-plugin \
78
+ allowed_roles="readwrite-service" \
79
+ connection_url="postgresql://{{username}}:{{password}}@postgres:5432/production?sslmode=verify-full" \
80
+ username="vaultadmin" \
81
+ password="supersecretadminpassword"
82
+
83
+ # 3. Define role template with automated role creation SQL
84
+ vault write database/roles/readwrite-service \
85
+ db_name=production-postgres \
86
+ creation_statements="CREATE ROLE \"{{name}}\" WITH LOGIN PASSWORD '{{password}}' VALID UNTIL '{{expiration}}'; \
87
+ GRANT SELECT, INSERT, UPDATE, DELETE ON ALL TABLES IN SCHEMA public TO \"{{name}}\";" \
88
+ default_ttl="1h" \
89
+ max_ttl="24h"
90
+ ```
91
+
92
+ Application requests credentials on demand:
93
+
94
+ ```bash
95
+ vault read database/creds/readwrite-service
96
+ # Returns: username: v-approle-readwrite-abc123, password: xyz..., lease_id: database/creds/readwrite-service/xyz...
97
+ ```
98
+
99
+ ---
100
+
101
+ ## 📜 PKI Dynamic mTLS Certificate Issuance
102
+
103
+ Automate TLS certificate issuance without manual CSR handling:
104
+
105
+ ```bash
106
+ # Mount PKI engine and configure Root/Intermediate CA
107
+ vault secrets enable pki
108
+ vault secrets tune -max-lease-ttl=87600h pki
109
+
110
+ # Configure role for cluster services
111
+ vault write pki/roles/internal-mesh \
112
+ allowed_domains="internal.cluster.local" \
113
+ allow_subdomains=true \
114
+ max_ttl="72h"
115
+
116
+ # Generate certificate on demand
117
+ vault write pki/issue/internal-mesh \
118
+ common_name="billing-service.internal.cluster.local" \
119
+ ttl="24h"
120
+ ```
121
+
122
+ ---
123
+
124
+ ## 📋 Architectural Rules & Best Practices
125
+
126
+ 1. **Never Hardcode Secrets**: Eliminate long-lived static DB passwords; adopt dynamic ephemeral database roles with short TTLs (< 2 hours).
127
+ 2. **Strict Secret ID Binding**: Bind AppRole `secret_id` to expected subnet CIDRs (`secret_id_bound_cidrs`) to stop credential theft across VPCs.
128
+ 3. **Lease Renewal & Heartbeats**: Background workers must periodically renew active leases (`vault write sys/leases/renew lease_id=...`) before expiry.
129
+ 4. **Audit Logging**: Enable Vault audit devices (`vault audit enable file file_path=/var/log/vault/audit.log`) with hashed payload sanitization.
@@ -0,0 +1,144 @@
1
+ ---
2
+ name: vllm-inference
3
+ description: >-
4
+ High-throughput LLM serving and inference optimization using vLLM, PagedAttention memory management, continuous batching, tensor parallelism, and OpenAI-compatible API architecture. Use when deploying open-weights models, optimizing GPU KV caches, scaling Ray clusters, or tuning inference throughput.
5
+ ---
6
+
7
+ # vLLM Inference & Serving Architecture
8
+
9
+ A comprehensive runbook for deploying, tuning, and operating enterprise LLM inference infrastructure using **vLLM**, PagedAttention, and distributed GPU clusters.
10
+
11
+ ---
12
+
13
+ ## 🎯 Architectural Principles
14
+
15
+ 1. **PagedAttention**: Near-zero memory waste by allocating KV cache in non-contiguous physical blocks (virtual memory paging for LLMs).
16
+ 2. **Continuous (Iteration-Level) Batching**: Requests join and exit the running batch dynamically at token generation boundaries rather than waiting for sequence completion.
17
+ 3. **Tensor & Pipeline Parallelism**: Seamless multi-GPU sharding using Megatron-LM style tensor parallelism across NVLink or distributed Ray nodes.
18
+ 4. **OpenAI Protocol Parity**: Fully compliant Drop-in replacement for Chat Completions, Completions, and Embedding endpoints.
19
+
20
+ ---
21
+
22
+ ## 🚀 Quickstart: Production Deployment
23
+
24
+ ### 1. Standalone Docker Container Deployment
25
+
26
+ ```bash
27
+ docker run --gpus all \
28
+ --shm-size 10.24gb \
29
+ -p 8000:8000 \
30
+ -v ~/.cache/huggingface:/root/.cache/huggingface \
31
+ --ipc=host \
32
+ vllm/vllm-openai:latest \
33
+ --model Qwen/Qwen2.5-72B-Instruct-AWQ \
34
+ --tensor-parallel-size 4 \
35
+ --max-model-len 32768 \
36
+ --gpu-memory-utilization 0.92 \
37
+ --kv-cache-dtype auto \
38
+ --enable-chunked-prefill \
39
+ --max-num-seqs 256
40
+ ```
41
+
42
+ ### 2. High-Performance Configuration Matrix
43
+
44
+ | Parameter | Recommended Setting | Architectural Rationale |
45
+ | :--- | :--- | :--- |
46
+ | `--gpu-memory-utilization` | `0.90` - `0.95` | Leaves ~5-10% GPU VRAM for CUDA context and PyTorch allocator overhead. |
47
+ | `--tensor-parallel-size` | Matches socket count (2, 4, 8) | Shards attention heads evenly across NVLink interconnects. |
48
+ | `--enable-chunked-prefill` | `true` | Prevents long prompt prefill passes from blocking decode iterations of active requests. |
49
+ | `--max-num-batched-tokens` | `4096` - `8192` | Balances prefill compute intensity with KV cache allocation throughput. |
50
+ | `--kv-cache-dtype` | `fp8` / `auto` | Halves KV memory consumption on Ada/Hopper architectures (H100/L40S). |
51
+
52
+ ---
53
+
54
+ ## 🛠️ Python SDK Integration
55
+
56
+ Interact with vLLM via either offline batch processing or the OpenAI client.
57
+
58
+ ### Pattern A: Offline High-Throughput Batch Processing
59
+
60
+ ```python
61
+ from vllm import LLM, SamplingParams
62
+
63
+ # Configure model engine with tensor parallelism
64
+ llm = LLM(
65
+ model="mistralai/Mistral-7B-Instruct-v0.3",
66
+ tensor_parallel_size=2,
67
+ gpu_memory_utilization=0.90,
68
+ max_model_len=16384,
69
+ trust_remote_code=True,
70
+ )
71
+
72
+ sampling_params = SamplingParams(
73
+ temperature=0.7,
74
+ top_p=0.95,
75
+ max_tokens=1024,
76
+ presence_penalty=0.1,
77
+ )
78
+
79
+ prompts = [
80
+ "Analyze the following architectural bottleneck: ...",
81
+ "Generate a Terraform module for Cilium eBPF on GKE: ...",
82
+ ]
83
+
84
+ outputs = llm.generate(prompts, sampling_params)
85
+
86
+ for output in outputs:
87
+ prompt = output.prompt
88
+ generated_text = output.outputs[0].text
89
+ print(f"Generated {len(output.outputs[0].token_ids)} tokens.")
90
+ ```
91
+
92
+ ### Pattern B: Async OpenAI Client Integration
93
+
94
+ ```python
95
+ from openai import AsyncOpenAI
96
+ import asyncio
97
+
98
+ client = AsyncOpenAI(
99
+ base_url="http://localhost:8000/v1",
100
+ api_key="token-internal-vllm",
101
+ )
102
+
103
+ async def stream_generation(prompt: str):
104
+ response = await client.chat.completions.create(
105
+ model="Qwen/Qwen2.5-72B-Instruct-AWQ",
106
+ messages=[{"role": "user", "content": prompt}],
107
+ temperature=0.2,
108
+ stream=True,
109
+ )
110
+ async for chunk in response:
111
+ delta = chunk.choices[0].delta.content or ""
112
+ print(delta, end="", flush=True)
113
+
114
+ asyncio.run(stream_generation("Summarize the benefits of continuous batching."))
115
+ ```
116
+
117
+ ---
118
+
119
+ ## 📈 Prometheus Observability & Metrics
120
+
121
+ vLLM exposes Prometheus metrics on `/metrics`:
122
+
123
+ ```text
124
+ # Cache usage metrics
125
+ vllm:gpu_cache_usage_factor # Active KV cache allocation (target: < 0.85)
126
+ vllm:num_requests_waiting # Requests queued in prefill backlog (target: 0)
127
+ vllm:num_requests_running # Concurrently decoding requests
128
+ vllm:time_to_first_token_seconds # TTFT distribution histogram
129
+ vllm:time_per_output_token_seconds # Inter-token generation latency (target: < 25ms)
130
+ ```
131
+
132
+ ---
133
+
134
+ ## 🛡️ Common Failure Modes & Mitigations
135
+
136
+ 1. **CUDA Out of Memory (OOM) during Startup**:
137
+ - *Cause*: Model weights + KV cache exceeds total VRAM.
138
+ - *Fix*: Reduce `--gpu-memory-utilization` from 0.95 to 0.88, or enforce AWQ/GPTQ 4-bit quantization.
139
+ 2. **Request Preemption Storms**:
140
+ - *Cause*: KV cache saturates (`gpu_cache_usage_factor = 1.0`), forcing vLLM to swap sequences to CPU memory.
141
+ - *Fix*: Reduce `--max-num-seqs` or enable `--kv-cache-dtype fp8` to double cache capacity.
142
+ 3. **TTFT Spikes on Long Contexts**:
143
+ - *Cause*: Large prompt prefills starving active decode steps.
144
+ - *Fix*: Pass `--enable-chunked-prefill` and `--max-num-batched-tokens 2048`.
@@ -0,0 +1,130 @@
1
+ ---
2
+ name: wasm-rust-optimizer
3
+ description: >-
4
+ Compiles and optimizes high-performance WebAssembly modules from Rust using wasm-pack, zero-copy memory buffers (Uint8Array), SIMD vectorization, and Web Worker thread pools.
5
+ ---
6
+
7
+ # WebAssembly & Rust Performance Optimization
8
+
9
+ This skill guides compiling compute-intensive logic (image processing, cryptographic hashing, parser engines, physics calculations) into high-throughput WebAssembly (WASM) modules using Rust.
10
+
11
+ ---
12
+
13
+ ## ⚡ Rust & Cargo Configuration (`Cargo.toml`)
14
+
15
+ Configure the crate for minimal binary footprint and direct browser bindings:
16
+
17
+ ```toml
18
+ [package]
19
+ name = "wasm-engine"
20
+ version = "0.1.0"
21
+ edition = "2021"
22
+
23
+ [lib]
24
+ crate-type = ["cdylib", "rlib"]
25
+
26
+ [dependencies]
27
+ wasm-bindgen = "0.2"
28
+ js-sys = "0.3"
29
+ web-sys = { version = "0.3", features = ["console"] }
30
+
31
+ [profile.release]
32
+ opt-level = 3
33
+ lto = true
34
+ codegen-units = 1
35
+ panic = "abort"
36
+ strip = true
37
+ ```
38
+
39
+ ---
40
+
41
+ ## 🚀 Zero-Copy Memory Transfer (Uint8Array)
42
+
43
+ Avoid JSON serialization overhead when passing gigabytes or megabytes of data between JavaScript and WebAssembly. Pass memory buffer pointers directly:
44
+
45
+ ### 1. Rust Implementation (`src/lib.rs`)
46
+
47
+ ```rust
48
+ use wasm_bindgen::prelude::*;
49
+
50
+ #[wasm_bindgen]
51
+ pub struct ImageProcessor {
52
+ buffer: Vec<u8>,
53
+ }
54
+
55
+ #[wasm_bindgen]
56
+ impl ImageProcessor {
57
+ #[wasm_bindgen(constructor)]
58
+ pub fn new(size: usize) -> Self {
59
+ Self {
60
+ buffer: vec![0u8; size],
61
+ }
62
+ }
63
+
64
+ /// Exposes raw memory pointer for zero-copy JavaScript access
65
+ pub fn get_buffer_ptr(&self) -> *const u8 {
66
+ self.buffer.as_ptr()
67
+ }
68
+
69
+ /// In-place high-performance pixel grayscale filter
70
+ pub fn process_grayscale(&mut self) {
71
+ // Fast in-place chunk iteration
72
+ for pixel in self.buffer.chunks_exact_mut(4) {
73
+ let r = pixel[0] as u32;
74
+ let g = pixel[1] as u32;
75
+ let b = pixel[2] as u32;
76
+ let gray = ((r * 77 + g * 150 + b * 29) >> 8) as u8;
77
+ pixel[0] = gray;
78
+ pixel[1] = gray;
79
+ pixel[2] = gray;
80
+ }
81
+ }
82
+ }
83
+ ```
84
+
85
+ ---
86
+
87
+ ### 2. JavaScript / TypeScript Client Integration
88
+
89
+ ```typescript
90
+ import init, { ImageProcessor } from './pkg/wasm_engine.js';
91
+
92
+ export async function runProcessor(canvas: HTMLCanvasElement) {
93
+ const wasm = await init();
94
+ const ctx = canvas.getContext('2d')!;
95
+ const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height);
96
+ const totalBytes = imageData.data.length;
97
+
98
+ // Instantiate Rust WASM processor
99
+ const processor = new ImageProcessor(totalBytes);
100
+ const ptr = processor.get_buffer_ptr();
101
+
102
+ // Create zero-copy views directly into WASM linear memory
103
+ const wasmMemoryView = new Uint8Array(wasm.memory.buffer, ptr, totalBytes);
104
+ wasmMemoryView.set(imageData.data);
105
+
106
+ // Execute native compiled computation
107
+ processor.process_grayscale();
108
+
109
+ // Read back transformed memory without cloning
110
+ imageData.data.set(wasmMemoryView);
111
+ ctx.putImageData(imageData, 0, 0);
112
+ }
113
+ ```
114
+
115
+ ---
116
+
117
+ ## 🛠️ Build & Optimization Workflow
118
+
119
+ 1. **Compile with `wasm-pack`:**
120
+ ```bash
121
+ wasm-pack build --target web --release
122
+ ```
123
+
124
+ 2. **Optimize with `wasm-opt` (Binaryen):**
125
+ ```bash
126
+ wasm-opt -O4 -o pkg/wasm_engine_bg_opt.wasm pkg/wasm_engine_bg.wasm
127
+ ```
128
+
129
+ 3. **Non-Blocking Compute in Web Workers:**
130
+ Always instantiate large WASM modules inside dedicated Web Workers (`new Worker(new URL('./worker.ts', import.meta.url))`) to keep the UI thread rendering at a silky 60/120 FPS.
@@ -52,5 +52,19 @@
52
52
  ]
53
53
  }
54
54
  ]
55
+ },
56
+ "secret-scrubber": {
57
+ "PreToolUse": [
58
+ {
59
+ "matcher": "write_to_file|replace_file_content|multi_replace_file_content",
60
+ "hooks": [
61
+ {
62
+ "type": "command",
63
+ "command": "bash ./hooks/secret-scrubber/scripts/scrub-secrets.sh",
64
+ "timeout": 10
65
+ }
66
+ ]
67
+ }
68
+ ]
55
69
  }
56
70
  }
@@ -10,6 +10,53 @@
10
10
  "postgres": {
11
11
  "command": "npx",
12
12
  "args": ["-y", "@modelcontextprotocol/server-postgres", "${DATABASE_URL}"]
13
+ },
14
+ "memory": {
15
+ "command": "npx",
16
+ "args": ["-y", "@modelcontextprotocol/server-memory"]
17
+ },
18
+ "fetch": {
19
+ "command": "npx",
20
+ "args": ["-y", "@modelcontextprotocol/server-fetch"]
21
+ },
22
+ "redis": {
23
+ "command": "npx",
24
+ "args": ["-y", "@modelcontextprotocol/server-redis", "${REDIS_URL}"]
25
+ },
26
+ "docker": {
27
+ "command": "npx",
28
+ "args": ["-y", "@modelcontextprotocol/server-docker"]
29
+ },
30
+ "clickhouse": {
31
+ "command": "npx",
32
+ "args": ["-y", "@modelcontextprotocol/server-clickhouse", "${CLICKHOUSE_URL}"]
33
+ },
34
+ "sequential-thinking": {
35
+ "command": "npx",
36
+ "args": ["-y", "@modelcontextprotocol/server-sequential-thinking"]
37
+ },
38
+ "filesystem": {
39
+ "command": "npx",
40
+ "args": ["-y", "@modelcontextprotocol/server-filesystem", "./docs", "./src"]
41
+ },
42
+ "sentry": {
43
+ "command": "npx",
44
+ "args": ["-y", "@modelcontextprotocol/server-sentry"],
45
+ "env": {
46
+ "SENTRY_AUTH_TOKEN": "${SENTRY_AUTH_TOKEN}"
47
+ }
48
+ },
49
+ "slack": {
50
+ "command": "npx",
51
+ "args": ["-y", "@modelcontextprotocol/server-slack"],
52
+ "env": {
53
+ "SLACK_BOT_TOKEN": "${SLACK_BOT_TOKEN}",
54
+ "SLACK_TEAM_ID": "${SLACK_TEAM_ID}"
55
+ }
56
+ },
57
+ "puppeteer": {
58
+ "command": "npx",
59
+ "args": ["-y", "@modelcontextprotocol/server-puppeteer"]
13
60
  }
14
61
  }
15
62
  }
@@ -39,5 +39,19 @@
39
39
  ]
40
40
  }
41
41
  ]
42
+ },
43
+ "secret-scrubber": {
44
+ "PreToolUse": [
45
+ {
46
+ "matcher": "write_to_file|replace_file_content|multi_replace_file_content",
47
+ "hooks": [
48
+ {
49
+ "type": "command",
50
+ "command": "bash ./hooks/secret-scrubber/scripts/scrub-secrets.sh",
51
+ "timeout": 10
52
+ }
53
+ ]
54
+ }
55
+ ]
42
56
  }
43
57
  }