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
- § 1DiscussionDay 1 recap + framing today
- § 2LectureFour prompts I reach for most
- § 3LectureGetting the regression you want
- § 4WorkshopJoin the data and run the first regression
Talk to the agent about
Merge the data
- 1Load
complaints-complaints.csv(already indata/raw/from Day 1) and fetchcomplaints-accused.csvfrom the sameinvinst/chicago-police-datarepo intodata/raw/if you don't have it yet. - 2Ask 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. - 3Merge 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.
- 4The outcome: whether a complaint was sustained.
- 5The treatment: whether the complaint was filed by a CPD officer (vs by a civilian).
- 6Restrict the sample to rows where the complainant is clearly a civilian or a CPD officer.
- 7Add beat fixed effects.
- 8Cluster standard errors at the beat level.
- 9Report the coefficient, the standard error, N, and a one-sentence interpretation in plain English.
- 10Ask 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
- 1Inner 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. - 2Raw sustained share: 4.9% for civilian-filed complaints, 41.8% for officer-filed (no FE, no controls).
- 3Beat-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.
- 1Heterogeneity by complaint type. Ask the agent to add an interaction between
officer_filedandcomplaint_category. Where is the officer-vs-civilian gap largest? Where is it smallest? Discuss with the agent whether the heterogeneity matches your priors. - 2Alternative outcome. Re-run with
disciplinedas the outcome instead ofsustained(a stricter outcome). Or trydays_to_closureas a process outcome. Ask the agent: does the officer-vs-civilian gap show up the same way? What does it mean ifsustainedmoves butdisciplineddoesn't? - 3More data, more questions. Ask the agent to browse the
invinst/chicago-police-datarepo athttps://github.com/invinst/chicago-police-dataand 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.
- 1
- § 5LectureMemory
- § 6WorkshopProject memory file
Spec: what to ask the agent to do
- 1Ask 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.
- 2Answer 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.
- 3When 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.mdrather than embedding variable definitions. - 4If a
CLAUDE.mdorAGENTS.mdalready 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. - 5Approve the plan. Verify the file landed at the project root.
- 6Now 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.
- 7Cross-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
- 1File lives at the project root:
CLAUDE.md(Claude Code) orAGENTS.md(Codex). Not in your home directory. - 2Captures 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. - 3Links out to
codebook.mdfor variable definitions instead of embedding them.
Done early? Try one of these.
- 1Ask 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 treatsustainedas 0/1). Discuss with the agent which belong in the project file vs the global file, then add the project ones. - 2Have 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.
- 1
- § 7LectureSkills
- § 8WorkshopAuthor a table-formatting skill
Install pre-written skills
- 1Before 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.mddescriptions and summarize what each one does so you can decide what is worth having. - 2These work in either coding agent. Skills follow a shared open standard (the
SKILL.mdformat), 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. - 3If 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. - 4Optional, install only if they fit your own research:
docx(Word documents),pdf,pptx,xlsx(Excel files), or anything else you spotted in the repos. - 5Confirm 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 runclaudeorcodex.
Write your own table-formatting skill
- 1Ask 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)beatfixed effects, (3)beatpluscomplaint_categoryfixed effects. (Remember to use plan mode and have it interview you!) - 2Ask 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.
- 3Ask the agent to use Quarto to render
table_1.mdtotable_1.docx. Open the.docxin 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.
- 4Ask 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-creatorskill you installed. Remember to tell the agent to make a plan first! - 5Tell the agent where the skill should live:
~/.claude/skills/format-regression-table/(Claude Code) or~/.agents/skills/format-regression-table/(Codex). - 6Confirm 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." - 7Test 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)beatfixed effects, (3)beatpluscomplaint_categoryfixed 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 withcd path/to/project, and then typingclaudeorcodex.
Done early? Try one of these.
- 1Open the source file the agent produced (the
.qmdif you used Quarto, or the.texif 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. - 2Do 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. - 3Go 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.
- 1
- § 9LectureWhat goes in a figure skill
- § 10WorkshopAuthor a figure-formatting skill
Write your own figure-formatting skill
- 1Ask 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)
beatfixed effects, (3)beatpluscomplaint_categoryfixed effects. Show each estimate as a point with its 95% confidence interval. Save it asresults/figures/fig_officer_filed.pdfand.png. Iterate until you like it: theme, axis labels, caption, chart type, colors. (Remember to use plan mode and have it interview you!) - 2Once 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-creatorskill you installed. Remember to tell the agent to make a plan first! - 3Tell the agent where the skill should live:
~/.claude/skills/format-figure/(Claude Code) or~/.agents/skills/format-figure/(Codex). - 4Confirm 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." - 5Test 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 withcd path/to/project, and then typingclaudeorcodex.
Done early? Try one of these.
- 1Brainstorm 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.
- 2Make 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.
- 1
- § 11LectureDrafting prose with the agent
- § 12WorkshopWrite 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.
- 1Tell 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. - 2Spec 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.
- 3Have the agent embed the §4 table and §10 figure by reference (not by retyping the numbers). Quarto handles
.pngand Markdown tables natively, so the embedded inputs render inline. - 4Ask the agent to render
paper.qmdto.docx. - 5Ask the agent to open
paper.docx, then confirm: table and figure appear inline, the coefficient in the prose matchesresults/tables/table_1.md, the structure follows the spec.
Optional (if time): a skill that writes in your voice
- 1Gather samples of your own academic writing: term papers, paper drafts, published papers. Drop them in a folder.
- 2Ask 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.
- 3Have 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.
- 4Give 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.
- 5Test 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.mdorAGENTS.mdso the agent writes this way by default.
- 1
- § 13DiscussionDebrief + Day 3 preview