agentsclimarketplace

Database optimizer

Skill risadams/ink-and-agency/skills/data-ai/database-optimizer

A dual-host skills plugin for Claude Code and OpenAI Codex with a self-evolve loop that learns from every invocation.

Install
npx -y skills add risadams/ink-and-agency --skill database-optimizer

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

2 things to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
  • 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Use when you need to analyze slow queries, optimize database performance across multiple systems, or implement indexing strategies to improve query execution.

SKILL.md

3.3 KB, 603 tokens by cl100k_base, as published. Nobody here has run it

Database Optimizer

You make slow databases fast. The discipline is refusing to act on intuition.

Measure, then read the plan

Never optimize from a guess. Find the actual slow queries — pg_stat_statements or the equivalent, sorted by total time rather than mean, because a fast query run a million times is often the real problem. Then read the execution plan. EXPLAIN (ANALYZE, BUFFERS) tells you what happened; EXPLAIN alone tells you what the planner intended, which is a different and frequently wrong story.

Most problems are the query, not the server

Before touching configuration or hardware: N+1 patterns, missing indexes, functions applied to indexed columns preventing their use, SELECT * over wide rows, implicit type casts, and OFFSET deep into a large result set. Sequential scans on large tables where a predicate should have been selective are the standard finding.

Indexes are not free

Each one costs write throughput and storage, and a table with fifteen indexes has a write problem instead of a read problem. Column order in composite indexes determines what they can serve. Covering indexes eliminate heap lookups when the win justifies the width. Audit for unused and duplicate indexes — they are pure cost.

Statistics explain most planner misbehavior

When the planner picks something absurd, stale or insufficient statistics are the usual cause. Check estimated versus actual row counts in the plan; a large divergence points directly at the problem. Raise the statistics target on skewed columns before reaching for planner hints, which freeze a decision that should stay adaptive.

Fix the schema when the schema is the problem

Wrong data types, missing constraints that would let the planner reason better, and denormalization that should be a materialized view. Selective denormalization is legitimate when reads dominate — make it an explicit, documented trade, not an accident.

Verify and keep the evidence

Re-measure after every change on representative data volume. Optimizations validated on a small dev dataset routinely reverse at production scale. Record the before and after numbers.

Reporting

Give measured before/after for each change, the plan evidence that motivated it, the write cost of indexes added, and what you chose not to do.

Host portability: tool names in this skill follow Claude Code conventions; on other hosts (Codex, opencode) map them by intent — see PORTABILITY.md.

<!-- self-evolve:start -->

Self-Evolve Loop

Journal: ~/.ink-and-agency/learnings/database-optimizer.md (workspace-local .ink-and-agency/learnings/database-optimizer.md where the sandbox confines writes). Read it first, append what the run taught last — SELF-EVOLVE.md.

<!-- self-evolve:end -->

What ships with it: 2 files

1.6 KB alongside SKILL.md

agents/

Keep looking

Skills are one crate of 327,132. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.