MR
Mayur Rathi
@mayurrathi
⭐ 5 GitHub stars

Database Migrations Migration Observability

Migration monitoring, CDC, and observability infrastructure

mkdir -p ./skills/database-migrations-migration-observability && curl -sfL https://raw.githubusercontent.com/mayurrathi/awesome-agent-skills/main/skills/database-migrations-migration-observability/SKILL.md -o ./skills/database-migrations-migration-observability/SKILL.md

Run in terminal / PowerShell. Requires curl (Unix) or PowerShell 5+ (Windows).

Skill Content

# Migration Observability and Real-time Monitoring


You are a database observability expert specializing in Change Data Capture, real-time migration monitoring, and enterprise-grade observability infrastructure. Create comprehensive monitoring solutions for database migrations with CDC pipelines, anomaly detection, and automated alerting.


Use this skill when


- Working on migration observability and real-time monitoring tasks or workflows

- Needing guidance, best practices, or checklists for migration observability and real-time monitoring


Do not use this skill when


- The task is unrelated to migration observability and real-time monitoring

- You need a different domain or tool outside this scope


Context

The user needs observability infrastructure for database migrations, including real-time data synchronization via CDC, comprehensive metrics collection, alerting systems, and visual dashboards.


Requirements

$ARGUMENTS


Instructions


1. Observable MongoDB Migrations


```javascript

const { MongoClient } = require('mongodb');

const { createLogger, transports } = require('winston');

const prometheus = require('prom-client');


class ObservableAtlasMigration {

constructor(connectionString) {

this.client = new MongoClient(connectionString);

this.logger = createLogger({

transports: [

new transports.File({ filename: 'migrations.log' }),

new transports.Console()

]

});

this.metrics = this.setupMetrics();

}


setupMetrics() {

const register = new prometheus.Registry();


return {

migrationDuration: new prometheus.Histogram({

name: 'mongodb_migration_duration_seconds',

help: 'Duration of MongoDB migrations',

labelNames: ['version', 'status'],

buckets: [1, 5, 15, 30, 60, 300],

registers: [register]

}),

documentsProcessed: new prometheus.Counter({

name: 'mongodb_migration_documents_total',

help: 'Total documents processed',

labelNames: ['version', 'collection'],

registers: [register]

}),

migrationErrors: new prometheus.Counter({

name: 'mongodb_migration_errors_total',

help: 'Total migration errors',

labelNames: ['version', 'error_type'],

registers: [register]

}),

register

};

}


async migrate() {

await this.client.connect();

const db = this.client.db();


for (const [version, migration] of this.migrations) {

await this.executeMigrationWithObservability(db, version, migration);

}

}


async executeMigrationWithObservability(db, version, migration) {

const timer = this.metrics.migrationDuration.startTimer({ version });

const session = this.client.startSession();


try {

this.logger.info(`Starting migration ${version}`);


await session.withTransaction(async () => {

await migration.up(db, session, (collection, count) => {

this.metrics.documentsProcessed.inc({

version,

collection

}, count);

});

});


timer({ status: 'success' });

this.logger.info(`Migration ${version} completed`);


} catch (error) {

this.metrics.migrationErrors.inc({

version,

error_type: error.name

});

timer({ status: 'failed' });

throw error;

} finally {

await session.endSession();

}

}

}

```


2. Change Data Capture with Debezium


```python

import asyncio

import json

from kafka import KafkaConsumer, KafkaProducer

from prometheus_client import Counter, Histogram, Gauge

from da

🎯 Best For

  • Claude users
  • Software engineers
  • Development teams
  • Tech leads

💡 Use Cases

  • Code quality improvement
  • Best practice enforcement

📖 How to Use This Skill

  1. 1

    Install the Skill

    Copy the install command from the Terminal tab and run it. The SKILL.md file downloads to your local skills directory.

  2. 2

    Load into Your AI Assistant

    Open Claude and reference the skill. Paste the SKILL.md content or use the system prompt tab.

  3. 3

    Apply Database Migrations Migration Observability to Your Work

    Open your project in the AI assistant and ask it to apply the skill. Start with a small module to verify the output quality.

  4. 4

    Review and Refine

    Review AI suggestions before committing. Run tests, check for regressions, and iterate on the skill output.

❓ Frequently Asked Questions

Is Database Migrations Migration Observability compatible with Cursor and VS Code?

Yes — this skill works with any AI coding assistant including Cursor, VS Code with Copilot, and JetBrains IDEs.

Do I need specific dependencies for Database Migrations Migration Observability?

Check the install command and Works With section. Most code skills only require the AI assistant and your codebase.

How do I install Database Migrations Migration Observability?

Copy the install command from the Terminal tab and run it. The skill downloads to ./skills/database-migrations-migration-observability/SKILL.md, ready to use.

Can I customize this skill for my team?

Absolutely. Edit the SKILL.md file to add team-specific instructions, examples, or workflows.

⚠️ Common Mistakes to Avoid

Skipping validation

Always test AI-generated code changes, even for simple refactors.

Missing dependency updates

Check if the skill requires updated dependencies or new packages.

🔗 Related Skills