Agent skill

Monitoring Database Transactions

by jeremylongshore in jeremylongshore/tons-of-skills-marketplace

Monitor use when you need to work with monitoring and observability.

MITAuto-check passedDevOps & Cloud

Install Monitoring Database Transactions

skills CLI
$ npx skills add jeremylongshore/tons-of-skills-marketplace --skill monitoring-database-transactions -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install jeremylongshore/tons-of-skills-marketplace monitoring-database-transactions --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/jeremylongshore/tons-of-skills-marketplace.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/.curated/monitoring-database-transactions .claude/skills/monitoring-database-transactions && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
monitoring-database-transactions
GitHub stars
2.8k
Token cost
~1.7k tokens
SKILL.md length
711 words
Files
5 (incl. scripts, references, assets)
Skills in repo
3,342
Repo updated
First seen
Licence
MIT

At a glance

Monitor use when you need to work with monitoring and observability.

  • Works in 10 steps: Query the active transaction view to… → Identify long-running transactions by… → Detect idle-in-transaction sessions that… → …
  • You need to work with monitoring and observability
  • SKILL.md covers Overview, Prerequisites, Instructions and Output, plus 3 more sections
  • Runs Python scripts from its folder

What it does

Monitoring Database Transactions is an agent skill from jeremylongshore/tons-of-skills-marketplace. Monitor use when you need to work with monitoring and observability. This skill provides health monitoring and alerting with comprehensive guidance and automation. Trigger with phrases like "monitor system health", "set up alerts", or "track metrics".

Its SKILL.md is about 1.7k tokens, which your agent loads only when the skill is triggered. The skill folder holds 7 other files, including scripts, reference files and assets (for example `assets/README.md`, `references/README.md` and `scripts/README.md`). Compatibility notes: Designed for Claude Code

It sits in DevOps & Cloud, covering Monitoring and alerting and Observability. It works with PostgreSQL, MySQL and MongoDB. The repository describes itself as: Model-agnostic agent-skills platform with a harness-free canonical layer, verified adapters, and the ccpi package manager. Explore at tonsofskills.com. The licence is MIT.

When your agent uses it

  • You need to work with monitoring and observability
  • With phrases like monitor system health

Example prompts

  • “monitor system health”
  • “set up alerts”
  • “track metrics”
  • “/monitoring-database-transactions”

Requirements

  • Python 3
  • Compatibility (from SKILL.md): Designed for Claude Code
  • Pre-approved tools (allowed-tools): Read, Write, Edit, Grep, Glob, Bash(psql:*), Bash(mysql:*), Bash(mongosh:*)

Workflow steps

10 steps, taken from the first numbered list in SKILL.md.

  1. Query the active transaction view to establish a baseline. For PostgreSQL: SELECT pid, state, query_start, now() - query_start AS…
  2. Identify long-running transactions by filtering for duration exceeding the application's expected transaction time. Set initial thresholds…
  3. Detect idle-in-transaction sessions that hold locks without executing queries. For PostgreSQL: SELECT pid, state, query_start, now()…
  4. Monitor lock contention by querying the lock manager. For PostgreSQL: SELECT blocked_locks.pid AS blocked_pid, blocking_locks.pid AS…
  5. Track transaction throughput by sampling pg_stat_database (xact_commit, xact_rollback) or MySQL Com_commit / Com_rollback status variables…
  6. Create monitoring scripts that run on a cron schedule (every 30-60 seconds) to capture transaction metrics and write to a time-series…
  7. Configure alerting thresholds: transactions exceeding 60 seconds, idle-in-transaction sessions exceeding 5 minutes, lock wait queues…
  8. Build a transaction summary dashboard query that shows: active transaction count, average duration, longest running transaction, lock wait…
  9. Implement automatic remediation for known-safe scenarios: terminate idle-in-transaction sessions older than 30 minutes using SELECT…
  10. Generate weekly transaction health reports summarizing peak transaction counts, P95/P99 duration percentiles, deadlock occurrences, and…

What it can do on your machine

Read from SKILL.md and the folder at commit cfae287. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Read
    • Write
    • Edit
    • Grep
    • Glob
    • Bash(psql:*)
    • Bash(mysql:*)
    • Bash(mongosh:*)

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 2 files in scripts/ (Python), which the agent can run.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • postgresql.org
    • mongodb.com
    • wiki.postgresql.org

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

  • Compatibility

    Designed for Claude Code

    From compatibility in the SKILL.md frontmatter.

Context cost

