extract-statistic
Skill8 starsChanged 2 months agoMITView on GitHub
Statistical analysis skill with two modes. Mode audit: review the statistics of one manuscript (.tex/.md) — test selection, assumptions, effect size, presentation, and cross-validation between text, tables, and figures — and emit flagged findings for the host agent's plan. Mode mine: extract the reported statistics from the full-text PDFs of a corpus (download via download_pdf.py, parse via extract_text.py) and synthesize a corpus statistics table plus a statistical-improvement opportunity list. Used inside paper-auditor and thesis-auditor (audit) and scopus-researcher (mine). Engineering-default domain profiles with a selectable cosmetic profile. Trigger when an agent reaches its statistical-audit or corpus-statistics step.
- Reads credentials
In this repository47 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .claude/skills/AGENTS.mdAGENTS.md
- .claude/CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- aider-setupSkill
- deliberationSkill
- drawio2tikzSkill
- extract-contributionsSkill
- extract-futureworksSkill
- extract-paper-ideaSkill
- extract-statisticSkill
- form-serviceSkill
- geolocalisationSkill
- latex-hygieneSkill
- loop-engineerSkill
- narrative-cvSkill
- obsidian-cliSkill
- opt-local-stt-vramSkill
- opt-local-vram-llmSkill
- paper2talkSkill
- recommendation-letterSkill
- rt-observeSkill
- scholar-evaluationSkill
- scientific-writingSkill
- scopusSkill
- word2latexSkill
- aider-setupSkill
- deliberationSkill
- drawio2tikzSkill
- extract-contributionsSkill
- extract-futureworksSkill
- extract-paper-ideaSkill
- form-serviceSkill
- geolocalisationSkill
- latex-hygieneSkill
- loop-engineerSkill
- narrative-cvSkill
- obsidian-cliSkill
- opt-local-stt-vramSkill
- opt-local-vram-llmSkill
- paper2talkSkill
- recommendation-letterSkill
- rt-observeSkill
- scholar-evaluationSkill
- scientific-writingSkill
- scopusSkill
- word2latexSkill
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 65
Ensure each retained paper's PDF is present — call .claude/skills/scopus/scripts/download_pdf.py (presence-gated.
- Very specific: line 130
Every hit returns the source citekey, the page, and the verbatim passage, so a human verifies before use.
- Distinctive: line 160
Never fabricate a statistic, a p-value, or a sample size.
- Distinctive: line 162
Do not flag a stylistic preference (SD vs SEM) unless it is inconsistent within the manuscript or violates the stated protocol.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 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
Statistical analysis (audit + corpus mining)
A reusable statistical-analysis capability invoked by the academic agents. It has two modes, one input contract each, and a strict boundary: it produces findings, the host agent judges them through its own deliberation step. The full pipeline and flag catalogue live in references/statistical-audit-protocol.md; the domain checks live in references/domain-profiles.md. Read both before using this skill. This file is the entry point and contract.
When to use
- Mode
audit— a host auditor (paper-auditor, thesis-auditor) has parsed a manuscript and reaches its statistical-audit step. The skill audits every statistical claim already in that manuscript. - Mode
mine— scopus-researcher has downloaded the corpus PDFs (Step 3b-PDF) and wants the reported statistics of those papers extracted and synthesized, so the gap map, Pareto matrix, and hypotheses target real statistical and methodological improvement opportunities for the next research project.
When NOT to use
- As a standalone command typed by the user. The skill is invoked by the agents at their statistical step, not directly. (It still runs if a user points it at a file, but its outputs are designed to feed a host pipeline.)
- On a thesis proposal: a proposal carries no results, so [thesis-proposal-auditor] does not embed it.
- For broad statistical methodology tutoring unanchored to a manuscript or a corpus.
Cross-review boundary (do not run deliberation here)
This skill does not run a deliberation panel and does not call gemini_reviewer.py or
github_reviewer.py. The host agents already run the mandatory deliberation
step once on their near-final output; the statistical findings produced here are merged into the host
plan and critiqued there. This is the single place cross-review happens — keeping one panel per run.
Modes
Mode audit — one manuscript's own statistics
- Input: a
.texor.mdmanuscript path (+ a sibling.bib, + an optionaldata/folder for ground-truth cross-validation). Resolve\input{}/\include{}recursively (up to 3 levels) and audit the merged document, exactly as the host auditors merge their input. - Pipeline (see the protocol reference): statistical inventory -> test-selection audit ->
effect-size / power audit -> result-presentation audit -> cross-validation (text vs tables vs
figures vs
data/) -> domain checks for the active profile. - Domain profile:
--profile engineering(default) or--profile cosmetic, or auto-detected from the manuscript (see references/domain-profiles.md). - Output:
<basename>_stats_report.mdnext to the manuscript (orstats_report_<YYYY-MM-DD>.mdin the working directory for pasted text).- A list of
[STATS …]flags the host folds into its plan (paper-auditor Section C subsection, thesis-auditor Section G).
- Never modify the manuscript directly. Corrections are applied by the host plan /
latex-writer.
Mode mine — corpus statistics from full-text PDFs
- Input: a
.bib(preferred) or an existingrefs/directory /refs/_manifest.json. - Steps:
- Ensure each retained paper's PDF is present — call
.claude/skills/scopus/scripts/download_pdf.py(presence-gated; skips PDFs already inrefs/). - Parse every present PDF with
scripts/extract_text.py(--stats-scanon) to get text, tables, and statistics candidates. - Synthesize a corpus statistics table (dominant datasets + sample sizes, methods, metrics, evaluation protocols, reported effect / accuracy deltas) and a statistical-improvement opportunity list (for example: no paper reports variance over seeds; accuracy used on imbalanced data; no significance test on model-vs-model deltas; no effect size on benchmark gains).
- Ensure each retained paper's PDF is present — call
- Presence-gated: a paper whose PDF failed to download (listed in
refs/_failed.md) contributes title/abstract-level statistics only and is flagged[STATS PDF-MISSING]; it never blocks the pipeline. - Output:
<basename>_corpus_stats.md(human-readable table + opportunity list) and<basename>_corpus_stats.json(machine-readable, consumed by scopus-researcher). These route into scopus-researcher Step 9b (gap map), Step 9d (Pareto contribution columns), and Step 10 (hypotheses).
Prerequisites
- PyMuPDF importable for
minemode PDF parsing -pymupdf4llm(LLM-ready Markdown, tables inline) andpymupdf(structuredfind_tables); both AGPL-3.0 (seescripts/requirements.txt, audited with pip-audit). A missing import disables PDF parsing; the mode degrades to abstract-level stats and flags it. - For PDF retrieval in
minemode:.claude/skills/scopus/scripts/download_pdf.pyreachable, andSCOPUS_API_KEYfor the Elsevier source (the Semantic Scholar open-access fallback works without it). - For reporting-guideline / standard lookups during the audit:
scopus_api.pyreachable. A network error is flagged[SCOPUS UNAVAILABLE]and the audit proceeds without references.
Invocation
# Mode audit (host auditor):
python ".claude/skills/extract-statistic/scripts/extract_text.py" text "<manuscript.tex>" --stats-scan
# then apply the pipeline in references/statistical-audit-protocol.md and write <basename>_stats_report.md
# Mode mine (scopus-researcher, after Step 3b-PDF):
python ".claude/skills/scopus/scripts/download_pdf.py" bib "<corpus.bib>" --latex "<main.tex>"
python ".claude/skills/extract-statistic/scripts/extract_text.py" bib "<corpus.bib>" --latex "<main.tex>" --stats-scan
# then synthesize <basename>_corpus_stats.md + .jsonParse cache
parse_cache.py caches the expensive PDF parse keyed by the source SHA-256, as
<name>.parsed.md plus a <name>.parsed.meta.json sidecar. parse_one reads
through it, so a repeated statistics scan or future-works scan on an unchanged
file costs no parse. The cache is additive: scan_sections() and scan_stats()
are unchanged and a cache miss behaves exactly as before.
Corpus index (opt-in)
corpus_index.py indexes a corpus for ad-hoc cross-corpus retrieval.
python .claude/skills/extract-statistic/scripts/corpus_index.py build --bib <corpus.bib>
python .claude/skills/extract-statistic/scripts/corpus_index.py query "<question>" --top 8
python .claude/skills/extract-statistic/scripts/corpus_index.py statusFour rules, none negotiable:
- Strictly additive.
scan_sections()andscan_stats()are not modified and remain the sole source for the statistics and future-works pipelines. The index never feeds them. - Every hit returns the source citekey, the page, and the verbatim passage, so
a human verifies before use. Same provenance contract as
geolocalisation. - The build is opt-in and never runs implicitly inside another skill.
- A retrieval hit is never a citation. A passage surfaced by similarity still passes the normal Scopus validation gate before entering any document.
The embedder is injected and defaults to the local Ollama endpoint on
127.0.0.1, so no corpus text leaves the machine. The store is the pgvector
Postgres of deploy/docker-compose.yml; set CORPUS_INDEX_DSN to reach it.
Resources
scripts/extract_text.py— PDF / HTML / plaintext extraction + a statistics-candidate scan; reusesdownload_pdf.pyfor retrieval (it does not reimplement downloading).scripts/parse_cache.py— content-addressed parse cache, additive.scripts/corpus_index.py— opt-in chunk, embed, pgvector store; injected embedder so tests stay offline.scripts/requirements.txt—pymupdf4llm+pymupdffloors with the pip-audit and AGPL note, plus the optionalpsycopg/pgvectorpins for the corpus index (both degrade gracefully when absent).references/statistical-audit-protocol.md— the six-step audit pipeline, flag catalogue, output format, and key rules.references/domain-profiles.md— theengineering(default) andcosmeticdomain-check profiles and the auto-detection rule.
Key rules
- Respond in the manuscript's language (French if the manuscript is French, English if English).
- Anti-AI-style hygiene follows
.claude/skills/scientific-writing/references/writing_principles.md(canonical), not an inline copy: no em dashes, straight quotes only, no zero-width characters, no AI transition phrases, no overly perfect lists. Target an AI-style risk score below 10%. - Never fabricate a statistic, a p-value, or a sample size; if the source does not state it, mark it missing.
- Do not flag a stylistic preference (SD vs SEM) unless it is inconsistent within the manuscript or violates the stated protocol.
- Domain flags apply only when the relevant study type is detected (the active profile gates them).
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.

