SC

schema-optimization-orchestrator

Automates schema optimization through a multi-phase test harness workflow.

Install

mkdir -p .claude/skills/schema-optimization-orchestrator && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/7602" && unzip -o skill.zip -d .claude/skills/schema-optimization-orchestrator && rm skill.zip

Installs to .claude/skills/schema-optimization-orchestrator

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Multi-phase schema optimization workflow orchestrator. Creates session directories,
spawns phase agents sequentially, validates outputs, aggregates results.
Trigger: "run schema optimization", "optimize schema workflow", "execute schema phases"
244 chars · catalog descriptionno explicit “when” trigger
Intermediate

Key capabilities

  • Creates time-stamped, isolated directory structures for each run
  • Executes 5 sequential analysis phases with state passing
  • Validates JSON artifacts against expected schema structure
  • Aggregates final evidence reports into a summary
  • Spawns independent agents for phase-specific logic

How it works

Uses a shell-based orchestrator to cycle through distinct agents, ensuring that each phase produces a validated JSON output before passing the state to the subsequent phase.

Inputs & outputs

You give it
Input folder path, extraction type, and base session dir
You get back
Phase-specific markdown reports and final aggregate summary

When to use schema-optimization-orchestrator

  • Optimize database schema
  • Run automated schema analysis
  • Validate schema migration results

About this skill

Schema Optimization Orchestrator

Runs a multi-phase schema optimization workflow with strict validation and evidence collection.

Workflow Pattern

This is a test harness pattern:

  • Creates isolated session directory per run
  • Spawns 5 phase agents sequentially
  • Each phase reads reference docs, runs scripts, writes reports
  • Validates JSON outputs and file artifacts
  • Aggregates final summary

Inputs (JSON)

{
  "skill_dir": "/absolute/path/to/.claude/skills/schema-optimization",
  "input_folder": "/path/to/bigquery/export",
  "extraction_type": "bigquery_json",
  "session_dir_base": ".claude/skills/schema-optimization/reports/runs"
}

Required:

  • skill_dir: Absolute path to this skill directory
  • input_folder: Path to data to analyze
  • extraction_type: Type of data extraction (e.g., "bigquery_json")

Optional:

  • session_dir_base: Where to create run directories (default: reports/runs)

Orchestration Steps

1. Create Session Directory

TIMESTAMP=$(date +%Y-%m-%d_%H%M%S)
SESSION_DIR="${session_dir_base}/${TIMESTAMP}"
mkdir -p "${SESSION_DIR}"

2. Run Phase 1: Initial Schema Analysis

Spawn Phase 1 agent with:

{
  "skill_dir": "<skill_dir>",
  "session_dir": "<SESSION_DIR>",
  "reference_path": "<skill_dir>/references/01-phase-1.md",
  "input_folder": "<input_folder>",
  "extraction_type": "<extraction_type>"
}

Expected output:

{
  "status": "complete",
  "report_path": "<SESSION_DIR>/01-initial-schema-analysis.md",
  "schema_summary": {
    "total_tables": 0,
    "total_fields": 0,
    "key_findings": []
  }
}

Validation:

  • JSON parse succeeds
  • status is "complete"
  • report_path file exists
  • schema_summary has required keys

3. Run Phase 2: Field Utilization Analysis

Spawn Phase 2 agent with:

{
  "skill_dir": "<skill_dir>",
  "session_dir": "<SESSION_DIR>",
  "reference_path": "<skill_dir>/references/02-phase-2.md",
  "phase1_report_path": "<phase1_report_path>",
  "input_folder": "<input_folder>"
}

Expected output:

{
  "status": "complete",
  "report_path": "<SESSION_DIR>/02-field-utilization-analysis.md",
  "utilization_summary": {
    "unused_fields": [],
    "low_utilization_fields": [],
    "recommendations": []
  }
}

4. Run Phase 3: Impact Assessment

Spawn Phase 3 agent with:

{
  "skill_dir": "<skill_dir>",
  "session_dir": "<SESSION_DIR>",
  "reference_path": "<skill_dir>/references/03-phase-3.md",
  "phase1_report_path": "<phase1_report_path>",
  "phase2_report_path": "<phase2_report_path>",
  "input_folder": "<input_folder>"
}

Expected output:

{
  "status": "complete",
  "report_path": "<SESSION_DIR>/03-impact-assessment.md",
  "impact_summary": {
    "high_risk_changes": [],
    "medium_risk_changes": [],
    "low_risk_changes": [],
    "estimated_savings": {}
  }
}

5. Run Phase 4: Verification with Script

Spawn Phase 4 agent with:

{
  "skill_dir": "<skill_dir>",
  "session_dir": "<SESSION_DIR>",
  "reference_path": "<skill_dir>/references/04-phase-4-verify-with-script.md",
  "phase2_report_path": "<phase2_report_path>",
  "phase3_report_path": "<phase3_report_path>",
  "input_folder": "<input_folder>",
  "script_path": "<skill_dir>/scripts/analyze_field_utilization.sh",
  "output_folder_path": "<input_folder>"
}

Expected output:

{
  "status": "complete",
  "report_path": "<SESSION_DIR>/04-field-utilization-verification.md",
  "verification_summary": {
    "files_analyzed": 0,
    "conclusions_confirmed": [],
    "conclusions_revised": [],
    "unexpected_findings": [],
    "revised_action_items": []
  }
}

6. Run Phase 5: Final Recommendations

Spawn Phase 5 agent with:

{
  "skill_dir": "<skill_dir>",
  "session_dir": "<SESSION_DIR>",
  "reference_path": "<skill_dir>/references/05-phase-5.md",
  "phase1_report_path": "<phase1_report_path>",
  "phase2_report_path": "<phase2_report_path>",
  "phase3_report_path": "<phase3_report_path>",
  "phase4_report_path": "<phase4_report_path>"
}

Expected output:

{
  "status": "complete",
  "report_path": "<SESSION_DIR>/05-final-recommendations.md",
  "recommendations_summary": {
    "priority_actions": [],
    "implementation_plan": [],
    "success_metrics": []
  }
}

Output (JSON Only)

{
  "status": "complete",
  "session_dir": "<SESSION_DIR>",
  "timestamp": "YYYY-MM-DD_HHMMSS",
  "phase_reports": {
    "phase1": "<SESSION_DIR>/01-initial-schema-analysis.md",
    "phase2": "<SESSION_DIR>/02-field-utilization-analysis.md",
    "phase3": "<SESSION_DIR>/03-impact-assessment.md",
    "phase4": "<SESSION_DIR>/04-field-utilization-verification.md",
    "phase5": "<SESSION_DIR>/05-final-recommendations.md"
  },
  "final_summary": {
    "total_tables": 0,
    "total_fields": 0,
    "unused_fields": 0,
    "optimization_opportunities": 0,
    "estimated_savings_pct": 0,
    "verification_status": "confirmed"
  }
}

Error Handling

If any phase fails:

  • Stop execution
  • Return error status with phase details
  • Preserve partial reports for debugging
{
  "status": "error",
  "failed_phase": 3,
  "error_message": "Phase 3 agent failed validation",
  "session_dir": "<SESSION_DIR>",
  "completed_phases": ["phase1", "phase2"]
}

Validation Rules

After each phase:

  1. Parse returned JSON (fail if invalid)
  2. Check status is "complete" (fail if not)
  3. Verify report_path exists on disk (fail if not)
  4. Validate phase-specific summary keys (fail if missing)

Implementation Notes

  • Use Task tool to spawn phase agents
  • Pass exact file paths (no wildcards)
  • Session directory must be absolute path
  • All reports must be written before returning
  • No terminal output except final JSON

Example Usage

User: "Run schema optimization on my BigQuery export"

Claude: [Creates session directory]
Claude: [Spawns Phase 1 agent]
Claude: [Validates Phase 1 output]
Claude: [Spawns Phase 2 agent with Phase 1 report]
Claude: [... continues through Phase 5]
Claude: [Returns final JSON summary]

Files Created Per Run

reports/runs/2025-01-15_143022/
├── 01-initial-schema-analysis.md
├── 02-field-utilization-analysis.md
├── 03-impact-assessment.md
├── 04-field-utilization-verification.md
└── 05-final-recommendations.md

