LeoYeAI/agent-master-skills / skills/bids
bids
UnverifiedOrganizes, queries, validates, and converts Brain Imaging Data Structure (BIDS) datasets. Supports organizing neuroscience and biomedical data (MRI, EEG, MEG, iEEG, PET, microscopy, NIRS, motion capture, EMG, MR spectroscopy, behavioral), querying BIDS layouts, validating compliance, converting DICOM to BIDS, writing metadata sidecars, or creating BIDS derivatives.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 14.5 KB |
| references/beps.yml | config | 24.8 KB |
| references/bids_schema.json | config | 806.4 KB |
| references/bids_specification.md | markdown | 9.0 KB |
| references/conversion_tools.md | markdown | 20.0 KB |
| references/core_workflows.md | markdown | 20.0 KB |
| references/metadata_fields.md | markdown | 11.4 KB |
| scripts/update_schema.py | script | 4.0 KB |
scripts/update_schema.py
View on GitHub#!/usr/bin/env python3
"""Update the bundled BIDS schema and BEP catalogue from official public sources.
From the skill directory:
python scripts/update_schema.py
For a reproducible release, or if ReadTheDocs rejects automated downloads:
python scripts/update_schema.py --schema-url https://raw.githubusercontent.com/bids-standard/bids-schema/main/versions/1.11.2/schema.json
For draft BEP schemas, discover the actual path under the upstream BEPs directory;
do not assume that BEPs/BEP032/schema.json exists. Drafts are not stable requirements.
No external dependencies beyond the Python standard library.
"""
import argparse
import json
import os
import re
import tempfile
import urllib.request
from pathlib import Path
REFERENCES_DIR = Path(__file__).resolve().parent.parent / "references"
SCHEMA_URL = "https://bids-specification.readthedocs.io/en/stable/schema.json"
BEPS_URL = "https://raw.githubusercontent.com/bids-standard/bids-website/main/data/beps/beps.yml"
MAX_BYTES = 20 * 1024 * 1024
TIMEOUT_SECONDS = 30
def fetch(url):
"""Fetch a bounded public response; reject non-HTTPS sources."""
if not url.startswith("https://"):
raise ValueError("Use an HTTPS URL for upstream data")
print(f"Fetching {url} ...")
req = urllib.request.Request(url, headers={"User-Agent": "bids-skill-updater/1.1"})
with urllib.request.urlopen(req, timeout=TIMEOUT_SECONDS) as resp:
data = resp.read(MAX_BYTES + 1)
if len(data) > MAX_BYTES:
raise ValueError(f"Upstream response exceeds {MAX_BYTES} bytes")
return data
def atomic_write(output, data):
"""Replace one validated artifact without truncating its previous copy."""
temporary = None
try:
with tempfile.NamedTemporaryFile(dir=output.parent, delete=False) as stream:
temporary = Path(stream.name)
stream.write(data)
os.replace(temporary, output)
finally:
if temporary is not None:
temporary.unlink(missing_ok=True)
def update_schema(url):
"""Download and check the schema's envelope before replacing the snapshot."""
d = json.loads(fetch(url))
if not isinstance(d, dict):
raise ValueError("Expected a BIDS schema object")
for field in ("schema_version", "bids_version"):
if not isinstance(d.get(field), str) or not d[field]:
raise ValueError(f"BIDS schema missing {field}")
if not isinstance(d.get("objects"), dict) or not isinstance(d.get("rules"), dict):
raise ValueError("BIDS schema must contain objects and rules mappings")
output = REFERENCES_DIR / "bids_schema.json"
atomic_write(output, (json.dumps(d, indent=2) + "\n").encode("utf-8"))
print(f" -> {output.name}: schema {d['schema_version']} / BIDS {d['bids_version']}")
def bep_numbers(data):
"""Check the known upstream catalogue envelope (not a general YAML parser)."""
text = data.decode("utf-8")
numbers = re.findall(r"^\s*-\s+number:\s*['\"]?(\d{3})['\"]?\s*$", text, re.MULTILINE)
if not numbers or len(numbers) != len(set(numbers)):
raise ValueError("Expected a BEP catalogue with unique three-digit number entries")
return numbers
def update_beps():
"""Preserve upstream YAML after an envelope check; reject HTML/error payloads."""
data = fetch(BEPS_URL)
count = len(bep_numbers(data))
output = REFERENCES_DIR / "beps.yml"
atomic_write(output, data)
print(f" -> {output.name}: {count} BEPs")
def main():
parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
parser.add_argument("--schema-url", default=SCHEMA_URL, help=f"Schema JSON URL (default: {SCHEMA_URL})")
parser.add_argument("--skip-beps", action="store_true", help="Skip fetching beps.yml")
args = parser.parse_args()
update_schema(args.schema_url)
if not args.skip_beps:
update_beps()
print("Done. Review version changes and dependent documentation before committing.")
if __name__ == "__main__":
main()
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |