Skill: datalad-clone
Obtain a copy of a DataLad dataset from a URL or local path. Optionally register it as
a subdataset inside an existing DataLad dataset (YODA-style nested layout).
Steps
- Identify source — read the source URL or path from
$ARGUMENTS. If not provided,
ask the user for the source before continuing. If the URL begins with ria+, this is
a RIA store. Accepted formats: ria+ssh://user@host/path, ria+http://host/path,
ria+file:///local/path. Load ${CLAUDE_PLUGIN_ROOT}/../references/siblings-and-remotes.md
for RIA store URL details.
- Determine mode — decide whether this clone should be:
- Standalone: a new independent dataset (no
-dflag) - As a subdataset: nested inside the current dataset (
-d .)
Check whether the current working directory is a DataLad dataset:
```bash
ls .datalad/ 2>/dev/null
```
- If inside a dataset and the user mentions "input data", "nested", "subdataset",
or a target path like inputs/raw/sub-01 — default to subdataset mode
- If not inside a dataset or the user says "standalone" — use standalone mode
- If ambiguous — ask:
> "Should this be registered as a subdataset of the current dataset, or cloned
> as a standalone dataset?"
- Determine destination path — read from
$ARGUMENTSor derive from the source
name (last path/URL component, minus .git). Show the planned destination and confirm
if it differs from what the user expects.
- Construct and show command:
- Standalone:
```
datalad clone <source> [<dest>]
```
- As subdataset:
```
datalad clone -d . <source> <dest>
```
When cloning on the same filesystem (e.g., HPC scratch → project directory),
--reckless=shared-local skips the safety copy and is substantially faster. Only use
on trusted local filesystems.
Always show the full command before executing.
- Execute — run the command. Report the installed path and the commit SHA recorded.
- Post-clone reminder (subdataset mode only) — after cloning as a subdataset, the
superdataset's working tree is modified but not yet committed. Remind the user:
> "The subdataset pointer is not yet saved. Run:
> datalad save -m 'add <name> as subdataset'
> to record it in the superdataset history."
Reference
Load ${CLAUDE_PLUGIN_ROOT}/../references/subdataset-patterns.md when the user asks
about nested layouts, why -d . is needed, or the YODA neuroimaging project structure.
Load ${CLAUDE_PLUGIN_ROOT}/../references/yoda-layout.md when the user asks about the
YODA directory layout, .gitattributes rules, or how inputs/ and outputs/ are
structured.
Constraints
- Never use
git clonefor DataLad datasets — usedatalad cloneto preserve annex
configuration and special remote registrations.
- Never use
datalad install— it is a deprecated alias fordatalad clone. - Never use
git submodule adddirectly — DataLad manages submodule entries via
datalad clone -d ..
- Always show the full command before executing.
- Always prompt for a follow-up
datalad saveafter a subdataset clone.