Adoption metric feature usage

From CraftOS-dev/craftbot-agent-bundles · View interactive version

Adoption metric feature usage is an AI agent skill from the GitHub repository CraftOS-dev/craftbot-agent-bundles. Source: https://posthog.com/docs/api/queries + https://developer.mixpanel.com/reference/query-api + https://amplitude.com/docs/apis/analytics + https://developers.heap.io/reference

How to use this skill

Skill file

<!--

Source: https://posthog.com/docs/api/queries + https://developer.mixpanel.com/reference/query-api + https://amplitude.com/docs/apis/analytics + https://developers.heap.io/reference

-->

Adoption Metric — Feature Usage / DAU MAU WAU — SKILL

Per-customer adoption metrics: DAU/MAU/WAU, feature adoption rate, feature breadth, login recency. Rolled up into composite AdoptionScore (0-1). Sources: PostHog HogQL (primary), Mixpanel JQL, Amplitude Chart Query, Heap. Daily writeback to CSP traits feeds health score formula. Triggers: adoption < 0.3 -> at-risk; adoption > 0.6 + sponsor active -> expansion-ready.

When to use

This skill feeds customer-health-scoring-vitally-catalyst-churnzero (adoption_score = 0.40 weight in composite formula), at-risk-identification-escalation (low adoption signal), expansion-opportunity-identification (high adoption signal), and qbr-scheduling-facilitation (QBR slide 4).

Trigger phrases: "DAU MAU", "adoption score", "feature adoption", "WAU", "feature usage", "active users", "engagement metrics".

Setup

# Product analytics MCPs already in agent.yaml
# posthog-mcp, mixpanel-mcp, amplitude-mcp

# Heap (alt)
export HEAP_APP_ID="<id>"
export HEAP_API_KEY="<key>"

# CSP writeback targets
export VITALLY_SUBDOMAIN="acme"
export VITALLY_API_KEY="<key>"
export CATALYST_API_KEY="<key>"

Workspace prerequisites:

AdoptionScore formula

AdoptionScore = 0.40 * (DAU / MAU normalized)
              + 0.30 * (key_feature_adoption_rate)
              + 0.20 * (feature_breadth normalized)
              + 0.10 * (login_recency_score)

Common recipes

Recipe 1: PostHog HogQL - per-customer DAU/MAU/WAU

SELECT
  properties.customer_id AS customer_id,
  uniq(distinct_id) FILTER (WHERE timestamp >= now() - INTERVAL 1 DAY) AS dau,
  uniq(distinct_id) FILTER (WHERE timestamp >= now() - INTERVAL 7 DAY) AS wau,
  uniq(distinct_id) FILTER (WHERE timestamp >= now() - INTERVAL 30 DAY) AS mau,
  uniq(distinct_id) FILTER (WHERE timestamp >= now() - INTERVAL 30 DAY) AS total_users_30d
FROM events
WHERE timestamp >= now() - INTERVAL 30 DAY
  AND event = 'user_action'
GROUP BY properties.customer_id;

Doc: https://posthog.com/docs/api/queries

Recipe 2: PostHog HogQL - feature adoption rate

SELECT
  properties.customer_id AS customer_id,
  uniq(distinct_id) FILTER (WHERE event = 'key_feature_used') * 1.0
  / nullif(uniq(distinct_id) FILTER (WHERE event = 'user_action'), 0) AS feature_adoption_rate,
  uniq(properties.feature_name) AS distinct_features_used
FROM events
WHERE timestamp >= now() - INTERVAL 30 DAY
GROUP BY properties.customer_id;

feature_adoption_rate = % of active users using key features.

Recipe 3: PostHog HogQL - feature breadth

SELECT
  properties.customer_id,
  uniq(properties.feature_name) AS feature_breadth
FROM events
WHERE event = 'key_feature_used'
  AND timestamp >= now() - INTERVAL 30 DAY
GROUP BY properties.customer_id;

Normalize: divide by total key features defined (e.g., 8 -> breadth_normalized = uniq / 8).

Recipe 4: PostHog HogQL - login recency

SELECT
  properties.customer_id,
  max(timestamp) AS last_login,
  exp(- dateDiff('day', max(timestamp), now()) / 30.0) AS login_recency_score
FROM events
WHERE event = 'login'
GROUP BY properties.customer_id;

Exponential decay: 30d half-life. Login today = 1.0; 30d ago = 0.37.

Recipe 5: Mixpanel JQL alt

curl -sS "https://mixpanel.com/api/2.0/jql" \
  -u "$MIXPANEL_API_KEY:" \
  --data-urlencode 'script=function main() {
    return Events({from_date: "2026-05-01", to_date: "2026-05-31"})
      .groupByUser(["customer_id"], mixpanel.reducer.count())
      .map(g => ({customer_id: g.key[0], events: g.value}))
  }'

Doc: https://developer.mixpanel.com/reference/query-api

Recipe 6: Amplitude Chart Query alt

curl -sS "https://amplitude.com/api/2/users/active" \
  -u "$AMPLITUDE_API_KEY:$AMPLITUDE_SECRET" \
  --data-urlencode 'start=20260501' \
  --data-urlencode 'end=20260531' \
  --data-urlencode 'm=active'

Doc: https://amplitude.com/docs/apis/analytics

Recipe 7: Heap query alt

curl -sS "https://heapanalytics.com/api/v1/queries" \
  -H "Authorization: Bearer $HEAP_API_KEY" \
  -d '{"event": "user_action", "since": "30d_ago", "group_by": "customer_id"}'

