diarios
Skill0 starsChanged 4 months agoMITView on GitHub
Reference for the shared diarios Python module — API lookup, usage patterns, and gotchas. Use when writing code that involves court data, legal text parsing, Brazilian administrative data cleaning, or when checking if a utility already exists before writing a new one.
In this repository39 other files it gives its agents.
- anecdotesSkill
- backupSkill
- checkSkill
- cite-syncSkill
- dataSkill
- distill-styleSkill
- driveSkill
- dropboxSkill
- fetch-annotationsSkill
- findings-auditSkill
- findingsSkill
- gmailSkill
- handoffSkill
- howtoSkill
- hypothesisSkill
- iatSkill
- ideaSkill
- inboxSkill
- institutionsSkill
- literatureSkill
- llmkitSkill
- meetSkill
- memory-auditSkill
- new-pipelineSkill
- new-projectSkill
- nextSkill
- otterSkill
- outlookSkill
- questionsSkill
- referee-panelSkill
- siteSkill
- style-checkSkill
- style-reviewSkill
- style-reviseSkill
- tactiqSkill
- theorySkill
- validate-sectionSkill
- whatsappSkill
- zoomSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 14
Read $ROOT/research-kit/meta/diarios_api.md for the full module inventory.
- Distinctive: line 77
Do NOT duplicate diarios functionality: If you're about to write a function for cleaning CPFs, parsing case numbers, normalizing …
- Distinctive: line 87
Write a new text cleaning function for Brazilian data
- Very specific: line 94
Before writing new code, check if diarios already has the function you need.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
diarios Module Reference
The diarios package is a shared Python module used across projects for Brazilian court and administrative data processing. Always check here before writing new utility functions.
Quick API reference
The workspace root contains CLAUDE.md alongside projects/, pipelines/, diarios/, research/. If the current directory is inside a project or pipeline, search upward to find the root.
Read $ROOT/research-kit/meta/diarios_api.md for the full module inventory. Key areas:
Text & Data Cleaning (diarios.clean.text)
clean_text()— clean text (character removal, case, accents)map_regex()/remove_regexes()/extract_series()— regex utilitiesadd_leads_and_lags()— panel data lag/lead constructionread_csv()— CSV reader with sensible defaults
Number & ID Cleaning (diarios.clean.numbers)
clean_cnj_number()/is_cnj_number()— CNJ case number normalizationclean_reais()/parse_brl()— Brazilian currency parsingclean_cpf()— CPF tax ID cleaningclean_oab()— OAB lawyer number cleaningget_tribunal()/get_filing_year()— extract metadata from case numbers
Legal Domain (diarios.clean.legal)
clean_parte()/clean_parte_key()— party name cleaningclean_classe()— case class normalizationget_procedencia()/get_plaintiffwins()— outcome extractionload_datajud_jsonl()/normalize_datajud()— DataJud data loading
Geography (diarios.clean.geo)
TRT/TRFclasses — Regional Labor/Federal Court representationsclean_municipio()/get_municipio_id()— municipality normalizationclean_comarca()/clean_vara()— court jurisdiction cleaning
Court Parsing (diarios.parse)
CaseParserclass — parse court cases with customizable regexparse_diario_extract()— parse diary extractsinspect()— inspection utility
Court Docket Parsers (diarios.consulta)
consulta.TJSP—parse_consulta_tjsp_from_zip()consulta.STF—parse_consulta_stf()consulta.STJ—parse_consulta_stj()consulta.TRF1—parse_consulta_trf1()
Decision Parsing (diarios.decision)
DecisionParserclass — parse court rulings into structured components
Other
diarios.database—query(),insert(),connect()diarios.io—read_files(),extract_pdf_text(),ocr_file()diarios.politica—split_coalition(),get_district(),get_office_type()diarios.close_election—is_close()for RDD analysis
Common patterns
| When you need to... | Use... |
| Parse BRL currency | diarios.clean.numbers.clean_reais() |
| Normalize municipality names | diarios.clean.geo.clean_municipio() |
| Clean CNJ case numbers | diarios.clean.numbers.clean_cnj_number() |
| Clean party names | diarios.clean.legal.clean_parte() |
| Parse TJSP docket data | diarios.consulta.TJSP.parse_consulta_tjsp_from_zip() |
| Extract text from PDFs | diarios.io.extract_pdf_text() |
| Determine plaintiff win | diarios.clean.legal.get_plaintiffwins() |
| Add leads/lags to panel | diarios.clean.text.add_leads_and_lags() |
Gotchas
- Always import from the specific submodule, not top-level, for non-exported functions. E.g.,
from diarios.clean.numbers import clean_reais, notfrom diarios import clean_reais. - Top-level exports are limited to:
CaseParser, DiarioParser, parse_diario_extract, inspect, Extractor, query, normalize_datajud. Everything else requires submodule imports. - Do NOT duplicate diarios functionality. If you're about to write a function for cleaning CPFs, parsing case numbers, normalizing municipalities, etc. — check this reference first. The function almost certainly exists.
- Do NOT modify diarios unless the user explicitly instructs you to. If you find a bug or need an enhancement, flag it to the user.
- The module has optional dependencies:
ocr(pytesseract, pdf2image) anddb(SQLAlchemy). Code using these features needs the optional extras installed. map_regex()returns the first match — order patterns most-specific-first.clean_municipio()andclean_parte()handle accent removal internally via Unidecode — don't pre-clean accents before calling them.- For the full source code, read files in
$ROOT/packages/diarios/diarios/. For the API summary, read$ROOT/research-kit/meta/diarios_api.md.
When this skill triggers automatically
This skill should be consulted (even without explicit /diarios invocation) whenever you're about to:
- Write a new text cleaning function for Brazilian data
- Parse court case numbers or docket data
- Clean party names, CPFs, OAB numbers, or municipality names
- Work with DataJud data
- Extract text from PDFs or perform OCR
- Build panel data with leads/lags
Before writing new code, check if diarios already has the function you need.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

