ops/skills/community-metrics/SKILL.md
Add or change community metrics in the 6529 SEIZE backend by updating metric rollup enums, recorder methods, recording call sites, optional historical backfills, OpenAPI response models, and community-metrics API aggregation. Use when adding new community metrics, exposing metric summaries or series, tracking community activity, or changing MetricsRecorder/MetricsDb behavior.
npx skillsauth add 6529-collections/6529seize-backend community-metricsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Use this workflow for metrics based on metric_rollup_hour and exposed through /community-metrics.
UPPER_SNAKE_CASEscope, key1, or key2rg:
MetricRollupHourMetric in src/entities/IMetricRollupHour.tsMetricsRecorder in src/metrics/MetricsRecorder.tsMetricsDb in src/metrics/MetricsDb.tssrc/api-serverless/src/community-metrics/src/api-serverless/openapi.yamlMetricRollupHourMetric. Keep the persisted enum string identical to the enum key.MetricsRecorder method. Use metricsDb.upsertMetricRollupHour with the current rollup fields:
event_count for occurrence countsvalue_sum for numeric totals or latest samplesscope, key1, and key2 for dimensions or distinct countingoverwrite: true for latest-state metrics such as profile counts or network TDHRequestContext so timers and transactions are preserved.src/api-serverless/openapi.yaml response schemas for summary, series, or mint metricscd src/api-serverless && npm run restructure-openapi && npm run generateCommunityMetricsService aggregation and mappingcommunity-metrics.routes.ts only when route validation or query behavior changessrc/profiles/abusiveness-check.db.test.ts as the pattern for DB/repository tests.npm run lint from the repo root after changes.Do not create a migration by default. If the user explicitly asks for historical data or the feature would be misleading without it, create a data-only backfill migration:
npm run migrate:new backfill-metric-name-metric
Write SQL in the up migration only, delete the generated .down.sql, and leave the JS down() implementation as a no-op. The repo is entities-first for schema/table changes: prefer TypeORM entities plus dbMigrationsLoop sync, and avoid schema migrations unless the user explicitly asks for one. Reserve migrations primarily for one-off data backfills or rare view changes.
event_count: 1, read summed event_count.value_sum to the numeric delta, read summed value_sum.event_count: 1, value_sum, and overwrite: true, then read the latest sample in the requested period.scope; use key1 and key2 only when a second or third dimension is needed.getMetricBucketDistinctCounts or a purpose-built query.MetricRollupHourMetric in src/entities/IMetricRollupHour.ts.MetricsRecorder.CommunityMetricsService.npm run lint passes.development
Create, improve, or review Codex/OpenAI Agent Skills and SKILL.md files. Use when writing a new skill, updating an existing skill, designing skill frontmatter and trigger behavior, choosing scripts/references/assets, validating skill structure, or turning repeatable Codex workflows into reusable skills.
development
Write, open, iterate, merge, and optionally deploy pull requests in the 6529 SEIZE backend with clear PR descriptions, safe validation notes, review-bot follow-up, DCO-signed commits only when explicitly requested, backend/API checks, lambda deployment planning, and staging or production deployment gates. Use when preparing PR bodies, creating PRs, responding to CodeRabbit or Claude review bots, deciding whether a PR is ready, merging, or carrying a backend/API PR through staging/prod rollout.
development
Add or change identity notification types in the 6529 SEIZE backend by updating notification causes, domain data types, DB-to-domain mappers, UserNotifier creation methods, push notification rendering/settings, notification API mappings, OpenAPI enums, and tests. Use when adding new notification types, creating identity notifications, changing notification payloads, or extending push/API notification behavior.
testing
Implement database-related changes in this repository, including schema changes via TypeORM entities, repository/query patterns, request-context transactions, DB tests, and explicit data migrations. Use when working on DB schema updates, repositories or *Db classes, SQL queries, transactions, data backfills, or app logic that reads or writes MySQL data.