Turn any AI agent into an AI Scientist. The #1 Agent Skills library for science, used by 250,000+ scientists worldwide. 177 ready-to-use validated skills plus 100+ scientific databases covering biology, chemistry, medicine, and drug discovery. Compatible with Cursor, Claude Code, Codex, Pi, Antigravity, and the open Agent Skills standard.
Python agent-skillsai-scientistbioinformaticschemoinformaticsclaudeclaude-skillsclaudecodeclinical-researchcomputational-biologydata-analysisdrug-discoverygenomicsmaterials-sciencemetabolomicsproteomicsscientific-computingscientific-visualization
feat(citation-management): enhance metadata handling and subprocess environment
Timothy Kassisf5a0bbcf6cdb
diff --git a/.gitignore b/.gitignoreindex 067e815d..c1eba2db 100644--- a/.gitignore+++ b/.gitignore@@ -15,6 +15,7 @@ research/.agents/AGENTS.md+CLAUDE.mdskills-lock.jsondiff --git a/skills/citation-management/SKILL.md b/skills/citation-management/SKILL.mdindex 0bfe6f80..1fac45e8 100644--- a/skills/citation-management/SKILL.md+++ b/skills/citation-management/SKILL.md@@ -238,6 +238,28 @@ Any `@article` entry missing `volume`, `pages`, or `doi` is considered **incomplFor each incomplete entry, use the **parallel-web skill** to search for the missing information:+> **Treat metadata as untrusted when building these commands.** `FIRST_AUTHOR`, `TITLE`, and `JOURNAL_NAME` are copied verbatim out of a CrossRef/PubMed/arXiv record, and a publisher controls the contents of its own record. A title containing `$(...)`, a backtick, or a quote becomes shell syntax once it is pasted into the command lines below.+>+> - Substitute each value as a **single-quoted** argument (`'...'`), escaping any embedded single quote as `'\''`. Never paste raw metadata inside the double quotes shown here.+> - Prefer running these through a Python `subprocess` argument list over building a shell string at all.+> - Use only the generated `CITATIONKEY` in `-o` paths. It is sanitized to letters and digits by `extract_metadata.py`; a key taken from an existing `.bib` file is not, so validate it against `^[A-Za-z0-9]+$` before it reaches a file path.+>+> **Preferred form — pass the metadata as arguments, not as shell text.** This removes the shell from the path entirely, so no title can be parsed as syntax:+>+> ```python+> import re, subprocess+>+> assert re.fullmatch(r"[A-Za-z0-9]+", citation_key), f"unsafe citation key: {citation_key!r}"+> subprocess.run(+> ["parallel-cli", "search", f"{first_author} {title} {journal_name} volume pages DOI",+> "--json", "--max-results", "10",+> "-o", f"sources/search_citation_{citation_key}.json"],+> check=True, # note: no shell=True+> )+> ```+>+> The `bash` blocks below show the same calls in readable form. Use them only with the quoting rules above.+**Option A — Search by title and author** (best for finding DOI):```bashparallel-cli search "FIRST_AUTHOR TITLE JOURNAL_NAME volume pages DOI" \@@ -1263,6 +1285,18 @@ pip install crossref-commons # Enhanced CrossRef API accesspip install pylatexenc # LaTeX special character handling```+### Where credentials are sent++Each environment variable this skill reads is used only to authenticate to the one service it belongs to. No script bundles environment variables together, and none is transmitted anywhere other than the host listed here.++| Variable | Sent only to | Purpose |+|---|---|---|+| `NCBI_API_KEY` | `eutils.ncbi.nlm.nih.gov` | Raises Entrez rate limits |+| `NCBI_EMAIL` | `eutils.ncbi.nlm.nih.gov` | Entrez caller identification (required by NCBI) |+| `OPENROUTER_API_KEY` | `openrouter.ai` | Bearer token for the optional schematic generation |++`api.crossref.org`, `doi.org`, and `arxiv.org` are queried without credentials. `generate_schematic.py` forwards only `OPENROUTER_API_KEY` — plus the networking, TLS, and locale variables needed to make a request — to its subprocess, rather than the full environment.+## SummaryThe citation-management skill provides:diff --git a/skills/citation-management/scripts/extract_metadata.py b/skills/citation-management/scripts/extract_metadata.pyindex 8e9d076c..5670bdac 100755--- a/skills/citation-management/scripts/extract_metadata.py+++ b/skills/citation-management/scripts/extract_metadata.py@@ -424,8 +424,10 @@ class MetadataExtractor:else:last_name = 'Unknown'- # Get year- year = metadata.get('year', '').strip()+ # Get year. It arrives verbatim from the CrossRef/PubMed/arXiv record,+ # so keep only digits — the key is used as a filename and as a shell+ # argument, and a publisher controls the contents of its own record.+ year = re.sub(r'[^0-9]', '', metadata.get('year', ''))if not year:year = 'XXXX'diff --git a/skills/citation-management/scripts/generate_schematic.py b/skills/citation-management/scripts/generate_schematic.pyindex 43331870..9a7fea02 100644--- a/skills/citation-management/scripts/generate_schematic.py+++ b/skills/citation-management/scripts/generate_schematic.py@@ -25,6 +25,28 @@ import subprocessimport sysfrom pathlib import Path+# Variables forwarded to the generation subprocess. The child needs the+# OpenRouter credential; the rest keep networking, TLS, and locale working.+# Copying the whole parent environment instead would hand the child every+# unrelated secret that happens to be exported in the calling shell.+FORWARDED_ENV_VARS = (+ "PATH", "HOME", "LANG", "LC_ALL", "TMPDIR", "PYTHONPATH",+ "HTTP_PROXY", "HTTPS_PROXY", "NO_PROXY",+ "http_proxy", "https_proxy", "no_proxy",+ "SSL_CERT_FILE", "SSL_CERT_DIR", "REQUESTS_CA_BUNDLE", "CURL_CA_BUNDLE",+ # Windows needs these for sockets, temp files, and interpreter startup.+ "SYSTEMROOT", "WINDIR", "COMSPEC", "PATHEXT",+ "APPDATA", "LOCALAPPDATA", "USERPROFILE", "TEMP", "TMP",+)+++def build_subprocess_env(api_key):+ """Return a minimal environment for the AI generation subprocess."""+ env = {name: os.environ[name] for name in FORWARDED_ENV_VARS if name in os.environ}+ if api_key:+ env["OPENROUTER_API_KEY"] = api_key+ return env+def main():"""Command-line interface."""@@ -124,10 +146,7 @@ Environment Variables:# Execute — pass API key via environment to avoid exposure in process listingstry:- env = os.environ.copy()- if api_key:- env["OPENROUTER_API_KEY"] = api_key- result = subprocess.run(cmd, check=False, env=env)+ result = subprocess.run(cmd, check=False, env=build_subprocess_env(api_key))sys.exit(result.returncode)except Exception as e:print(f"Error executing AI generation: {e}")diff --git a/skills/imaging-data-commons/SKILL.md b/skills/imaging-data-commons/SKILL.mdindex 8d2bdcad..51b780e1 100644--- a/skills/imaging-data-commons/SKILL.md+++ b/skills/imaging-data-commons/SKILL.md@@ -23,10 +23,19 @@ import idc_indexREQUIRED_VERSION = "0.11.14" # Must match metadata.idc-index in this fileinstalled = idc_index.__version__-if installed < REQUIRED_VERSION:+def _parts(version):+ # Compare numerically: "0.9.0" < "0.11.14" is False as a string comparison.+ return tuple(int(p) if p.isdigit() else 0 for p in version.split(".")[:3])++if _parts(installed) < _parts(REQUIRED_VERSION):print(f"Upgrading idc-index from {installed} to {REQUIRED_VERSION}...")import subprocess- subprocess.run(["pip3", "install", "--upgrade", "--break-system-packages", "idc-index"], check=True)+ # Pin to the tested version — an unpinned upgrade installs whatever is+ # newest on PyPI, into system packages, and may still not satisfy the check.+ subprocess.run(+ ["pip3", "install", "--break-system-packages", f"idc-index=={REQUIRED_VERSION}"],+ check=True,+ )print("Upgrade complete. Restart Python to use new version.")else:print(f"idc-index {installed} meets requirement ({REQUIRED_VERSION})")diff --git a/skills/infographics/scripts/generate_infographic.py b/skills/infographics/scripts/generate_infographic.pyindex ab26dcad..5feda09d 100755--- a/skills/infographics/scripts/generate_infographic.py+++ b/skills/infographics/scripts/generate_infographic.py@@ -38,6 +38,28 @@ DOC_TYPES = ["marketing", "report", "presentation", "social", "internal", "draft", "default"]+# Variables forwarded to the generation subprocess. The child needs the+# OpenRouter credential; the rest keep networking, TLS, and locale working.+# Copying the whole parent environment instead would hand the child every+# unrelated secret that happens to be exported in the calling shell.+FORWARDED_ENV_VARS = (+ "PATH", "HOME", "LANG", "LC_ALL", "TMPDIR", "PYTHONPATH",+ "HTTP_PROXY", "HTTPS_PROXY", "NO_PROXY",+ "http_proxy", "https_proxy", "no_proxy",+ "SSL_CERT_FILE", "SSL_CERT_DIR", "REQUESTS_CA_BUNDLE", "CURL_CA_BUNDLE",+ # Windows needs these for sockets, temp files, and interpreter startup.+ "SYSTEMROOT", "WINDIR", "COMSPEC", "PATHEXT",+ "APPDATA", "LOCALAPPDATA", "USERPROFILE", "TEMP", "TMP",+)+++def build_subprocess_env(api_key):+ """Return a minimal environment for the AI generation subprocess."""+ env = {name: os.environ[name] for name in FORWARDED_ENV_VARS if name in os.environ}+ if api_key:+ env["OPENROUTER_API_KEY"] = api_key+ return env+def list_options():"""Print available types, styles, and palettes."""@@ -220,10 +242,7 @@ Environment Variables:# Execute — pass API key via environment to avoid exposure in process listingstry:- env = os.environ.copy()- if api_key:- env["OPENROUTER_API_KEY"] = api_key- result = subprocess.run(cmd, check=False, env=env)+ result = subprocess.run(cmd, check=False, env=build_subprocess_env(api_key))sys.exit(result.returncode)except Exception as e:print(f"Error executing AI generation: {e}")diff --git a/skills/latex-posters/scripts/generate_schematic.py b/skills/latex-posters/scripts/generate_schematic.pyindex 43331870..9a7fea02 100644--- a/skills/latex-posters/scripts/generate_schematic.py+++ b/skills/latex-posters/scripts/generate_schematic.py@@ -25,6 +25,28 @@ import subprocessimport sysfrom pathlib import Path+# Variables forwarded to the generation subprocess. The child needs the+# OpenRouter credential; the rest keep networking, TLS, and locale working.+# Copying the whole parent environment instead would hand the child every+# unrelated secret that happens to be exported in the calling shell.+FORWARDED_ENV_VARS = (+ "PATH", "HOME", "LANG", "LC_ALL", "TMPDIR", "PYTHONPATH",+ "HTTP_PROXY", "HTTPS_PROXY", "NO_PROXY",+ "http_proxy", "https_proxy", "no_proxy",+ "SSL_CERT_FILE", "SSL_CERT_DIR", "REQUESTS_CA_BUNDLE", "CURL_CA_BUNDLE",+ # Windows needs these for sockets, temp files, and interpreter startup.+ "SYSTEMROOT", "WINDIR", "COMSPEC", "PATHEXT",+ "APPDATA", "LOCALAPPDATA", "USERPROFILE", "TEMP", "TMP",+)+++def build_subprocess_env(api_key):+ """Return a minimal environment for the AI generation subprocess."""+ env = {name: os.environ[name] for name in FORWARDED_ENV_VARS if name in os.environ}+ if api_key:+ env["OPENROUTER_API_KEY"] = api_key+ return env+def main():"""Command-line interface."""@@ -124,10 +146,7 @@ Environment Variables:# Execute — pass API key via environment to avoid exposure in process listingstry:- env = os.environ.copy()- if api_key:- env["OPENROUTER_API_KEY"] = api_key- result = subprocess.run(cmd, check=False, env=env)+ result = subprocess.run(cmd, check=False, env=build_subprocess_env(api_key))sys.exit(result.returncode)except Exception as e:print(f"Error executing AI generation: {e}")diff --git a/skills/literature-review/scripts/generate_schematic.py b/skills/literature-review/scripts/generate_schematic.pyindex 43331870..9a7fea02 100644--- a/skills/literature-review/scripts/generate_schematic.py+++ b/skills/literature-review/scripts/generate_schematic.py@@ -25,6 +25,28 @@ import subprocessimport sysfrom pathlib import Path+# Variables forwarded to the generation subprocess. The child needs the+# OpenRouter credential; the rest keep networking, TLS, and locale working.+# Copying the whole parent environment instead would hand the child every+# unrelated secret that happens to be exported in the calling shell.+FORWARDED_ENV_VARS = (+ "PATH", "HOME", "LANG", "LC_ALL", "TMPDIR", "PYTHONPATH",+ "HTTP_PROXY", "HTTPS_PROXY", "NO_PROXY",+ "http_proxy", "https_proxy", "no_proxy",+ "SSL_CERT_FILE", "SSL_CERT_DIR", "REQUESTS_CA_BUNDLE", "CURL_CA_BUNDLE",+ # Windows needs these for sockets, temp files, and interpreter startup.+ "SYSTEMROOT", "WINDIR", "COMSPEC", "PATHEXT",+ "APPDATA", "LOCALAPPDATA", "USERPROFILE", "TEMP", "TMP",+)+++def build_subprocess_env(api_key):+ """Return a minimal environment for the AI generation subprocess."""+ env = {name: os.environ[name] for name in FORWARDED_ENV_VARS if name in os.environ}+ if api_key:+ env["OPENROUTER_API_KEY"] = api_key+ return env+def main():"""Command-line interface."""@@ -124,10 +146,7 @@ Environment Variables:# Execute — pass API key via environment to avoid exposure in process listingstry:- env = os.environ.copy()- if api_key:- env["OPENROUTER_API_KEY"] = api_key- result = subprocess.run(cmd, check=False, env=env)+ result = subprocess.run(cmd, check=False, env=build_subprocess_env(api_key))sys.exit(result.returncode)except Exception as e:print(f"Error executing AI generation: {e}")diff --git a/skills/scientific-schematics/scripts/generate_schematic.py b/skills/scientific-schematics/scripts/generate_schematic.pyindex 43331870..9a7fea02 100644--- a/skills/scientific-schematics/scripts/generate_schematic.py+++ b/skills/scientific-schematics/scripts/generate_schematic.py@@ -25,6 +25,28 @@ import subprocessimport sysfrom pathlib import Path+# Variables forwarded to the generation subprocess. The child needs the+# OpenRouter credential; the rest keep networking, TLS, and locale working.+# Copying the whole parent environment instead would hand the child every+# unrelated secret that happens to be exported in the calling shell.+FORWARDED_ENV_VARS = (+ "PATH", "HOME", "LANG", "LC_ALL", "TMPDIR", "PYTHONPATH",+ "HTTP_PROXY", "HTTPS_PROXY", "NO_PROXY",+ "http_proxy", "https_proxy", "no_proxy",+ "SSL_CERT_FILE", "SSL_CERT_DIR", "REQUESTS_CA_BUNDLE", "CURL_CA_BUNDLE",+ # Windows needs these for sockets, temp files, and interpreter startup.+ "SYSTEMROOT", "WINDIR", "COMSPEC", "PATHEXT",+ "APPDATA", "LOCALAPPDATA", "USERPROFILE", "TEMP", "TMP",+)+++def build_subprocess_env(api_key):+ """Return a minimal environment for the AI generation subprocess."""+ env = {name: os.environ[name] for name in FORWARDED_ENV_VARS if name in os.environ}+ if api_key:+ env["OPENROUTER_API_KEY"] = api_key+ return env+def main():"""Command-line interface."""@@ -124,10 +146,7 @@ Environment Variables:# Execute — pass API key via environment to avoid exposure in process listingstry:- env = os.environ.copy()- if api_key:- env["OPENROUTER_API_KEY"] = api_key- result = subprocess.run(cmd, check=False, env=env)+ result = subprocess.run(cmd, check=False, env=build_subprocess_env(api_key))sys.exit(result.returncode)except Exception as e:print(f"Error executing AI generation: {e}")diff --git a/skills/scientific-slides/scripts/generate_schematic.py b/skills/scientific-slides/scripts/generate_schematic.pyindex 43331870..9a7fea02 100644--- a/skills/scientific-slides/scripts/generate_schematic.py+++ b/skills/scientific-slides/scripts/generate_schematic.py@@ -25,6 +25,28 @@ import subprocessimport sysfrom pathlib import Path+# Variables forwarded to the generation subprocess. The child needs the+# OpenRouter credential; the rest keep networking, TLS, and locale working.+# Copying the whole parent environment instead would hand the child every+# unrelated secret that happens to be exported in the calling shell.+FORWARDED_ENV_VARS = (+ "PATH", "HOME", "LANG", "LC_ALL", "TMPDIR", "PYTHONPATH",+ "HTTP_PROXY", "HTTPS_PROXY", "NO_PROXY",+ "http_proxy", "https_proxy", "no_proxy",+ "SSL_CERT_FILE", "SSL_CERT_DIR", "REQUESTS_CA_BUNDLE", "CURL_CA_BUNDLE",+ # Windows needs these for sockets, temp files, and interpreter startup.+ "SYSTEMROOT", "WINDIR", "COMSPEC", "PATHEXT",+ "APPDATA", "LOCALAPPDATA", "USERPROFILE", "TEMP", "TMP",+)+++def build_subprocess_env(api_key):+ """Return a minimal environment for the AI generation subprocess."""+ env = {name: os.environ[name] for name in FORWARDED_ENV_VARS if name in os.environ}+ if api_key:+ env["OPENROUTER_API_KEY"] = api_key+ return env+def main():"""Command-line interface."""@@ -124,10 +146,7 @@ Environment Variables:# Execute — pass API key via environment to avoid exposure in process listingstry:- env = os.environ.copy()- if api_key:- env["OPENROUTER_API_KEY"] = api_key- result = subprocess.run(cmd, check=False, env=env)+ result = subprocess.run(cmd, check=False, env=build_subprocess_env(api_key))sys.exit(result.returncode)except Exception as e:print(f"Error executing AI generation: {e}")diff --git a/skills/scientific-slides/scripts/generate_slide_image.py b/skills/scientific-slides/scripts/generate_slide_image.pyindex 08f2aa9c..02e1cf5a 100644--- a/skills/scientific-slides/scripts/generate_slide_image.py+++ b/skills/scientific-slides/scripts/generate_slide_image.py@@ -28,6 +28,28 @@ import subprocessimport sysfrom pathlib import Path+# Variables forwarded to the generation subprocess. The child needs the+# OpenRouter credential; the rest keep networking, TLS, and locale working.+# Copying the whole parent environment instead would hand the child every+# unrelated secret that happens to be exported in the calling shell.+FORWARDED_ENV_VARS = (+ "PATH", "HOME", "LANG", "LC_ALL", "TMPDIR", "PYTHONPATH",+ "HTTP_PROXY", "HTTPS_PROXY", "NO_PROXY",+ "http_proxy", "https_proxy", "no_proxy",+ "SSL_CERT_FILE", "SSL_CERT_DIR", "REQUESTS_CA_BUNDLE", "CURL_CA_BUNDLE",+ # Windows needs these for sockets, temp files, and interpreter startup.+ "SYSTEMROOT", "WINDIR", "COMSPEC", "PATHEXT",+ "APPDATA", "LOCALAPPDATA", "USERPROFILE", "TEMP", "TMP",+)+++def build_subprocess_env(api_key):+ """Return a minimal environment for the AI generation subprocess."""+ env = {name: os.environ[name] for name in FORWARDED_ENV_VARS if name in os.environ}+ if api_key:+ env["OPENROUTER_API_KEY"] = api_key+ return env+def main():"""Command-line interface."""@@ -126,10 +148,7 @@ Environment Variables:# Execute — pass API key via environment to avoid exposure in process listingstry:- env = os.environ.copy()- if api_key:- env["OPENROUTER_API_KEY"] = api_key- result = subprocess.run(cmd, check=False, env=env)+ result = subprocess.run(cmd, check=False, env=build_subprocess_env(api_key))sys.exit(result.returncode)except Exception as e:print(f"Error executing AI generation: {e}")