Agent skill · Audited from source
Detecting Database Deadlocks
skill · jeremylongshore/claude-code-plugins-plus-skillsMIT licenceAudited 8 Oct 2026 · source 4f83675ca38a
Is it safe? Yes — SAFE, grade B (89/100). We read this skill's source at commit 4f83675ca38a and found no filesystem, network or shell access and no hard-coded secrets. What it does: Process use when you need to work with deadlock detection.
Cite
Cite this page
ModelsAtlas. “Detecting Database Deadlocks (jeremylongshore/claude-code-plugins-plus-skills)”. Retrieved 8 Oct 2026. https://modelsatlas.com/skills/jeremylongshore/detecting-database-deadlocks
Trust audit
Audit 0.4.1 · source read 8 Oct 2026
SAFE means nothing in the source contradicts what the skill says it does. Grade B is shared by 17,406 of 18,389 audited skills.
What the source does
- FilesystemNone observedNo reads or writes in the source
- NetworkNone observedNo outbound calls in the source
- ShellNone observedNo commands run in the source
- DependenciesPinnedNothing floats
- SecretsNone foundNo keys in source
Five audit layers
| Layer | What we check | Result | Findings |
|---|---|---|---|
L0 Provenance | Repo owner, licence, archive status, activity | PASS | 0 |
L1 Static source | Secrets, path traversal, supply chain, hidden code | PASS | 0 |
L2 Instructions | Prompt injection, authority framing, hidden directives | PASS | 0 |
L3 Inventory | The files and declarations match the source | PASS | 0 |
L4 Sandbox | Run in isolation and watch behaviour | SKIPPED why | 0 |
Gates applied: no behavioural pass.
Findings (0)
No findings at any severity. We re-audit when the source changes.
Audit 0.4.1 · source sha 4f83675ca38a · 8 Oct 2026Report an issue or request a re-scan
Provenance
Who published it, and what the verdict is pinned to
- Publisherjeremylongshore GitHub userOwner of the repository this skill is read from
- Source folderjeremylongshore/claude-code-plugins-plus-skills/plugins/database/database-deadlock-detector/skills/detecting-database-deadlocksThe exact folder we audited
- LicenceMITAs the repository states it
- Commit pinned for this verdict4f83675ca38aA new audit runs when the source changes
- Repository statusNot archivedPushed today
- Sandboxed runNot runSkills are read, not executed; layer L4 is skipped
What it tells the agent
Full source on GitHub ↗Its description: Process use when you need to work with deadlock detection.
--- name: detecting-database-deadlocks description: 'Process use when you need to work with deadlock detection. This skill provides deadlock detection and resolution with comprehensive guidance and automation. Trigger with phrases like "detect deadlocks", "resolve deadlocks", or "prevent deadlocks". ' allowed-tools: Read, Write, Edit, Grep, Glob, Bash(psql:*), Bash(mysql:*), Bash(mongosh:*) version: 1.27.0 author: Jeremy Longshore <[email protected]> license: MIT tags: - database - detecting-database compatibility: Designed for Claude Code --- # Database Deadlock Detector ## Overview Detect, analyze, and prevent database deadlocks in PostgreSQL, MySQL, and MongoDB by examining lock wait graphs, parsing deadlock log entries, identifying the application code paths that cause lock ordering conflicts, and implementing preventive patterns. ## Prerequisites - Database credentials with access to lock monitoring views (`pg_locks`, `INNODB_LOCK_WAITS`) - `psql` or `mysql` CLI for executing diagnostic queries - PostgreSQL: `log_lock_waits = on` and `deadlock_timeout = 1s` configured - MySQL: `innodb_print_all_deadlocks = ON` for deadlock logging to error log - Access to database error logs for deadlock event parsing - Application source code access for identifying lock-inducing code paths ## Instructions 1. Check for currently blocked transactions and their blockers: - PostgreSQL: `SELECT blocked.pid AS blocked_pid, blocked.query AS blocked_query, blocking.pid AS blocking_pid, blocking.query AS blocking_query FROM pg_stat_activity blocked JOIN pg_locks bl ON bl.pid = blocked.pid JOIN pg_locks bl2 ON bl2.locktype = bl.locktype AND bl2.relation = bl.relation AND bl2.pid != bl.pid JOIN pg_stat_activity blocking ON blocking.pid = bl2.pid WHERE NOT bl.granted` - MySQL: `SELECT * FROM information_schema.INNODB_LOCK_WAITS` 2. Parse recent deadlock events from database logs: - PostgreSQL: Search logs for `ERROR: deadlock detected` entries, which include the two conflicting queries and the lock types - MySQL: Run `SHOW ENGINE INNODB STATUS\G` and examine the `LATEST DETECTED DEADLOCK` section - Extract: transaction IDs, queries involved, tables and rows locked, and which transaction was rolled back 3. Construct the lock wait graph from the deadlock log. Map which transaction held which lock and which lock each transaction was waiting for. The circular dependency reveals the deadlock cycle. Identify the specific rows or index ranges involved. 4. Trace the deadlocking queries back to application code. Use Grep to find the SQL statements in the codebase and identify the transaction boundaries (`BEGIN`/`COMMIT` blocks or ORM transaction decorators). Map the full sequence of operations within each transaction. 5. Identify the root cause pattern: - **Opposite lock ordering**: Transaction A locks row 1 then row 2; Transaction B locks row 2 then row 1. Fix by ensuring consistent lock ordering. - **Index gap locks (MySQL)**: UPDATE/DELETE on non-existent rows creates gap locks that conflict. Fix by adding the target row first or using `READ COMMITTED` isolation. - **Foreign key lock escalation**: INSERT into child table acquires shared lock on parent row, conflicting with UPDATE on parent. Fix by locking parent first explicitly. - **Implicit lock promotion**: SELECT with FOR UPDATE followed by UPDATE promotes shared to exclusive lock. Fix by acquiring the exclusive lock upfront. 6. Implement deadlock prevention strategies: - Enforce consistent lock ordering: always lock tables/rows in alphabetical or ID order within transactions - Minimize transaction duration: move non-database operations (API calls, file I/O) outside the transaction - Use `SELECT ... FOR UPDATE NOWAIT` or `SKIP LOCKED` to fail fast instead of waiting - Reduce transaction isolation level from SERIALIZABLE to READ COMMITTED where possible 7. Add retry logic for deadlock victims. When the database aborts a transaction due to deadlock, catch the error (PostgreSQL error code `40P01`, MySQL error code `1213`) and retry the entire transaction up to 3 times with a short random delay. 8. Monitor deadlock frequency over time. Create a query or script that counts deadlock events per hour from the database logs. Alert when deadlock frequency exceeds the baseline by more than 3x. 9. For persistent deadlocks on specific tables, consider advisory locks (`pg_advisory_lock()` in PostgreSQL) to serialize access to contended resources at the application level, avoiding database-level lock contention entirely. 10. Document all identified deadlock patterns, root causes, and fixes in a deadlock analysis report for the development team. ## Output - **Lock wait graph visualization** showing the circular dependency between transactions - **Deadlock analysis report** with root cause, affected queries, and code paths - **Code fix recommendations** with before/after transaction ordering examples - **Retry logic implementation** for deadlock victim transactions - **Monitoring queries/scripts** for tracking deadlock frequency trends ## Error Handling | Error | Cause | Solution | |-------|-------|---------| | PostgreSQL error `40P01: deadlock detected` | Circular lock dependency between transactions | Implement retry logic; fix lock ordering in application code; reduce transaction scope | | MySQL error `1213: Deadlock found when trying to get lock` | InnoDB detected circular wait in lock wait graph | Enable `innodb_print_all_deadlocks`; analyze `SHOW ENGINE INNODB STATUS`; implement retry logic | | Lock wait timeout (not deadlock) | Transaction holding lock too long, exceeding `lock_wait_timeout` | Investigate the blocking transaction; increase timeout or implement NOWAIT; optimize the long-running transaction | | Phantom deadlocks in monitoring | Transient lock waits resolved before deadlock detection runs | Increase monitoring frequency; use database deadlock log instead of snapshot queries; set
Excerpt, first 6,000 characters of SKILL.md, verbatim from the audited commit. It is text from someone else’s repository, quoted so you can judge it before your agent reads it.
Install
Pinned to the audited commit 4f83675
git clone https://github.com/jeremylongshore/claude-code-plugins-plus-skills git -C claude-code-plugins-plus-skills checkout 4f83675ca38a
The author documents no install command, so this uses the repository directly. Our verdict covers commit 4f83675ca38a only.
Works in which agents?
What its own text says, not a test
| Agent | Status | More |
|---|---|---|
| Claude Code | Mentioned in its text, not tested | Skills for Claude Code · About Claude Code |
Audit history
Every audit, every source change
- ✓SAFE B 89 / 100
first audit · source
4f83675ca38a
README badge
For maintainers · shows the latest audit
[](https://modelsatlas.com/skills/jeremylongshore/detecting-database-deadlocks/)
The badge shows our verdict and grade for this skill, and links back to this page. It changes when the audit does.
Similar skills
All data & analysis skills →jeremylongshore/claude-code-plugins-plus
Model-agnostic agent-skills platform with a harness-free canonical layer, verified adapters, and the ccpi package manager. Explore at tonsofskills.com.
jeremylongshore/claude-code-plugins-plus
Model-agnostic agent-skills platform with a harness-free canonical layer, verified adapters, and the ccpi package manager. Explore at tonsofskills.com.
jeremylongshore/claude-code-plugins-plus
Model-agnostic agent-skills platform with a harness-free canonical layer, verified adapters, and the ccpi package manager. Explore at tonsofskills.com.
jeremylongshore/claude-code-plugins-plus
Model-agnostic agent-skills platform with a harness-free canonical layer, verified adapters, and the ccpi package manager. Explore at tonsofskills.com.
jeremylongshore/claude-code-plugins-plus
Model-agnostic agent-skills platform with a harness-free canonical layer, verified adapters, and the ccpi package manager. Explore at tonsofskills.com.
jeremylongshore/claude-code-plugins-plus
Deploy and orchestrate Vertex AI ADK agents using A2A protocol. Manages
Add this badge to your README
[](https://modelsatlas.com/skills/jeremylongshore/detecting-database-deadlocks/)
<a href="https://modelsatlas.com/skills/jeremylongshore/detecting-database-deadlocks/"><img src="https://modelsatlas.com/skills/jeremylongshore/detecting-database-deadlocks/badge.svg" alt="ModelsAtlas: SAFE B"></a>
Questions about Detecting Database Deadlocks
What does the Detecting Database Deadlocks skill do?
Is Detecting Database Deadlocks safe to install?
What can Detecting Database Deadlocks access on my machine?
Which assistants does Detecting Database Deadlocks work with?
How current is this page?
Sources
- github.com/jeremylongshore/claude-code-plugins-plus-skills/tree/ — the audited source at commit 4f83675ca38a and every finding aboveObserved · 8 Oct 2026
Spotted something wrong? Report a correction · Methodology
Keep going in your AI
Opens with this page as the source. We add nothing else to the prompt.
- What does the Detecting Database Deadlocks skill do?
- Is Detecting Database Deadlocks safe to install?
- What can Detecting Database Deadlocks access on my machine?