100xprism 2.3.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.
- package/LICENSE +21 -0
- package/README.md +196 -0
- package/VERSION +1 -0
- package/adapters/antigravity.sh +14 -0
- package/adapters/claude-code.sh +160 -0
- package/adapters/codex.sh +13 -0
- package/adapters/copilot.sh +13 -0
- package/adapters/cursor.sh +13 -0
- package/adapters/gemini.sh +13 -0
- package/adapters/lib/__pycache__/modules.cpython-312.pyc +0 -0
- package/adapters/lib/modules.py +592 -0
- package/adapters/lib/shared.sh +83 -0
- package/adapters/lib/sync_plugins.py +113 -0
- package/adapters/windsurf.sh +15 -0
- package/bin/100xprism.js +29 -0
- package/get.sh +24 -0
- package/install-project.sh +82 -0
- package/install.sh +281 -0
- package/lib/adapters/windows.js +429 -0
- package/lib/bootstrap.js +33 -0
- package/lib/init.js +19 -0
- package/lib/install.js +18 -0
- package/lib/migrate.js +52 -0
- package/lib/platform.js +22 -0
- package/lib/update.js +29 -0
- package/modules/_lib/reference.md +77 -0
- package/modules/a11y-auditor/SKILL.md +151 -0
- package/modules/ab-test-setup/SKILL.md +266 -0
- package/modules/ab-test-setup/evals/evals.json +105 -0
- package/modules/ab-test-setup/references/sample-size-guide.md +263 -0
- package/modules/ab-test-setup/references/test-templates.md +277 -0
- package/modules/ad-creative/SKILL.md +362 -0
- package/modules/ad-creative/evals/evals.json +90 -0
- package/modules/ad-creative/references/generative-tools.md +637 -0
- package/modules/ad-creative/references/platform-specs.md +213 -0
- package/modules/ai-seo/SKILL.md +398 -0
- package/modules/ai-seo/evals/evals.json +90 -0
- package/modules/ai-seo/references/content-patterns.md +285 -0
- package/modules/ai-seo/references/platform-ranking-factors.md +152 -0
- package/modules/analytics-tracking/SKILL.md +309 -0
- package/modules/analytics-tracking/evals/evals.json +90 -0
- package/modules/analytics-tracking/references/event-library.md +260 -0
- package/modules/analytics-tracking/references/ga4-implementation.md +300 -0
- package/modules/analytics-tracking/references/gtm-implementation.md +390 -0
- package/modules/architect/SKILL.md +282 -0
- package/modules/branch/SKILL.md +105 -0
- package/modules/churn-prevention/SKILL.md +424 -0
- package/modules/churn-prevention/evals/evals.json +93 -0
- package/modules/churn-prevention/references/cancel-flow-patterns.md +316 -0
- package/modules/churn-prevention/references/dunning-playbook.md +408 -0
- package/modules/cloud-security/SKILL.md +240 -0
- package/modules/cold-email/SKILL.md +178 -0
- package/modules/cold-email/evals/evals.json +94 -0
- package/modules/cold-email/references/benchmarks.md +83 -0
- package/modules/cold-email/references/follow-up-sequences.md +81 -0
- package/modules/cold-email/references/frameworks.md +90 -0
- package/modules/cold-email/references/personalization.md +79 -0
- package/modules/cold-email/references/subject-lines.md +53 -0
- package/modules/commit/SKILL.md +195 -0
- package/modules/competitor-alternatives/SKILL.md +256 -0
- package/modules/competitor-alternatives/evals/evals.json +93 -0
- package/modules/competitor-alternatives/references/content-architecture.md +271 -0
- package/modules/competitor-alternatives/references/templates.md +223 -0
- package/modules/connect/SKILL.md +894 -0
- package/modules/content-strategy/SKILL.md +359 -0
- package/modules/content-strategy/evals/evals.json +90 -0
- package/modules/context-dump/SKILL.md +67 -0
- package/modules/copy-editing/SKILL.md +447 -0
- package/modules/copy-editing/evals/evals.json +89 -0
- package/modules/copy-editing/references/plain-english-alternatives.md +394 -0
- package/modules/copywriting/SKILL.md +271 -0
- package/modules/copywriting/evals/evals.json +111 -0
- package/modules/copywriting/references/cold-email-benchmarks.md +83 -0
- package/modules/copywriting/references/cold-email-follow-ups.md +81 -0
- package/modules/copywriting/references/cold-email-frameworks.md +90 -0
- package/modules/copywriting/references/cold-email-personalization.md +79 -0
- package/modules/copywriting/references/cold-email-subject-lines.md +53 -0
- package/modules/copywriting/references/copy-frameworks.md +344 -0
- package/modules/copywriting/references/email-copy-guidelines.md +113 -0
- package/modules/copywriting/references/email-types.md +515 -0
- package/modules/copywriting/references/natural-transitions.md +272 -0
- package/modules/copywriting/references/sequence-templates.md +168 -0
- package/modules/data-query/SKILL.md +58 -0
- package/modules/data-viz/SKILL.md +225 -0
- package/modules/db/SKILL.md +205 -0
- package/modules/db/db-engines/_router.md +24 -0
- package/modules/db/db-engines/athena.md +16 -0
- package/modules/db/db-engines/cloud-sql.md +16 -0
- package/modules/db/db-engines/databricks.md +14 -0
- package/modules/db/db-engines/oracle.md +14 -0
- package/modules/db/db-engines/postgres.md +15 -0
- package/modules/db/db-engines/presto.md +14 -0
- package/modules/db/db-engines/snowflake.md +14 -0
- package/modules/docs/SKILL.md +100 -0
- package/modules/email-sequence/SKILL.md +309 -0
- package/modules/email-sequence/evals/evals.json +93 -0
- package/modules/email-sequence/references/copy-guidelines.md +113 -0
- package/modules/email-sequence/references/email-types.md +515 -0
- package/modules/email-sequence/references/sequence-templates.md +168 -0
- package/modules/enterprise-design/SKILL.md +75 -0
- package/modules/eval/SKILL.md +105 -0
- package/modules/figma-translator/SKILL.md +49 -0
- package/modules/fix-bugs/SKILL.md +104 -0
- package/modules/form-cro/SKILL.md +429 -0
- package/modules/form-cro/evals/evals.json +90 -0
- package/modules/free-tool-strategy/SKILL.md +178 -0
- package/modules/free-tool-strategy/evals/evals.json +90 -0
- package/modules/free-tool-strategy/references/tool-types.md +217 -0
- package/modules/gate/SKILL.md +232 -0
- package/modules/grill-me/SKILL.md +59 -0
- package/modules/interaction-engineer/SKILL.md +49 -0
- package/modules/issue/SKILL.md +272 -0
- package/modules/launch/SKILL.md +345 -0
- package/modules/launch-strategy/SKILL.md +353 -0
- package/modules/launch-strategy/evals/evals.json +91 -0
- package/modules/lint/SKILL.md +126 -0
- package/modules/marketing-ideas/SKILL.md +167 -0
- package/modules/marketing-ideas/evals/evals.json +90 -0
- package/modules/marketing-ideas/references/ideas-by-category.md +366 -0
- package/modules/marketing-psychology/SKILL.md +455 -0
- package/modules/marketing-psychology/evals/evals.json +88 -0
- package/modules/motion-designer/SKILL.md +214 -0
- package/modules/onboarding-cro/SKILL.md +220 -0
- package/modules/onboarding-cro/evals/evals.json +92 -0
- package/modules/onboarding-cro/references/experiments.md +258 -0
- package/modules/orchestrate/SKILL.md +77 -0
- package/modules/page-cro/SKILL.md +182 -0
- package/modules/page-cro/evals/evals.json +111 -0
- package/modules/page-cro/references/experiments.md +248 -0
- package/modules/page-cro/references/paywall-experiments.md +164 -0
- package/modules/paid-ads/SKILL.md +315 -0
- package/modules/paid-ads/evals/evals.json +90 -0
- package/modules/paid-ads/references/ad-copy-templates.md +207 -0
- package/modules/paid-ads/references/audience-targeting.md +243 -0
- package/modules/paid-ads/references/platform-setup-checklists.md +277 -0
- package/modules/paywall-upgrade-cro/SKILL.md +227 -0
- package/modules/paywall-upgrade-cro/evals/evals.json +93 -0
- package/modules/paywall-upgrade-cro/references/experiments.md +164 -0
- package/modules/popup-cro/SKILL.md +453 -0
- package/modules/popup-cro/evals/evals.json +94 -0
- package/modules/pr/SKILL.md +203 -0
- package/modules/pricing-strategy/SKILL.md +231 -0
- package/modules/pricing-strategy/evals/evals.json +90 -0
- package/modules/pricing-strategy/references/research-methods.md +152 -0
- package/modules/pricing-strategy/references/tier-structure.md +232 -0
- package/modules/product-marketing-context/SKILL.md +241 -0
- package/modules/product-marketing-context/evals/evals.json +85 -0
- package/modules/programmatic-seo/SKILL.md +238 -0
- package/modules/programmatic-seo/evals/evals.json +94 -0
- package/modules/programmatic-seo/references/playbooks.md +308 -0
- package/modules/push/SKILL.md +202 -0
- package/modules/referral-program/SKILL.md +255 -0
- package/modules/referral-program/evals/evals.json +89 -0
- package/modules/referral-program/references/affiliate-programs.md +164 -0
- package/modules/referral-program/references/program-examples.md +143 -0
- package/modules/release/SKILL.md +293 -0
- package/modules/revops/SKILL.md +343 -0
- package/modules/revops/evals/evals.json +91 -0
- package/modules/revops/references/automation-playbooks.md +290 -0
- package/modules/revops/references/lifecycle-definitions.md +278 -0
- package/modules/revops/references/routing-rules.md +203 -0
- package/modules/revops/references/scoring-models.md +247 -0
- package/modules/sales-enablement/SKILL.md +349 -0
- package/modules/sales-enablement/evals/evals.json +91 -0
- package/modules/sales-enablement/references/deck-frameworks.md +263 -0
- package/modules/sales-enablement/references/demo-scripts.md +355 -0
- package/modules/sales-enablement/references/objection-library.md +270 -0
- package/modules/sales-enablement/references/one-pager-templates.md +208 -0
- package/modules/schema-markup/SKILL.md +179 -0
- package/modules/schema-markup/evals/evals.json +87 -0
- package/modules/schema-markup/references/schema-examples.md +398 -0
- package/modules/security/SKILL.md +138 -0
- package/modules/seo-audit/SKILL.md +412 -0
- package/modules/seo-audit/evals/evals.json +136 -0
- package/modules/seo-audit/references/ai-writing-detection.md +200 -0
- package/modules/seo-audit/references/content-patterns.md +285 -0
- package/modules/seo-audit/references/platform-ranking-factors.md +152 -0
- package/modules/signup-flow-cro/SKILL.md +359 -0
- package/modules/signup-flow-cro/evals/evals.json +88 -0
- package/modules/site-architecture/SKILL.md +357 -0
- package/modules/site-architecture/evals/evals.json +88 -0
- package/modules/site-architecture/references/mermaid-templates.md +216 -0
- package/modules/site-architecture/references/navigation-patterns.md +305 -0
- package/modules/site-architecture/references/site-type-templates.md +293 -0
- package/modules/social-content/SKILL.md +278 -0
- package/modules/social-content/evals/evals.json +92 -0
- package/modules/social-content/references/platforms.md +170 -0
- package/modules/social-content/references/post-templates.md +177 -0
- package/modules/social-content/references/reverse-engineering.md +195 -0
- package/modules/spec/SKILL.md +81 -0
- package/modules/subagents/SKILL.md +123 -0
- package/modules/techdebt/SKILL.md +71 -0
- package/modules/terminal-setup/SKILL.md +49 -0
- package/modules/test/SKILL.md +493 -0
- package/modules/test/references/e2e-patterns.md +294 -0
- package/modules/update-claude-md/SKILL.md +52 -0
- package/modules/visual-system-architect/SKILL.md +53 -0
- package/package.json +44 -0
- package/plugins/plugins.json +43 -0
- package/shell/aliases.sh +24 -0
- package/shell/check-update.sh +212 -0
- package/templates/.env.example +199 -0
- package/templates/docker-compose.md +46 -0
- package/templates/node-frontend.md +56 -0
- package/templates/node-fullstack.md +59 -0
- package/templates/python-api.md +57 -0
- package/update.sh +231 -0
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: data-viz
|
|
3
|
+
description: Act as a Senior Data Visualization Designer to pick the right chart for the question, lay out a dashboard, and ship it in Recharts / visx / D3 / Plotly. Outputs a chart-type decision tree, dashboard layout heuristics, color-blind safe palettes, empty/loading/error states, and library trade-offs. Use when designing dashboards, analytics pages, or any chart-driven UI.
|
|
4
|
+
category: design
|
|
5
|
+
tier: on-demand
|
|
6
|
+
allowed-tools: Read Write
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
You are a Senior Data Visualization Designer. Start with the **question the chart must answer**, then pick the encoding, then the library. Never the reverse.
|
|
10
|
+
|
|
11
|
+
## Required Input
|
|
12
|
+
|
|
13
|
+
For each chart in scope provide:
|
|
14
|
+
- **Question** — what decision does the viewer make from this chart?
|
|
15
|
+
- **Data shape** — categorical / temporal / continuous; n rows; cardinality of each dim
|
|
16
|
+
- **Audience** — analyst, executive, end-user
|
|
17
|
+
- **Update cadence** — static, on-load, streaming
|
|
18
|
+
- **Density target** — single hero chart / dashboard tile / sparkline
|
|
19
|
+
|
|
20
|
+
For dashboards, also provide:
|
|
21
|
+
- **Primary user job** — monitor / explore / explain / report
|
|
22
|
+
- **Refresh model** — real-time, hourly, daily, on-demand
|
|
23
|
+
- **Surface** — large screen, laptop, mobile, embedded, PDF export
|
|
24
|
+
|
|
25
|
+
## Chart-Type Decision Tree
|
|
26
|
+
|
|
27
|
+
Start from the **question type**, not the data type.
|
|
28
|
+
|
|
29
|
+
### "How does X change over time?"
|
|
30
|
+
- 1 series, smooth trend → **line**
|
|
31
|
+
- 1 series, discrete buckets → **column** (vertical bar)
|
|
32
|
+
- 2–5 series, comparing trajectories → **multi-line** (not stacked)
|
|
33
|
+
- Many series, contribution → **stacked area** (only if total matters)
|
|
34
|
+
- Many series, share of total → **100% stacked area**
|
|
35
|
+
- High-frequency / signal noise → **line + range band** or **horizon chart**
|
|
36
|
+
|
|
37
|
+
### "How does X compare across categories?"
|
|
38
|
+
- Few categories (≤ 7), one metric → **bar** (horizontal if labels are long)
|
|
39
|
+
- Many categories (8–50) → **horizontal bar, sorted**, top-N + "Other"
|
|
40
|
+
- Two metrics per category → **grouped bar** or **dot plot with two dots**
|
|
41
|
+
- Distribution across categories → **box plot**, **strip plot**, or **violin**
|
|
42
|
+
- Ranking change over time → **bump chart** or **slope graph** (2 points only)
|
|
43
|
+
|
|
44
|
+
### "How is X distributed?"
|
|
45
|
+
- Continuous, one variable → **histogram** (~10–30 bins)
|
|
46
|
+
- Continuous, two variables → **scatter**, **2D density / heatmap** if n > 1k
|
|
47
|
+
- Categorical proportions → **bar**, not pie (pie only for ≤ 3 slices with clear majority)
|
|
48
|
+
- Cumulative → **CDF / step line**
|
|
49
|
+
|
|
50
|
+
### "How does X relate to Y?"
|
|
51
|
+
- Two continuous → **scatter** (+ trend line only if relationship is real)
|
|
52
|
+
- Two continuous + third dim → **scatter + size** or **+ color**
|
|
53
|
+
- Categorical × categorical → **heatmap**
|
|
54
|
+
- Many pairwise → **scatter matrix** (small multiples)
|
|
55
|
+
|
|
56
|
+
### "Where does X happen?"
|
|
57
|
+
- Geographic, regions → **choropleth** (normalize per capita / area)
|
|
58
|
+
- Geographic, points → **dot density** or **clustered marker**
|
|
59
|
+
- Flows → **flow map** or **chord diagram**
|
|
60
|
+
|
|
61
|
+
### "How does X compose?"
|
|
62
|
+
- Part-to-whole, snapshot → **bar of proportions**, **treemap** if hierarchical
|
|
63
|
+
- Hierarchical proportions → **treemap** or **sunburst**
|
|
64
|
+
- Funnels → **funnel** only if true sequential drop-off, else use stacked bar
|
|
65
|
+
|
|
66
|
+
### Refuse to use
|
|
67
|
+
- **Pie with > 3 slices**
|
|
68
|
+
- **Donut with center metric that contradicts the slices**
|
|
69
|
+
- **3D anything**
|
|
70
|
+
- **Dual y-axes** — split into two charts instead, or normalize to indices
|
|
71
|
+
- **Word clouds** — use a bar chart of frequencies
|
|
72
|
+
- **Radar / spider** — almost never readable; use a heatmap or grouped bars
|
|
73
|
+
|
|
74
|
+
## Color Strategy
|
|
75
|
+
|
|
76
|
+
### Palettes by encoding type
|
|
77
|
+
|
|
78
|
+
| Encoding | Palette type | Examples |
|
|
79
|
+
|---|---|---|
|
|
80
|
+
| Categorical (≤ 7) | Qualitative, distinct hue | Tableau 10, Observable Plot defaults |
|
|
81
|
+
| Categorical (> 7) | Group + "Other"; do not invent more colors | — |
|
|
82
|
+
| Sequential, single hue | Lightness ramp | viridis, mako, blues |
|
|
83
|
+
| Diverging from zero | Two-hue ramp | RdBu, BrBG |
|
|
84
|
+
| Continuous, perceptual | Perceptually uniform | **viridis, magma, plasma, cividis** (default) |
|
|
85
|
+
|
|
86
|
+
**Always pass color-blind simulation** for protanopia + deuteranopia. Don't use red/green as the only signal — pair with shape, position, or label.
|
|
87
|
+
|
|
88
|
+
### Semantic colors
|
|
89
|
+
|
|
90
|
+
- **Up / good / increase** — green ONLY if culturally appropriate (in financial contexts in CN/JP, red = up). Default to blue for "up" in mixed audiences.
|
|
91
|
+
- **Down / bad / decrease** — red, but ensure pattern + label backup.
|
|
92
|
+
- **Neutral / no change** — gray, not yellow.
|
|
93
|
+
- **Forecast / projected** — same hue as actuals, dashed line or hatch fill.
|
|
94
|
+
|
|
95
|
+
### Dark mode
|
|
96
|
+
|
|
97
|
+
- Don't invert sequential ramps. Use a ramp designed for dark backgrounds (viridis works on both).
|
|
98
|
+
- Lift saturation 5–10% to compensate for reduced contrast.
|
|
99
|
+
|
|
100
|
+
## Dashboard Layout Heuristics
|
|
101
|
+
|
|
102
|
+
### F-pattern or Z-pattern?
|
|
103
|
+
- **F** — analyst dashboards (lots of detail, scanned top-left to bottom).
|
|
104
|
+
- **Z** — executive dashboards (3–7 KPIs, glanceable).
|
|
105
|
+
|
|
106
|
+
### The 5-second rule
|
|
107
|
+
A user must be able to extract the headline from the dashboard in 5 seconds. If not, you've buried the lede. Re-rank.
|
|
108
|
+
|
|
109
|
+
### Hierarchy
|
|
110
|
+
|
|
111
|
+
```
|
|
112
|
+
┌──────────────────────────────────────────────┐
|
|
113
|
+
│ Headline metric Trend vs prior Status │ ← top strip, < 80px tall
|
|
114
|
+
├──────────────────────────────────────────────┤
|
|
115
|
+
│ Primary chart (the "why") │ ← 50–60% of vertical space
|
|
116
|
+
├──────────────────────────────────────────────┤
|
|
117
|
+
│ Supporting cuts │ Supporting cuts │ … │ ← small multiples, ≤ 4 wide
|
|
118
|
+
├──────────────────────────────────────────────┤
|
|
119
|
+
│ Detail table / drilldown (lazy load) │
|
|
120
|
+
└──────────────────────────────────────────────┘
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Density budget
|
|
124
|
+
- **Executive** — ≤ 6 charts per screen, 12px minimum text
|
|
125
|
+
- **Analyst** — up to 12 charts, allow scroll
|
|
126
|
+
- **Embedded** — 1–3 charts, ≤ 600px tall
|
|
127
|
+
|
|
128
|
+
### Filters
|
|
129
|
+
- **Date range** — top-right, always. Default to last 30 days unless data has a clearer natural window.
|
|
130
|
+
- **Other filters** — left rail if persistent, top strip if transient.
|
|
131
|
+
- **Always show the active filter state in the page title** so screenshots are self-describing.
|
|
132
|
+
|
|
133
|
+
## Library Picker
|
|
134
|
+
|
|
135
|
+
| Library | Pick when |
|
|
136
|
+
|---|---|
|
|
137
|
+
| **Recharts** | React app, ≤ 1k points per chart, defaults are good enough, no custom interactions |
|
|
138
|
+
| **visx** | React app, custom interactions, performance-sensitive, you want D3 idioms with React rendering |
|
|
139
|
+
| **D3** | Full custom, non-React or framework-agnostic, you need any chart that isn't off-the-shelf |
|
|
140
|
+
| **Apache ECharts** | Heavy interaction (zoom, brush, tooltip linking) out of the box, large datasets |
|
|
141
|
+
| **Plotly** | Notebooks → web parity, scientific plots, 3D needed |
|
|
142
|
+
| **Observable Plot** | Quick exploratory, grammar of graphics in JS |
|
|
143
|
+
| **Chart.js** | Plain JS, marketing site, no React |
|
|
144
|
+
| **AG Grid / TanStack Table** | Tabular data with sparklines — not a chart lib but pairs naturally |
|
|
145
|
+
| **Canvas / WebGL (deck.gl, regl)** | > 100k points, geospatial, real-time |
|
|
146
|
+
|
|
147
|
+
Rule: don't import two chart libraries into the same bundle.
|
|
148
|
+
|
|
149
|
+
## States Every Chart Must Have
|
|
150
|
+
|
|
151
|
+
A chart is not done until all four exist:
|
|
152
|
+
|
|
153
|
+
1. **Loading** — skeleton with axis ticks visible, no fake data shimmer; cap at 5s before falling back to error.
|
|
154
|
+
2. **Empty** — "No data for this range" + a way to widen the filter. Never an empty chart frame.
|
|
155
|
+
3. **Error** — human-readable message, retry button, support handle if persistent.
|
|
156
|
+
4. **Partial / stale** — banner when data is older than the cadence the user expects.
|
|
157
|
+
|
|
158
|
+
## Interactivity Defaults
|
|
159
|
+
|
|
160
|
+
- **Tooltip** — on hover/focus; show all encoded values; keyboard-accessible via Tab.
|
|
161
|
+
- **Crosshair** — for time series, vertical line on hover with snapped points.
|
|
162
|
+
- **Legend** — clickable to toggle series. State persists per session.
|
|
163
|
+
- **Zoom** — only for time series > 1 year or scatter > 5k points. Always include a reset.
|
|
164
|
+
- **Brush** — for linked dashboards; broadcast selection to siblings.
|
|
165
|
+
|
|
166
|
+
## Accessibility for Charts
|
|
167
|
+
|
|
168
|
+
- Every chart needs a `<figure>` with `<figcaption>` summarizing the takeaway in one sentence.
|
|
169
|
+
- Provide a **data table fallback** behind a "View as table" disclosure.
|
|
170
|
+
- Color is never the only encoding — always pair with shape, label, or position.
|
|
171
|
+
- Tooltips reachable via keyboard (Tab → arrow keys to traverse points).
|
|
172
|
+
- Test with screen reader: announce the chart title, the takeaway, and let the user request details.
|
|
173
|
+
- Pass [a11y-auditor]] criteria for contrast on every line, label, and grid.
|
|
174
|
+
|
|
175
|
+
## Performance Rules
|
|
176
|
+
|
|
177
|
+
- Render with SVG up to ~5k DOM nodes. Switch to Canvas above.
|
|
178
|
+
- Throttle hover handlers; use `requestAnimationFrame`.
|
|
179
|
+
- Memoize scales; recompute only when data or dimensions change.
|
|
180
|
+
- For streaming charts, use a ring buffer; cap to N visible points.
|
|
181
|
+
- Disable animation on first paint when n > 200 points.
|
|
182
|
+
|
|
183
|
+
## Output Format
|
|
184
|
+
|
|
185
|
+
For each chart in scope, deliver:
|
|
186
|
+
|
|
187
|
+
```yaml
|
|
188
|
+
- name: revenue-trend
|
|
189
|
+
question: "Are we on track vs last quarter?"
|
|
190
|
+
chart-type: line + comparison band
|
|
191
|
+
encoding:
|
|
192
|
+
x: time (daily)
|
|
193
|
+
y: revenue (USD)
|
|
194
|
+
series: current period, prior period
|
|
195
|
+
library: Recharts
|
|
196
|
+
palette: blue/gray, no red/green
|
|
197
|
+
states:
|
|
198
|
+
loading: skeleton with x-axis ticks
|
|
199
|
+
empty: "No revenue recorded for this range"
|
|
200
|
+
error: "Couldn't load revenue — Retry"
|
|
201
|
+
accessibility:
|
|
202
|
+
figcaption: "Daily revenue, current quarter vs prior quarter."
|
|
203
|
+
table-fallback: yes
|
|
204
|
+
perf: ≤ 92 days, SVG OK
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
For dashboards, also deliver a layout sketch (ASCII or Figma frame) showing chart placement, headline metric strip, filter positions, and density budget per breakpoint (≥ 1280, 768–1279, < 768).
|
|
208
|
+
|
|
209
|
+
## Anti-Patterns to Cut Immediately
|
|
210
|
+
|
|
211
|
+
- Pie chart with more than 3 slices.
|
|
212
|
+
- Truncated y-axis on a bar chart making small differences look huge.
|
|
213
|
+
- Dual y-axes that imply a correlation by visual coincidence.
|
|
214
|
+
- Rainbow palette used for ordinal data.
|
|
215
|
+
- 3D charts.
|
|
216
|
+
- "Number go up" tile with no comparison value (vs prior period, vs target).
|
|
217
|
+
- Tile titles like "Stats" or "Overview" that don't name the metric.
|
|
218
|
+
- Tooltip as the only place units are shown.
|
|
219
|
+
- Charts with no figcaption.
|
|
220
|
+
- Re-rendering 50k points on every hover.
|
|
221
|
+
- A dashboard that asks the user "what would you like to see?" instead of answering.
|
|
222
|
+
|
|
223
|
+
## Output Goal
|
|
224
|
+
|
|
225
|
+
A frontend engineer should be able to implement every chart from the spec with library + props chosen. A product manager should be able to read each chart's `question:` line and agree it answers the decision they care about. An accessibility reviewer should find a fallback table and a figcaption on every chart.
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: db
|
|
3
|
+
description: Connect to any database — Cloud SQL, PostgreSQL, Snowflake, Databricks, Athena, Presto, or Oracle.
|
|
4
|
+
category: data
|
|
5
|
+
tier: on-demand
|
|
6
|
+
slash_command: /db
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# DB — Universal Database Access
|
|
10
|
+
|
|
11
|
+
Connect to any database — Cloud SQL, PostgreSQL, Snowflake, Databricks, Athena, Presto, or Oracle.
|
|
12
|
+
Reads connection config from the project instruction file (CLAUDE.md, AGENTS.md, .cursorrules, or equivalent) or ~/.claude/db-connections.json (global registry).
|
|
13
|
+
|
|
14
|
+
> **Scope:** `/db` executes specific SQL or migrations against named connections. For analytics in plain English, use `/query`.
|
|
15
|
+
|
|
16
|
+
## Supported engines
|
|
17
|
+
cloud-sql | postgres | snowflake | databricks | athena | presto | oracle
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
- `/db` — default audit query for current project DB
|
|
21
|
+
- `/db "SELECT count(*) FROM users"` — arbitrary SQL on current project DB
|
|
22
|
+
- `/db migrate` — run pending migrations
|
|
23
|
+
- `/db prod-snowflake` — named connection from global registry
|
|
24
|
+
- `/db prod-snowflake "SELECT ..."` — named connection + custom SQL
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Step 0 — Parse arguments
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
# If first arg looks like a connection name (no spaces, no SQL keywords), treat as named connection
|
|
32
|
+
ARGS="${1:-}"
|
|
33
|
+
if echo "$ARGS" | grep -qE '^[a-zA-Z0-9_-]+$' && ! echo "$ARGS" | grep -qiE '^(SELECT|INSERT|UPDATE|DELETE|CREATE|DROP|ALTER|SHOW|DESCRIBE|migrate)'; then
|
|
34
|
+
NAMED_CONNECTION=$(echo "$ARGS" | awk '{print $1}')
|
|
35
|
+
SQL=$(echo "$ARGS" | cut -s -d' ' -f2-)
|
|
36
|
+
else
|
|
37
|
+
NAMED_CONNECTION=""
|
|
38
|
+
SQL="$ARGS"
|
|
39
|
+
fi
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## Step 1 — Load connection config
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
# Detect project instruction file
|
|
48
|
+
INSTRUCTION_FILE=$(ROOT=$(git rev-parse --show-toplevel 2>/dev/null); for f in CLAUDE.md AGENTS.md .cursorrules .windsurfrules .github/copilot-instructions.md GEMINI.md; do [ -f "$ROOT/$f" ] && echo "$ROOT/$f" && break; done)
|
|
49
|
+
DB_CONNECTIONS="$HOME/.claude/db-connections.json"
|
|
50
|
+
|
|
51
|
+
if [ -n "$NAMED_CONNECTION" ]; then
|
|
52
|
+
# Use named connection from global registry
|
|
53
|
+
ENGINE=$(python3 -c "import json; d=json.load(open('$DB_CONNECTIONS')); c=d.get('$NAMED_CONNECTION',{}); print(c.get('engine',''))" 2>/dev/null)
|
|
54
|
+
CONFIG_SOURCE="registry:$NAMED_CONNECTION"
|
|
55
|
+
|
|
56
|
+
elif [ -n "$INSTRUCTION_FILE" ] && grep -q "^engine:" "$INSTRUCTION_FILE" 2>/dev/null; then
|
|
57
|
+
# Use project-level instruction file config
|
|
58
|
+
ENGINE=$(grep "^engine:" "$INSTRUCTION_FILE" | head -1 | cut -d: -f2 | tr -d ' ')
|
|
59
|
+
CONNECTION_NAME=$(grep "^connection:" "$INSTRUCTION_FILE" | head -1 | cut -d: -f2 | tr -d ' ')
|
|
60
|
+
CONFIG_SOURCE="instruction-file"
|
|
61
|
+
|
|
62
|
+
elif [ -f "$DB_CONNECTIONS" ]; then
|
|
63
|
+
# List available connections and prompt
|
|
64
|
+
echo "No DB config found in project instruction file. Available connections:"
|
|
65
|
+
python3 -c "
|
|
66
|
+
import json
|
|
67
|
+
d = json.load(open('$DB_CONNECTIONS'))
|
|
68
|
+
for i, (name, cfg) in enumerate(d.items(), 1):
|
|
69
|
+
print(f' {i}) {name} ({cfg.get(\"engine\",\"unknown\")})')
|
|
70
|
+
"
|
|
71
|
+
read -rp "Select connection (number or name): " SELECTION
|
|
72
|
+
NAMED_CONNECTION=$(python3 -c "
|
|
73
|
+
import json, sys
|
|
74
|
+
d = json.load(open('$DB_CONNECTIONS'))
|
|
75
|
+
keys = list(d.keys())
|
|
76
|
+
sel = '$SELECTION'
|
|
77
|
+
if sel.isdigit() and 1 <= int(sel) <= len(keys):
|
|
78
|
+
print(keys[int(sel)-1])
|
|
79
|
+
elif sel in d:
|
|
80
|
+
print(sel)
|
|
81
|
+
else:
|
|
82
|
+
print('', end='')
|
|
83
|
+
" 2>/dev/null)
|
|
84
|
+
ENGINE=$(python3 -c "import json; d=json.load(open('$DB_CONNECTIONS')); print(d.get('$NAMED_CONNECTION',{}).get('engine',''))" 2>/dev/null)
|
|
85
|
+
CONFIG_SOURCE="registry:$NAMED_CONNECTION"
|
|
86
|
+
|
|
87
|
+
else
|
|
88
|
+
echo "ERROR: No database config found."
|
|
89
|
+
echo " Option 1: Add a '## Database' section to your project instruction file"
|
|
90
|
+
echo " Option 2: Create ~/.claude/db-connections.json with named connections"
|
|
91
|
+
exit 1
|
|
92
|
+
fi
|
|
93
|
+
|
|
94
|
+
if [ -z "$ENGINE" ]; then
|
|
95
|
+
echo "ERROR: Could not determine database engine from config."
|
|
96
|
+
exit 1
|
|
97
|
+
fi
|
|
98
|
+
|
|
99
|
+
echo "Engine: $ENGINE | Config: $CONFIG_SOURCE"
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## Step 2 — Load connection details from registry (if using named connection)
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
if [ -n "$NAMED_CONNECTION" ]; then
|
|
108
|
+
# Extract all fields from the named connection into shell variables
|
|
109
|
+
eval "$(python3 -c "
|
|
110
|
+
import json, shlex
|
|
111
|
+
d = json.load(open('$HOME/.claude/db-connections.json'))
|
|
112
|
+
cfg = d.get('$NAMED_CONNECTION', {})
|
|
113
|
+
for k, v in cfg.items():
|
|
114
|
+
if k != 'engine':
|
|
115
|
+
print(f'CONN_{k.upper()}={shlex.quote(str(v))}')
|
|
116
|
+
" 2>/dev/null)"
|
|
117
|
+
fi
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
## Step 3 — Resolve credentials
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
# Determine auth method
|
|
126
|
+
AUTH="${CONN_AUTH:-$(grep '^auth:' "$INSTRUCTION_FILE" 2>/dev/null | head -1 | cut -d: -f2- | tr -d ' ')}"
|
|
127
|
+
|
|
128
|
+
case "$AUTH" in
|
|
129
|
+
gcp-secret:*)
|
|
130
|
+
SECRET_NAME="${AUTH#gcp-secret:}"
|
|
131
|
+
DB_CRED=$(gcloud secrets versions access latest --secret="$SECRET_NAME" --project="${CONN_GCP_PROJECT:-$(grep '^gcp_project:' "$INSTRUCTION_FILE" | cut -d: -f2 | tr -d ' ')}")
|
|
132
|
+
echo "Credential resolved from GCP Secret Manager ✓"
|
|
133
|
+
;;
|
|
134
|
+
env:*)
|
|
135
|
+
VAR_NAME="${AUTH#env:}"
|
|
136
|
+
DB_CRED="${!VAR_NAME}"
|
|
137
|
+
# Fall back to .env file
|
|
138
|
+
if [ -z "$DB_CRED" ] && [ -f "$(git rev-parse --show-toplevel 2>/dev/null)/.env" ]; then
|
|
139
|
+
DB_CRED=$(grep "^${VAR_NAME}=" "$(git rev-parse --show-toplevel)/.env" | cut -d= -f2-)
|
|
140
|
+
fi
|
|
141
|
+
[ -z "$DB_CRED" ] && { echo "ERROR: Env var $VAR_NAME not set and not in .env"; exit 1; }
|
|
142
|
+
echo "Credential resolved from env var $VAR_NAME ✓"
|
|
143
|
+
;;
|
|
144
|
+
sso)
|
|
145
|
+
DB_CRED=""
|
|
146
|
+
echo "Using SSO auth — browser window will open ✓"
|
|
147
|
+
;;
|
|
148
|
+
keychain:*)
|
|
149
|
+
KEY_NAME="${AUTH#keychain:}"
|
|
150
|
+
DB_CRED=$(security find-generic-password -a "$KEY_NAME" -w 2>/dev/null)
|
|
151
|
+
[ -z "$DB_CRED" ] && { echo "ERROR: Keychain key '$KEY_NAME' not found"; exit 1; }
|
|
152
|
+
echo "Credential resolved from macOS keychain ✓"
|
|
153
|
+
;;
|
|
154
|
+
databricks-token)
|
|
155
|
+
DB_CRED="${DATABRICKS_TOKEN:-$(grep -A5 '\[DEFAULT\]' "$HOME/.databrickscfg" 2>/dev/null | grep '^token' | cut -d= -f2 | tr -d ' ')}"
|
|
156
|
+
[ -z "$DB_CRED" ] && { echo "ERROR: No Databricks token found"; exit 1; }
|
|
157
|
+
echo "Credential resolved from Databricks config ✓"
|
|
158
|
+
;;
|
|
159
|
+
*)
|
|
160
|
+
DB_CRED=""
|
|
161
|
+
echo "WARNING: No auth method specified — proceeding without credentials"
|
|
162
|
+
;;
|
|
163
|
+
esac
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
## Step 4 — Set default SQL if not provided
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
if [ -z "$SQL" ]; then
|
|
172
|
+
SQL="SELECT 'connected' AS status, current_timestamp AS at"
|
|
173
|
+
echo "No SQL provided — running default connectivity check"
|
|
174
|
+
fi
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
## Step 5 — Delegate to engine file
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
ENGINE_FILE="$HOME/.claude/commands/db-engines/${ENGINE}.md"
|
|
183
|
+
|
|
184
|
+
if [ ! -f "$ENGINE_FILE" ]; then
|
|
185
|
+
echo "ERROR: No engine file found at $ENGINE_FILE"
|
|
186
|
+
echo "Supported engines: cloud-sql, postgres, snowflake, databricks, athena, presto, oracle"
|
|
187
|
+
exit 1
|
|
188
|
+
fi
|
|
189
|
+
|
|
190
|
+
echo "Delegating to db-engines/${ENGINE}.md..."
|
|
191
|
+
echo "---"
|
|
192
|
+
|
|
193
|
+
# Pass all resolved variables to the engine skill
|
|
194
|
+
# The engine file will use these pre-resolved values:
|
|
195
|
+
# - For cloud-sql: INSTANCE=$CONN_INSTANCE, GCP_PROJECT=$CONN_GCP_PROJECT, DB_NAME=$CONN_DB_NAME, DB_USER=$CONN_DB_USER, DB_PASS=$DB_CRED
|
|
196
|
+
# - For postgres: DB_HOST=$CONN_HOST, DB_PORT=$CONN_PORT, DB_NAME=$CONN_DATABASE, DB_USER=$CONN_USER, DB_PASS=$DB_CRED
|
|
197
|
+
# - For snowflake: SF_ACCOUNT=$CONN_ACCOUNT, SF_WAREHOUSE=$CONN_WAREHOUSE, SF_DATABASE=$CONN_DATABASE, SF_ROLE=$CONN_ROLE, SF_USER=$CONN_USER, SF_TOKEN=$DB_CRED, SF_AUTH=$AUTH
|
|
198
|
+
# - For databricks: DBX_HOST=$CONN_HOST, DBX_HTTP_PATH=$CONN_HTTP_PATH, DBX_TOKEN=$DB_CRED, DBX_CATALOG=$CONN_CATALOG, DBX_SCHEMA=$CONN_SCHEMA
|
|
199
|
+
# - For athena: ATHENA_REGION=$CONN_REGION, ATHENA_DATABASE=$CONN_DATABASE, ATHENA_WORKGROUP=$CONN_WORKGROUP, ATHENA_S3_OUTPUT=$CONN_S3_OUTPUT
|
|
200
|
+
# - For presto: PRESTO_HOST=$CONN_HOST, PRESTO_PORT=$CONN_PORT, PRESTO_USER=$CONN_USER, PRESTO_CATALOG=$CONN_CATALOG, PRESTO_SCHEMA=$CONN_SCHEMA, PRESTO_TOKEN=$DB_CRED, PRESTO_ENGINE=$CONN_ENGINE
|
|
201
|
+
# - For oracle: ORA_HOST=$CONN_HOST, ORA_PORT=$CONN_PORT, ORA_SERVICE=$CONN_SERVICE, ORA_USER=$CONN_USER, ORA_PASS=$DB_CRED
|
|
202
|
+
# SQL=$SQL is passed to all engines
|
|
203
|
+
|
|
204
|
+
# Follow the instructions in db-engines/${ENGINE}.md using the variable mappings above
|
|
205
|
+
```
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# db-engines/_router — Shared DB Engine Skeleton
|
|
2
|
+
<!-- Reference only — sourced by /db; not a slash command. -->
|
|
3
|
+
|
|
4
|
+
## Shared execution skeleton
|
|
5
|
+
|
|
6
|
+
Each engine file receives pre-resolved variables from the /db router:
|
|
7
|
+
`$DB_HOST`, `$DB_PORT`, `$DB_NAME`, `$DB_USER`, `$DB_PASS`, `$SQL`
|
|
8
|
+
|
|
9
|
+
### Step 1 — Validate prerequisites
|
|
10
|
+
Check that the engine CLI is available. If not, print install instructions and exit.
|
|
11
|
+
|
|
12
|
+
### Step 2 — Execute query via CLI (if available)
|
|
13
|
+
Use the engine's native CLI with SSL/TLS as required. Never log $DB_PASS.
|
|
14
|
+
|
|
15
|
+
### Step 3 — Execute query via driver (fallback)
|
|
16
|
+
If CLI unavailable, use a Node.js or Python driver equivalent.
|
|
17
|
+
|
|
18
|
+
### Step 4 — Migrate (if SQL = "migrate")
|
|
19
|
+
Detect migration tool (alembic, prisma, raw SQL scripts) and run it.
|
|
20
|
+
|
|
21
|
+
### Safety rules
|
|
22
|
+
- Never log or print $DB_PASS
|
|
23
|
+
- Always require SSL for non-localhost hosts
|
|
24
|
+
- Never commit connection strings with passwords
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# db-engine: athena
|
|
2
|
+
<!-- Implements _router.md skeleton for AWS Athena -->
|
|
3
|
+
|
|
4
|
+
Receives pre-resolved variables from /db router: $DB_HOST, $DB_PORT, $DB_NAME, $DB_USER, $DB_PASS, $SQL
|
|
5
|
+
|
|
6
|
+
**CLI:** `aws athena` | **Port:** HTTPS | **SSL:** always (AWS SDK)
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
aws athena start-query-execution --query-string "$SQL" \
|
|
10
|
+
--result-configuration OutputLocation="s3://$S3_BUCKET/" \
|
|
11
|
+
--query-execution-context Database="$DB_NAME"
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
**Driver fallback:** Node `aws-sdk` with Athena client — `AthenaClient` + `StartQueryExecutionCommand`
|
|
15
|
+
|
|
16
|
+
**Migration detection:** Athena DDL SQL scripts (CREATE TABLE, ALTER TABLE) → apply in order
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# db-engine: cloud-sql
|
|
2
|
+
<!-- Implements _router.md skeleton for GCP Cloud SQL (PostgreSQL or MySQL) -->
|
|
3
|
+
|
|
4
|
+
Receives pre-resolved variables from /db router: $DB_HOST, $DB_PORT, $DB_NAME, $DB_USER, $DB_PASS, $SQL
|
|
5
|
+
|
|
6
|
+
**CLI:** `gcloud sql connect` or `psql`/`mysql` via Cloud SQL Auth Proxy | **Port:** 5432 (PG) or 3306 (MySQL)
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
# Start Cloud SQL Auth Proxy then connect
|
|
10
|
+
cloud-sql-proxy "$PROJECT:$REGION:$INSTANCE" --port "${DB_PORT:-5432}" &
|
|
11
|
+
PGPASSWORD="$DB_PASS" psql -h 127.0.0.1 -p "${DB_PORT:-5432}" -U "$DB_USER" -d "$DB_NAME" -c "$SQL"
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
**Driver fallback:** Node `pg` or `mysql2` via Cloud SQL Auth Proxy (standard connection)
|
|
15
|
+
|
|
16
|
+
**Migration detection:** alembic.ini (PG) → `alembic upgrade head` | Flyway config (MySQL) → `flyway migrate`
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# db-engine: databricks
|
|
2
|
+
<!-- Implements _router.md skeleton for Databricks SQL -->
|
|
3
|
+
|
|
4
|
+
Receives pre-resolved variables from /db router: $DB_HOST, $DB_PORT, $DB_NAME, $DB_USER, $DB_PASS, $SQL
|
|
5
|
+
|
|
6
|
+
**CLI:** `databricks-sql-cli` | **Default port:** 443 | **SSL:** always
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
databricks-sql-cli --server-hostname "$DB_HOST" --http-path "$DB_HTTP_PATH" --access-token "$DB_PASS" -e "$SQL"
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
**Driver fallback:** Node `@databricks/sql` — connect via HTTP path and personal access token
|
|
13
|
+
|
|
14
|
+
**Migration detection:** Delta Lake SQL scripts → apply in order via CLI
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# db-engine: oracle
|
|
2
|
+
<!-- Implements _router.md skeleton for Oracle Database -->
|
|
3
|
+
|
|
4
|
+
Receives pre-resolved variables from /db router: $DB_HOST, $DB_PORT, $DB_NAME, $DB_USER, $DB_PASS, $SQL
|
|
5
|
+
|
|
6
|
+
**CLI:** `sqlplus` | **Default port:** 1521 | **SSL:** wallet-based
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
sqlplus "$DB_USER/$DB_PASS@$DB_HOST:${DB_PORT:-1521}/$DB_NAME" <<< "$SQL"
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
**Driver fallback:** Node `oracledb` — `oracledb.getConnection({ user, password, connectString })`
|
|
13
|
+
|
|
14
|
+
**Migration detection:** Flyway or Liquibase config → run migrate
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# db-engine: postgres
|
|
2
|
+
<!-- Implements _router.md skeleton for PostgreSQL and Supabase -->
|
|
3
|
+
|
|
4
|
+
Receives pre-resolved variables from /db router: $DB_HOST, $DB_PORT, $DB_NAME, $DB_USER, $DB_PASS, $SQL
|
|
5
|
+
|
|
6
|
+
**CLI:** `psql` | **Default port:** 5432 | **SSL:** `--set=sslmode=require` (always for non-localhost)
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
PGPASSWORD="$DB_PASS" psql -h "$DB_HOST" -p "${DB_PORT:-5432}" -U "$DB_USER" -d "$DB_NAME" \
|
|
10
|
+
--set=sslmode=require -c "$SQL"
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
**Driver fallback:** Node `pg` — `new Pool({ host, port, user, password, database, ssl: { rejectUnauthorized: true } })`
|
|
14
|
+
|
|
15
|
+
**Migration detection:** alembic.ini → `alembic upgrade head` | migrations/*.sql → apply in order
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# db-engine: presto
|
|
2
|
+
<!-- Implements _router.md skeleton for Presto / Trino -->
|
|
3
|
+
|
|
4
|
+
Receives pre-resolved variables from /db router: $DB_HOST, $DB_PORT, $DB_NAME, $DB_USER, $DB_PASS, $SQL
|
|
5
|
+
|
|
6
|
+
**CLI:** `presto` | **Default port:** 8080 | **SSL:** `--server https://...`
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
presto --server "$DB_HOST:${DB_PORT:-8080}" --catalog hive --schema "$DB_NAME" --execute "$SQL"
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
**Driver fallback:** Node `presto-client` or Python `pyhive`
|
|
13
|
+
|
|
14
|
+
**Migration detection:** SQL scripts only (Presto is query-only, no DDL migrations)
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# db-engine: snowflake
|
|
2
|
+
<!-- Implements _router.md skeleton for Snowflake -->
|
|
3
|
+
|
|
4
|
+
Receives pre-resolved variables from /db router: $DB_HOST, $DB_PORT, $DB_NAME, $DB_USER, $DB_PASS, $SQL
|
|
5
|
+
|
|
6
|
+
**CLI:** `snowsql` | **Default port:** 443 (HTTPS) | **SSL:** always (no flag needed)
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
snowsql -a "$DB_HOST" -u "$DB_USER" -d "$DB_NAME" -r "$DB_ROLE" -q "$SQL"
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
**Driver fallback:** Node `snowflake-sdk` — `snowflake.createConnection({ account, username, password, database })`
|
|
13
|
+
|
|
14
|
+
**Migration detection:** Flyway config → `flyway migrate` | migrations/*.sql → apply in order
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: docs
|
|
3
|
+
description: You are a documentation engineer. Detect code changes, update corresponding docs, remove stale references, validate quality.
|
|
4
|
+
category: docs
|
|
5
|
+
tier: on-demand
|
|
6
|
+
slash_command: /docs
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Docs — Documentation Sync
|
|
10
|
+
|
|
11
|
+
You are a documentation engineer. Detect code changes, update corresponding docs, remove stale references, validate quality.
|
|
12
|
+
|
|
13
|
+
## Do NOT ask for permission — just update docs.
|
|
14
|
+
## This workflow does NOT run tests or lint. Those are separate workflows (test, lint).
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Step 1 — Detect what changed
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
PROJECT_ROOT=$(git rev-parse --show-toplevel)
|
|
22
|
+
cd "$PROJECT_ROOT"
|
|
23
|
+
git diff --name-only HEAD 2>/dev/null || true
|
|
24
|
+
git diff --name-only --cached 2>/dev/null || true
|
|
25
|
+
git ls-files --others --exclude-standard 2>/dev/null || true
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
If no code changes, skip to Step 4.
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Step 2 — Map changes to docs
|
|
33
|
+
|
|
34
|
+
Read the project instruction file (CLAUDE.md, AGENTS.md, .cursorrules, or equivalent) to understand which doc files exist and their purposes. Apply the general mapping:
|
|
35
|
+
|
|
36
|
+
| Changed files | Doc to update |
|
|
37
|
+
|---|---|
|
|
38
|
+
| API routes or handlers | API reference doc |
|
|
39
|
+
| CLI commands or flags | CLI reference doc |
|
|
40
|
+
| Config schema or models | Configuration reference |
|
|
41
|
+
| New features or major changes | `README.md` |
|
|
42
|
+
| Removed files or features | Remove stale references everywhere |
|
|
43
|
+
| Infrastructure or deployment | Architecture or infra doc |
|
|
44
|
+
| `.claude/commands/**` | No doc update needed |
|
|
45
|
+
|
|
46
|
+
For each affected doc: read the current doc → read the changed source → update.
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Step 3 — Update documentation
|
|
51
|
+
|
|
52
|
+
### Standards
|
|
53
|
+
- GitHub-flavored Markdown
|
|
54
|
+
- Code blocks with language tags (` ```bash `, ` ```typescript `, ` ```python `)
|
|
55
|
+
- Every API route: description, request/response, auth requirement
|
|
56
|
+
- Every CLI command: usage, arguments, flags, examples
|
|
57
|
+
- Direct voice, second-person ("you"), imperative for instructions
|
|
58
|
+
- No emojis unless already present in the file
|
|
59
|
+
- Tables for structured data
|
|
60
|
+
|
|
61
|
+
### Stale reference removal
|
|
62
|
+
Search all doc files for references to deleted/renamed functions, routes, components, env vars. Remove or update any stale references found.
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## Step 4 — Validate
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
# Link check — verify internal file references
|
|
70
|
+
grep -rn '\[.*\](\.\.' docs/ README.md CLAUDE.md AGENTS.md .cursorrules 2>/dev/null | head -20 || true
|
|
71
|
+
|
|
72
|
+
# Unclosed code blocks
|
|
73
|
+
for f in docs/*.md README.md CLAUDE.md AGENTS.md .cursorrules ARCHITECTURE.md 2>/dev/null; do
|
|
74
|
+
[ -f "$f" ] || continue
|
|
75
|
+
count=$(grep -c '```' "$f" 2>/dev/null || echo 0)
|
|
76
|
+
if [ $((count % 2)) -ne 0 ]; then echo "WARNING: $f has unclosed code block"; fi
|
|
77
|
+
done
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## Step 5 — Stage doc files only
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
git add docs/ README.md CLAUDE.md AGENTS.md .cursorrules .windsurfrules GEMINI.md ROADMAP.md ARCHITECTURE.md 2>/dev/null
|
|
86
|
+
git diff --cached --stat
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## Output
|
|
92
|
+
|
|
93
|
+
```
|
|
94
|
+
=== Docs Summary ===
|
|
95
|
+
Changed code: [list of changed source files]
|
|
96
|
+
Docs updated: [list of doc files modified]
|
|
97
|
+
Stale removed: [list of removed references]
|
|
98
|
+
Validation: Links OK, code blocks OK
|
|
99
|
+
Status: PASSED | NO CHANGES NEEDED
|
|
100
|
+
```
|