Skip to content
Join our email list to get $100 off Ally. The code expires October 31 →
R for the Rest of Us Logo

Ally Lesson

Give your AI standing instructions with an AGENTS.md file

Free preview: first minute

In the video I open my instruction files with my {ally} package. Install it from GitHub, then run edit_agent_instructions():

# install.packages("pak")
pak::pak("rfortherestofus/ally")

ally::edit_agent_instructions()

Transcript

Click on the transcript to go to that point in the video. Please note that transcripts are auto generated and may contain minor inaccuracies.

I kept giving my AI agents the same instructions in every prompt, so I walked through setting up an AGENTS.md file instead. I showed the one we use for consulting projects, then opened my own global CLAUDE.md file to show how I split general instructions from project-specific ones.

You'll learn:

  • How to use an AGENTS.md file to give an agent standing instructions, such as always using the tidyverse, loading packages at the top of the file, and using the native pipe
  • A way to give an agent project context by adding a line in AGENTS.md that points it to the README file
  • How the naming differs across tools: Claude Code still uses CLAUDE.md for its global file, while AGENTS.md now works within a project
  • How to decide what goes in a global instruction file (writing style, how the agent talks to you, Git workflow, R preferences) versus a project-level file that teammates' agents will also follow

Tools mentioned: AGENTS.md, CLAUDE.md, Claude Code, Codex, Posit Assistant, {ally}, tidyverse, Git, GitHub

Key moments:

  • 00:03 Why repeating the same instructions to agents gets tedious
  • 00:36 Example AGENTS.md used for consulting projects
  • 01:16 Adding project context or pointing to a README
  • 01:44 Global AGENTS.md files and the CLAUDE.md naming confusion
  • 02:10 Opening instruction files with the {ally} package
  • 03:20 Walking through my global CLAUDE.md file
  • 04:45 Global instructions versus project-specific instructions