Claude-skill-registry bidsapp-nidm-standards
Standards and tools for creating, maintaining, and refactoring NIDM-integrated BIDSapps that run through BABS. Use when working with sensein BIDSapp repositories (freesurfer_bidsapp, mriqc-nidm_bidsapp, ants_bidsapp) or creating new BIDSapps. Helps with repository structure consistency, NIDM integration patterns, CLI argument standardization, BIDS-compliant output structures, and BABS configuration.
git clone https://github.com/majiayu000/claude-skill-registry
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/bidsapp-nidm-standards" ~/.claude/skills/majiayu000-claude-skill-registry-bidsapp-nidm-standards && rm -rf "$T"
skills/data/bidsapp-nidm-standards/SKILL.mdBIDSapp NIDM Standards
Standardize BIDSapp repositories with NIDM integration for consistent structure, output formats, and BABS compatibility.
Overview
This skill defines standards for BIDSapp repositories that:
- Process neuroimaging data (FreeSurfer, MRIQC, ANTs, etc.)
- Integrate NIDM (Neuroimaging Data Model) outputs
- Run through BABS (BIDS App Bootstrap) on HPC clusters
- Maintain consistent structure across multiple analysis tools
Core Standards
Repository Structure
All BIDSapp repos follow this structure:
<bidsapp_name>/ ├── src/ │ ├── <analysis_name>/ # Main analysis code │ │ ├── __init__.py │ │ ├── run.py # Entry point │ │ └── <analysis>_runner.py │ └── nidm/ # NIDM conversion (analysis-specific) │ ├── __init__.py │ ├── nidm_converter.py │ └── data/ ├── tests/ │ ├── test_<analysis>.py │ └── test_nidm.py ├── examples/ ├── Dockerfile ├── Singularity ├── setup.py ├── requirements.txt ├── VERSION └── README.md
CLI Arguments
Standard BIDS arguments (required):
- Input BIDS dataset pathbids_dir
- Output directory pathoutput_dir
- Must be "participant"analysis_level
- Subject ID(s) without "sub-" prefix--participant-label
- Session ID(s) without "ses-" prefix (optional)--session-label
Standard NIDM arguments (required):
- Path to existing NIDM files directory--nidm-input-dir
- Skip NIDM conversion--skip-nidm
- Skip analysis if already run (e.g.,--skip-<analysis>
,--skip-freesurfer
,--skip-mriqc
)--skip-ants
Analysis-specific arguments (optional):
- Add as needed for specific analysis tools (e.g.,
for FreeSurfer,--fs-license
for MRIQC)--nprocs
See
references/cli_arguments.md for complete specifications.
Output Structure
BIDS-compliant derivatives structure:
<output_dir>/ └── <bidsapp_name>/ # e.g., freesurfer_nidm, mriqc_nidm, ants_nidm ├── dataset_description.json ├── <analysis>/ # e.g., freesurfer, mriqc, ants │ ├── dataset_description.json │ └── sub-{id}/ │ └── ses-{session}/ # Optional │ └── [analysis outputs] └── nidm/ ├── dataset_description.json └── sub-{id}/ └── ses-{session}/ # Optional └── sub-{id}_ses-{session}.ttl
NIDM Integration Workflow
The standard NIDM workflow:
- Copy existing NIDM file from
to output NIDM folder--nidm-input-dir - Run analysis (unless
)--skip-<analysis> - Extract metrics from analysis outputs
- Integrate into NIDM file (overwrite the copied file)
The NIDM input directory should contain:
- Single
file at root, ORnidm.ttl - Per-subject files:
sub-{id}/ses-{session}/sub-{id}_ses-{session}.ttl
For complete NIDM integration specifications, see
references/nidm_integration.md.
Common Workflows
Check Repository Compliance
Verify a repo follows standards:
- Directory structure: Compare against
references/repo_structure.md - CLI arguments: Check
for standard argssrc/<analysis>/run.py - Output structure: Verify code creates
pattern<bidsapp_name>/{<analysis>, nidm}/ - NIDM integration: Ensure copy→run→integrate workflow exists
- Containers: Check Dockerfile/Singularity follow
references/container_patterns.md
Refactor Existing Repository
To update a repo to match standards:
- Review: Compare current structure against
references/repo_structure.md - Reorganize: Move files to match standard layout
- Update CLI: Add missing standard arguments
- Ensure
,--participant-label--session-label - Add
,--nidm-input-dir
,--skip-nidm--skip-<analysis>
- Ensure
- Fix output structure: Update code to create proper BIDS derivatives
- Update NIDM workflow: Implement copy→run→integrate pattern
- Align containers: Update Dockerfile/Singularity
- Standardize setup.py: Match template configuration
- Update tests: Ensure test coverage for all components
Create New BIDSapp
To create a new NIDM-integrated BIDSapp from scratch:
- Initialize structure: Copy
directoryassets/template/ - Rename components: Replace
placeholders throughout<analysis> - Implement analysis: Code
src/<analysis>/<analysis>_runner.py - Implement NIDM: Code
for this analysissrc/nidm/nidm_converter.py - Build containers:
- Create Dockerfile following
references/container_patterns.md - Create Singularity file for HPC deployment
- Create Dockerfile following
- Add tests: Follow standard test patterns
- Generate BABS config: Use
templatereferences/babs_config.md - Document: Update README with usage examples
Update Standards Across All Repos
When changing standards that affect all BIDSapps:
- Update this skill: Modify reference documentation first
- Identify affected repos: List all BIDSapps needing updates
- Update each repo:
- NIDM converter pattern changes →
src/nidm/nidm_converter.py - CLI changes →
src/<analysis>/run.py - Output structure changes → Runner and output code
- Container changes → Dockerfile, Singularity
- NIDM converter pattern changes →
- Test with BABS: Ensure all repos work with BABS workflow
- Update BABS configs: Regenerate YAML files if needed
Reference Documentation
All reference files provide detailed specifications:
- Complete repository structure template with explanationsreferences/repo_structure.md
- Full NIDM workflow, file formats, integration patternsreferences/nidm_integration.md
- BABS YAML configuration template with examplesreferences/babs_config.md
- Complete CLI argument specifications and validationreferences/cli_arguments.md
- Docker and Singularity build patternsreferences/container_patterns.md
- Test structure and coverage requirementsreferences/testing_patterns.md
Container Standards
Both Dockerfile and Singularity should:
- Use analysis tool base images where available (e.g.,
)vnmd/freesurfer_8.0.0 - Install Python package via setup.py
- Set appropriate entry points
- Support both Docker and Apptainer/Singularity execution
- Follow BIDS App containerization best practices
See
references/container_patterns.md for complete specifications.
Testing Standards
Standard test coverage:
- CLI argument parsing and validation
- BIDS input dataset validation
- Analysis execution (with mock or example data)
- NIDM conversion correctness
- Output structure validation
- Container build and execution
Use pytest with fixtures for test data. See
references/testing_patterns.md.
BABS Integration
All BIDSapps must work with BABS for HPC deployment. Key requirements:
- Accept standard BIDS App CLI arguments
- Output to BIDS derivatives structure
- Support DataLad input datasets
- Work with Singularity/Apptainer containers
- Include proper resource requirements
Generate BABS YAML configs using
references/babs_config.md template.