schema-optimization-orchestrator

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"

1,868 stars

Best use case

schema-optimization-orchestrator is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

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"

Teams using schema-optimization-orchestrator should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/schema-optimization/SKILL.md --create-dirs "https://raw.githubusercontent.com/jeremylongshore/claude-code-plugins-plus-skills/main/workspace/lab/schema-optimization/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/schema-optimization/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How schema-optimization-orchestrator Compares

Feature / Agentschema-optimization-orchestratorStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

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"

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

Related Guides

SKILL.md Source

# 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)

```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

```bash
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:

```json
{
  "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:
```json
{
  "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:

```json
{
  "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:
```json
{
  "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:

```json
{
  "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:
```json
{
  "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:

```json
{
  "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:
```json
{
  "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:

```json
{
  "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:
```json
{
  "status": "complete",
  "report_path": "<SESSION_DIR>/05-final-recommendations.md",
  "recommendations_summary": {
    "priority_actions": [],
    "implementation_plan": [],
    "success_metrics": []
  }
}
```

## Output (JSON Only)

```json
{
  "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

```json
{
  "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.

Related Skills

supabase-schema-from-requirements

1868
from jeremylongshore/claude-code-plugins-plus-skills

Design Supabase Postgres schema from business requirements with migrations, RLS, and types. Use when translating specifications into database tables, creating migration files, adding Row Level Security policies, or generating TypeScript types from schema. Trigger with phrases like "supabase schema", "design database supabase", "schema from requirements", "supabase migration", "supabase tables from spec".

oraclecloud-schema-migration

1868
from jeremylongshore/claude-code-plugins-plus-skills

Migrate to OCI Autonomous Database — wallet setup, mTLS, Data Pump, and python-oracledb. Use when provisioning Autonomous DB, downloading wallets, or migrating data with Data Pump. Trigger with "autonomous database", "oci adb", "wallet download", "data pump oci", "mtls oracle".

openrouter-context-optimization

1868
from jeremylongshore/claude-code-plugins-plus-skills

Optimize context window usage for OpenRouter models to reduce cost and improve quality. Use when hitting context limits, managing long conversations, or building RAG systems. Triggers: 'openrouter context', 'context window', 'openrouter token limit', 'reduce tokens openrouter'.

providing-performance-optimization-advice

1868
from jeremylongshore/claude-code-plugins-plus-skills

Provide comprehensive prioritized performance optimization recommendations for frontend, backend, and infrastructure. Use when analyzing bottlenecks or seeking improvement strategies. Trigger with phrases like "optimize performance", "improve speed", or "performance recommendations".

designing-database-schemas

1868
from jeremylongshore/claude-code-plugins-plus-skills

Process use when you need to work with database schema design. This skill provides schema design and migrations with comprehensive guidance and automation. Trigger with phrases like "design schema", "create migration", or "model database".

comparing-database-schemas

1868
from jeremylongshore/claude-code-plugins-plus-skills

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".

changelog-orchestrator

1868
from jeremylongshore/claude-code-plugins-plus-skills

Draft changelog PRs by collecting GitHub/Slack/Git changes, formatting with templates, running quality gates, and preparing a branch/PR. Use when generating weekly/monthly release notes or when the user asks to create a changelog from recent merges. Trigger with "changelog weekly", "generate release notes", "draft changelog", "create changelog PR".

validating-api-schemas

1868
from jeremylongshore/claude-code-plugins-plus-skills

Validate API schemas against OpenAPI, JSON Schema, and GraphQL specifications. Use when validating API schemas and contracts. Trigger with phrases like "validate API schema", "check OpenAPI spec", or "verify schema".

database-schema-visualizer

1868
from jeremylongshore/claude-code-plugins-plus-skills

Database Schema Visualizer - Auto-activating skill for Visual Content. Triggers on: database schema visualizer, database schema visualizer Part of the Visual Content skill category.

response-schema-generator

1868
from jeremylongshore/claude-code-plugins-plus-skills

Response Schema Generator - Auto-activating skill for API Development. Triggers on: response schema generator, response schema generator Part of the API Development skill category.

graphql-schema-generator

1868
from jeremylongshore/claude-code-plugins-plus-skills

Graphql Schema Generator - Auto-activating skill for API Development. Triggers on: graphql schema generator, graphql schema generator Part of the API Development skill category.

cost-optimization-analyzer

1868
from jeremylongshore/claude-code-plugins-plus-skills

Cost Optimization Analyzer - Auto-activating skill for AWS Skills. Triggers on: cost optimization analyzer, cost optimization analyzer Part of the AWS Skills skill category.