claw-semantic-sim
Semantic Similarity Index for disease research literature using PubMedBERT embeddings
What this skill does
# ๐ฆ Semantic Similarity Index Measure how isolated or connected disease research is across the global biomedical literature, using PubMedBERT embeddings on PubMed abstracts spanning 175 GBD diseases. ## What it does 1. Takes a disease list (GBD taxonomy) as input 2. Retrieves PubMed abstracts (2000-2025) for each disease with quality filtering 3. Generates 768-dimensional PubMedBERT embeddings for every abstract 4. Computes four semantic equity metrics per disease: - **Semantic Isolation Index (SII)**: average cosine distance to k-nearest disease neighbours; higher = more isolated, less connected research - **Knowledge Transfer Potential (KTP)**: cross-disease centroid similarity; higher = more potential for research spillover - **Research Clustering Coefficient (RCC)**: within-disease embedding variance; higher = more diverse research approaches - **Temporal Semantic Drift**: cosine distance between yearly centroids; measures how research focus evolves 5. Generates publication-quality multi-panel figures: - **Panel A**: Semantic isolation by disease category (boxplot) - **Panel B**: Top 20 most semantically isolated diseases (bar chart, NTD/Global South colour-coded) - **Panel C**: Semantic isolation vs research volume (scatter with regression) - **Panel D**: NTD vs non-NTD significance test (Welch's t-test, Cohen's d) 6. Produces a markdown report with all metrics, rankings, and reproducibility bundle ## Why this exists If you ask ChatGPT to "measure research neglect for diseases," it will: - Not know which embedding model to use for biomedical text - Hallucinate metrics that sound plausible but have no methodological grounding - Skip quality filtering (year coverage, abstract coverage, minimum papers) - Not handle MPS acceleration or checkpointed batch processing - Produce a single scatter plot with no disease classification This skill encodes the correct methodological decisions: - Uses PubMedBERT (the gold-standard biomedical language model) - Fetches from PubMed with exponential backoff and NCBI rate limiting - Quality filters: year coverage >= 70%, abstract coverage >= 95%, minimum 50 papers - Batch embedding with Apple MPS acceleration and CPU fallback - Checkpointed processing (resume after interruption) - HDF5 storage with gzip compression and SHA-256 checksums - Classification against WHO NTD list and Global South priority diseases - Statistical significance testing (Welch's t-test, Cohen's d) ## Key Finding Neglected tropical diseases (NTDs) are significantly more semantically isolated than other conditions (P < 0.001, Cohen's d = 0.8+). They exist in knowledge silos with limited cross-disciplinary research bridges. The 25 most isolated diseases are disproportionately Global South priority conditions. ## Pipeline ``` 05-00-heim-sem-setup.py # Validate environment, create directories 05-01-heim-sem-fetch.py # Retrieve PubMed abstracts (checkpointed) 05-02-heim-sem-embed.py # Generate PubMedBERT embeddings (MPS/CPU) 05-03-heim-sem-compute.py # Compute SII, KTP, RCC, temporal drift 05-04-heim-sem-figures.py # Generate publication figures 05-05-heim-sem-integrate.py # Merge with biobank + clinical trial dimensions ``` ### Demo (works out of the box) ```bash python semantic_sim.py --demo --output demo_report ``` The demo uses pre-computed embeddings and metrics for 175 GBD diseases and generates the full 4-panel figure instantly. ## Example Output ``` Semantic Similarity Index ========================= Diseases analysed: 175 Total PubMed abstracts: 13,100,000 Embedding model: PubMedBERT (768-dim) Metric Ranges: SII: 0.0412 - 0.1893 KTP: 0.6234 - 0.9187 RCC: 0.0891 - 0.3421 Key Finding: NTDs show +38% higher semantic isolation P < 0.0001, Cohen's d = 0.84 14/25 most isolated diseases are Global South priority Figures saved to: demo_report/ Fig5_Semantic_Structure.png (300 dpi) Fig5_Semantic_Structure.pdf (vector) Reproducibility: commands.sh | environment.yml | checksums.sha256 ``` ## Interpretation Guide - **High SII**: Disease research exists in a knowledge silo; limited cross-disciplinary bridges - **Low KTP**: Research on this disease has few methodological overlaps with others - **High RCC**: Diverse research approaches within the disease (many subtopics) - **High Temporal Drift**: Research focus has shifted significantly over time - NTDs shown in **red**, Global South diseases in **orange**, others in **grey** - The scatter plot (Panel C) reveals the inverse relationship between research volume and isolation ## Citation If you use this skill in a publication, please cite: - Corpas, M. et al. (2026). HEIM: Health Equity Index for Measuring structural bias in biomedical research. Under review. - Corpas, M. (2026). ClawBio. https://github.com/ClawBio/ClawBio
Related in AI Agents
skill-development
IncludedComprehensive meta-skill for creating, managing, validating, auditing, and distributing Claude Code skills and slash commands (unified in v2.1.3+). Provides skill templates, creation workflows, validation patterns, audit checklists, naming conventions, YAML frontmatter guidance, progressive disclosure examples, and best practices lookup. Use when creating new skills, validating existing skills, auditing skill quality, understanding skill architecture, needing skill templates, learning about YAML frontmatter requirements, progressive disclosure patterns, tool restrictions (allowed-tools), skill composition, skill naming conventions, troubleshooting skill activation issues, creating custom slash commands, configuring command frontmatter, using command arguments ($ARGUMENTS, $1, $2), bash execution in commands, file references in commands, command namespacing, plugin commands, MCP slash commands, Skill tool configuration, or deciding between skills vs slash commands. Delegates to docs-management skill for official documentation.
reprompter
IncludedTransform messy prompts into well-structured, effective prompts โ single or multi-agent. Use when: "reprompt", "reprompt this", "clean up this prompt", "structure my prompt", rough text needing XML tags and best practices, "reprompter teams", "repromptception", "run with quality", "smart run", "smart agents", multi-agent tasks, audits, parallel work, anything going to agent teams. Don't use when: simple Q&A, pure chat, immediate execution-only tasks. See "Don't Use When" section for details. Outputs: Structured XML/Markdown prompt, quality score (before/after), optional team brief + per-agent sub-prompts, agent team output files. Success criteria: Single mode quality score โฅ 7/10; Repromptception per-agent prompt quality score 8+/10; all required sections present, actionable and specific.
adaptive-compaction
IncludedAdaptive add-on policy and recovery layer that decides WHEN to compact, prune, snapshot, or fork -- replacing fixed-percent auto-compaction across Claude Code, Codex, and MCP-capable hosts. Trigger on auto-compact timing or damage: "when should I compact", "is it safe to compact now or start a fresh session", "auto-compact fires too early/mid-task", "switching to an unrelated task but the window still has space", "context rot", "answers get worse the longer the session runs", "the agent forgot the plan or my decisions after it summarized", "add a layer on top that manages context without changing the agent", raising autoCompactWindow to give the policy room, or installing/tuning a cross-tool compaction policy or PreCompact hook -- even when "compaction" is never said but the problem is context-window pressure or post-summarization memory loss. Do NOT use to summarize a conversation, build RAG, write a summarization prompt (decides WHEN not HOW), or answer max-context-length trivia.
agent-skill-creator
IncludedCreate cross-platform agent skills from workflow descriptions. Activates when users ask to create an agent, automate a repetitive workflow, create a custom skill, or need advanced agent creation. Triggers on phrases like create agent for, automate workflow, create skill for, every day I have to, daily I need to, turn process into agent, need to automate, create a cross-platform skill, validate this skill, export this skill, migrate this skill. Supports single skills, multi-agent suites, transcript processing, template-based creation, interactive configuration, cross-platform export, and spec validation.
llm-wiki
IncludedUse when building or maintaining a persistent personal knowledge base (second brain) in Obsidian where an LLM incrementally ingests sources, updates entity/concept pages, maintains cross-references, and keeps a synthesis current. Triggers include "second brain", "Obsidian wiki", "personal knowledge management", "ingest this paper/article/book", "build a research wiki", "compound knowledge", "Memex", or whenever the user wants knowledge to accumulate across sessions instead of being re-derived by RAG on every query.
skill-master
IncludedAgent Skills authoring, evaluation, and optimization. Create, edit, validate, benchmark, and improve skills following the agentskills.io specification. Use when designing SKILL.md files, structuring skill folders (references, scripts, assets), ingesting external documentation into skills, running trigger evals, benchmarking skill quality, optimizing descriptions, or performing blind A/B comparisons. Keywords: agentskills.io, SKILL.md, skill authoring, eval, benchmark, trigger optimization.