smoke-test-database
# Smoke Test Database Skill
What this skill does
# Smoke Test Database Skill
**Quick Reference** - Load this first for fast context (~3KB)
## Mission
Execute comprehensive database smoke tests to validate connectivity, query performance, data integrity, and backup/restore operations during release workflows.
## Core Capabilities
- **Connection Testing**: Validate database connectivity and authentication
- **Query Performance**: Test read/write operations against SLA targets
- **Schema Validation**: Verify database schema matches expected structure
- **Data Integrity**: Check critical data constraints and relationships
- **Replication Health**: Validate primary/replica synchronization
- **Backup Validation**: Verify backup operations and restore capability
## When to Use This Skill
Use this skill when:
- Executing pre-release smoke tests (verify database readiness)
- Validating post-deployment health (after migrations)
- Testing canary deployments (database connection pooling)
- Verifying rollback success (schema rollback validation)
- Running scheduled health checks (monitoring integration)
## Quick Start
### 1. Load Skill in Agent
```yaml
skills:
- name: smoke-test-database
path: skills/smoke-test-database/SKILL.md
```
### 2. Execute Database Tests
```javascript
const { SmokeTestDatabase } = require('./scripts/test-connectivity.js');
const tester = new SmokeTestDatabase({
type: 'postgresql', // or 'mysql', 'mongodb', 'redis'
host: 'localhost',
port: 5432,
database: 'staging_db',
username: 'app_user',
password: process.env.DB_PASSWORD
});
const result = await tester.executeTests({
environment: 'staging',
tests: ['connectivity', 'query-performance', 'schema-validation']
});
if (result.passed) {
console.log('✅ Database smoke tests passed');
} else {
console.error('❌ Database smoke tests failed');
}
```
### 3. Configuration Template
```yaml
environment: staging
database:
type: postgresql
host: staging-db.example.com
port: 5432
database: app_staging
username: app_user
password: ${DB_PASSWORD}
ssl: true
poolSize: 10
tests:
- connectivity
- query-performance
- schema-validation
- data-integrity
```
## Database Smoke Test Categories
### 1. Connectivity Tests
- Primary connection: Connect to primary database
- Replica connection: Connect to read replica
- Connection pooling: Validate pool size and idle connections
- SSL/TLS validation: Verify encrypted connections
- Authentication: Test credentials and permissions
### 2. Query Performance Tests
- Simple query: `SELECT 1` (target: ≤10ms)
- Table query: `SELECT * FROM users LIMIT 1` (target: ≤50ms)
- Join query: Multi-table join (target: ≤200ms)
- Index usage: Verify indexes are used (EXPLAIN analysis)
- Write operations: INSERT/UPDATE/DELETE (target: ≤100ms)
### 3. Schema Validation
- Table existence: Verify all required tables exist
- Column validation: Check columns, types, constraints
- Index validation: Verify indexes exist and are valid
- Foreign key constraints: Check referential integrity
- Migration status: Verify all migrations applied
### 4. Data Integrity Tests
- Record counts: Validate expected data volume
- Constraint validation: Check NOT NULL, UNIQUE, CHECK constraints
- Referential integrity: Validate foreign key relationships
- Critical data: Verify essential configuration records
- Data consistency: Check for orphaned or duplicate records
### 5. Replication Health
- Replication lag: Measure primary-replica lag (target: ≤1s)
- Replica status: Verify replicas are connected and healthy
- Data consistency: Compare row counts across replicas
- Failover readiness: Test replica promotion capability
### 6. Backup Validation
- Backup recency: Verify last backup timestamp (target: ≤24h)
- Backup integrity: Validate backup file checksums
- Point-in-time recovery: Test PITR capability
- Backup restoration: Verify restore to test environment
## Performance SLAs
```javascript
const SLA_TARGETS = {
connectivity: 1000, // Connection: ≤1000ms
simpleQuery: 10, // SELECT 1: ≤10ms
tableQuery: 50, // Table scan: ≤50ms
joinQuery: 200, // Multi-table join: ≤200ms
writeOperation: 100, // INSERT/UPDATE/DELETE: ≤100ms
replicationLag: 1000, // Replication lag: ≤1000ms
timeout: 30000 // Global timeout: ≤30000ms
};
```
## Pass/Fail Criteria
**Pass**: All smoke tests must pass
- ✅ Database connections established successfully
- ✅ All query performance SLAs met
- ✅ Schema matches expected structure
- ✅ Data integrity constraints satisfied
- ✅ Replication lag within acceptable limits
- ✅ Recent backup exists and is valid
**Fail**: Any smoke test failure blocks deployment
- ❌ Connection failures or authentication errors
- ❌ Query performance exceeds SLA targets
- ❌ Missing tables, columns, or indexes
- ❌ Data integrity violations detected
- ❌ Replication lag exceeds threshold
- ❌ Backup missing, stale, or corrupted
## Execution Points
Database smoke tests are executed at these points in the release workflow:
1. **Pre-Release** (before staging deployment): Validate database readiness and migrations
2. **Post-Staging** (after staging deployment): Verify database health after deployment
3. **Canary 5%** (5% traffic): Test database connection pooling with minimal load
4. **Canary 25%** (25% traffic): Validate database performance under moderate load
5. **Canary 100%** (100% traffic): Test database at full production load
6. **Post-Production** (after production deployment): Verify production database health
7. **Post-Rollback** (after rollback): Validate rollback database state and schema
## Common Patterns
### Pattern 1: Simple Connectivity Test
```javascript
const result = await tester.testConnectivity({
timeout: 5000,
retries: 2
});
```
### Pattern 2: Query Performance Test
```javascript
const result = await tester.testQueryPerformance({
queries: [
{ sql: 'SELECT 1', sla: 10 },
{ sql: 'SELECT * FROM users LIMIT 1', sla: 50 }
]
});
```
### Pattern 3: Schema Validation
```javascript
const result = await tester.validateSchema({
tables: ['users', 'products', 'orders'],
checkIndexes: true,
checkConstraints: true
});
```
### Pattern 4: Data Integrity Check
```javascript
const result = await tester.validateDataIntegrity({
checks: [
{ table: 'users', expected: { min: 100, max: 1000000 } },
{ table: 'products', constraint: 'price > 0' },
{ query: 'SELECT COUNT(*) FROM orders WHERE user_id NOT IN (SELECT id FROM users)', expected: 0 }
]
});
```
## Output Format
```javascript
{
passed: true,
details: {
totalTests: 6,
passed: 6,
failed: 0,
executionTime: 1234
},
reason: 'Database smoke tests passed: All 6 tests passing',
metrics: {
testsPassed: 6,
testsFailed: 0,
averageQueryTime: 45,
maxQueryTime: 198,
executionTime: 1234
},
results: [
{
test: 'connectivity',
category: 'Connection',
passed: true,
duration: 234,
sla: 1000
},
{
test: 'query-performance',
category: 'Performance',
passed: true,
duration: 45,
sla: 50,
details: {
queries: 5,
averageTime: 45,
maxTime: 198
}
}
]
}
```
## Database Type Support
### PostgreSQL
- Connection: `pg` driver with connection pooling
- Schema validation: `information_schema` queries
- Performance: `EXPLAIN ANALYZE` for query plans
- Replication: `pg_stat_replication` monitoring
### MySQL
- Connection: `mysql2` driver with connection pooling
- Schema validation: `INFORMATION_SCHEMA` queries
- Performance: `EXPLAIN` for query plans
- Replication: `SHOW SLAVE STATUS` monitoring
### MongoDB
- Connection: `mongodb` driver with connection pooling
- Schema validation: Collection and index validation
- Performance: `explain()` for query plans
- Replication: Replica set status monitoring
### Redis
- Connection: `redis` client with connection pooling
- Operations: GET, SET, INCR, EXPIRE tests
- Performance: ResRelated in Code Review
gstack
IncludedFast headless browser for QA testing and site dogfooding. Navigate pages, interact with elements, verify state, diff before/after, take annotated screenshots, test responsive layouts, forms, uploads, dialogs, and capture bug evidence. Use when asked to open or test a site, verify a deployment, dogfood a user flow, or file a bug with screenshots. (gstack)
startup-due-diligence
IncludedLegal due diligence review for seed-stage and Series A startups (US, Delaware C-Corp focus). Supports both investor and founder perspectives. Capabilities include: (1) Interactive document review and issue spotting; (2) Document request list generation; (3) Cap table and SAFE/convertible note analysis; (4) Red flag identification with severity ratings; (5) Diligence report generation. TRIGGERS: due diligence, DD, startup investment, cap table review, Series A, seed round, investor diligence, legal review startup, SAFE analysis, convertible note, 409A, founder vesting.
interview-master
IncludedThis skill should be used when the user asks to "generate interview questions", "prepare for interview", "optimize resume", "conduct mock interview", "analyze git commits for resume", "generate resume from code", "review my resume", or mentions interview preparation, career assistance, or extracting project experience from git history. Provides comprehensive interview and career development guidance for both job seekers and interviewers.
fix-issue
IncludedFixes GitHub issues using parallel analysis agents for root cause investigation, code exploration, and regression detection. Reads issue context from gh CLI, searches codebase and memory for related patterns, generates a fix with tests, and links the resolution back to the issue via PR. Includes prevention analysis to avoid recurrence. Use when debugging errors, resolving regressions, fixing bugs, or triaging issues.
sf-apex
IncludedGenerates and reviews Salesforce Apex code with 150-point scoring. TRIGGER when: user writes, reviews, or fixes Apex classes, triggers, test classes, batch/queueable/schedulable jobs, or touches .cls/.trigger files. DO NOT TRIGGER when: LWC JavaScript (use sf-lwc), Flow XML (use sf-flow), SOQL-only queries (use sf-soql), or non-Salesforce code.
swift-development
IncludedComprehensive Swift development for building, testing, and deploying iOS/macOS applications. Use when Claude needs to: (1) Build Swift packages or Xcode projects from command line, (2) Run tests with XCTest or Swift Testing framework, (3) Manage iOS simulators with simctl, (4) Handle code signing, provisioning profiles, and app distribution, (5) Format or lint Swift code with SwiftFormat/SwiftLint, (6) Work with Swift Package Manager (SPM), (7) Implement Swift 6 concurrency patterns (async/await, actors, Sendable), (8) Create SwiftUI views with MVVM architecture, (9) Set up Core Data or SwiftData persistence, or any other Swift/iOS/macOS development tasks.