Quick Ref / Command

Engineer Kit

/ak:databases

MongoDB and PostgreSQL guidance

Unified MongoDB and PostgreSQL guidance for schema design, queries, aggregation, indexes, migrations, replication, backups, administration, and performance.

01

Classify work

02

Choose engine

03

Load reference

04

Model data

Rule 01

Pick the database from data shape and access patterns.

Rule 02

PostgreSQL favors integrity, joins, constraints, and normalized models.

Rule 03

MongoDB favors document aggregates and embedded 1-to-few relationships.

Rule 04

Indexes follow real query paths, not wishful future access.

Rule 05

Production work includes backup, auth, permissions, and recovery.

Execution Map

Core lanes from input to output, aligned with the command's real execution path.

01

Start

Input, scope, route

  1. 1 Classify work Determine whether the task is schema design, SQL/NoSQL query writing, aggregation, index tuning, migration, backup, replication, permissions, or production admin.
  2. 2 Choose engine Route relational integrity and joins to PostgreSQL, document-oriented 1-to-few models to MongoDB, or compare trade-offs when unclear.
02

Work

Agent / skill execution

  1. 3 Load reference Load only the needed reference: db design, MongoDB CRUD/aggregation/indexing/Atlas, or PostgreSQL queries/psql/performance/admin.
  2. 4 Model data Design tables or collections around transactional or analytical use, relationships, constraints, access patterns, and growth.
03

Verify

Gate, review, validation

  1. 5 Write operation Produce SQL, psql commands, MongoDB query language, aggregation pipelines, migrations, or maintenance commands with clear assumptions.
  2. 6 Tune performance Use EXPLAIN ANALYZE, slow query analysis, compound indexes, frequently filtered fields, vacuum/analyze, and connection pooling as appropriate.
04

Close

Report, handoff, artifact

  1. 7 Protect production Account for authentication, TLS, backups, disaster recovery, users, permissions, replication, sharding, and operational maintenance.

Syntax, arguments, subcommands

How to invoke the skill: syntax, positional arguments, shared options, then each subcommand with its own syntax and outcome.

Syntax

/ak:databases [query or schema task]

Arguments

[query or schema task] Required

Database task

Natural-language schema, query, aggregation, index, migration, backup, replication, permission, or performance request. It does not choose a default database or connect automatically.

/ak:databases "Design a backward-compatible PostgreSQL migration for order.external_id with SQL, lock analysis, rollback limits, and verification queries; do not connect or apply it."

Sample Prompt

Concrete invocations for each flag, subcommand, mode, or route available in the live workflow.

Safe migration design Recommended
/ak:databases design a backward-compatible PostgreSQL migration that adds order.external_id, backfills it in batches, and adds uniqueness
Use when:
A schema change or migration is central and needs constraints, rollback limits, and verification queries.
Expected:
A forward PostgreSQL plan with SQL or migration guidance, lock and compatibility notes, index advice, assumptions, and verification queries before mutation.
Mongo aggregation
/ak:databases write a MongoDB aggregation pipeline to group events by account and day, including index considerations
Use when:
You need MongoDB query language or aggregation pipeline help for document-shaped data.
Expected:
Aggregation stages with stated input assumptions, grouping shape, operator choices, and indexes tied to the real match and sort predicates.
Slow PostgreSQL query
/ak:databases optimize this PostgreSQL query using my EXPLAIN ANALYZE output and recommend safe indexes
Use when:
Performance or latency is the central database problem and query-plan evidence is available.
Expected:
Plan interpretation, likely bottlenecks, concrete index or query rewrites, VACUUM/ANALYZE checks, and validation steps for the changed plan.
Backup and administration
/ak:databases plan a PostgreSQL backup and restore rehearsal with user permissions and disaster recovery checks
Use when:
Backup, restore, permissions, replication, or production administration is the database boundary.
Expected:
A safety-first operations plan covering required local tools, least-privilege access, backup and restore evidence, permissions, and remaining approval points.

Handled Scope

  • OLTP/OLAP schema design
  • PostgreSQL queries and psql
  • MongoDB CRUD and aggregation
  • Index and query optimization
  • Migrations
  • Backup and restore
  • Replication and administration

Next