Repeatability
High
SQL refactoring follows well-established patterns — replacing procedural loops with set-based window functions and CTEs is a repeatable transformation. The task structure is consistent and doesn't require novel judgment each time.
Ambiguity Tolerance
High
Success criteria are concrete and measurable: ≤100 lines, sub-2-second execution on 50K customers, and functionally identical output. An agent can verify all three without subjective interpretation.
Data & Tool Availability
Medium
The agent needs the full stored procedure source, the underlying schema, sample or test data, and ideally a live Postgres instance to benchmark. If these are provided, the task is executable; if not, the agent is guessing at table structures and can't validate performance.
Error Cost
Medium
A bug in CLV calculation could silently produce wrong business metrics, which is a real risk — but the outcome is reversible since the original procedure can be restored and the refactor tested in a staging environment before production deployment.
Human Judgment Required
Low
SQL optimization is a technical discipline with clear best practices; no taste, ethics, or relationship context is needed. A human should review the output for correctness, but the generation itself doesn't require human intuition.