Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

“It runs” is not “it is right”

Errors come in two kinds.

Loud. It calls a function that does not exist, the script stops, you fix it in ten seconds. These are fine.

Quiet. It uses mean() where you needed median(), drops rows with a filter that looks reasonable, or handles missing values in a way that changes your effect size by 4%.

Only the second kind reaches a paper.

The four checks, every time

  1. Row counts. Before and after every join and filter.

  2. A known answer. Run it on data where you already know the result.

  3. The extremes. Empty input, one row, all-missing column.

  4. Read the code. Not the output — the code.

You did all four before this tool existed. It only removes the time you used to spend typing, which is the part that never caught the bug anyway.

Reproducibility

The problem:

The symptoms in research code are code that works but the author cannot explain, functions that subtly disagree across re-runs, and a pipeline that breaks four months later because someone re-prompted.

What helps: treat AI output like any code — commit, review, test. Pin versions of your real dependencies rather than trusting the AI’s picks. For published analyses, understand every line you would cite. Note AI assistance in your methods, even briefly. Save a regenerated prompt alongside the code if it is central.

Two things that do not speed up together

Writing code speeds up, dramatically. Understanding it does not — nor does documenting it, nor justifying it to a reviewer in eighteen months.

The gap between those two is where research software quietly stops being reproducible. It is not a new failure mode; it is an existing one with the throttle removed.

If you generate more code per hour and document at the same rate as before, your provenance per line of code has fallen. That is arithmetic, not pessimism.

FAIR, in one table

The question an AI assistant makes sharper
FFindableWhere does this analysis live, and does it have an identifier?
AAccessibleCan someone else obtain the code and the data description?
IInteroperableAre formats and vocabularies standard, or private to you?
RReusableIs there enough provenance for someone to trust and rerun it?

FAIR was written for data. FAIR4RS extended it to software, on the argument that software is research output, not research plumbing. An assistant that writes code faster than you can document it puts direct pressure on R — the principle that was already the weakest.

Making the work FAIR, in five minutes

ForAsk for
FWrite a README with a one-paragraph description, the inputs, the outputs, and how to run it
FAdd a CITATION.cff for this repository — then Zenodo gives it a DOI on release
AAdd an open licence file appropriate for research code — and check with your DCC
IReplace the hard-coded column renames with a data dictionary in data/schema.csv
RSet up renv and snapshot, Replace absolute paths with here::here()
RWrite CONTRIBUTING.md describing how to rerun the analysis from a clean clone

“How was Figure 3 produced?”

Eighteen months from now, if the answer lives in a chat: the session has expired or was on an account you have left; it is not shareable, citable, or searchable; forty wrong turns and three right ones sit undistinguished; and nobody will ever read it, including you.

If the answer lives in git: git log figures/figure3.R gives every change, dated. git blame gives which line, which commit, which reason. Commit messages carry the why. It clones with the repository, and survives you leaving.

Chat history is not provenance. Git history is.

The git safety net

Five commands make this safe:

CommandWhat it means
git switch -c fix-mergeA room you can walk out of. Work here; main stays untouched
git statusWhat has changed since the last checkpoint
git diffLine by line, what actually changed. The most important one
git commit -am "..."A checkpoint. You can always come back to exactly this
git restore .Throw away everything since the last checkpoint. The undo button

The loop: checkpoint → let it change things → read the diff → keep it or bin it.

Commit before you ask for a change. A commit is cheap, private until you push, and it is what makes git restore safe rather than terrifying.

All five have a button in the VS Code Source Control view: the changes list is git status, clicking a file is git diff side by side and syntax-highlighted, the branch name bottom-left switches or creates, Discard changes is git restore with a confirmation, and the sparkle writes the commit message.

An agent may touch six files. In the terminal that is a wall of text you scroll past. In the Source Control view it is six items you click through, one at a time, red and green, side by side. This is the single strongest practical argument for reviewing agent output in an IDE rather than a terminal.

What to delegate, and what to type yourself

Fine to delegate — git status, git diff, git log. Read-only. Let it run these all day; it is faster than you at reading them.

You type these yourself — git restore, git reset --hard, git clean -fd, force-push. It cannot undo what it does not know you wanted.