Doc: https://developers.heap.io/reference

Recipe 8: Materialize adoption_metrics_daily view

CREATE OR REPLACE VIEW adoption_metrics_daily AS
SELECT
  customer_id,
  date_trunc('day', now()) AS as_of,
  dau,
  wau,
  mau,
  (dau * 1.0 / nullif(mau, 0)) AS dau_mau,
  feature_adoption_rate,
  feature_breadth,
  feature_breadth * 1.0 / 8 AS feature_breadth_normalized,  -- assuming 8 key features
  login_recency_score,
  -- Composite score
  0.40 * least(1.0, (dau * 1.0 / nullif(mau, 0)) / 0.4)
  + 0.30 * coalesce(feature_adoption_rate, 0)
  + 0.20 * least(1.0, feature_breadth * 1.0 / 8)
  + 0.10 * coalesce(login_recency_score, 0)
  AS adoption_score
FROM (
  SELECT customer_id, dau, wau, mau, feature_adoption_rate, feature_breadth, login_recency_score
  FROM <output of Recipes 1-4 joined>
) x;

Schedule nightly via postgresql-mcp + cron.

Recipe 9: Daily writeback to Vitally

# For each customer in adoption_metrics_daily:
curl -sS -X PUT "https://$VITALLY_SUBDOMAIN.rest.vitally.io/resources/accounts/external/$CUSTOMER_ID/traits" \
  -H "Authorization: Basic $(echo -n $VITALLY_API_KEY: | base64)" \
  -d '{
    "adoption_score": 0.62,
    "dau_30d": 18,
    "mau_30d": 47,
    "wau_30d": 32,
    "dau_mau_ratio": 0.38,
    "feature_adoption_score": 0.71,
    "feature_breadth": 6
  }'

Recipe 10: Catalyst writeback

curl -sS -X PATCH "https://api.catalyst.io/v1/companies/$CUSTOMER_ID/properties" \
  -H "Authorization: Bearer $CATALYST_API_KEY" \
  -d '{"properties": {"adoption_score": 0.62, "dau_mau_ratio": 0.38}}'

Recipe 11: Adoption signal triggers

-- At-risk adoption (< 0.3 sustained 7d)
SELECT customer_id, avg(adoption_score) AS avg_score_7d
FROM adoption_metrics_daily
WHERE as_of >= now() - INTERVAL '7 days'
GROUP BY customer_id
HAVING avg(adoption_score) < 0.3;

Route to at-risk-identification-escalation.

-- Expansion-ready (> 0.6 + sponsor active)
SELECT a.customer_id, a.avg_score_7d, s.sponsor_last_seen_days
FROM (
  SELECT customer_id, avg(adoption_score) AS avg_score_7d
  FROM adoption_metrics_daily
  WHERE as_of >= now() - INTERVAL '7 days'
  GROUP BY customer_id
  HAVING avg(adoption_score) > 0.6
) a
JOIN sponsor_activity s USING (customer_id)
WHERE s.sponsor_last_seen_days < 14;

Route to expansion-opportunity-identification.

Recipe 12: Per-customer adoption chart (QBR slide 4 data)

SELECT
  date_trunc('week', as_of) AS week,
  avg(dau) AS avg_dau,
  avg(wau) AS avg_wau,
  avg(mau) AS avg_mau,
  avg(feature_adoption_rate) AS avg_feature_adoption,
  avg(adoption_score) AS avg_adoption_score
FROM adoption_metrics_daily
WHERE customer_id = '$CUSTOMER_ID'
  AND as_of >= now() - INTERVAL '90 days'
GROUP BY week
ORDER BY week;

Pipe to pptx skill chart generation.

Recipe 13: Cohort benchmarking (compare customers)

SELECT
  tier,
  count(*) AS customers,
  round(avg(adoption_score)::numeric, 2) AS avg_adoption,
  percentile_cont(0.5) WITHIN GROUP (ORDER BY adoption_score) AS p50,
  percentile_cont(0.9) WITHIN GROUP (ORDER BY adoption_score) AS p90
FROM adoption_metrics_daily a
JOIN customers c USING (customer_id)
WHERE as_of = (SELECT max(as_of) FROM adoption_metrics_daily)
GROUP BY tier
ORDER BY avg_adoption DESC;

Enables "your team is in 80th percentile of Enterprise tier" for QBR positioning.

Examples

Example 1: Nightly adoption pipeline (zero-touch)

Goal: Every morning, CSP has fresh adoption signals; downstream skills can act.

Steps:

  1. 02:00 UTC: Recipes 1-4 HogQL queries run via posthog-mcp.
  2. 02:30 UTC: Recipe 8 materializes view in Postgres.
  3. 03:00 UTC: Recipe 9 / 10 writeback to CSP.
  4. 03:30 UTC: Recipe 11 triggers at-risk + expansion signals.
  5. 09:00 UTC: Recipes 12-13 dashboards.

Result: Adoption pipeline runs hands-off.

Example 2: Feature launch tracking

Goal: New feature "Workflows" launched Mon; track adoption across customer base.

Steps:

  1. Recipe 2 modified for event = 'workflow_used' instead of generic key_feature_used.
  2. Day 7: 12% of customers tried it. Day 30: 31%. Plot in Notion.
  3. Customers who haven't tried by Day 14 -> route to feature-adoption-interventions.
  4. Customers who used multiple times Day 30 -> route to customer-advocacy-case-study-reference for "show us how you're using Workflows."

Result: Feature adoption tracked + interventions fire automatically.

Edge cases / gotchas

Sources

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.