add-alert-metric
Skill44 starsChanged 5 months agoApache-2.0View on GitHub
Cross-cutting workflow for adding a new alert metric spanning DB, backend, cron, frontend, and AI agent. Only invoke explicitly when adding a new metric type.
In this repository20 other files it gives its agents.
- .claude/CLAUDE.mdCLAUDE.md
- CLAUDE.mdCLAUDE.md
- product/CLAUDE.mdCLAUDE.md
- pulse-web-otel/CLAUDE.mdCLAUDE.md
- add-ai-sub-agentSkill
- add-api-endpointSkill
- add-ui-componentSkill
- add-ui-screenSkill
- clickhouse-migrationSkill
- deploy-serviceSkill
- fatal-fiveSkill
- integrate-pulse-web-sdkSkill
- pr-reviewSkill
- pulse-prd-authorSkill
- pulse-prd-reviewSkill
- web-otel-spec-audit-orchestratorSkill
- web-otel-spec-implementation-auditSkill
- web-sdk-e2e-matrixSkill
- web-sdk-instrumentSkill
- web-sdk-shipSkill
The file
We split this skill into the rules it gives an agent
12 rules. About 0 are common, 8 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈8
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 30
Update deploy/db/mysql-init.sql to include the new metric for fresh installs.
- Distinctive: line 34
Add to the metric enum/constants in the backend service layer
- Very specific: line 35
Update ClickhouseMetricService to build the correct ClickHouse SQL for this metric
- Distinctive: line 36
Add the ClickHouse query function (e.g., percentile, count, rate calculation)
- Very specific: line 40
Verify AlertEvaluationService can evaluate the new metric:
- Distinctive: line 41
Check threshold comparison logic handles the metric's value type
- Distinctive: line 42
Ensure notification formatting includes the metric name
- Very specific: line 47
If custom UI is needed, update the alert form in pulse-ui/src/screens/AlertFormWizard/
- Distinctive: line 48
Add display formatting if the metric has special units
- Distinctive: line 56
Create an alert with the new metric via the UI
- Distinctive: line 57
Verify the cron evaluates it correctly
- Distinctive: line 58
Ask the AI agent about the metric in natural language
≈ “Common” is an estimate: at least 1 in 5 of the 372,429 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Add Alert Metric (Cross-Cutting)
This is a cross-cutting change — a new alert metric touches 5 layers.
Workflow
- [ ] Step 1: MySQL migration — add metric to alert_metrics table
- [ ] Step 2: Backend — add to MetricType enum and ClickHouse query builder
- [ ] Step 3: Alerts cron — verify evaluation handles new metric
- [ ] Step 4: Frontend — add metric option to alert form
- [ ] Step 5: AI agent — add to metrics registry
- [ ] Step 6: Test end-to-endStep 1: MySQL Migration
Create deploy/db/migration-add-<metric-name>.sql:
INSERT INTO alert_metrics (scope_type_id, metric_name, display_name, description)
VALUES (1, 'MY_NEW_METRIC', 'My New Metric', 'Description of what this metric measures');Update deploy/db/mysql-init.sql to include the new metric for fresh installs.
Step 2: Backend
- Add to the metric enum/constants in the backend service layer
- Update
ClickhouseMetricServiceto build the correct ClickHouse SQL for this metric - Add the ClickHouse query function (e.g., percentile, count, rate calculation)
Step 3: Alerts Cron
Verify AlertEvaluationService can evaluate the new metric:
- Check threshold comparison logic handles the metric's value type
- Ensure notification formatting includes the metric name
Step 4: Frontend
- The metric should appear automatically if it's fetched from the API
- If custom UI is needed, update the alert form in
pulse-ui/src/screens/AlertFormWizard/ - Add display formatting if the metric has special units
Step 5: AI Agent
Note: The AI agent currently has a flat structure (pulse_ai/agent.py) with no registries. When registries are added, create or update the metrics registry. For now, update the root agent's instruction in pulse_ai/agent.py to include knowledge of the new metric, or add a registry file at the pulse_ai/ root when the first metric is added.
Step 6: End-to-End Test
- Create an alert with the new metric via the UI
- Verify the cron evaluates it correctly
- Ask the AI agent about the metric in natural language
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

