Perf Budget Checker

Description

jiayaoqijia Updated

File contents

Description

Check simple performance budgets against metrics JSON. Validates that application metrics stay within defined budgets for performance thresholds.

Inputs

{
  "metrics": {
    "bundle_size": "100kb",
    "load_time": "3s"
  },
  "budgets": {
    "bundle_size": "150kb",
    "load_time": "5s"
  }
}

Outputs

{
  "ok": true,
  "data": {
    "passed": true,
    "violations": []
  }
}

Usage

Demo Mode

python scripts/main.py --demo

Check Performance Budget

echo '{"metrics": {}, "budgets": {}}' | python3 scripts/main.py

Examples

Example 1: Budget Check

$ echo '{"metrics": {"bundle_size": "100kb"}, "budgets": {"bundle_size": "150kb"}}' | python3 scripts/main.py
{
  "ok": true,
  "data": {
    "passed": true,
    "violations": []
  }
}

Error Handling

When an error occurs, the skill returns:

{
  "ok": false,
  "error": "Error description",
  "details": {
    "metrics": "Invalid metrics format"
  }
}

jiayaoqijia/cryptoskill/tree/main/skills/ai-crypto/xspoonai-official-perf-budget-checker commit 0ef9c70af9

Frequently asked questions

npx skillmds@latest add jiayaoqijia/perf-budget-checker