Atlas Commerce Ops Solver
Core Workflow
- Read the task prompt, every file under
input/payloads/, and especially answer_template.json. Treat the request payload and template as the contract; do not add narrative or extra fields to answer.json.
- Fetch live Atlas metadata before writing analysis SQL:
python skill/scripts/atlas_api.py schema
python skill/scripts/atlas_api.py dictionary
- Use references/atlas-patterns.md when designing the SQL plan. Build the solution in auditable CTEs: cohort, effective rows or state at cutoff, metric rows, ordered output arrays, risk/status classification.
- Query through the read-only endpoint unless the request explicitly requires an approved correction:
python skill/scripts/atlas_api.py sql --file query.sql
- Keep intermediate ratios and money unrounded. Round only final reported fields to the precision required by the request/template.
- Write a single JSON object to
answer.json, then validate it:
python skill/scripts/validate_answer.py input/payloads/answer_template.json answer.json
SQL Discipline
- Prefer one final SQL query with named CTEs over scattered manual arithmetic. Add diagnostic queries only to inspect cardinalities, distinct statuses, or tie-break behavior.
- Derive state as of a cutoff from the relevant event/source table when a request uses words such as
effective, at cutoff, as of, active, or backlog. Snapshot current_status columns are convenient but may lag append-only history.
- Apply production scope through the account flags when the request says production accounts/orders/customers: exclude internal and test accounts unless the request says otherwise.
- Sort every output array in the exact order specified by the request/template. Use stable tie-breakers from the payload, commonly identifier ascending.
- Validate suspicious results with independent cross-checks: cohort count, numerator/denominator count, duplicate logical IDs, missing FX rows, and row counts before/after any mutation.
Controlled Corrections
Use POST /api/sql/transaction only when the request explicitly asks for a controlled correction. First identify the target with read-only SQL, calculate the pre-correction metric, and confirm the approved scope.
For canonical source corrections:
- Update only the approved canonical field and any explicitly allowed correction metadata fields.
- Never change raw source values, source-system identifiers, external event IDs, or unrelated business rows.
- Insert exactly the audit record required by the payload.
- Re-query the business row, audit row, and post-correction metric before reporting
APPLIED.
- Report
NOT_APPLIED with the observed row counts if the transaction, audit insert, or post-change verification does not satisfy the request's success rule.
The API helper can post a prepared transaction body without assuming its shape:
python skill/scripts/atlas_api.py transaction --file transaction.json
1---2name: atlas-commerce-ops-solver-23description: Solve Atlas Commerce Operations database tasks that provide prompt.txt, request payloads, answer_template.json, and authenticated TASK_ENV_BASE_URL API endpoints. Use for fulfillment, refund, carrier quality, warehouse productivity, support health, inventory, order, payment, customer, SQL analysis, and controlled canonical-correction tasks that must write an exact answer.json.4metadata:5 source: https://skillmd.com/skills/prism-shadow/atlas-commerce-ops-solver-26---78# Atlas Commerce Ops Solver910## Core Workflow11121. Read the task prompt, every file under `input/payloads/`, and especially `answer_template.json`. Treat the request payload and template as the contract; do not add narrative or extra fields to `answer.json`.132. Fetch live Atlas metadata before writing analysis SQL:1415```bash16python skill/scripts/atlas_api.py schema17python skill/scripts/atlas_api.py dictionary18```19203. Use [references/atlas-patterns.md](references/atlas-patterns.md) when designing the SQL plan. Build the solution in auditable CTEs: cohort, effective rows or state at cutoff, metric rows, ordered output arrays, risk/status classification.214. Query through the read-only endpoint unless the request explicitly requires an approved correction:2223```bash24python skill/scripts/atlas_api.py sql --file query.sql25```26275. Keep intermediate ratios and money unrounded. Round only final reported fields to the precision required by the request/template.286. Write a single JSON object to `answer.json`, then validate it:2930```bash31python skill/scripts/validate_answer.py input/payloads/answer_template.json answer.json32```3334## SQL Discipline3536- Prefer one final SQL query with named CTEs over scattered manual arithmetic. Add diagnostic queries only to inspect cardinalities, distinct statuses, or tie-break behavior.37- Derive state as of a cutoff from the relevant event/source table when a request uses words such as `effective`, `at cutoff`, `as of`, `active`, or `backlog`. Snapshot `current_status` columns are convenient but may lag append-only history.38- Apply production scope through the account flags when the request says production accounts/orders/customers: exclude internal and test accounts unless the request says otherwise.39- Sort every output array in the exact order specified by the request/template. Use stable tie-breakers from the payload, commonly identifier ascending.40- Validate suspicious results with independent cross-checks: cohort count, numerator/denominator count, duplicate logical IDs, missing FX rows, and row counts before/after any mutation.4142## Controlled Corrections4344Use `POST /api/sql/transaction` only when the request explicitly asks for a controlled correction. First identify the target with read-only SQL, calculate the pre-correction metric, and confirm the approved scope.4546For canonical source corrections:4748- Update only the approved canonical field and any explicitly allowed correction metadata fields.49- Never change raw source values, source-system identifiers, external event IDs, or unrelated business rows.50- Insert exactly the audit record required by the payload.51- Re-query the business row, audit row, and post-correction metric before reporting `APPLIED`.52- Report `NOT_APPLIED` with the observed row counts if the transaction, audit insert, or post-change verification does not satisfy the request's success rule.5354The API helper can post a prepared transaction body without assuming its shape:5556```bash57python skill/scripts/atlas_api.py transaction --file transaction.json58```