Skip to content
Agentmart
Submit a tool

dir-tree-index

Generate or update distributed STRUCTURE.md index files across a repo to help LLMs orient quickly in project structure and to make large knowledge…

Skill by apocohq

IndexedMIT★ 4
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/apocohq-dir-tree-index

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Generate or update distributed STRUCTURE.md index files across a repo to help LLMs orient quickly in project structure and to make large knowledge repositories easier to navigate and summarize.

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/dir-tree-index

What's inside

Skill name
dir-tree-index
Description
Generate or update distributed STRUCTURE.md index files across a repo to help LLMs orient quickly in project structure and to make large knowledge repositories easier to navigate and summarize.
License
MIT
Instructions
81 lines in SKILL.md · view on GitHub

Files (1)

  • SKILL.md

SKILL.md (first lines)

# Dir Tree Index

Generate a `STRUCTURE.md` in every directory, listing its contents with one-line summaries.
This helps LLMs orient themselves quickly, improves discovery in large codebases, and is especially effective for documentation-first or knowledge repository workflows.

## Input

Optional argument: target directory (defaults to repo root).

## Algorithm

Process directories bottom-up (deepest first) so child indexes exist before parents need them.

### Step 1: Discover directories

Replace `<target>` with the resolved path (repo root if no argument given):

```bash
find <target> -type d -not -path '*/.*' | sort -r
```

Process the output in order (deepest first).

### Step 2: For each directory, gather contents

List immediate children. Replace `<dir>` with the directory being processed.

Subdirectories (excluding hidden):

```bash
find <dir> -mindepth 1 -maxdepth 1 -type d -not -name '.*' | sort
```

Files (excluding hidden and STRUCTURE.md):

```bash
find <dir> -mindepth 1 -maxdepth 1 -type f -not -name '.*' -not -name 'STRUCTURE.md' | sort
```

Skip binary files, images, and other non-text files silently.

### Step 3: Build entries

**The files and folders from Step 2 are authoritative.** If a `STRUCTURE.md` already exists, parse it as a summary cache (entry name to summary), but only to avoid re-summarizing unchanged items.

For each child found in Step 2:
- **File, cached:** reuse existing summary.
- **File, new:** read first 30 lines, write a one-line summary.
- **Subdir, cached:** reuse existing summary.
- **Subdir, new:** summarize from its `STRUCTURE.md` (already generated in this pass). If none exists, summarize from folder name.

Remove any entry from the cache that no longer exists on disk.

### Step 4: Write STRUCTURE.md

Write using the format below. Skip the write if content is identical to the existing file (avoid unnecessary git diffs).

After completion, report which directories were created or updated.

## Output Format

```markdown
# {directory name, or "Structure" for root}

*Auto-generated by the `dir-tree-index` skill. Do not edit manually.*

## Folders
- [`subfolder/`](subfolder/) - One-line summary

## Files
- [`README.md`](README.md) - One-line summary
- [`other.md`](other.md) - One-line summary
```

- Use relative markdown links for all entries.
- Always include the auto-generated notice line.
- Omit `## Folders` or `## Files` if that category is empty.
- Sort alphabetically, but put `README.md` first among files.
- Summaries: under 80 chars, sentence fragments, no leading articles, no trailing periods.

From apocohq/skills, MIT.

More from apocohq/skills

Signals

Stars
4
Forks
0
Open issues
0
Last commit (this folder)
Mar 25, 2026 (7 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from apocohq

Cite this page

dir-tree-index skill. Agent Mart. https://agentmart.dev/skills/apocohq-dir-tree-index (last updated 2026-10-24)