Three Codex habits that make SQL changes safe

OpenAI's own advice for Codex comes down to three habits: save a Git checkpoint, say what done looks like, and review before you keep anything. What each one means when the change is a query, a view or a pipeline step.

Short answer: save a Git checkpoint before Codex starts, so any change can be undone. Say what done looks like in a way Codex can check: "done when the reconciliation query returns the same monthly totals as before". Run /review and read the changes before you keep them. For SQL, the second habit matters most: a query that runs is not a query that is right.

Agents are good at making code that runs. They cannot know that revenue for March must still be 412,880 unless you tell them. The "done" line turns your knowledge into a check the agent can run itself.

Nothing loads from YouTube until you press play. Then Google receives your IP address and may set its own storage. Narrated with an AI-generated voice. Privacy

What does each habit look like for SQL?

Checkpoint
  • git commit before the task
  • one task per commit
Done when"the totals query returns the same 12 monthly numbers as before, and the new column has no blanks"
Review/review, then read every changed join and filter yourself
Three habits, applied to a query change

How do you write a good "done when"?

WeakStrong
"Make it faster""Done when it runs under 10 s on the test database and the result has the same 1,284 rows"
"Fix the revenue view""Done when March revenue equals the finance figure of 412,880"
"Add the region column""Done when every row has a region and the monthly totals are unchanged"

The numbers here are made up. Use a figure you trust, from finance or a past run.

What does /permissions add?

/permissions sets what Codex may do without asking. For SQL work, let it run your tests and the read-only checks freely, and keep it asking before anything that writes to a database.

Where can you check this?

Where do you start?

Try it on a first task with your first Codex task on a data repository. For checks you run before any query, see a skill that checks SQL.

Keep reading

More from the blog.

Every post

Next

Building this? Say hello.

A question about this post, a pattern you would build differently, or the next thing you want written out: Behnia reads every message.