Small commits are not tidiness — they are resolution. They decide how precisely you can undo. A day’s work in one commit gives you exactly one place to go back to, and it is this morning.

Sensitive data

Assume by default that consumer chat (free ChatGPT, Claude.ai) may use prompts for training; that IDE assistants see your open files; that even “enterprise” tiers vary, so read the DPA; that logs may be retained around 30 days for abuse review; and that “anonymised” patient data often is not.

Usually fine: toy or synthetic examples mimicking your structure; the schema of your data (columns, types); code written against a mock that runs on your data later; published or open datasets.

Questions before adopting a tool: Where is data processed — EU or US? Is there a DPA or BAA? Is the tool on your institution’s approved list? Could a local model (Ollama, LM Studio) work, at lower quality?

At LUMC: when in doubt, ask the DCC or your data steward before pasting. It is easier than explaining afterwards.

What actually leaves your machine

In the IDE the assistant sends more than you typed. That is the point of it, and it is the thing to be clear-eyed about.

SurfaceTypically sent
Ghost textthe code around your cursor, plus nearby open files
Inline chatyour selection and its surroundings
Chat with #filethe whole file you named
#codebase / agentwhatever it decides is relevant across the project

If a data file is open in a tab, treat it as sent. The safest habit is simply not to open identifiable data in an editor with an assistant enabled.

Work on a schema, not on rows. Ten fake rows with the real column names give the assistant everything it needs and give you nothing to worry about.

What you can turn off

The habit that replaces all of them is synthetic data by default:

Generate 20 rows of fake data matching data/schema.csv. Realistic ranges,
no real values. Save to data/example.csv.

Develop against that, run against the real thing. Nothing sensitive is ever in the editor, and the example file makes the repository more reusable — which is R in FAIR, arriving free.

Disclosure

Ten Simple Rules, Rule 8 — document your process: record decisions in code comments and version-controlled files, independent of chat histories.

What it costs to comply is one line in a commit message:

Assisted-by: GitHub Copilot

That is the entire obligation. The diff then tells the truth about how the code was produced, permanently, to anyone who clones the repository.

The line can also go in the script header:

# Portions of this script were drafted with
# GitHub Copilot (VS Code) and reviewed by
# the author. See git log for full history.

or as one sentence in the README under a How this was built heading.

It is not a confession. It is a method note — the same category as saying which version of R you used. The failure mode is not disclosing too little; it is disclosing nothing, then being asked, and having to reconstruct it from memory eighteen months later.

Journal and funder policies differ and are changing quickly. Check the one you are submitting to; the repository line costs nothing either way.

When not to reach for AI

Do not when the output flows into a clinical decision; you are learning the language for the first time and should let yourself struggle; the data is sensitive and you cannot sanitise it; you cannot test whether the answer is right; or you would accept the code just because it compiles.

Do when you can describe what “right” looks like; you have a fast feedback loop (tests, plots, a REPL); the cost of being wrong is bounded; you want to read code rather than write it; or you are stuck and need an unstuck-er, not an oracle.

Sources

The two sessions drew on the following openly licensed material.

Source

Used for

CodeRefinery · Responsible Use of Generative AI in Assisted Coding · CC-BY-4.0 · DOI 10.5281/zenodo.19335927

The three scenarios; what leaves your machine

Carpentries Incubator · Coding with LLMs (novice) · CC-BY-4.0

R and RStudio framing

Southampton RSG · Coding with AI · CC-BY-4.0

What it is genuinely good at; error types

NL eScience Center / Carpentries Incubator · AI-assisted Coding

Prompting patterns

Wilkinson et al. 2016 · The FAIR Guiding Principles · Sci Data 3:160018

FAIR

Chue Hong et al. 2022 · FAIR Principles for Research Software (FAIR4RS) · DOI 10.15497/RDA00068

Software as research output

King et al. 2026 · Ten simple rules for using generative AI in research computing · PLOS Comp Biol

Provenance and disclosure (Rule 8)

METR 2025 · Randomised trial of AI on experienced developer productivity

Found experienced developers were slower with AI assistance while believing they were faster

Further reading suggested in the sessions: CodeRefinery — Coding with AI, the VS Code Copilot documentation, Posit — Copilot in RStudio, The Turing Way, Anthropic — Building effective agents, Simon Willison’s weblog, and CodeRefinery.