# Datalad Subdatasets

> >

- **Type:** Skill
- **Install:** `agentstack add skill-neuroanalytics-data-science-harness-datalad-subdatasets`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [neuroanalytics](https://agentstack.voostack.com/s/neuroanalytics)
- **Installs:** 0
- **Category:** [Agent Skills](https://agentstack.voostack.com/c/agent-skills)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [neuroanalytics](https://github.com/neuroanalytics)
- **Source:** https://github.com/neuroanalytics/data-science-harness/tree/main/plugins/datalad-cli/skills/datalad-subdatasets

## Install

```sh
agentstack add skill-neuroanalytics-data-science-harness-datalad-subdatasets
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# Skill: datalad-subdatasets

Inspect the subdataset tree and manage subdataset properties. Lists all registered
subdatasets, their state (present/absent), and the commit SHA they are pinned to.

## Steps

1. **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.

2. **Determine action** — read from `$ARGUMENTS` or conversation context:
   - **inspect** (default): list all subdatasets
   - **recursive listing**: list the full tree
   - **filter absent**: show only uninitialized subdatasets
   - **set property**: modify a `.gitmodules` entry for a specific subdataset

3. **Construct and run command**:

   ### inspect (default)
   ```bash
   datalad subdatasets
   ```

   ### recursive listing
   ```bash
   datalad subdatasets -r
   ```

   ### filter absent
   ```bash
   datalad subdatasets --state absent
   ```

   ### set property
   Show the command and confirm before running — this modifies `.gitmodules`:
   ```
   datalad subdatasets --set-property   
   ```
   Common properties: `url` (change where the subdataset is fetched from).

   ### run a command across subdatasets (`datalad foreach-dataset`)
   When the user wants to execute a command on every subdataset in the tree, use
   `datalad foreach-dataset`. Gather:
   - The command or DataLad command to run (as a string)
   - Whether to recurse (`-r`) into nested subdatasets
   - Whether to include the superdataset (`--include-super`)

   ```bash
   datalad foreach-dataset [-r] [--include-super] -- 
   ```

   Examples:
   ```bash
   # Run datalad status on every subdataset
   datalad foreach-dataset -r -- datalad status

   # Update all subdatasets
   datalad foreach-dataset -r -- datalad update --how=merge

   # Check annex usage in every subdataset
   datalad foreach-dataset -r -- git annex info --fast
   ```

   Always show the full command before executing and warn that errors in one subdataset
   will be reported but processing continues for the rest.

4. **Interpret output** — explain the results to the user:
   - `state: present` — the subdataset is cloned and accessible locally
   - `state: absent` — the subdataset is registered in `.gitmodules` but not yet cloned;
     files are not accessible
   - `gitshasum` — the exact commit the superdataset has pinned for this subdataset

5. **Suggest follow-up** based on what's found:
   - For **absent** subdatasets:
     > "Run `datalad get -n ` to initialize the subdataset handle without
     > downloading content, or `datalad get ` to initialize and retrieve all files."
   - For **present** subdatasets that appear out-of-date:
     > "Run `datalad update -s origin --how=merge` to pull the latest state."
   - For a large tree with many absent subdatasets:
     > "Run `datalad get -r .` to initialize and retrieve all absent subdatasets and
     > their content at once."

## Reference

Load `${CLAUDE_PLUGIN_ROOT}/../references/subdataset-patterns.md` for the absent/present
model, neuroimaging layout examples, recursive get patterns, and `.gitmodules` structure.

## Constraints

- The **query actions are read-only** — `datalad subdatasets` and `--state` filters do
  not modify any state.
- For `--set-property`: always show the command and ask the user to confirm before
  running — it modifies `.gitmodules`, which is a tracked file that requires a subsequent
  `datalad save` to record the change.
- Never edit `.gitmodules` directly — use `datalad subdatasets --set-property` or
  DataLad's other subdataset management commands.
- Never use `git submodule` commands directly inside a DataLad dataset unless explicitly
  debugging at the git level — DataLad's abstraction layer must be kept consistent.

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [neuroanalytics](https://github.com/neuroanalytics)
- **Source:** [neuroanalytics/data-science-harness](https://github.com/neuroanalytics/data-science-harness)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-neuroanalytics-data-science-harness-datalad-subdatasets
- Seller: https://agentstack.voostack.com/s/neuroanalytics
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