Each file is evidence of work completed.

When not to use it

  • If the input schema data is too small to justify an multi-phase workflow
  • When performing a one-off database change that does not require verification
  • If the environment lacks sufficient write permissions for session directory creation

Prerequisites

bashJSON validation tool

Limitations

  • Linear execution path is strictly bound by prior phase completion
  • Failure in one phase stops the entire chain
  • Rigidly coupled to the specific folder structure of the skill directory

How it compares

It creates a formal test harness for schema changes, moving away from ad-hoc analysis to a consistent, auditable multi-phase process.

Compared to similar skills

schema-optimization-orchestrator side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
schema-optimization-orchestrator (this skill)13moReviewIntermediate
database-design66moReviewIntermediate
database-schema-designer66moNo flagsIntermediate
database-specialist05moNo flagsAdvanced

Try saying

Example prompts that trigger this skill in your AI assistant.

More by jeremylongshore

View all by jeremylongshore

analyzing-logs

jeremylongshore

Analyze application logs to detect performance issues, identify error patterns, and improve stability by extracting key insights.

14123

ollama-setup

jeremylongshore

Configure auto-configure Ollama when user needs local LLM deployment, free AI alternatives, or wants to eliminate hosted API costs. Trigger phrases: "install ollama", "local AI", "free LLM", "self-hosted AI", "replace OpenAI", "no API costs". Use when appropriate context detected. Trigger with relevant phrases based on skill purpose.

1167

backtesting-trading-strategies

jeremylongshore

Backtest crypto and traditional trading strategies against historical data. Calculates performance metrics (Sharpe, Sortino, max drawdown), generates equity curves, and optimizes strategy parameters. Use when user wants to test a trading strategy, validate signals, or compare approaches. Trigger with phrases like "backtest strategy", "test trading strategy", "historical performance", "simulate trades", "optimize parameters", or "validate signals".

1071

generating-database-seed-data

jeremylongshore

Process this skill enables AI assistant to generate realistic test data and database seed scripts for development and testing environments. it uses faker libraries to create realistic data, maintains relational integrity, and allows configurable data volumes. u... Use when working with databases or data models. Trigger with phrases like 'database', 'query', or 'schema'.

1033

cursor-codebase-indexing

jeremylongshore

Execute set up and optimize Cursor codebase indexing. Triggers on "cursor index setup", "codebase indexing", "index codebase", "cursor semantic search". Use when working with cursor codebase indexing functionality. Trigger with phrases like "cursor codebase indexing", "cursor indexing", "cursor".

885

testing-mobile-apps

jeremylongshore

Execute mobile app testing on iOS and Android devices/simulators. Use when performing specialized testing. Trigger with phrases like "test mobile app", "run iOS tests", or "validate Android functionality".

810

You might also like

database-design

davila7

Database design principles and decision-making. Schema design, indexing strategy, ORM selection, serverless databases.

648

database-schema-designer

davila7

Design robust, scalable database schemas for SQL and NoSQL databases. Provides normalization guidelines, indexing strategies, migration patterns, constraint design, and performance optimization. Ensures data integrity, query performance, and maintainable data models.

628

database-specialist

FelipeArruda

Use this skill when the task centers on database design or behavior: schema modeling, SQL, indexes, constraints, migrations, query tuning, data integrity, transactional logic, or tradeoffs across engines such as SQLite, PostgreSQL, and MySQL.

00

comparing-database-schemas

jeremylongshore

Process use when you need to work with schema comparison. This skill provides database schema diff and sync with comprehensive guidance and automation. Trigger with phrases like "compare schemas", "diff databases", or "sync database schemas".

10

phased-migration-plan

kaladron

Author or update a phased plan-*.md document for a multi-step migration or refactor. Use when a change is too large for a single commit, when coordinating database/architecture migrations across many call sites, or when the user asks for a "plan" before implementation. Covers the standard plan struc

00

drizzle-orm

EpicenterHQ

Drizzle ORM patterns for type branding and custom types. Use when working with Drizzle column definitions, branded types, or custom type conversions.

32190

Search skills

Search the agent skills registry