技能创建器
skill-creator
创建、改进和评估自定义技能,把专业流程转化为可重复使用的 AI 能力。
cja-dimension-analysis【数据与研究】Comprehensive dimension analysis and reporting for CJA. Use this skill whenever the user wants to analyze one or more dimensions — including cardinality, distribution/skew, trends, anomalies, data quality errors, comparisons, and forecasting. Also trigger when someone asks "what are the top values for...", "dimension health", "explore this dimension"…
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Analyze one or more CJA dimensions to understand their cardinality, distribution, trends, anomalies, data quality issues, and forecasts. Produces an actionable report that helps teams understand what's inside their dimensions and where to focus attention.
Execute phases in order. Each phase is selectable — the user can ask for a subset (e.g., "just cardinality and errors") or the full analysis. Default is all phases.
findDataViews to list available data views. If the user hasn't specified one,
ask which data view to analyze. Set it with setDefaultSessionDataViewId.For each dimension:
searchDimensionItems(dimensionId, limit: 50000) to estimate unique value count,
or runReport with the dimension as rows and a count metric to get row count.| Level | Threshold |
|---|---|
| LOW | < 100 unique values |
| MEDIUM | 100 – 1,000 |
| HIGH | 1,000 – 10,000 |
| VERY HIGH | > 10,000 |
runReport with dimension + date breakdown;
count unique dimension values per day/week to see cardinality growth trend.Store: {dimensionId, name, uniqueValueCount, cardinalityLevel, cardinalityTrend}
For each dimension:
runReport with dimension as rows + primary metric (e.g., occurrences/visits).
Request at least 50 rows to capture the distribution shape.| Label | Condition |
|---|---|
| Extreme skew | Top 1 value > 50% of total |
| High skew | Top 1 value > 30% of total |
| Moderate | Top 5 values < 70% of total |
| Long tail | Top 10 values < 50% of total |
Store: {dimensionId, distribution: [{value, metric, pct, cumulative}], gini, skewLabel, top1Pct, top5Pct, top10Pct}
For each dimension:
runReport with dimension + date granularity (day or week depending on range).
Compare two periods: first half vs second half of the selected date range.Store: {dimensionId, periodComparison: {period1, period2, changes: [{value, p1Metric, p2Metric, pctChange, badge}]}, newValues: [], disappearedValues: []}
For each dimension:
Store: {dimensionId, anomalies: [{value, date, type, magnitude, zScore}]}
For each dimension:
searchDimensionItems:
"Unspecified", "None", "(empty)", "", "null", "undefined", "N/A", "unknown"runReport filtering to each known bad value.Store: {dimensionId, errorPatterns: [{pattern, count, pct}], missingDataPct, missingDataSeverity}
This phase runs when the user is analyzing 2+ dimensions OR requests period comparison.
Side-by-side (2–3 dimensions):
Time-period comparison (single dimension):
Store: {comparisons: [{type, dimensions or periods, table}]}
For each dimension with sufficient time-series data (>= 7 data points):
Store: {dimensionId, forecasts: [{value, slope, r2, direction, confidence, projectedValues: []}]}
After all analysis phases complete:
Save all collected data to a JSON file:
dimension_analysis_results_YYYY-MM-DD_HH-MM.json
(in a temp output directory, e.g. /tmp/cja-dimension-analysis/, or a path the user specifies)
Run the Python report generator:
python3 scripts/cja_dimension_analysis.py \
<analysis_json> \
"<data_view_name>" \
"<data_view_id>" \
[output_directory] \
[--format=html|markdown] \
[--keep-analyses=N]
Options:
--format=html (default): Interactive HTML dashboard with Chart.js visualizations--format=markdown: Comprehensive text-based report with tables--keep-analyses=N (default: 0 = keep all): Auto-cleanup of old analysis filesThe script generates a second output file: the report (HTML or markdown).
Open with open <output_directory>/dimension_analysis_report_*.html
Present the report path to the user and summarize key findings:
| Tool | Phase | Purpose |
|---|---|---|
findDataViews | 0 | List available data views |
setDefaultSessionDataViewId | 0 | Set active data view for session |
findDimensions | 0 | Discover dimensions by name/search |
describeDimension | 0 | Get dimension metadata and ID |
searchDimensionItems | 1, 5 | Count unique values; search for specific items (error patterns) |
runReport | 1–7 | Primary data engine: dimension rows + metric, with optional date breakdown |
Interactive report with:
The generated HTML must use the editorial design system shared across all skills: warm off-white surface, serif display title, red-on-black gradient header, and underline-on-hover text-link nav. Do not introduce corporate-blue chrome, centered headers, or alternative gradients.
Read template.html and use it verbatim. It contains the
Google Fonts <link> tags, the full CSS block, and the <header> structure.
Paste the <head> block into the generated report's <head>, paste the
<header> block at the top of <body>, and fill in the {ORG_NAME},
{DIMENSION_COUNT}, {DATE_RANGE}, {DATA_VIEW_NAME}, and {DATE}
placeholders. Do not improvise the styling.
Where {ORG_NAME} is the customer's brand name (with technical suffixes like
— Prod, - Demo, MCP, Stage stripped). Never substitute a vendor or
product name into the title. The title is all white — do not color any word red.
For single-dimension reports, replace the h1 with {ORG_NAME} {DIMENSION_NAME} Report.
Section titles — no phase prefix: Section headings in the HTML report must not include the phase number. Use the plain section name only:
Text-based report with:
The JSON schema consumed by scripts/cja_dimension_analysis.py is derived from the
Store: {...} shapes in each phase above. The script knows its own input contract;
build the JSON to match the per-phase Store entries.
"Can you analyze how our 'Marketing Channel' dimension is performing and break it down by device type?"
findDataViews. Call setDefaultSessionDataViewId.findDimensions to locate the 'Marketing Channel' dimension and its ID. Confirm it exists and has data with searchDimensionItems.runReport for Marketing Channel performance over the last 30 days (visits, conversions, revenue). Identify top and bottom performers.runReport times out on a dimension, reduce the row limit and note the limitation.