Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsBlogPro
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Authors
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges
  • Chrome Extension
  • Skill Manager

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

ProTermsPrivacyRefunds
Back to skills

Qsiprep Tool

ASecurity

Use this skill whenever the user wants to run QSIPrep (BIDS App) for diffusion MRI (DWI) preprocessing with best-practice workflows (topup/eddy, denoising/unringing options, susceptibility/motion correction, coregistration/normalization, QC reports) on BIDS datasets. This skill is the NeuroClaw interface-layer wrapper for QSIPrep: it checks installation (Docker/Singularity/conda), generates an execution plan with exact commands and resource estimates, waits for explicit confirmation, then rou...

171 stars
0 votes
0 copies
0 views
Added 9/6/2026
ai-agentspythongoshellbashdockerdocumentation

Security Analysis

A100/100

Scanned 9/6/2026

$npx -y skills add BioTender-max/awesome-bio-agent-skills --skill qsiprep-tool --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Qsiprep Tool?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Qsiprep Tool
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/biotender-max-qsiprep-tool/badge)](https://www.skillsdirectory.com/skills/biotender-max-qsiprep-tool)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
Files
SKILL.md
---
name: qsiprep-tool
description: "Use this skill whenever the user wants to run QSIPrep (BIDS App) for diffusion MRI (DWI) preprocessing with best-practice workflows (topup/eddy, denoising/unringing options, susceptibility/motion correction, coregistration/normalization, QC reports) on BIDS datasets. This skill is the NeuroClaw interface-layer wrapper for QSIPrep: it checks installation (Docker/Singularity/conda), generates an execution plan with exact commands and resource estimates, waits for explicit confirmation, then routes all execution through claw-shell."
license: MIT License (NeuroClaw custom skill – freely modifiable within the project)
layer: base
skill_type: tool
dependencies:
  - claw-shell
  - bids-organizer
---
# QSIPrep Tool (Interface Layer)

## Overview
QSIPrep is a BIDS-App pipeline for **diffusion MRI (DWI) preprocessing** that emphasizes:
- Robust distortion/motion/eddy-current correction
- Interoperable derivatives for downstream modeling (DTI/DKI/CSD, tractography, connectome, etc.)
- Strong QC reporting (HTML)

This skill is the **NeuroClaw interface-layer wrapper** for QSIPrep and strictly follows the NeuroClaw safety pattern:

1. Check whether QSIPrep is available (preferred: Docker/Singularity image; alternative: conda).
2. If missing → invoke `dependency-planner` to produce an installation plan.
3. Verify inputs (must be BIDS-compliant; detect DWI + fieldmaps/reverse-PE b0 if present).
4. Generate a clear numbered plan with **exact commands**, runtime/resource estimates, and risks.
5. Wait for explicit user confirmation (“YES” / “execute” / “proceed”).
6. On confirmation → delegate all commands to `claw-shell`.
7. Summarize outputs (derivatives paths + QC report location) and suggest next steps.

**Research use only.**

---

## What QSIPrep Typically Does (High-Level)
- Validates BIDS layout (or skips if requested)
- Creates brain mask(s)
- Denoising (optional), Gibbs unringing (optional)
- Susceptibility distortion correction (e.g., reverse phase-encoded b0 via topup-style approach)
- Eddy-current + motion correction (FSL eddy family behavior within containerized workflow)
- Gradient/bvec handling (rotation after motion correction)
- Coregistration to anatomical (and optionally standard space outputs)
- Produces derivatives + QC HTML reports

---

## Quick Reference

| Task | Recommended Approach | Typical Output |
|---|---|---|
| Standard DWI preprocessing | QSIPrep BIDS-App `participant` | `derivatives/qsiprep/sub-*/dwi/*preproc_dwi.nii.gz` |
| Multi-subject run | `--participant-label sub-001 sub-002 ...` | per-subject derivatives |
| HPC / cluster | Singularity `.sif` execution | same derivatives |
| QC | Default QSIPrep reports | `derivatives/qsiprep/sub-*/figures/*.html` |

Typical runtime (very data-dependent): **~0.5–4+ hours per subject**.

---

## Installation (Handled by `dependency-planner`)
Preferred: **Docker** (workstations) or **Singularity/Apptainer** (HPC).

Ask `dependency-planner` for one of:
- “Install Docker and pull latest QSIPrep image”
- “Install Apptainer/Singularity and pull QSIPrep .sif”
- “Install QSIPrep via conda (not recommended unless container is unavailable)”

Verification examples:
```bash
docker --version
docker image ls | grep -i qsiprep
# or
apptainer --version
apptainer exec qsiprep.sif qsiprep --version
```

**FreeSurfer license**: QSIPrep often requires a FreeSurfer license file.
- Usually passed with: `--fs-license-file /path/to/license.txt`
- This skill will request it if not provided.

---

## Common Command Templates (Executed via `claw-shell`)

### A) Docker (Recommended on workstations)
```bash
# Inputs:
BIDS_DIR=/data/bids
OUT_DIR=/data/derivatives
WORK_DIR=/data/work/qsiprep
FS_LICENSE=/data/license.txt

mkdir -p "$OUT_DIR" "$WORK_DIR"

docker run --rm -t \
  -v "$BIDS_DIR":/data:ro \
  -v "$OUT_DIR":/out \
  -v "$WORK_DIR":/work \
  -v "$FS_LICENSE":/opt/freesurfer/license.txt:ro \
  pennbbl/qsiprep:latest \
  /data /out participant \
  --participant-label sub-001 \
  --work-dir /work \
  --fs-license-file /opt/freesurfer/license.txt \
  --nthreads 16 --omp-nthreads 8 --mem-mb 64000
```

### B) Singularity / Apptainer (Recommended on HPC)
```bash
BIDS_DIR=/data/bids
OUT_DIR=/data/derivatives
WORK_DIR=/data/work/qsiprep
FS_LICENSE=/data/license.txt
IMG=/images/qsiprep.sif

mkdir -p "$OUT_DIR" "$WORK_DIR"

apptainer run --cleanenv \
  -B "$BIDS_DIR":/data:ro \
  -B "$OUT_DIR":/out \
  -B "$WORK_DIR":/work \
  -B "$FS_LICENSE":/opt/freesurfer/license.txt:ro \
  "$IMG" \
  /data /out participant \
  --participant-label sub-001 \
  --work-dir /work \
  --fs-license-file /opt/freesurfer/license.txt \
  --nthreads 16 --omp-nthreads 8 --mem-mb 64000
```

> Notes:
> - Image name (`pennbbl/qsiprep:latest`) should be verified by `dependency-planner` against the latest official docs/releases.
> - Some flags vary by QSIPrep version; this skill will always generate commands after checking installed version.

---

## NeuroClaw recommended wrapper script (Reference): `qsiprep_wrapper.py`

> This wrapper only *builds and prints* a plan; actual execution must be routed through `claw-shell` by the calling skill.

```python
# qsiprep_wrapper.py (reference template)
import argparse
from pathlib import Path
from datetime import datetime

def build_qsiprep_cmd(engine, bids_dir, out_dir, work_dir, participant_labels, fs_license, img):
    labels = " ".join(participant_labels) if participant_labels else ""
    if engine == "docker":
        cmd = f"""
mkdir -p "{out_dir}" "{work_dir}"
docker run --rm -t \
  -v "{bids_dir}":/data:ro \
  -v "{out_dir}":/out \
  -v "{work_dir}":/work \
  -v "{fs_license}":/opt/freesurfer/license.txt:ro \
  {img} \
  /data /out participant \
  {"--participant-label " + labels if labels else ""} \
  --work-dir /work \
  --fs-license-file /opt/freesurfer/license.txt
""".strip()
    else:
        cmd = f"""
mkdir -p "{out_dir}" "{work_dir}"
apptainer run --cleanenv \
  -B "{bids_dir}":/data:ro \
  -B "{out_dir}":/out \
  -B "{work_dir}":/work \
  -B "{fs_license}":/opt/freesurfer/license.txt:ro \
  "{img}" \
  /data /out participant \
  {"--participant-label " + labels if labels else ""} \
  --work-dir /work \
  --fs-license-file /opt/freesurfer/license.txt
""".strip()
    return cmd

if __name__ == "__main__":
    p = argparse.ArgumentParser()
    p.add_argument("--engine", choices=["docker", "apptainer"], required=True)
    p.add_argument("--bids-dir", required=True)
    p.add_argument("--out-dir", required=True)
    p.add_argument("--work-dir", required=True)
    p.add_argument("--fs-license", required=True)
    p.add_argument("--img", required=True, help="Docker image (e.g., pennbbl/qsiprep:latest) or .sif path")
    p.add_argument("--participants", nargs="*", default=None)
    args = p.parse_args()

    cmd = build_qsiprep_cmd(
        engine=args.engine,
        bids_dir=Path(args.bids_dir).resolve(),
        out_dir=Path(args.out_dir).resolve(),
        work_dir=Path(args.work_dir).resolve(),
        participant_labels=args.participants,
        fs_license=Path(args.fs_license).resolve(),
        img=args.img
    )

    tag = f"qsiprep_{datetime.now().strftime('%Y%m%d_%H%M%S')}"
    print("Execution plan (delegate to claw-shell):")
    print(cmd)
    print("\nLog tag suggestion:", tag)
```

---

## Important Notes & Limitations
- **BIDS input is strongly recommended**. If you only have raw NIfTI/DICOM, use `bids-organizer` (and `dcm2nii`) first.
- QSIPrep benefits a lot from having **reverse phase-encoded b0 images (AP/PA)** or valid fieldmaps; otherwise distortion correction may be limited.
- Ensure adequate resources:
  - RAM commonly **16–64 GB**
  - Disk: work directory can be large (tens of GB)
- All execution must go through `claw-shell` due to long runtime and logging requirements.
- This skill does not replace downstream modeling (DTI/CSD/NODDI). After preprocessing, delegate to:
  - `dipy-tool` for Python-based metrics/ROI features
  - MRtrix/FSL-based workflows (future tool skills) for tractography/connectomes

---

## When to Call This Skill
- User requests “run QSIPrep”, “preprocess DWI with QSIPrep”, “BIDS diffusion preprocessing”, “topup/eddy style pipeline with QC reports”.
- Before any quantitative diffusion features (FA/MD/tractometry/connectome) are extracted.

## Post-Execution Verification (Harness Integration)

After QSIPrep completes, this skill **automatically invokes harness-core's VerificationRunner** to validate diffusion preprocessing outputs:

**Integrated verification checks**:

```python
from skills.harness_core import VerificationRunner, AuditLogger
import nibabel as nib
import numpy as np
from pathlib import Path

verifier = VerificationRunner(task_type="qsiprep_diffusion_preprocessing")

# 1. Preprocessed DWI files exist
verifier.add_check("preprocessed_dwi_exists",
    checker=lambda: verify_preprocessed_dwi_files(output_dir),
    severity="error"
)

# 2. Brain mask generated
verifier.add_check("brain_mask_generated",
    checker=lambda: verify_brain_mask_exists(output_dir),
    severity="error"
)

# 3. DWI data shape consistent and reasonable
verifier.add_check("dwi_shape_consistency",
    checker=lambda: verify_dwi_shape(output_dir),
    severity="error"
)

# 4. No NaN/Inf in preprocessed DWI
verifier.add_check("dwi_data_integrity",
    checker=lambda: verify_dwi_no_nan_inf(output_dir),
    severity="error"
)

# 5. Gradient table preserved and reasonable
verifier.add_check("gradient_table",
    checker=lambda: verify_bval_bvec_files(output_dir),
    severity="warning"
)

# 6. Motion/susceptibility distortion corrections applied
verifier.add_check("preprocessing_applied",
    checker=lambda: verify_preprocessing_flags(output_dir),
    severity="warning"
)

# 7. Diffusion metrics (FA/MD) computable from output
verifier.add_check("diffusion_metric_bounds",
    checker=lambda: verify_fa_md_bounds(output_dir),
    severity="warning"
)

# 8. QC reports generated
verifier.add_check("qc_reports",
    checker=lambda: verify_qc_html_reports(output_dir),
    severity="warning"
)

report = verifier.run(output_dir)

# Log verification results
logger = AuditLogger(log_file=f"{output_dir}/qsiprep_verification.jsonl")
logger.log_validation(
    task_name="qsiprep_diffusion_preprocessing",
    checks_passed=len([r for r in report.results if r.passed]),
    checks_failed=len([r for r in report.results if not r.passed]),
    warnings=len([r for r in report.results if r.severity == "warning" and not r.passed]),
    report_summary=report.to_dict()
)

if report.failed:
    raise ValueError(f"QSIPrep verification failed: {report.summary}")
```

**Output files generated**:
- `{output_dir}/qsiprep_verification.jsonl` — structured audit log
- `{output_dir}/.qsiprep_verification_timestamp` — completion marker

## Complementary / Related Skills

- `dependency-planner` → install Docker/Apptainer + QSIPrep image
- `docker-env-manager` → safe Docker operations (pull/run/prune) when needed
- `claw-shell` → mandatory safe execution layer
- `harness-core` → automated verification and audit logging

---

## Reference
- QSIPrep documentation and BIDS App usage (official docs; version-dependent)
- NeuroClaw interface-layer pattern aligned with `fmriprep-tool` and `hcppipeline-tool`

Created At: 2026-03-26 00:45 HKT
Last Updated At: 2026-04-05 02:01 HKT
Author: chengwang96

Attribution

BioTender-maxBioTender-max
View sourceSee grades on GitHubMore from BioTender-max →
SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Related Skills

Caveman

Terse caveman voice: answer first, fluff gone, every technical fact kept. Use for /caveman, "caveman mode", "talk like caveman", "be brief", "less tokens". Stays on until "stop caveman" or "normal mode".

1100021 votes

Hyperplan

Adversarial multi-agent planning skill. Self-orchestrates 5 hostile category members (unspecified-low, unspecified-high, deep, ultrabrain, artistry) via team-mode for ruthless cross-critique debate, distills only the defensible insights, then MANDATORILY hands the distilled insight bundle to the `plan` agent for executable plan formalization. Use when planning needs maximum rigor and surfacing of weak assumptions, blind spots, and over-engineering. Triggers: 'hyperplan', 'hpp', '/hyperplan', ...

698621 votes

Writing Skills

Create and manage Claude Code skills in HASH repository following Anthropic best practices. Use when creating new skills, modifying skill-rules.json, understanding trigger patterns, working with hooks, debugging skill activation, or implementing progressive disclosure. Covers skill structure, YAML frontmatter, trigger types (keywords, intent patterns), UserPromptSubmit hook, and the 500-line rule. Includes validation and debugging with SKILL_DEBUG. Examples include rust-error-stack, cargo-dep...

3931 votes

Mcp Code Execution

Routes multi-tool workflows through MCP servers for large datasets and pipelines. Use when Bash tool overhead is limiting throughput on data-heavy tasks.

3421 votes

catchup

Recovers the conversation and failed tool calls of a previous Codex, Amp, Claude Code, Antigravity, Cline, Copilot CLI, Cursor, DeepSeek Harness, Grok Build, Kimi, OpenCode, Pi Agent, or ZCode session. Use when the user says "catch up", "what did the last session do", "get me up to speed", "I switched agents", asks to recover/summarize a previous session before continuing, or asks to diagnose or report a catchup failure. Do NOT use for the current conversation, git history, or any non-agent log.

741 votes
View all in ai-agents →