workshop / day-2

Day 2 · Tuesday, 2 June 2026

Working with Data

Deliverable
First regression script + project memory file + table-formatting skill + figure-formatting skill + Quarto memo rendered to .docx.

Slides

Open deck in presentation mode ↗

Agenda

  1. § 1
    Day 1 recap + framing today
    Discussion
  2. § 2
    Four prompts I reach for most
    Lecture
  3. § 3
    Getting the regression you want
    Lecture
  4. § 4
    Join the data and run the first regression

    Talk to the agent about

    Merge the data

    1. 1
      Load complaints-complaints.csv (already in data/raw/ from Day 1) and fetch complaints-accused.csv from the same invinst/chicago-police-data repo into data/raw/ if you don't have it yet.
    2. 2
      Ask the agent to go find, download, and read the codebook to figure out what column to merge on. If it can't find the codebook, it is at https://github.com/invinst/chicago-police-data/blob/master/data/unified_data/data-dictionary/data-dictionary.yaml.
    3. 3
      Merge the two files. Ask the agent to report row counts before and after, and the merge type (one-to-one, one-to-many, many-to-many).

    Run your first regression

    The question: are complaints filed by a CPD officer more likely to be sustained than complaints filed by a civilian? You'll fit a linear probability model with beat fixed effects to find out.

    1. 4
      The outcome: whether a complaint was sustained.
    2. 5
      The treatment: whether the complaint was filed by a CPD officer (vs by a civilian).
    3. 6
      Restrict the sample to rows where the complainant is clearly a civilian or a CPD officer.
    4. 7
      Add beat fixed effects.
    5. 8
      Cluster standard errors at the beat level.
    6. 9
      Report the coefficient, the standard error, N, and a one-sentence interpretation in plain English.
    7. 10
      Ask the agent to confirm that it actually clustered standard errors at beat (and not, say, heteroskedasticity-robust). Push back if it quietly fell back to robust, and ask it to re-run with clustering.

    Answer key: check your numbers

    1. 1
      Inner merge on cr_id: 263,315 merged rows; 38.2% of complaints have no accused-officer record and drop out. Zero accused rows are unmatched.
    2. 2
      Raw sustained share: 4.9% for civilian-filed complaints, 41.8% for officer-filed (no FE, no controls).
    3. 3
      Beat-FE regression: coefficient on officer_filed = 0.345, SE = 0.012, t = 28.1, N = 154,457. Officer-filed complaints are about 34.5 percentage points more likely to be sustained than civilian-filed complaints within the same beat.
    Done early? Try one of these.
    1. 1
      Heterogeneity by complaint type. Ask the agent to add an interaction between officer_filed and complaint_category. Where is the officer-vs-civilian gap largest? Where is it smallest? Discuss with the agent whether the heterogeneity matches your priors.
    2. 2
      Alternative outcome. Re-run with disciplined as the outcome instead of sustained (a stricter outcome). Or try days_to_closure as a process outcome. Ask the agent: does the officer-vs-civilian gap show up the same way? What does it mean if sustained moves but disciplined doesn't?
    3. 3
      More data, more questions. Ask the agent to browse the invinst/chicago-police-data repo at https://github.com/invinst/chicago-police-data and describe what other tables are available. Pick one that interests you, ask the agent to download and join it, then brainstorm together which research questions you can now answer that you couldn't with just the complaints data.
    Workshop
  5. § 5
    Memory
    Lecture
  6. § 6
    Project memory file

    Spec: what to ask the agent to do

    1. 1
      Ask the agent to interview you about this project so it can draft a project memory file. List the topics: data files and keys, outcome variable, treatment variable, sample restrictions, identification strategy, fixed effects, what to cluster standard errors at, data integrity habits (like reporting N before and after every join), anything else worth standing-rule status. For each question, ask the agent to propose its own recommendation with a short justification before you answer, so you have a default to react to.
    2. 2
      Answer one question at a time. If you don't know the answer, ask the agent to research it and make suggestions. If the agent tries to write the file before finishing the interview, push back: ask it to keep interviewing.
    3. 3
      When the interview is done, ask the agent to make a plan before writing. Confirm: file path at project root (not your home directory), section structure, and that it links out to codebook.md rather than embedding variable definitions.
    4. 4
      If a CLAUDE.md or AGENTS.md already exists at the project root, tell the agent to read it first and incorporate the existing rules into the new version rather than overwriting them. Ask to see the full proposed final file before approving.
    5. 5
      Approve the plan. Verify the file landed at the project root.
    6. 6
      Now stress-test the file: ask the agent to summarize which rules it now considers binding for this project, in its own words. If the agent doesn't see the file at all, check the path. If a rule's restatement doesn't match what you wrote, the rule is too vague; fix it.
    7. 7
      Cross-check against your global memory file. If anything is restated from the global, ask the agent where the rule should be.

    What good looks like

    1. 1
      File lives at the project root: CLAUDE.md (Claude Code) or AGENTS.md (Codex). Not in your home directory.
    2. 2
      Captures the workshop conventions: cr_id is the complaint key; sustained is 0/1; cluster SE at beat; exclude blank complainant_type; report N before and after every join.
    3. 3
      Links out to codebook.md for variable definitions instead of embedding them.
    Done early? Try one of these.
    1. 1
      Ask the agent to look back at the §4 regression workflow and propose additional rules that should have been in the project memory file but weren't (e.g., always exclude blank complainant_type, always cluster at beat, always treat sustained as 0/1). Discuss with the agent which belong in the project file vs the global file, then add the project ones.
    2. 2
      Have the agent compare your project file against your global file and flag anything restated (preferred language, regression package, output format, etc.). For each duplicate, decide whether it belongs in the project file or the global one, and remove it from the other.
    Workshop
  7. § 7
    Skills
    Lecture
  8. § 8
    Author a table-formatting skill

    Install pre-written skills

    1. 1
      Before you build your own, see what already exists. Browse the official skill collections with your agent: github.com/anthropics/skills and github.com/openai/skills. Ask the agent to read the SKILL.md descriptions and summarize what each one does so you can decide what is worth having.
    2. 2
      These work in either coding agent. Skills follow a shared open standard (the SKILL.md format), so a skill written for Claude Code also works in Codex and vice versa: you just place it in that agent's skills directory. A few Claude Code-only options do not carry over, but plain skills like these do.
    3. 3
      If you only install one, I recommend skill-creator. It helps you write new skills, which is exactly what you do in the next step. Install it into your user skills directory (~/.claude/skills/ for Claude Code, ~/.agents/skills/ for Codex), and have the agent make a plan before installing.
    4. 4
      Optional, install only if they fit your own research: docx (Word documents), pdf, pptx, xlsx (Excel files), or anything else you spotted in the repos.
    5. 5
      Confirm it took: in a fresh session, ask the agent which skills it now has and when it would use each. The answer should match the skills' description: lines. Start a fresh session by typing /clear, or open a new terminal, cd path/to/project, and run claude or codex.

    Write your own table-formatting skill

    1. 1
      Ask the agent to fit three regressions in R of whether a complaint is sustained on whether the officer filed it, all with SE clustered at beat: (1) no fixed effects, (2) beat fixed effects, (3) beat plus complaint_category fixed effects. (Remember to use plan mode and have it interview you!)
    2. 2
      Ask the agent to combine the three results into a single publication-style regression table with one column per spec. Save it as results/tables/table_1.md.

    Quarto renders to both PDF and Word. These two tracks pair Quarto with Word and LaTeX with PDF; pick the one you will use.

    1. 3
      Ask the agent to use Quarto to render table_1.md to table_1.docx. Open the .docx in Word and ask the agent to fix anything you don't like about the formatting. For example, do you like standard errors, p-values, and/or confidence intervals below your coefficients? Do you like p<=0.05 or p<=0.10? Do you want to include R-squared in your tables? etc.
    1. 4
      Ask the agent to author a skill that encodes those formatting choices so the next regression table will look like the one you just made; the agent can lean on the skill-creator skill you installed. Remember to tell the agent to make a plan first!
    2. 5
      Tell the agent where the skill should live: ~/.claude/skills/format-regression-table/ (Claude Code) or ~/.agents/skills/format-regression-table/ (Codex).
    3. 6
      Confirm the skill has a clear description: so the agent can decide when to use it. For example: "Create, revise, or render publication-style regression tables. Use when the user asks for regression tables or model comparison tables."
    4. 7
      Test in a fresh session: ask the agent to fit three regressions of whether a complaint is sustained on the year it was filed, all with SE clustered at beat: (1) no fixed effects, (2) beat fixed effects, (3) beat plus complaint_category fixed effects, then produce a formatted regression table. It should follow your formatting without you restating the rules. Start a fresh session either by typing /clear, or by opening a new terminal window, navigating to the project directory with cd path/to/project, and then typing claude or codex.
    Done early? Try one of these.
    1. 1
      Open the source file the agent produced (the .qmd if you used Quarto, or the .tex if you used LaTeX). If you've never seen one before, ask the agent to walk you through it line by line: what does each block do, what would change if you wanted a different layout, where does the rendered table actually get inserted. The point is to leave with a working mental model of the file, not just a rendered output.
    2. 2
      Do the same exercise with the other format. If you used Quarto for the workshop, ask the agent to redo the table in LaTeX (.tex). If you used LaTeX, ask for the Quarto (.qmd) version. Then open both side by side and compare: what's nicer about each, what's clunkier, which one you'd reach for first next time.
    3. 3
      Go find more skills you'll actually use. Beyond the two official repos (github.com/anthropics/skills and github.com/openai/skills), community catalogs collect them: claudemarketplaces.com/skills and awesomeskill.ai. Pick a few that fit your research, have the agent install them, then confirm in a fresh session that it knows when to use each.
    Workshop
  9. § 9
    What goes in a figure skill
    Lecture
  10. § 10
    Author a figure-formatting skill

    Write your own figure-formatting skill

    1. 1
      Ask the agent to make one publication-quality coefficient plot in R showing all three regressions of whether a complaint is sustained on whether the officer filed it: (1) no fixed effects, (2) beat fixed effects, (3) beat plus complaint_category fixed effects. Show each estimate as a point with its 95% confidence interval. Save it as results/figures/fig_officer_filed.pdf and .png. Iterate until you like it: theme, axis labels, caption, chart type, colors. (Remember to use plan mode and have it interview you!)
    2. 2
      Once the figure looks right, ask the agent to author a skill that encodes those standing defaults so the next figure starts from this style; the agent can lean on the skill-creator skill you installed. Remember to tell the agent to make a plan first!
    3. 3
      Tell the agent where the skill should live: ~/.claude/skills/format-figure/ (Claude Code) or ~/.agents/skills/format-figure/ (Codex).
    4. 4
      Confirm the skill has a clear description: so the agent can decide when to use it. It should name figures (not tables) and the formatting it produces. For example: "Create and format publication-quality figures. Use when the user asks for a figure, a plot, or a coefficient plot."
    5. 5
      Test in a fresh session: ask the agent for a different figure (e.g., the raw share of complaints sustained, broken out by complainant type) and check that it follows your theme, saves both formats, and labels axes in words without you restating the rules. Start a fresh session either by typing /clear, or by opening a new terminal window, navigating to the project directory with cd path/to/project, and then typing claude or codex.
    Done early? Try one of these.
    1. 1
      Brainstorm with the agent: ask it to suggest several interesting figures you could make from the complaints data, then pick a couple and have it build them. To go further, have the agent download more of the data from the same Invisible Institute repo so you have more variables to explore. Let your figure skill handle the formatting.
    2. 2
      Make more skills. Anything you format or check the same way every time is a skill candidate. Examples: a descriptive-statistics ("Table 1") skill; an event-study figure skill; or a data-cleaning audit skill that reports row counts, key uniqueness, and the non-match rate after every merge. Pick one and build it.
    Workshop
  11. § 11
    Drafting prose with the agent
    Lecture
  12. § 12
    Write and compile your draft

    Spec: what to ask the agent to do

    Quarto renders to both PDF and Word. These two tracks pair Quarto with Word and LaTeX with PDF; pick the one you will use.

    1. 1
      Tell the agent you want a short Quarto document (paper.qmd) that renders to .docx. Inputs available: the §4 regression script, results/tables/table_1.md, results/figures/fig_officer_filed.png.
    2. 2
      Spec the structure before the agent writes: a one-sentence framing of the question, one paragraph on the data and sample, one paragraph on the spec, one paragraph on the result with the §4 coefficient and SE, one paragraph on caveats. Make the document about 2 pages.
    3. 3
      Have the agent embed the §4 table and §10 figure by reference (not by retyping the numbers). Quarto handles .png and Markdown tables natively, so the embedded inputs render inline.
    4. 4
      Ask the agent to render paper.qmd to .docx.
    5. 5
      Ask the agent to open paper.docx, then confirm: table and figure appear inline, the coefficient in the prose matches results/tables/table_1.md, the structure follows the spec.
    Optional (if time): a skill that writes in your voice
    1. 1
      Gather samples of your own academic writing: term papers, paper drafts, published papers. Drop them in a folder.
    2. 2
      Ask the agent to read them and describe your voice back to you: sentence length and rhythm, how you build an argument, words you favor, things you never do. Push back until the description actually sounds like you.
    3. 3
      Have the agent author a skill that drafts prose in your voice, referencing those samples as examples. Make it plan first, and tell it to interview you.
    4. 4
      Give the skill a list of words and tics to avoid. Point the agent at a catalog of AI tells, for example Wikipedia's Signs of AI writing, or a ready-made humanizer skill such as github.com/blader/humanizer. Add your own banned words on top.
    5. 5
      Test it: ask for a paragraph on something you know well and check whether it reads like you. Edit the draft until it sounds right, then hand the agent both versions and ask it to update the skill from the differences between them. Iterate the skill, not the paragraph. Once it is good, reference it from your CLAUDE.md or AGENTS.md so the agent writes this way by default.
    Workshop
  13. § 13
    Debrief + Day 3 preview
    Discussion

← All days