DEV Community

Cover image for From AI Code Generation to AI System Investigation
Jonathan Miller
Jonathan Miller

Posted on

From AI Code Generation to AI System Investigation

I Released AI DB Investigator - A Skill for Structured Database Analysis

AI is very good at generating answers.

But when it comes to database problems, raw answers are not enough.

A slow query, a missing index, a suspicious schema, a broken relation, or an unclear data model usually cannot be solved by guessing. These problems require investigation.

That is why I released AI DB Investigator.

GitHub repo:
https://github.com/miller-28/skill-ai-db-investigator

What is AI DB Investigator?

AI DB Investigator is a skill designed to help AI analyze databases in a more structured way.

Instead of asking an AI model a broad question like:

Why is my database slow?

The goal is to guide the model into a more disciplined investigation flow.

A good database investigation usually requires several steps:

  1. Understand the schema.
  2. Identify important tables and relationships.
  3. Look at indexes.
  4. Inspect query patterns.
  5. Detect possible bottlenecks.
  6. Separate symptoms from root causes.
  7. Suggest safe, practical improvements.

AI DB Investigator is built around that idea.

Not magic.
Not guessing.
A structured investigation process.

Why I built it

I have spent many years working with production systems, especially around backend architecture, PostgreSQL, Redis, APIs, and distributed flows.

One thing becomes clear after enough production experience:

Database problems are rarely isolated.

A performance issue may look like a slow query, but the real cause may be:

  • a missing composite index
  • a bad join pattern
  • an overloaded table
  • unnecessary eager loading
  • poor pagination
  • wrong data modeling
  • missing constraints
  • too much logic happening in the wrong layer
  • data growth that changed the original assumptions

The database does not fail loudly at first.

It whispers.

Then it slows down.

Then it becomes the center of the fire.

So I wanted a skill that helps AI behave less like a random answer generator and more like a careful technical investigator.

The idea behind the skill

The core idea is simple:

AI should not only answer database questions.
It should investigate them.

That means the AI should slow down and ask the right technical questions before jumping to conclusions.

For example:

  • What database engine is being used?
  • What is the schema?
  • Which tables are involved?
  • Is this about performance, correctness, design, migrations, or reliability?
  • Are there indexes?
  • Are there foreign keys?
  • Is the query using OFFSET pagination?
  • Are there N+1 query patterns?
  • Is the data volume small, medium, or already production-scale?
  • Is the issue caused by the database, the application, or both?

This is the difference between generic AI assistance and operational AI assistance.

What this skill is useful for

AI DB Investigator can help with:

  • database schema review
  • PostgreSQL investigation
  • query analysis
  • index suggestions
  • performance bottleneck detection
  • database design review
  • migration reasoning
  • relationship mapping
  • production debugging
  • explaining suspicious DB behavior
  • turning vague DB problems into structured diagnostic steps

It is especially useful when the problem is not yet clearly defined.

Sometimes the real value is not the final answer.

Sometimes the value is forcing the investigation into the right shape.

Why this matters for AI-assisted development

A lot of AI development today focuses on generation:

  • generate code
  • generate tests
  • generate docs
  • generate APIs
  • generate UI

That is useful.

But production work is not only generation.

Production work is also diagnosis.

A senior engineer spends a lot of time asking:

  • What is really happening here?
  • What changed?
  • Where is the pressure?
  • What assumption is now false?
  • What is safe to change?
  • What should not be touched?
  • What is the smallest useful fix?

That mindset is hard to capture with a generic prompt.

A skill gives the AI a repeatable operating pattern.

That is the direction I find interesting: not only using AI to write code faster, but teaching AI how to approach technical systems with discipline.

Small tool, larger direction

This is not meant to be a huge framework.

It is intentionally focused.

The purpose is to encode a specific kind of engineering judgment into a reusable form.

For me, this is part of a larger shift:

Developers are moving from writing every line manually
to designing, directing, and refining intelligent workflows.

The developer becomes less of a typist and more of an orchestrator.

But orchestration only works when the AI has structure.

Without structure, AI improvises.

With structure, AI can investigate.

Repository

The project is available here:

https://github.com/miller-28/skill-ai-db-investigator

Feedback, ideas, issues, and suggestions are welcome.

Especially around:

  • PostgreSQL investigation flows
  • schema analysis
  • query review patterns
  • useful diagnostic prompts
  • real-world DB debugging examples

Final thought

Database work rewards patience.

The best answers usually come after the right questions.

AI DB Investigator is my attempt to give AI a better path through that process.

Not just to answer.

To investigate.

Top comments (0)