Monitoring Database Transactions loads about 1.7k tokens when it runs, and up to ~1.7k if it reads all its reference files. Until then it costs about 71 tokens; SKILL.md has 711 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~71
When it runs · the whole SKILL.md, loaded when a task matches
~1.7k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~1.7k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.

SKILL.md

The full file from jeremylongshore/tons-of-skills-marketplace at commit cfae287, republished under its MIT licence (© jeremylongshore). 711 words, ~1,699 tokens.

Download SKILL.mdSave it as .claude/skills/monitoring-database-transactions/SKILL.md (or your agent's skills folder). This skill also uses 4 other files; get the full folder from GitHub.
name
monitoring-database-transactions
description
Monitor use when you need to work with monitoring and observability. This skill provides health monitoring and alerting with comprehensive guidance and automation. Trigger with phrases like "monitor system health", "set up alerts", or "track metrics".
allowed-tools
Read, Write, Edit, Grep, Glob, Bash(psql:*), Bash(mysql:*), Bash(mongosh:*)
compatibility
Designed for Claude Code
version
1.27.0
author
Jeremy Longshore <jeremy@intentsolutions.io>
license
MIT
tags
database, monitoring, observability

Database Transaction Monitor

Overview

Monitor active database transactions in real time to detect long-running queries, lock contention, uncommitted transactions, and transaction throughput anomalies across PostgreSQL, MySQL, and MongoDB.

Prerequisites

  • Database credentials with access to system catalogs (pg_stat_activity, information_schema.PROCESSLIST, or MongoDB currentOp)
  • psql, mysql, or mongosh CLI installed
  • Permissions to view other sessions' transactions (PostgreSQL: pg_monitor role; MySQL: PROCESS privilege)
  • Baseline metrics for normal transaction duration and throughput
  • Alerting infrastructure (email, Slack webhook, or PagerDuty) for notifications

Instructions

  1. Query the active transaction view to establish a baseline. For PostgreSQL: SELECT pid, state, query_start, now() - query_start AS duration, query FROM pg_stat_activity WHERE state != 'idle' ORDER BY duration DESC. For MySQL: SELECT id, user, host, db, command, time, state, info FROM information_schema.PROCESSLIST WHERE command != 'Sleep'.

  2. Identify long-running transactions by filtering for duration exceeding the application's expected transaction time. Set initial thresholds at 30 seconds for OLTP workloads or 5 minutes for batch/reporting workloads.

  3. Detect idle-in-transaction sessions that hold locks without executing queries. For PostgreSQL: SELECT pid, state, query_start, now() - state_change AS idle_duration FROM pg_stat_activity WHERE state = 'idle in transaction' AND now() - state_change > interval '5 minutes'.

  4. Monitor lock contention by querying the lock manager. For PostgreSQL: SELECT blocked_locks.pid AS blocked_pid, blocking_locks.pid AS blocking_pid, blocked_activity.query AS blocked_query FROM pg_catalog.pg_locks blocked_locks JOIN pg_catalog.pg_locks blocking_locks ON blocking_locks.locktype = blocked_locks.locktype. For MySQL: SELECT * FROM information_schema.INNODB_LOCK_WAITS.

  5. Track transaction throughput by sampling pg_stat_database (xact_commit, xact_rollback) or MySQL Com_commit / Com_rollback status variables at regular intervals. Calculate commits/second and rollback ratio.

  6. Create monitoring scripts that run on a cron schedule (every 30-60 seconds) to capture transaction metrics and write to a time-series store or log file.

  7. Configure alerting thresholds: transactions exceeding 60 seconds, idle-in-transaction sessions exceeding 5 minutes, lock wait queues exceeding 10 waiters, and rollback ratio exceeding 5%.

  8. Build a transaction summary dashboard query that shows: active transaction count, average duration, longest running transaction, lock wait count, and commits-per-second over the last hour.

  9. Implement automatic remediation for known-safe scenarios: terminate idle-in-transaction sessions older than 30 minutes using SELECT pg_terminate_backend(pid) (PostgreSQL) or KILL connection_id (MySQL), with logging of terminated sessions.

  10. Generate weekly transaction health reports summarizing peak transaction counts, P95/P99 duration percentiles, deadlock occurrences, and long-running transaction incidents.

Output

  • Transaction monitoring queries tailored to the specific database engine in use
  • Monitoring scripts (shell or Python) for scheduled transaction health checks
  • Alert configuration with threshold definitions and notification channel setup
  • Dashboard queries showing transaction throughput, duration distribution, and lock metrics
  • Weekly health report template with transaction performance trends and anomaly highlights
Show full SKILL.md (294 more words)Show less

Error Handling

ErrorCauseSolution
pg_stat_activity returns no rows for other sessionsMissing pg_monitor role or track_activities disabledGrant pg_monitor role; set track_activities = on in postgresql.conf
Lock monitoring query times outMassive lock table during contention stormQuery pg_locks with a statement_timeout; reduce monitoring frequency during incidents
False positive alerts for long-running transactionsBatch jobs or maintenance operations trigger duration alertsCreate an exclusion list for known batch job PIDs or application users; use separate thresholds for batch vs OLTP
Transaction throughput drops to zeroConnection pool exhaustion or database crashCheck max_connections usage; verify database process is running; check for full disk or OOM conditions
Monitoring queries add overheadHigh-frequency polling of system catalogsReduce polling interval to every 60 seconds; use pg_stat_statements for aggregated stats instead of per-query monitoring

Examples

Detecting a connection leak in a web application: Transaction count steadily increases over hours while commit rate remains flat. Monitoring reveals hundreds of idle in transaction sessions from the application server. Root cause: missing connection.close() in error handling paths. Resolution: terminate stale sessions and fix application connection management.

Identifying lock contention during peak hours: Dashboard shows lock wait count spiking from 0 to 50+ between 2-4 PM daily. Lock analysis reveals a nightly reporting query overlapping with high-volume order processing. Resolution: reschedule reporting queries to off-peak hours and add NOWAIT hints to critical transaction paths.

Tracking transaction rollback ratio spike: Rollback ratio jumps from 1% to 15% after a deployment. Transaction monitor logs show serialization failures on a frequently updated inventory table. Resolution: reduce transaction isolation level from SERIALIZABLE to READ COMMITTED for non-critical paths and add retry logic for serialization failures.

Resources

© jeremylongshore, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 4 other files (scripts, references, assets) in skills/.curated/monitoring-database-transactions of jeremylongshore/tons-of-skills-marketplace.

  • SKILL.md
  • assets/README.md
  • references/README.md
  • scripts/README.md
  • scripts/rollback_analyzer.py

Open the folder on GitHubat commit cfae287

Compare with similar skills

Monitoring Database Transactions next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Monitoring Database Transactions compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Monitoring Database Transactions this skilljeremylongshore/tons-of-skills-marketplace2.8k—~1.7kAutomated safety check: PassMIT
Database Observabilitygrafana/skills282—~1.1kAutomated safety check: PassApache-2.0
Database ObservabilityKilo-Org/kilo-marketplace190—~1.4kAutomated safety check: PassApache-2.0
How To Communicatedatabasus/databasus8.8k—~3.9kAutomated safety check: PassMIT
Database Backupssickn33/agentic-awesome-skills47k2 repos~3.1kAutomated safety check: NotesMIT
Neonsmontlouis/bible-strong171—~7.1kAutomated safety check: NotesGPL-3.0

Similar skills

  • Official

    Set up Grafana Cloud Database Observability for MySQL and PostgreSQL — enables pgstatstatements / Performance Schema, creates a least-privilege monitoring user, configures the…

    282 GitHub stars~1.1k tokensUpdated 2 days ago
    DevOps & CloudAuto-check passed
  • Database Observability

    Kilo-Org/kilo-marketplace

    Grafana Cloud Database Observability — query-level performance insights for MySQL and PostgreSQL.

    190 GitHub stars~1.4k tokensUpdated 12 days ago
    DevOps & CloudAuto-check passed
  • How To Communicate

    databasus/databasus

    Communicate clearly in every response, progress update and agent-authored document.

    8.8k GitHub stars~3.9k tokensUpdated 18 days ago
    DatabasesAuto-check passed
  • Database Backups

    sickn33/agentic-awesome-skills

    Implement database backup strategies. An agent skill from sickn33/agentic-awesome-skills.

    47k GitHub starsUsed in 2 repos~3.1k tokens
    DatabasesAuto-check: notes
  • Neon

    smontlouis/bible-strong

    Overview of Neon, a complete set of cloud backend primitives for apps and agents, spanning Lakebase Postgres, Auth, the Data API, Object Storage, Compute Functions, and the AI Gateway.

    171 GitHub stars~7.1k tokensUpdated today
    Backend & APIsAuto-check: notes
  • Git Commits

    databasus/databasus

    Write Databasus commit messages and branch names using the repository's release-compatible format.

    8.8k GitHub stars~294 tokensUpdated 18 days ago
    DevelopmentAuto-check passed

More from jeremylongshore/tons-of-skills-marketplace

All 3,342 skills in this repo
  • Performing Security Code Review

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill enables AI assistant to conduct a security-focused code review using the security-agent plugin.

    2.8k GitHub starsUsed in 2 repos~1.3k tokens
    Auto-check: notes
  • Adapting Transfer Learning Models

    jeremylongshore/tons-of-skills-marketplace

    Build this skill automates the adaptation of pre-trained machine learning models using transfer learning techniques.

    2.8k GitHub stars~1.1k tokensUpdated yesterday
    Auto-check passed
  • Agent Context Loader

    jeremylongshore/tons-of-skills-marketplace

    Execute proactive auto-loading: automatically detects and loads agents.md files.

    2.8k GitHub stars~1.1k tokensUpdated yesterday
    Auto-check passed
  • Aggregating Performance Metrics

    jeremylongshore/tons-of-skills-marketplace

    Aggregate and centralize performance metrics from applications, systems, databases, caches, and services.

    2.8k GitHub stars~1.2k tokensUpdated yesterday
    Auto-check passed
  • Analyzing Capacity Planning

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill enables AI assistant to analyze capacity requirements and plan for future growth.

    2.8k GitHub stars~947 tokensUpdated yesterday
    Auto-check passed
  • Analyzing Database Indexes

    jeremylongshore/tons-of-skills-marketplace

    Process use when you need to work with database indexing. An agent skill from jeremylongshore/tons-of-skills-marketplace.

    2.8k GitHub stars~2k tokensUpdated yesterday
    Auto-check passed

Categories

Questions about Monitoring Database Transactions

What does Monitoring Database Transactions do?

Monitor use when you need to work with monitoring and observability. Monitoring Database Transactions is an agent skill from jeremylongshore/tons-of-skills-marketplace. Monitor use when you need to work with monitoring and observability.

When should I use Monitoring Database Transactions?

Monitoring Database Transactions fits situations like: you need to work with monitoring and observability; with phrases like monitor system health.

How do I install Monitoring Database Transactions in Claude Code?

Run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill monitoring-database-transactions -a claude-code`. Or copy the skill folder (skills/.curated/monitoring-database-transactions in jeremylongshore/tons-of-skills-marketplace) into .claude/skills/monitoring-database-transactions in your project. Claude Code loads it when a task matches its description.

How do I install Monitoring Database Transactions in Codex?

Run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill monitoring-database-transactions -a codex`. Or copy the skill folder (skills/.curated/monitoring-database-transactions in jeremylongshore/tons-of-skills-marketplace) into .agents/skills/monitoring-database-transactions in your project. Codex loads it when a task matches its description.

Can I use Monitoring Database Transactions in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill monitoring-database-transactions -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/monitoring-database-transactions, .gemini/skills/monitoring-database-transactions, .github/skills/monitoring-database-transactions and .opencode/skills/monitoring-database-transactions in your project.

What does Monitoring Database Transactions need to run?

Going by SKILL.md and its folder, Monitoring Database Transactions needs Python for the scripts in its folder. Our summary lists: Python 3. Its frontmatter pre-approves these tools: Read, Write, Edit, Grep, Glob, Bash(psql:*), Bash(mysql:*), Bash(mongosh:*). Compatibility (from SKILL.md): Designed for Claude Code.

Does Monitoring Database Transactions access the network?

SKILL.md names 3 domains. As links in the text: postgresql.org, mongodb.com and wiki.postgresql.org. This is read from the text; nothing was executed.

Is Monitoring Database Transactions safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Monitoring Database Transactions use?

Monitoring Database Transactions is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Monitoring Database Transactions use?

About 1.7k tokens (SKILL.md is roughly 6.8k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 18 tokens, read only when the agent opens those files.

What are the alternatives to Monitoring Database Transactions?

Skills that share tags, products or a category with Monitoring Database Transactions: Database Observability (grafana/skills, 282 stars), Database Observability (Kilo-Org/kilo-marketplace, 190 stars), How To Communicate (databasus/databasus, 8.8k stars) and Database Backups (sickn33/agentic-awesome-skills, 47k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Monitoring Database Transactions?

jeremylongshore (a GitHub user) maintains it in jeremylongshore/tons-of-skills-marketplace, which has 2,827 GitHub stars. The repository holds 3,342 skills in this directory. The repository was last updated on October 10, 2026.

Source: jeremylongshore/tons-of-skills-marketplace on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.