@yibeichan/claude-skills 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +98 -0
  3. package/cli.js +272 -0
  4. package/install.py +240 -0
  5. package/package.json +44 -0
  6. package/skills/bidsapp-nidm-standards/SKILL.md +202 -0
  7. package/skills/bidsapp-nidm-standards/references/babs_config.md +20 -0
  8. package/skills/bidsapp-nidm-standards/references/cli_arguments.md +76 -0
  9. package/skills/bidsapp-nidm-standards/references/container_patterns.md +53 -0
  10. package/skills/bidsapp-nidm-standards/references/nidm_integration.md +403 -0
  11. package/skills/bidsapp-nidm-standards/references/repo_structure.md +121 -0
  12. package/skills/bidsapp-nidm-standards/references/testing_patterns.md +82 -0
  13. package/skills/dicom2fmriprep/SKILL.md +377 -0
  14. package/skills/dicom2fmriprep/evals/evals.json +26 -0
  15. package/skills/dicom2fmriprep/references/babs-details.md +407 -0
  16. package/skills/dicom2fmriprep/references/fmriprep-details.md +250 -0
  17. package/skills/dicom2fmriprep/references/heudiconv-details.md +243 -0
  18. package/skills/fmri-ssm/SKILL.md +317 -0
  19. package/skills/fmri-ssm/references/code_templates.md +1570 -0
  20. package/skills/fmri-ssm/references/downstream_analysis.md +680 -0
  21. package/skills/fmri-ssm/references/group_inference.md +608 -0
  22. package/skills/fmri-ssm/references/hrf_modeling.md +447 -0
  23. package/skills/fmri-ssm/references/model_catalog.md +436 -0
  24. package/skills/fmri-ssm/references/paradigm_guide.md +406 -0
  25. package/skills/fmri-ssm/references/preprocessing.md +614 -0
  26. package/skills/fmri-ssm.zip +0 -0
  27. package/skills/neuroimaging-qc/SKILL.md +203 -0
  28. package/skills/neuroimaging-qc/references/eeg_qc.md +400 -0
  29. package/skills/neuroimaging-qc/references/fmri_qc.md +343 -0
  30. package/skills/neuroimaging-qc/references/fnirs_qc.md +430 -0
  31. package/skills/neuroimaging-qc/references/structural_qc.md +454 -0
  32. package/skills/neuroimaging-qc/scripts/parse_fmriprep_confounds.py +153 -0
  33. package/skills/neuroimaging-qc/scripts/parse_mriqc.py +114 -0
  34. package/skills/neuroimaging-qc/scripts/qc_report.py +295 -0
  35. package/skills/scientific-writer/SKILL.md +202 -0
  36. package/skills/scientific-writer/references/citation_styles.md +163 -0
  37. package/skills/scientific-writer/references/field_conventions.md +245 -0
  38. package/skills/scientific-writer/references/figures_tables.md +225 -0
  39. package/skills/scientific-writer/references/reporting_guidelines.md +225 -0
  40. package/skills.json +54 -0
