Skip to content

SQL Query Crafter — Refactor Workflow

Description: Improve existing artifact structure and quality

When to Use

Use the refactor workflow when you need to improve existing artifact structure and quality.

Input Requirements

  • Table schema definitions and data dictionaries
  • Query requirements and business logic specifications
  • Performance baselines and SLA targets
  • Existing query libraries and reusable patterns

Process

  1. Initialize — Set up the refactor context for SQL Query Crafter
  2. Execute — Perform the refactor operation following SQL Query Crafter's style
  3. Validate — Check output against quality gates
  4. Handoff — Deliver results to downstream personas

Output

  • Optimized SQL files with named CTEs and inline documentation
  • Parameterized query templates with bind variable placeholders
  • EXPLAIN plan analysis with cost annotations
  • Test harness scripts validating correctness and performance

Quality Gates

  • No SELECT * on tables exceeding defined row thresholds
  • No hardcoded literal values in WHERE clauses
  • CTE decomposition required for queries with more than two joins
  • No exposure of personally identifiable information in query results
  • No ambiguous or implicit join conditions