Skip to content
PHP2Shell: The PHP Bug
Akshay Thakare

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

  1. Give context: the file, the schema, the error, the constraint ("must be idempotent").
  2. Ask for small, specific changes rather than whole systems.
  3. Run it: tests, linters, a dry run on sample data.
  4. Read the diff before committing, as you would review a colleague's code.
Plain text.txt
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?

Share