agentleFS
dream-horizon-orgdream-horizon-org/pulse/.agents/skills/add-alert-metric/SKILL.md

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.

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
  1. Very specific:

    Update deploy/db/mysql-init.sql to include the new metric for fresh installs.

    line 30
  2. Distinctive:

    Add to the metric enum/constants in the backend service layer

    line 34
  3. Very specific:

    Update ClickhouseMetricService to build the correct ClickHouse SQL for this metric

    line 35
  4. Distinctive:

    Add the ClickHouse query function (e.g., percentile, count, rate calculation)

    line 36
  5. Very specific:

    Verify AlertEvaluationService can evaluate the new metric:

    line 40
  6. Distinctive:

    Check threshold comparison logic handles the metric's value type

    line 41
  7. Distinctive:

    Ensure notification formatting includes the metric name

    line 42
  8. Very specific:

    If custom UI is needed, update the alert form in pulse-ui/src/screens/AlertFormWizard/

    line 47
  9. Distinctive:

    Add display formatting if the metric has special units

    line 48
  10. Distinctive:

    Create an alert with the new metric via the UI

    line 56
  11. Distinctive:

    Verify the cron evaluates it correctly

    line 57
  12. Distinctive:

    Ask the AI agent about the metric in natural language

    line 58

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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-end

Step 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

  1. Add to the metric enum/constants in the backend service layer
  2. Update ClickhouseMetricService to build the correct ClickHouse SQL for this metric
  3. 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

  1. The metric should appear automatically if it's fetched from the API
  2. If custom UI is needed, update the alert form in pulse-ui/src/screens/AlertFormWizard/
  3. 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

  1. Create an alert with the new metric via the UI
  2. Verify the cron evaluates it correctly
  3. Ask the AI agent about the metric in natural language

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.