
Tree View
- 12 installs
- 17 repo stars
- Updated July 25, 2026
- dwsy/agent
Displays a directory tree structure with customizable depth using fd and Python3 for fast, readable visualization, useful when the standard tree command is missing or too slow.
About
tree-view is a Claude Code skill that renders a directory tree with customizable depth using fd and Python3 for fast, clean visualization. A solo builder reaches for it to get a quick hierarchical overview of a project's files when the default tree command is unavailable or too slow.
- Fast directory tree via fd + Python3
- Customizable depth limits
- Works when tree is unavailable
- Readable hierarchical output
Tree View by the numbers
- 12 all-time installs (skills.sh)
- Ranked #383 of 550 CLI & Terminal skills by installs in the Skillselion catalog
- Data as of Jul 29, 2026 (Skillselion catalog sync)
npx skills add https://github.com/dwsy/agent --skill tree-viewAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 12 |
|---|---|
| repo stars | ★ 17 |
| Last updated | July 25, 2026 |
| Repository | dwsy/agent ↗ |
What it does
Displays a directory tree structure with customizable depth using fd and Python3 for fast, readable visualization, useful when the standard tree command is missing or too slow.
Who is it for?
Builders wanting a quick project structure overview
Skip if: Users needing rich file-manager GUIs
Files
Tree View
Fast directory tree visualization using fd + Python3.
When to Use
- Need a quick overview of directory structure
- Want to see files organized hierarchically
- Default
treecommand is not available or too slow - Need customizable depth limits
Usage
# Show directory tree (default 2 levels)
bun ~/.pi/agent/skills/tree-view/cli.ts
# Show 3 levels deep
DEPTH=3 bun ~/.pi/agent/skills/tree-view/cli.ts
# Show 4 levels deep
DEPTH=4 bun ~/.pi/agent/skills/tree-view/cli.tsFeatures
- Fast: Uses
fdfor efficient file discovery - Depth control: Environment variable
DEPTHcontrols levels - Clean output: Proper tree structure with branch characters
- Smart truncation: Long filenames are truncated for readability
Requirements
bun- Bun runtimefd- Fast alternative tofindpython3- For tree formatting
Output Format
docs/
├── adr/
│ └── 20240210-decision.md
├── issues/
│ ├── frontend/
│ │ └── 20240210-task.md
│ └── backend/
└── guides/Notes
- Directories are shown with trailing
/ - Files are shown without trailing slash
- Names longer than 30 characters are truncated (
prefix...suffix)
#!/usr/bin/env bun
/**
* Tree View CLI
*
* Provides directory tree display functionality using fd + Python3.
*
* Usage:
* bun cli.ts # Show 2 levels (default)
* DEPTH=3 bun cli.ts # Show 3 levels
*/
import { execSync } from "child_process";
import { writeFileSync, unlinkSync } from "fs";
import { tmpdir } from "os";
import { join } from "path";
const depth = process.env.DEPTH || "2";
const pythonScript = `import os
import subprocess
# 获取目录列表以判断是否是目录
depth = os.environ.get('DEPTH', '2')
dirs_result = subprocess.run(['fd', '-t', 'd', '-d', depth], capture_output=True, text=True)
dirs = set(line.rstrip('/') for line in dirs_result.stdout.strip().split('\\n') if line)
# 处理文件列表
files_result = subprocess.run(['fd', '-d', depth], capture_output=True, text=True)
root = {}
children = {}
for line in files_result.stdout.strip().split('\\n'):
if not line:
continue
path = line.rstrip('/')
parts = path.split('/')
if len(parts) == 1:
root[parts[0]] = (parts[0] in dirs)
elif len(parts) == 2:
parent, name = parts
if parent not in children:
children[parent] = []
is_dir = (f"{parent}/{name}" in dirs)
children[parent].append((name, is_dir))
# 输出结果
for path in sorted(root.keys()):
is_dir = root[path]
print(f"{path}/" if is_dir else path)
if path in children:
items = children[path]
for i, (name, is_dir) in enumerate(items):
suffix = '/' if is_dir else ''
if len(name) > 30:
name = f"{name[:10]}...{name[-7:]}"
if i == len(items) - 1:
print(f"└── {name}{suffix}")
else:
print(f"├── {name}{suffix}")
`;
try {
// Write script to temp file
const tempFile = join(tmpdir(), `tree-view-${Date.now()}.py`);
writeFileSync(tempFile, pythonScript, "utf8");
// Execute
const result = execSync(`DEPTH=${depth} python3 "${tempFile}"`, {
encoding: "utf8",
});
console.log(result);
// Cleanup
unlinkSync(tempFile);
} catch (error) {
console.error("Error:", (error as Error).message);
process.exit(1);
}