Using AI Coding Assistants Well (and Safely)
How to get reliable results from AI coding tools on data projects: give context, ask for small changes, verify with tests, and protect secrets.
AI ToolsBeginner2 min readUpdated 11 Oct 2026
What they are good at
- Boilerplate: DAG skeletons, schemas, CLI wiring, test scaffolding
- Explaining unfamiliar code or an error message
- Translating between SQL dialects or from pandas to PySpark
- First drafts of documentation and tests
What to watch
- Plausible but wrong code: APIs that do not exist, wrong defaults, subtle logic bugs
- Outdated library versions
- Over-engineered solutions to simple problems
A workflow that works
- Give context: the file, the schema, the error, the constraint ("must be idempotent").
- Ask for small, specific changes rather than whole systems.
- Run it: tests, linters, a dry run on sample data.
- Read the diff before committing, as you would review a colleague's code.
Write a PySpark function that keeps the latest row per order_id by updated_at.
Input schema: order_id string, updated_at timestamp, amount decimal(18,2).
Include a pytest with a duplicate key and a null updated_at.Protect secrets and data
- Never paste credentials, tokens or customer data into prompts.
- Check your organisation's policy on which tools may see source code.
- Review generated code for hard-coded secrets and unsafe SQL string building.
Finished this note?
