📚 Educational Resource

Understanding AI Coding Agents

A comprehensive guide to AI coding assistants, skills, rules, and how they work together to supercharge your research workflow.

🤖

What Are AI Coding Agents?

AI coding agents are intelligent assistants that can read, understand, and write code. Unlike simple autocomplete tools, these agents can:

  • Understand context — Read your entire project structure, documentation, and existing code
  • Execute tasks autonomously — Run commands, create files, and make changes across multiple files
  • Follow instructions — Adhere to project-specific conventions and coding standards
  • Learn from feedback — Improve based on corrections and preferences you provide

Example: Using an AI Agent for Economics Research

$ claude > Analyze this panel dataset using a difference-in-differences approach with state and year fixed effects. Use robust standard errors clustered at the state level. ✓ Reading data from treatment_data.dta ✓ Generating Stata code with reghdfe ✓ Adding clustered standard errors ✓ Creating event study plot ✓ Exporting results to LaTeX table
🛠️

What Are Skills?

Skills are reusable instruction sets that teach AI agents how to perform specific tasks. Think of them as "expert knowledge packages" that you can plug into your agent.

The Agent Skills standard defines a portable format using SKILL.md files that work across multiple AI tools.

Without Skills

You must explain every detail each time: "Use Stata's reghdfe package with clustered standard errors, format output as LaTeX, follow AER style guidelines..."

With Skills

Just say: "Run a DiD analysis on this data" — the skill handles all the domain-specific knowledge automatically.

Skill Structure (SKILL.md)

A skill is a folder containing a SKILL.md file with metadata and instructions:

# Folder structure r-econometrics/ ├── SKILL.md # Required: instructions + metadata ├── scripts/ # Optional: helper scripts ├── references/ # Optional: documentation └── assets/ # Optional: templates, data
# Example SKILL.md --- name: r-econometrics description: Run econometric analyses in R using fixest, modelsummary workflow_stage: analysis compatibility: - claude-code - cursor - gemini-cli tags: [regression, panel-data, did] --- # R Econometrics ## Purpose Use this skill for econometric analysis in R, including difference-in-differences, instrumental variables, and regression discontinuity designs. ## Instructions 1. Use the fixest package for fixed effects estimation 2. Always report heteroskedasticity-robust standard errors 3. Create coefficient plots using ggplot2 4. Export tables in LaTeX format using modelsummary

How Skills Work: Progressive Disclosure

  1. Discovery — Agent loads only skill names and descriptions at startup
  2. Activation — When a task matches, the full instructions are loaded
  3. Execution — Agent follows instructions, using bundled scripts/assets as needed
📋

What Are Rules?

Rules are project-level configuration files that provide persistent instructions to AI agents. They define coding standards, project conventions, and preferences that should apply to all interactions.

🔧 Project Rules

Live in your repository. Shared with all contributors. Version controlled.

AGENTS.md

👤 Personal Rules

Apply to all your projects. Your individual preferences.

~/.claude/CLAUDE.md

🏢 Team Rules

Organization-wide standards managed by IT/DevOps.

Managed policies

What to Include in Rules

  • Build commands — How to install dependencies, run tests, build the project
  • Code style — Formatting preferences, naming conventions, patterns to use
  • Project structure — Where files should go, how modules are organized
  • Domain knowledge — Project-specific terminology, data sources, methodologies
  • Security rules — Files to never modify, secrets handling, compliance requirements

Example: Rules for an Economics Research Project

# AGENTS.md ## Project Overview This repository contains replication files for our JEL submission on minimum wage effects in developing countries. ## Data - Raw data is in `data/raw/` — NEVER modify these files - Processed data goes in `data/processed/` - All data cleaning must be reproducible via `make data` ## Code Style - Stata: Use `reghdfe` for fixed effects, cluster at state level - R: tidyverse style, use `fixest` for estimation - All tables in LaTeX format following AER guidelines ## Testing - Run `make test` before committing - Ensure all figures reproduce exactly
📄

AGENTS.md vs CLAUDE.md

Both are rule files, but they serve different purposes and have different scopes:

Aspect AGENTS.md CLAUDE.md
Scope Project-specific Personal (all projects)
Location Repository root ~/.claude/CLAUDE.md
Version Control ✓ Committed to git ✗ Local only
Shared With Team ✓ Yes ✗ No
Compatibility 60k+ projects, many agents Claude Code only
Best For Build commands, project structure, team conventions Personal preferences, communication style

💡 Pro Tip: Use Both

Put project-specific instructions (build commands, data handling) in AGENTS.md so your collaborators benefit too. Keep personal preferences (response style, your favorite packages) in CLAUDE.md.

Other Tool-Specific Files

Different tools may have their own configuration files that work alongside AGENTS.md:

  • .cursorrules — Cursor-specific rules (being unified with AGENTS.md)
  • .gemini/settings.json — Gemini CLI configuration
  • .github/copilot-instructions.md — GitHub Copilot instructions
🔀

Skills vs Subagents

These terms are sometimes confused, but they serve fundamentally different purposes:

🛠️ Skills

What: Instruction sets (text files) that teach an agent HOW to do something

Analogy: A recipe book — provides knowledge and procedures

When loaded: On-demand when relevant to the task

Execution: Main agent follows the instructions

🤖 Subagents

What: Separate AI instances spawned to handle specific subtasks

Analogy: Hiring a contractor — delegates work to another worker

When spawned: For parallelizable or isolated tasks

Execution: Independent agent runs, returns results

Example: When to Use Each

Use a Skill

"Run a DiD analysis following best practices"

→ The agent needs domain knowledge on HOW to do DiD correctly

Use a Subagent

"Search the codebase for all files that use this dataset"

→ An independent search task that can run in parallel

Use a Skill

"Format this regression output as a LaTeX table"

→ Needs knowledge of formatting conventions

Use a Subagent

"Read all 50 do-files and summarize what variables each creates"

→ Large, parallelizable reading task

Key Differences

Skills Subagents
Purpose Add knowledge Parallelize work
Context Shares main context Isolated context
Can edit files ✓ (via main agent) Usually read-only
Persistent ✓ Reusable files ✗ Ephemeral
🔗

How They Work Together

All these components form a hierarchy that guides how AI agents understand and work on your project:

Organization Level Managed Policies

Company-wide standards, security requirements

User Level ~/.claude/CLAUDE.md

Your personal preferences across all projects

Project Level AGENTS.md

Project rules, conventions, build commands

Task Level Skills (SKILL.md)

Domain expertise loaded on-demand

Immediate Your Prompt

Specific instructions for this task (highest priority)

Resolution Order

When instructions conflict, more specific ones win:

Your prompt > Nearest AGENTS.md > Project root AGENTS.md > User CLAUDE.md > Org policies

Real-World Example: Economics Research Workflow

1
You open your research project

Agent reads AGENTS.md: learns about your data structure, Stata conventions, and that raw data must never be modified.

2
You ask for a regression analysis

Agent activates the stata-econometrics skill: now knows to use reghdfe, cluster standard errors, and format output for AER.

3
You specify "use probit instead"

Your prompt overrides the skill's default of OLS — agent adapts while keeping all other conventions.

4
Agent spawns a subagent to search for similar regressions

Parallel search through your do-files to check for consistency with existing analyses.

📚

Resources & Documentation

Ready to Get Started?

Browse our curated collection of economics-specific AI skills.