Skill: datalad-fsck
Check the integrity of annexed file content in a DataLad dataset using git annex fsck.
Identifies missing, corrupt, or unreachable content and guides recovery.
Steps
- Verify DataLad context — check for
.datalad/in the current directory or a
parent:
```bash
ls .datalad/ 2>/dev/null
```
If no dataset is found, inform the user and stop.
- Determine scope — ask the user:
- Fast check (
--fast): verifies file sizes and presence only. Quick, recommended
for routine checks or large datasets. Does not verify checksums.
- Full check (no flag): verifies checksums against stored hashes. Thorough but can
take a very long time on large datasets. Only recommend if corruption is suspected or
a transfer completed unexpectedly.
- Path-scoped check: optionally limit to a specific file or directory by passing
the path as an argument.
Warn the user: a full fsck on a large dataset can take a very long time. Recommend
--fast first unless there is specific reason to suspect checksum-level corruption.
- Construct and show command — display before executing:
```bash
git annex fsck [--fast] [<path>]
```
Ask: "Ready to run?"
- Execute and interpret output — run the command and summarize results:
- OK: file is present and (for full check) checksum matches — no action needed
- corrupt: checksum mismatch — file content is damaged
- missing: file is not present locally
Report counts of OK / corrupt / missing files.
- Suggest recovery based on findings:
- Missing content: run
datalad get <path>to re-fetch from a known remote - Corrupt content: drop the corrupt copy with
datalad drop --nocheck <path>,
then re-fetch with datalad get <path>
- Unrecoverable (no remote has the content): inform the user the content is lost
and cannot be recovered automatically — escalate to manual investigation
Constraints
- Always show the full
git annex fsckcommand before executing. - Always warn that a full fsck (without
--fast) can take a very long time on large
datasets before starting.
- Never attempt to auto-repair corrupt files without confirming recovery steps with the
user first.
- Load
${CLAUDE_PLUGIN_ROOT}/../references/troubleshooting.mdwhen the user needs
guidance on recovering from corrupt or missing content beyond simple datalad get.