DataLad Dataset Skill

DataLad Dataset Skill

Guides an AI agent in fetching, versioning and publishing scientific datasets with DataLad and git-annex, and recording reproducible provenance with datalad run and rerun.

Skill files4 files

references/

SKILL.md330 lines
1
---
2
name: datalad
3
description: Retrieves, versions, and publishes scientific datasets with DataLad and git-annex, and captures computational provenance with datalad run, rerun, and containers-run. Use when cloning or fetching data from OpenNeuro, DANDI, datasets.datalad.org, or any DataLad dataset; when a file in a dataset reads as a broken symlink or a small pointer instead of real data; when an analysis needs a machine-readable record of how each output was produced so it can be re-executed; or when publishing a dataset to siblings such as a GitHub repository plus a storage remote. Also use to decide between DataLad and plain Git for a data-carrying repository.
4
compatibility: Requires Python 3.10+, DataLad 1.6.5, Git, and git-annex 10.x. Tested with git-annex 10.20260901 and datalad-container 1.2.6 on macOS ARM64. Containers additionally require Singularity, Apptainer, or Docker. Remote data access needs network access and may need provider credentials. Local filesystem workflows work offline.
5
license: MIT
6
allowed-tools: Read Write Edit Bash
7
metadata:
8
version: "1.2"
9
last-reviewed: "2026-09-30"
10
skill-author: Dylan Pulver
11
---
12
13
# DataLad
14
15
## Overview
16
17
DataLad is a data management layer over Git and git-annex. Git tracks the dataset
18
structure, small text files, and the history. git-annex tracks the *content* of large
19
files, storing each file as a key and keeping the bytes somewhere that is not necessarily
20
the local repository.
21
22
A normal clone retrieves Git history and the top-level file listing while leaving
23
annexed bytes unfetched. Installed subdatasets have their own histories; a clone does not
24
automatically populate them. Clone cost depends on Git history and file count, not just
25
the data volume. Retrieve annexed bytes selectively with `datalad get`.
26
27
The second thing DataLad adds is provenance. `datalad run` executes a command and commits
28
the result together with a machine-readable record of the command, its inputs, and its
29
outputs. `datalad rerun` reads that record back and re-executes it. This turns "how was
30
this figure produced" from an archaeology problem into a command.
31
32
## When to use DataLad instead of plain Git
33
34
Use DataLad when any of the following holds:
35
36
- Files are too large for Git to handle comfortably, or the total exceeds what every
37
collaborator wants on disk.
38
- Data lives in more than one place (a lab server, a cluster scratch, S3, a supercomputer)
39
and you need to know which copies exist.
40
- The analysis must be re-executable, and a plain commit message is not enough evidence.
41
- You are consuming published datasets from OpenNeuro, DANDI, or `datasets.datalad.org`,
42
which are distributed as DataLad datasets.
43
- The project nests other datasets inside it and you want each one to keep its own
44
independent history.
45
46
Use plain Git when the repository is code and text only, everything fits comfortably in
47
Git, and nobody needs partial checkouts. DataLad on top of a small pure-code repository
48
adds indirection without buying anything.
49
50
## Installation
51
52
```bash
53
# git-annex is NOT written in Python but is available from PyPI if you already
54
# have git itself installed:
55
uv pip install git-annex
56
# You can also install it first from the system
57
# (Debian/Ubuntu: apt install git-annex; macOS: brew install git-annex;
58
# conda-forge: conda install -c conda-forge git-annex)
59
uv pip install "datalad==1.6.5"
60
uv pip install "datalad-container==1.2.6" # only for containers-run
61
62
datalad wtf --section dependencies # confirm git-annex version is visible
63
```
64
65
The PyPI `git-annex` package supplies platform-specific binaries. The reviewed
66
10.20260901.post1 wheels cover Linux glibc 2.34+ (x86_64/ARM64), macOS ARM64 14+ and
67
x86_64 15+, and Windows x86_64. Use a system package when no wheel matches. Keep its
68
environment on `PATH` and verify the executable; the wheel does not supply Git itself.
69
Configure Git author name/email before creating or saving a dataset.
70
71
`datalad wtf` prints the resolved environment and is the first thing to run when behaviour
72
looks impossible. An old or missing git-annex is behind a large share of confusing errors.
73
74
DataLad is MIT licensed; git-annex has a separate AGPL license. Consult the upstream
75
license when redistributing either tool.
76
77
## The failure that bites first: pointers are not data
78
79
After `datalad clone`, annexed files exist as symlinks into `.git/annex/objects/` (or as
80
small pointer files where symlinks are unavailable, such as on Windows or a crippled
81
filesystem). Nothing has downloaded the content yet.
82
83
Illustrative remote-data example; inspect the selected revision for the exact path and
84
install NiBabel before the Python read. The refresh tested equivalent local pointer/get
85
behavior without downloading imaging data.
86
87
```bash
88
datalad clone https://github.com/OpenNeuroDatasets/ds000001.git
89
cd ds000001
90
ls sub-01/anat/ # the file is listed
91
python -c "import nibabel; nibabel.load('sub-01/anat/sub-01_T1w.nii.gz')" # fails
92
datalad get sub-01/anat/sub-01_T1w.nii.gz # now it works
93
```
94
95
The failure mode to recognise: a tool reports the file as empty, truncated, corrupt, "not
96
a gzip file", or a broken symlink, and the file size on disk is a few hundred bytes. These symptoms can indicate an unfetched annex pointer; confirm with annex status
97
before diagnosing corruption. **Run `datalad get` before reading data, and treat
98
"file exists" as insufficient evidence that its content is present.**
99
100
Before an analysis touches a directory, fetch it explicitly:
101
102
```bash
103
datalad get sub-01/ # everything under a path
104
datalad get -r . # everything, including subdatasets
105
datalad get -n -r . # subdataset structure only, no file content
106
```
107
108
`datalad status --annex availability` checks which content is present locally, and
109
`git annex whereis <path>` reports which repositories hold a given file. `whereis` reads
110
recorded state and does not contact the remotes, so it tells you what git-annex last
111
learned rather than what is true right now.
112
113
See [data-access.md](references/data-access.md) for finding datasets, subdataset
114
behaviour, dropping content safely, and repairing a dataset.
115
116
## Recording provenance with datalad run
117
118
`datalad run` is the reason to reach for DataLad in a methods context. It saves the
119
command alongside its effect, in the same commit:
120
121
Illustrative FSL example (requires `bet` and an existing `derivatives/` directory):
122
123
```bash
124
datalad run -m "extract brain and mask" \
125
--input "sub-01/anat/sub-01_T1w.nii.gz" \
126
--output "derivatives/sub-01_brain.nii.gz" \
127
--output "derivatives/sub-01_brain_mask.nii.gz" \
128
"bet {inputs[0]} {outputs[0]} -m"
129
```
130
131
What each part does, and why skipping it hurts:
132
133
- `--input` retrieves the content before running, so the command does not fail on a
134
pointer. It also records the dependency, which is what lets `rerun` fetch the same
135
inputs on a different machine.
136
- `--output` unlocks or removes the target first, so git-annex does not refuse to write
137
over content it is protecting. Without it, a second run of the same command commonly
138
fails with a permission error on an annexed file that looks read-only.
139
- `{inputs}` and `{outputs}` expand to those values. `{pwd}`, `{dspath}`, and `{tmpdir}`
140
are also available, and `{inputs[0]}` indexes individual entries.
141
- The commit message carries a JSON run record between `=== Do not change lines below ===`
142
and `^^^ Do not change lines above ^^^`. Do not hand-edit that block; `rerun` parses it.
143
144
`datalad run` refuses to start when the dataset has unsaved modifications, because an
145
unclean starting state makes the record unreliable. Save or discard first, or pass
146
`--explicit` to save only declared outputs. This does not capture unsaved input changes;
147
save all dependencies before claiming the run is reproducible. Check a
148
command before committing to it with `--dry-run basic` or `--dry-run command`.
149
150
A run that changes nothing produces no commit, exactly as `datalad save` does.
151
152
`run` records the command and dataset state; it does not freeze arbitrary host-installed software or external services. Version an environment lockfile and scripts as declared inputs, or use a tracked container image with `containers-run`. Record random seeds and relevant runtime settings, then test `rerun` from a fresh environment before claiming computational reproducibility.
153
154
### Re-executing
155
156
```bash
157
datalad rerun # redo the run recorded at HEAD
158
datalad rerun --report # show what would be done, change nothing
159
datalad rerun --script recompute.sh # extract the commands instead of running them
160
datalad rerun --since <commit> -b check <revision> # replay a range onto a new branch
161
```
162
163
`--report` only inspects the plan; it does not execute or validate the result. A branch
164
(`-b`) preserves the original commits, but uses the same worktree. See the reference for
165
a `--since`/`--onto` replay that starts before the first run, and compare annex keys or
166
content checksums as well as scientific outputs.
167
168
### Containers
169
170
With the `datalad-container` extension, register an image once and every subsequent run
171
records which image produced the outputs:
172
173
Illustrative container workflow using a previously built local SIF image (not executed
174
in this refresh; the runtime and image must be available):
175
176
```bash
177
datalad containers-add fsl --url /path/to/fsl.sif \
178
--call-fmt 'apptainer exec {img} {cmd}'
179
datalad containers-run -n fsl -m "brain and mask in container" \
180
--input "sub-01/anat/sub-01_T1w.nii.gz" \
181
--output "derivatives/sub-01_brain.nii.gz" \
182
--output "derivatives/sub-01_brain_mask.nii.gz" \
183
"bet {inputs[0]} {outputs[0]} -m"
184
```
185
186
The image itself is tracked in the dataset, so the software environment travels with the
187
data and the provenance record rather than living in someone's shell history. When only
188
one container is configured, `-n` may be omitted.
189
190
See [provenance.md](references/provenance.md) for the STAMPED principles and the YODA
191
project layout, the run record format, `--explicit` and `--assume-ready` semantics, and
192
exporting provenance toward W3C PROV.
193
194
## Saving and inspecting changes
195
196
```bash
197
datalad status # what changed, including subdataset state
198
datalad save -m "add QC report" path/to/file
199
datalad save -m "checkpoint" -r # recurse into subdatasets
200
datalad save -m "small text file" --to-git notes.md
201
```
202
203
`datalad save` decides per file whether content goes to Git or to git-annex, following the
204
dataset's `.gitattributes`. Force a file into Git with `--to-git`, which is the right call
205
for code and small text files that should stay directly readable. The `yoda` procedure
206
(`datalad create -c yoda`) sets this up for `code/`, `README.md`, and `CHANGELOG.md`
207
automatically.
208
209
## Creating a dataset
210
211
```bash
212
datalad create my_dataset # plain dataset
213
datalad create -c yoda my_analysis # analysis layout (code/ tracked in Git,
214
# README.md and CHANGELOG.md preconfigured)
215
datalad create -d . inputs/raw # register a new subdataset under an existing one
216
```
217
218
`-c yoda` applies the analysis project layout described in
219
[provenance.md](references/provenance.md). `-d .` is what registers a new dataset as a
220
subdataset of the parent rather than leaving an unrelated repository inside it.
221
222
## Publishing
223
224
A DataLad dataset is usually published to two places at once: a Git hosting service for
225
the history, and a storage remote for the annexed content.
226
227
Illustrative authenticated publication (creates remote resources; requires a GitHub
228
token and S3 credentials). Use `myorg/mydataset` only for an organization namespace.
229
230
```bash
231
datalad create-sibling-github mydataset
232
git annex initremote store type=S3 bucket=my-bucket protocol=https \
233
encryption=none autoenable=true
234
datalad siblings configure -s github --publish-depends store
235
datalad push --to github
236
```
237
238
The Git sibling and the storage sibling are created by different tools on purpose. A Git
239
sibling is a Git remote, and `datalad create-sibling-*` handles the hosting-service ones.
240
An S3 bucket (or WebDAV, or an SSH directory) is a *git-annex special remote*, not a Git
241
remote, so it is created with `git annex initremote`. `datalad siblings` picks the special
242
remote up afterwards and treats it like any other. Using `datalad siblings add --url
243
s3://...` here is the mistake this section exists to prevent: `--url` is a Git remote URL,
244
S3 is not, and the `push --to github` below then fails on the `--publish-depends` hop.
245
246
`--publish-depends` is what stops the common broken publication: a Git repository whose
247
history references content that was never uploaded, so collaborators clone successfully
248
and then find every `datalad get` failing. Declaring the dependency makes the storage
249
sibling publish first, every time.
250
251
`datalad push` sends both the Git history and, by default (`--data auto-if-wanted`), the
252
annexed content selected by a target's wanted settings; without wanted settings it
253
transfers all selected current content. `--data anything` bypasses preferred-content
254
filtering, but does not recover missing local bytes or archive every historical version.
255
256
See [publishing.md](references/publishing.md) for RIA stores, special remotes, credential
257
handling, and configuring which sibling holds what.
258
259
## Freeing disk space
260
261
```bash
262
git annex whereis sub-01/ # inspect recorded locations first
263
datalad drop sub-01/ # remove local content, keep the pointer
264
```
265
266
`datalad drop` checks required copies and availability by default. `--nocheck` is
267
deprecated in favor of `--reckless availability`, which disables those protections.
268
`--if-dirty` is deprecated and ignored; it is not an availability-check option.
269
`--what` selects between `filecontent` (the default), `allkeys`, `datasets`, and `all`.
270
271
## Failure modes worth knowing
272
273
| Symptom | Cause | Fix |
274
|---|---|---|
275
| File reads as empty, truncated, or a broken symlink | Content not retrieved; only the pointer is present | `datalad get <path>` |
276
| "Permission denied" writing an existing output | git-annex write-protects annexed content | Declare it with `--output`, or `datalad unlock <path>` |
277
| `datalad run` refuses to start | Dataset has unsaved changes | `datalad save` first, or pass `--explicit` |
278
| `datalad drop` refuses | No verified second copy of the content | Push to a reachable sibling, then retry the safety check |
279
| Collaborator clones but every `get` fails | History published without the content | Publish the storage sibling, and set `--publish-depends` |
280
| Clone succeeds, subdataset directories are empty | Subdatasets are not installed by default | `datalad get -n -r .`, then `get` the paths you need |
281
| Commands behave impossibly | git-annex missing or too old | `datalad wtf --section dependencies` |
282
283
## Detailed references
284
285
- [data-access.md](references/data-access.md): finding published datasets
286
(`registry.datalad.org`, OpenNeuro, DANDI, `datasets.datalad.org` and the `///`
287
shortcut), clone and get options, subdataset handling, annex content states, dropping
288
and removing, and `fsck` repair.
289
- [provenance.md](references/provenance.md): the STAMPED principles and the YODA layout,
290
the run record format, `run` and `rerun` options in full, `containers-run`, and the
291
current state of exporting DataLad provenance toward W3C PROV.
292
- [publishing.md](references/publishing.md): siblings and their actions,
293
`create-sibling-*` variants, RIA stores, special remotes, `push` semantics, and
294
credential handling.
295
296
## Related skills
297
298
The `bids` skill covers the Brain Imaging Data Structure that most of the neuroimaging
299
datasets distributed through DataLad are organised in. A typical workflow clones a BIDS
300
dataset with DataLad, validates it with the BIDS tooling, then runs a BIDS-App under
301
`datalad containers-run` so the derivatives carry provenance.
302
303
## Validation scope
304
305
Reviewed 2026-09-30 against DataLad 1.6.5 and datalad-container 1.2.6 source and
306
current official manuals. Tiny local tests cover clone/get/drop, unlocked saves,
307
subdataset installation, run/rerun, default push selection, and RIA publish/clone/get.
308
Remote hosting, credentials, FSL, and container execution examples are illustrative;
309
no authenticated remote publication or scientific-data downloads were performed.
310
311
## Primary sources
312
313
- DataLad documentation: <https://docs.datalad.org/en/stable/>
314
- DataLad Handbook: <https://handbook.datalad.org/en/latest/>
315
- `datalad run` chapter: <https://handbook.datalad.org/en/latest/basics/101-108-run.html>
316
- YODA principles: <https://handbook.datalad.org/en/latest/basics/101-127-yoda.html>
317
- STAMPED principles (operationalized from YODA): <https://stamped-principles.org>
318
- datalad-container: <https://docs.datalad.org/projects/container/en/stable/>
319
- git-annex: <https://git-annex.branchable.com/>
320
- Dataset registry: <https://registry.datalad.org>
321
322
## Acknowledgment
323
324
Topic scope for this skill was informed in part by @bcmcpher's MIT-licensed
325
[datalad-cli](https://github.com/bcmcpher/my-skills/tree/main/plugins/datalad-cli)
326
plugin (nineteen per-command slash-command skills). The text here is written
327
independently and grounded in the upstream DataLad documentation; overlap is unavoidable
328
because both cover DataLad, but the structure, style, and specific technical claims are
329
different.
330

© Dylan Pulver · MIT · source · posted by @OpenSourceBuffGuy on promptparty.com

@OpenSourceBuffGuy

I find openly licensed prompts and post them here.

0 followers · 12,238 prompts

More by @OpenSourceBuffGuy

See all
Laravel Expert Agent prompt image

Laravel Expert Agent

Acts as a Laravel 12+ expert who builds and reviews applications with Eloquent, Artisan, routing, auth, queues and tests following framework conventions.

sub-agent, act-as, expert-advice, code-generation, laravel, php, backend, web-development, database, authentication, testing, unit-testing, best-practices, for-developers, full-stack, code, debugging, performance-optimization, advanced, long-form, tool-use

Career Advancement Strategist prompt image

Career Advancement Strategist

Turns the AI into a career strategist that assesses promotion readiness and builds 30/60/90-day and long-term advancement plans with stakeholder and skills strategies.

system-prompt, act-as, coach, expert-advice, career-planning, leadership, workplace, professional-networking, performance-reviews, for-job-seekers, for-managers, roadmap, report, action-items, gap-analysis, planner, xml-tags, structured-output, guardrails, formal, advanced, long-form, goal-setting, self-improvement

Indonesian Dish Floating Ingredients Poster prompt image

Indonesian Dish Floating Ingredients Poster

Generates a cinematic food poster of an Indonesian dish with labelled ingredients floating above it amid splashes of sauce and spices.

image-prompt, nano-banana, food-photography, photorealistic, cinematic, exploded-view, text-rendering, poster, dramatic-lighting, bokeh, cooking, restaurants, for-content-creators, for-marketers, vibrant-colors, soft-lighting, editorial, slow-motion

Reviews

Loading reviews…

Discussion

Loading comments…