Create chart

From amplitude/builder-skills · View interactive version

Create chart is an AI agent skill from the GitHub repository amplitude/builder-skills. Creates Amplitude charts from natural language descriptions, handling event selection, filters, groupings, and visualization choices. Use when you know what you want to measure but prefer not to build the chart manually.

How to use this skill

Skill file

Create Amplitude Chart

Create charts from natural language by discovering events, building chart definitions, and verifying results.

Planning First (Critical)

Before any tool calls, decompose the request:

1. Identify chart components:

2. Plan event searches:

3. Plan parallel tool calls:

Event Discovery (Critical: Discovery First)

IMPORTANT: Cast a wide net before narrowing down

When the user's request is ambiguous or could map to multiple events:

  1. Search BROADLY first to discover relevant options
  2. Review relevant results - look for related events, custom events, meta events
  3. Present options to user OR explain your selection rationale
  4. Try not to assume a single event is the only answer without exploration

Search for events:

Amplitude:search with entity_types=['EVENT', 'CUSTOM_EVENT']

Make informed decisions, then explain:

  1. Search broadly to discover all options
  2. Review results and identify the most comprehensive/accurate approach
  3. Make your best judgment call (prefer aggregated custom events over single events)
  4. Always explain: "I found X, Y, Z options. I chose [X] because [reason]. This includes/excludes [scope]."
  5. User can correct if your assumption was wrong

Decision criteria:

Examples:

Verify before use:

Get properties:

Amplitude:get_event_properties for exact property names/values

Find cohorts:

Amplitude:search with entity_types=['COHORT']
Amplitude:get_cohorts to get full definitions

Chart Type Selection

| Chart Type | Use When |

|------------|----------|

| eventsSegmentation | Counting events/users over time, trends, comparisons, KPIs, distributions, property analytics |

| funnels | Multi-step conversion analysis with a known sequence, drop-off analysis, time between specific events, time-to-convert metrics |

| retention | User return behavior, cohort retention curves, churn analysis |

| dataTableV2 | Tabular comparisons, rankings, multi-dimensional breakdowns |

| customerJourney | Path exploration, discovering unknown paths users take, comparing converted vs dropped-off paths |

| sessions | Session duration, session frequency, time spent per user, session length distributions |

Quick Reference

eventsSegmentation - Most versatile. Use for:

Aggregation Scope (eventsSegmentation):

funnels - Conversion analysis with predefined steps. Use for:

retention - Return behavior. Use for:

dataTableV2 - Tabular data. Use for:

customerJourney - Path exploration and discovery. Use for:

sessions - Session-based engagement metrics. Use for:

Special metrics:

Meta events:

Chart Definition Structure

Core parameters (all chart types):

{
  "name": "Descriptive Chart Title",
  "projectId": "12345",
  "definition": {
    "app": "12345",
    "type": "eventsSegmentation",
    "params": {
      "range": "Last 30 Days",
      "events": [{
        "event_type": "Purchase Completed",
        "filters": [],
        "group_by": []
      }],
      "metric": "uniques",
      "countGroup": "User",
      "interval": 1,
      "segments": [{"conditions": []}]
    }
  }
}

Key parameters:

Event filters (inline OR logic):

"filters": [{
  "group_type": "User",
  "subprop_key": "country",
  "subprop_op": "is",
  "subprop_type": "event",
  "subprop_value": ["United States", "Canada"]
}]

User segments (conditions AND logic):

"segments": [{
  "name": "Active Users",
  "conditions": [{
    "type": "property",
    "group_type": "User",
    "prop_type": "user",
    "prop": "plan",
    "op": "is",
    "values": ["Pro", "Enterprise"]
  }]
}]

Cohort segments:

Search for cohort, get ID, then:

"segments": [{
  "name": "My Cohort",
  "conditions": [{
    "type": "cohort",
    "group_type": "User",
    "cohort_id": "abc123",
    "op": "is_in"
  }]
}]

Workflow: Create Chart

  1. Get context:
Amplitude:get_context (for projectId)
  1. Discover events (BROAD search first):
Amplitude:search for each distinct concept
- Use broad search terms initially
- Look for all related events, custom events, cohorts
- Review ALL results before selecting
  1. Evaluate and decide:
  1. Find similar charts (see examples):
Amplitude:search entity_types=['CHART'] query="similar concept"
Amplitude:get_charts to see definition structure
  1. Get properties if needed:
Amplitude:get_event_properties
  1. Build definition using discovered names
  1. Create chart:
Amplitude:query_dataset with full definition
  1. Verify results - check data makes sense
  1. Save chart:
Amplitude:save_chart_edits with editId from query_dataset

Error Handling

If query_dataset fails:

If zero results:

Best Practices

Naming:

Time ranges:

Verification:

Comparisons:

Always include:

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.