@@ -0,0 +1,202 @@
1
+ ---
2
+ name: bidsapp-nidm-standards
3
+ description: 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.
4
+ compatibility: "Designed for code editing and development tasks. Works with Python, Docker, Singularity/Apptainer, and neuroimaging pipeline development. Suitable for both claude.ai and Claude Code environments."
5
+ ---
6
+
7
+ # BIDSapp NIDM Standards
8
+
9
+ Standardize BIDSapp repositories with NIDM integration for consistent structure, output formats, and BABS compatibility.
10
+
11
+ ## Overview
12
+
13
+ This skill defines standards for BIDSapp repositories that:
14
+ 1. Process neuroimaging data (FreeSurfer, MRIQC, ANTs, etc.)
15
+ 2. Integrate NIDM (Neuroimaging Data Model) outputs
16
+ 3. Run through BABS (BIDS App Bootstrap) on HPC clusters
17
+ 4. Maintain consistent structure across multiple analysis tools
18
+
19
+ ## Core Standards
20
+
21
+ ### Repository Structure
22
+
23
+ All BIDSapp repos follow this structure:
24
+
25
+ ```
26
+ <bidsapp_name>/
27
+ ├── src/
28
+ │ ├── <analysis_name>/ # Main analysis code
29
+ │ │ ├── __init__.py
30
+ │ │ ├── run.py # Entry point
31
+ │ │ └── <analysis>_runner.py
32
+ │ └── nidm/ # NIDM conversion (analysis-specific)
33
+ │ ├── __init__.py
34
+ │ ├── nidm_converter.py
35
+ │ └── data/
36
+ ├── tests/
37
+ │ ├── test_<analysis>.py
38
+ │ └── test_nidm.py
39
+ ├── examples/
40
+ ├── Dockerfile
41
+ ├── Singularity
42
+ ├── setup.py
43
+ ├── requirements.txt
44
+ ├── VERSION
45
+ └── README.md
46
+ ```
47
+
48
+ ### CLI Arguments
49
+
50
+ **Standard BIDS arguments** (required):
51
+ - `bids_dir` - Input BIDS dataset path
52
+ - `output_dir` - Output directory path
53
+ - `analysis_level` - Must be "participant"
54
+ - `--participant-label` - Subject ID(s) without "sub-" prefix
55
+ - `--session-label` - Session ID(s) without "ses-" prefix (optional)
56
+
57
+ **Standard NIDM arguments** (required):
58
+ - `--nidm-input-dir` - Path to existing NIDM files directory
59
+ - `--skip-nidm` - Skip NIDM conversion
60
+ - `--skip-<analysis>` - Skip analysis if already run (e.g., `--skip-freesurfer`, `--skip-mriqc`, `--skip-ants`)
61
+
62
+ **Analysis-specific arguments** (optional):
63
+ - Add as needed for specific analysis tools (e.g., `--fs-license` for FreeSurfer, `--nprocs` for MRIQC)
64
+
65
+ See `references/cli_arguments.md` for complete specifications.
66
+
67
+ ### Output Structure
68
+
69
+ **BIDS-compliant derivatives structure**:
70
+
71
+ ```
72
+ <output_dir>/
73
+ └── <bidsapp_name>/ # e.g., freesurfer_nidm, mriqc_nidm, ants_nidm
74
+ ├── dataset_description.json
75
+ ├── <analysis>/ # e.g., freesurfer, mriqc, ants
76
+ │ ├── dataset_description.json
77
+ │ └── sub-{id}/
78
+ │ └── ses-{session}/ # Optional
79
+ │ └── [analysis outputs]
80
+ └── nidm/
81
+ ├── dataset_description.json
82
+ └── sub-{id}/
83
+ └── ses-{session}/ # Optional
84
+ └── sub-{id}_ses-{session}.ttl
85
+ ```
86
+
87
+ ### NIDM Integration Workflow
88
+
89
+ The standard NIDM workflow:
90
+
91
+ 1. **Copy existing NIDM file** from `--nidm-input-dir` to output NIDM folder
92
+ 2. **Run analysis** (unless `--skip-<analysis>`)
93
+ 3. **Extract metrics** from analysis outputs
94
+ 4. **Integrate into NIDM file** (overwrite the copied file)
95
+
96
+ The NIDM input directory should contain:
97
+ - Single `nidm.ttl` file at root, OR
98
+ - Per-subject files: `sub-{id}/ses-{session}/sub-{id}_ses-{session}.ttl`
99
+
100
+ For complete NIDM integration specifications, see `references/nidm_integration.md`.
101
+
102
+ ## Common Workflows
103
+
104
+ ### Check Repository Compliance
105
+
106
+ Verify a repo follows standards:
107
+
108
+ 1. **Directory structure**: Compare against `references/repo_structure.md`
109
+ 2. **CLI arguments**: Check `src/<analysis>/run.py` for standard args
110
+ 3. **Output structure**: Verify code creates `<bidsapp_name>/{<analysis>, nidm}/` pattern
111
+ 4. **NIDM integration**: Ensure copy→run→integrate workflow exists
112
+ 5. **Containers**: Check Dockerfile/Singularity follow `references/container_patterns.md`
113
+
114
+ ### Refactor Existing Repository
115
+
116
+ To update a repo to match standards:
117
+
118
+ 1. **Review**: Compare current structure against `references/repo_structure.md`
119
+ 2. **Reorganize**: Move files to match standard layout
120
+ 3. **Update CLI**: Add missing standard arguments
121
+ - Ensure `--participant-label`, `--session-label`
122
+ - Add `--nidm-input-dir`, `--skip-nidm`, `--skip-<analysis>`
123
+ 4. **Fix output structure**: Update code to create proper BIDS derivatives
124
+ 5. **Update NIDM workflow**: Implement copy→run→integrate pattern
125
+ 6. **Align containers**: Update Dockerfile/Singularity
126
+ 7. **Standardize setup.py**: Match template configuration
127
+ 8. **Update tests**: Ensure test coverage for all components
128
+
129
+ ### Create New BIDSapp
130
+
131
+ To create a new NIDM-integrated BIDSapp from scratch:
132
+
133
+ 1. **Initialize structure**: Copy `assets/template/` directory
134
+ 2. **Rename components**: Replace `<analysis>` placeholders throughout
135
+ 3. **Implement analysis**: Code `src/<analysis>/<analysis>_runner.py`
136
+ 4. **Implement NIDM**: Code `src/nidm/nidm_converter.py` for this analysis
137
+ 5. **Build containers**:
138
+ - Create Dockerfile following `references/container_patterns.md`
139
+ - Create Singularity file for HPC deployment
140
+ 6. **Add tests**: Follow standard test patterns
141
+ 7. **Generate BABS config**: Use `references/babs_config.md` template
142
+ 8. **Document**: Update README with usage examples
143
+
144
+ ### Update Standards Across All Repos
145
+
146
+ When changing standards that affect all BIDSapps:
147
+
148
+ 1. **Update this skill**: Modify reference documentation first
149
+ 2. **Identify affected repos**: List all BIDSapps needing updates
150
+ 3. **Update each repo**:
151
+ - NIDM converter pattern changes → `src/nidm/nidm_converter.py`
152
+ - CLI changes → `src/<analysis>/run.py`
153
+ - Output structure changes → Runner and output code
154
+ - Container changes → Dockerfile, Singularity
155
+ 4. **Test with BABS**: Ensure all repos work with BABS workflow
156
+ 5. **Update BABS configs**: Regenerate YAML files if needed
157
+
158
+ ## Reference Documentation
159
+
160
+ All reference files provide detailed specifications:
161
+
162
+ - `references/repo_structure.md` - Complete repository structure template with explanations
163
+ - `references/nidm_integration.md` - Full NIDM workflow, file formats, integration patterns
164
+ - `references/babs_config.md` - BABS YAML configuration template with examples
165
+ - `references/cli_arguments.md` - Complete CLI argument specifications and validation
166
+ - `references/container_patterns.md` - Docker and Singularity build patterns
167
+ - `references/testing_patterns.md` - Test structure and coverage requirements
168
+
169
+ ## Container Standards
170
+
171
+ Both Dockerfile and Singularity should:
172
+ - Use analysis tool base images where available (e.g., `vnmd/freesurfer_8.0.0`)
173
+ - Install Python package via setup.py
174
+ - Set appropriate entry points
175
+ - Support both Docker and Apptainer/Singularity execution
176
+ - Follow BIDS App containerization best practices
177
+
178
+ See `references/container_patterns.md` for complete specifications.
179
+
180
+ ## Testing Standards
181
+
182
+ Standard test coverage:
183
+ - CLI argument parsing and validation
184
+ - BIDS input dataset validation
185
+ - Analysis execution (with mock or example data)
186
+ - NIDM conversion correctness
187
+ - Output structure validation
188
+ - Container build and execution
189
+
190
+ Use pytest with fixtures for test data. See `references/testing_patterns.md`.
191
+
192
+ ## BABS Integration
193
+
194
+ All BIDSapps must work with BABS for HPC deployment. Key requirements:
195
+
196
+ - Accept standard BIDS App CLI arguments
197
+ - Output to BIDS derivatives structure
198
+ - Support DataLad input datasets
199
+ - Work with Singularity/Apptainer containers
200
+ - Include proper resource requirements
201
+
202
+ Generate BABS YAML configs using `references/babs_config.md` template.
@@ -0,0 +1,20 @@
1
+ # BABS Configuration Reference
2
+
3
+ Use the BABS script example (mriqc_babs_script1226.sh) as the reference template.
4
+
5
+ ## Key Configuration Elements
6
+
7
+ ### Input Datasets
8
+ - BIDS dataset with required files
9
+ - NIDM dataset for incremental building
10
+
11
+ ### CLI Arguments
12
+ - Standard BIDS args (--participant_label, --session_label)
13
+ - NIDM args (--nidm-input-dir)
14
+ - Analysis-specific args
15
+
16
+ ### Output Configuration
17
+ Use bidsapp name as zip folder (e.g., mriqc_nidm)
18
+
19
+ ### Resource Requirements
20
+ Adjust CPU, memory, time based on analysis tool
@@ -0,0 +1,76 @@
1
+ # CLI Arguments Reference
2
+
3
+ ## Standard BIDS App Arguments
4
+
5
+ ### Positional Arguments (Required)
6
+ ```python
7
+ parser.add_argument('bids_dir', help='BIDS dataset directory')
8
+ parser.add_argument('output_dir', help='Output directory')
9
+ parser.add_argument('analysis_level', choices=['participant'], help='Analysis level')
10
+ ```
11
+
12
+ ### Standard Optional Arguments
13
+
14
+ ```python
15
+ parser.add_argument('--participant-label', nargs='+',
16
+ help='Subject ID(s) without "sub-" prefix')
17
+ parser.add_argument('--session-label', nargs='+',
18
+ help='Session ID(s) without "ses-" prefix')
19
+ ```
20
+
21
+ ## NIDM Arguments (Required for all BIDSapps)
22
+
23
+ ```python
24
+ parser.add_argument('--nidm-input-dir', required=True,
25
+ help='Directory containing existing NIDM files')
26
+ parser.add_argument('--skip-nidm', action='store_true',
27
+ help='Skip NIDM conversion step')
28
+ parser.add_argument('--skip-<analysis>', action='store_true',
29
+ help='Skip <analysis> execution (use existing outputs)')
30
+ ```
31
+
32
+ ## Analysis-Specific Arguments
33
+
34
+ Add as needed for each tool. Examples:
35
+
36
+ ### FreeSurfer
37
+ ```python
38
+ parser.add_argument('--fs-license', help='Path to FreeSurfer license file')
39
+ parser.add_argument('--fs-options', help='Additional options for recon-all')
40
+ ```
41
+
42
+ ### MRIQC
43
+ ```python
44
+ parser.add_argument('--nprocs', type=int, default=1, help='Number of processors')
45
+ parser.add_argument('--mem', help='Memory limit (e.g., "16G")')
46
+ parser.add_argument('--omp-nthreads', type=int, help='OpenMP threads')
47
+ ```
48
+
49
+ ### ANTs
50
+ ```python
51
+ parser.add_argument('--num-threads', type=int, default=1, help='Number of threads')
52
+ parser.add_argument('--prob-threshold', type=float, default=0.5,
53
+ help='Probability threshold for segmentation')
54
+ ```
55
+
56
+ ## Argument Validation
57
+
58
+ Always validate inputs:
59
+
60
+ ```python
61
+ def validate_args(args):
62
+ """Validate CLI arguments."""
63
+ # Check BIDS directory exists
64
+ if not Path(args.bids_dir).exists():
65
+ raise ValueError(f"BIDS directory not found: {args.bids_dir}")
66
+
67
+ # Check NIDM input directory exists
68
+ if not Path(args.nidm_input_dir).exists():
69
+ raise ValueError(f"NIDM input directory not found: {args.nidm_input_dir}")
70
+
71
+ # Validate participant labels format
72
+ if args.participant_label:
73
+ for label in args.participant_label:
74
+ if label.startswith('sub-'):
75
+ raise ValueError(f"Remove 'sub-' prefix from participant label: {label}")
76
+ ```
@@ -0,0 +1,53 @@
1
+ # Container Build Patterns
2
+
3
+ ## Dockerfile Template
4
+
5
+ ```dockerfile
6
+ # Use analysis tool base image
7
+ FROM vnmd/<tool>:<version>
8
+
9
+ # Install Python and dependencies
10
+ RUN apt-get update && apt-get install -y \
11
+ python3 \
12
+ python3-pip \
13
+ git
14
+
15
+ # Copy repository
16
+ COPY . /app
17
+ WORKDIR /app
18
+
19
+ # Install Python package
20
+ RUN pip3 install -e .
21
+
22
+ # Set entry point
23
+ ENTRYPOINT ["python3", "-m", "<package_name>.run"]
24
+ ```
25
+
26
+ ## Singularity Template
27
+
28
+ ```singularity
29
+ Bootstrap: docker
30
+ From: vnmd/<tool>:<version>
31
+
32
+ %files
33
+ . /app
34
+
35
+ %post
36
+ apt-get update
37
+ apt-get install -y python3 python3-pip git
38
+ cd /app
39
+ pip3 install -e .
40
+
41
+ %runscript
42
+ exec python3 -m <package_name>.run "$@"
43
+ ```
44
+
45
+ ## Build Commands
46
+
47
+ ```bash
48
+ # Docker
49
+ docker build -t <bidsapp_name>:<version> .
50
+
51
+ # Singularity/Apptainer
52
+ apptainer build --fakeroot <bidsapp_name>.sif Singularity
53
+ ```