An Autonomous AI Agent Skill & SRE Runbook for Auditing, Diagnosing, and Optimizing High-Performance Web Applications (Ruby on Rails, PostgreSQL, Redis, Puma).
This repository contains a production-tested AI Agent Skill (SKILL.md) designed to equip autonomous coding assistants (such as Google Antigravity, Cursor, or Claude Code) and SRE teams with exact guidelines, SQL diagnostic runbooks, Puma/PostgreSQL concurrency tuning rules, and k6 benchmark scripts.
- PostgreSQL Index & Query Audit: SQL queries to detect slow queries via
pg_stat_statements, measure table scan rates viapg_stat_user_tables, and monitor active connection saturation viapg_stat_activity. - Zero-Downtime Migration Patterns: Best practices for creating composite indexes using
disable_ddl_transaction!andalgorithm: :concurrently. - Puma & Concurrency Sizing: Mathematical formulas to align
RAILS_MAX_THREADS, Puma cluster workers, and ActiveRecord DB connection pools. - Memory & Resource Optimization:
jemallocpreloading rules to reduce Ruby MRI memory fragmentation by up to 30%. - SRE Golden Signals & Alerting Matrix: Explicit threshold rules for P95 latency, 5xx error rates, DB pool exhaustion, and Redis memory evaporation policies.
- k6 Load Testing Benchmarks: Pre-configured JavaScript load testing scenarios for peak traffic events.
Copy the sre-performance-audit directory into your project's agent skills directory:
mkdir -p .agents/skills/sre_performance_audit
cp SKILL.md .agents/skills/sre_performance_audit/SKILL.mdYou can execute the SQL queries directly in references/postgres_diagnostic_queries.sql against your production or staging database via psql or rails console.
.
├── SKILL.md # The core AI Agent Skill specification
├── README.md # Project documentation
├── LICENSE # MIT License
└── references/
├── postgres_diagnostic_queries.sql # Ready-to-run PostgreSQL audit queries
└── k6_load_test.js # Load testing scenario for k6
Distributed under the MIT License. Created by Franco Rodríguez.