-- agent_skills usage probe, generated by packages/skill-catalog/scripts/census.ts
-- Run against staging and prod; paste counts back into the census markdown.
select
  skill_id,
  count(*)                         as enabled_rows,
  count(distinct tenant_id)        as tenants,
  min(created_at)                  as first_enabled_at,
  max(created_at)                  as latest_enabled_at
from agent_skills
where enabled = true
  and skill_id in ('account-health-review', 'agent-email-send', 'agent-thread-management', 'artifacts', 'compound', 'customer-onboarding', 'customer-onboarding-reconciler', 'frame', 'gather', 'google-calendar', 'google-email', 'task-system-tasks', 'package', 'renewal-prep', 'sales-prep', 'sandbox-pilot', 'skill-dispatcher', 'smoke-package-only', 'synthesize', 'web-search', 'workspace-memory')
group by skill_id
order by enabled_rows desc, skill_id;
