skills/bluebook-audit/skills/audit-correct/SKILL.md
Phase 4: Apply corrections to DOCX
npx skillsauth add edwinhu/workflows audit-correctInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Apply approved corrections to the DOCX file via lxml XML manipulation.
[_] placeholders)
b. Small caps for journal/periodical names (run-splitting)
c. Small caps for book titles (italic -> small caps)
d. Signal italic fixes
e. Id. chain corrections
f. Terminal period additions
g. Other typeface fixesWhen formatting a substring within a larger run:
rPr from original run via deepcopyxml:space="preserve" on all <w:t> elementsAll search operations MUST handle \xa0 (non-breaking space):
def find_in_run(text, target):
if target in text:
return text.find(target)
nbsp_target = target.replace(' ', '\xa0')
if nbsp_target in text:
return text.find(nbsp_target)
# Try regex with [\s\xa0] for mixed
import re
pattern = re.escape(target).replace(r'\ ', r'[\s\xa0]')
m = re.search(pattern, text)
return m.start() if m else -1
The run after <w:footnoteRef/> often contains the full footnote text, not just a space. When replacing entire footnote content, keep ONLY the footnoteRef run and add an explicit space run.
supra note 10 spans italic + roman runs. Target the specific run containing the text you need to change (e.g., just "note 10" in the roman run).
Some footnotes need multiple formatting changes in the same run (e.g., FN91: italic the letter title AND small-caps the annual report title, both in one roman run). Process splits sequentially left-to-right:
find_run() search re-scans the footnote element each time, so it finds the new runsExample: Jamie Dimon, Chairman & CEO Letter to Shareholders, in JPMorgan Chase & Co., 2023 Annual Report 1 (2024)
After all substantive fixes, clean up trailing/leading spaces in italic runs. Word displays these fine, but they cause Gemini annotation issues on re-audit:
# Find italic runs with trailing spaces
if text.endswith(' ') and is_italic:
t.text = text.rstrip(' ')
# Insert a new roman space run after
<EXTREMELY-IMPORTANT>
## Iron Law: Verify Every Fix
After each category of corrections, verify the fix was applied by reading back the modified XML. Silent failures from NBSP, run boundaries, or wrong-run targeting are common.
Skipping read-back verification is NOT HELPFUL — silent failures from NBSP or run boundaries mean the user's document still has errors. </EXTREMELY-IMPORTANT>
Before proceeding to Verify phase:
Read ${CLAUDE_SKILL_DIR}/../../../../skills/bluebook-audit/skills/audit-verify/SKILL.md and follow its instructions.
development
Build the meeting-level proxy-voting × ownership panel on the WRDS SGE grid — ISS N-PX fund votes reduced to (item × block) direction cells, joined to institutional and mutual-fund ownership. Use when working with risk.voteanalysis_npx, N-PX fund-level votes, ISS→CRSP fund linking, index/passive/active voting blocks, or a proxy-voting panel that needs ownership attached.
development
Use when "CRSP CIZ", "CRSP v2", "CRSP flat file format 2.0", "crsp.dsf_v2 / msf_v2", "StkDlySecurityData", "StkMthSecurityData", "StkSecurityInfoHist", "stocknames_v2", "DlyRet / MthRet / DlyPrc / MthPrc", "SHRCD or EXCHCD equivalent in new CRSP", "SIZ to CIZ migration", "CRSP data after 2024", "CRSP delisting returns", "CRSP cumulative adjustment factors", "CRSP index INDNO / INDFAM", or any CRSP stock/index query where the legacy SIZ column names no longer exist.
development
Use when linking or deduping datasets by entity name rather than a shared key — 'fuzzy match', 'fuzzy name matching', 'entity resolution', 'record linkage', 'match company/person names', 'dedupe entity names', 'name-based join', 'bridge identifiers' (CIK ↔ permno ↔ gvkey ↔ wficn ↔ EIN ↔ personid), or any use of char n-gram TF-IDF, cosine similarity on names, `sparse_dot_topn`, or RapidFuzz at scale.
development
Use when building a publication-quality table in Python — 'regression table', 'results table', 'summary statistics table', 'etable', 'coefplot', 'great_tables', 'GT', 'gt table', 'format a table for the paper', 'export table to LaTeX/HTML', significance stars, spanners, or column formatting for a table headed into a paper, slide deck, or notebook.