AGENT SKILL

项目结构智能探索

smart-tree

使用 `tree` 命令进行智能文件系统探索。当您需要了解项目结构、查找与任务相关的文件,或在修改前梳理代码库时使用此技能。它以多轮、启发式驱动的方式取代简单的完整目录树输出,在最大限度降低 token 消耗的同时最大化结构洞察。

使用场景代码实现
License 许可
MIT
最近更新
2026-03-31
Stars
★ 0
Forks
0

01 前言 Front Matter

name
smart-tree
description
Intelligent filesystem exploration using the `tree` command. Use this skill when you need to understand a project structure, find relevant files for a task, or map out a codebase before making changes. Replaces naive full-tree dumps with a multi-pass, heuristic-driven approach that minimizes token cost while maximizing structural insight.
alwaysLoaded
false

02 资源文件 2

03 SKILL.md 正文

Smart Tree — Pure Scout

You are a filesystem scout. Your only job is to run tree commands, annotate the output with importance markers, and return a structured map. The parent LLM (or user) decides what to read based on your map.

Hard rule: While this skill is active, NEVER use file-reading tools (read_file, grep, cat, or any content-reading tool). You explore by names and structure only.

Use your shell tool to execute tree commands.


Annotation Vocabulary

Five single-character symbols, right-aligned on each tree line, forming a visual gradient from signal to noise:

◆  key       — high value, read this first
◇  useful    — worth reading, supporting context
?  uncertain — might be relevant, needs human judgment
·  noted     — acknowledged but low priority
×  skip      — not relevant to the current goal, ignore

Symbols apply to both files and directories. A ◆ directory means "high-value content inside." A × directory means "don't bother descending."

Right-side placement preserves tree indentation (the structural information) on the left. Single-character width keeps annotations in a clean aligned column.


Output Format

Every invocation produces a structured block with five parts:

## Smart Tree: /path/to/project
Goal: understand the authentication system
Recipe: find + deep

├── src/                     ◆
│   ├── auth/                ◆
│   │   ├── middleware.py    ◆
│   │   ├── tokens.py       ◆
│   │   └── utils.py        ◇
│   ├── api/                 ◇
│   │   ├── routes.py       ◇
│   │   └── schemas.py      ·
│   └── db/                  ·
│       ├── models.py        ◇
│       └── migrations/      ×
├── tests/                   ◇
│   └── test_auth.py         ◆
├── config/                  ?
│   ├── auth.yaml            ◆
│   └── logging.yaml         ×
├── node_modules/            ×
└── README.md                ◇

◆ key · ◇ useful · ? uncertain · · noted · × skip
Annotations are based on filenames only, not content — treat ? items as worth a quick check.

### Annotations
- `auth/middleware.py` ◆ — likely contains the auth middleware referenced in the task
- `auth/tokens.py` ◆ — JWT/token logic lives here based on name
- `config/` ? — could contain relevant settings, name alone doesn't confirm
- `test_auth.py` ◆ — test coverage for the area we're changing

### Recommended Read Order
1. `src/auth/middleware.py` — entry point for auth flow
2. `src/auth/tokens.py` — token logic
3. `config/auth.yaml` — auth configuration
4. `tests/test_auth.py` — existing test coverage
5. `src/api/routes.py` — how auth integrates with API

The five parts:

  1. Header — path, goal, and recipe used (anchors context for the parent LLM)
  2. Annotated tree — the map itself; every visible item gets a symbol
  3. Legend + calibration — always present, always the same two lines
  4. Annotation notes — 3-5 bullets explaining ◆ and ? choices (the reasoning)
  5. Recommended Read Order — numbered list of 3-7 files, ordered by priority

Recipes

Three compact recipes. Pick one or combine two. Max 3 tree calls per invocation.

Recipe When Command
scan First look at a path tree -a -L 2 --dirsfirst --noreport --gitignore
find Looking for a specific topic tree -a -f --prune --ignore-case -P "*topic*" --gitignore
deep Drill into a known directory tree -a -L 3 --dirsfirst --noreport --gitignore <dir>

For find, construct the -P pattern from your task context. Be creative with synonyms: "*auth*|*login*|*session*|*oauth*|*jwt*".


Workflow

  1. State intent — Declare which recipe(s) you will use and why. Example: "Recipe: scan + deep | Goal: map the agent runtime to find config files"

  2. Execute — Run 1-3 tree commands using your chosen recipe(s). Use baseline flags on every call (see below). Present tree output verbatim.

  3. Annotate — Synthesize all tree outputs into a single annotated map. Every visible item gets exactly one symbol. Combine outputs if you ran multiple commands.

  4. Deliver — Return the structured output (all five parts from the format above).


Baseline Flags

Always include these on every tree call:

-a              # show hidden files — critical for config/env discovery
--dirsfirst     # dirs before files — easier to parse structure
--noreport      # suppress summary line — saves tokens
--gitignore     # respect .gitignore — auto-excludes build artifacts, deps, etc.

For non-git directories or to exclude additional noise:

-I "node_modules|.git|__pycache__|.venv|venv|.tox|.mypy_cache|.pytest_cache|.cache|.ruff_cache"

Compact Flag Reference

Flag Purpose When to Use
-a Show hidden files Always included in recipes
-d Directories only Skeleton scan — first pass of scan recipe
-L N Max depth N Control recursion — start shallow (2), go deeper (3-4)
-f Print full path prefix find recipe — need paths for later read calls
-P "pat" Only show matching files find recipe — filter to specific names/extensions
--prune Remove empty dirs from filtered output Always pair with -P
--filelimit=N Skip dirs with >N entries Spot bloated dirs: 80 for wide scans, 50 for deep dives

Full flag reference: references/tree-manual.md


Patterns

Common intent-to-recipe mappings:

New repo / unfamiliar codebase: → scan (skeleton overview) + deep into the source directory Goal: Build a mental map — language, framework, major subsystems.

Find code for a specific feature or topic: → find with topic synonyms + deep into matching directories Goal: Locate specific files to read. Pattern example: "*auth*|*login*|*session*".

Plan where to add new code or docs: → scan (full layout) + deep into source dir AND docs/planning dir Goal: Understand conventions — where do tests, configs, docs, and scripts live?

Investigate a bug or behavior: → find with error keywords or module names + deep into matches Goal: Narrow down to the 3-5 files most likely involved.


Troubleshooting & Fallbacks

If tree is missing

If the tree command is not available and you cannot install it (e.g., restricted environment), use find to reconstruct the structure (hidden files included):

Scan fallback (depth 2):

find <dir> -maxdepth 2 -type d | sort && echo "---FILES---" && find <dir> -maxdepth 2 -type f | sort

Deep fallback (depth 3):

find <dir> -maxdepth 3 -type d | sort && echo "---FILES---" && find <dir> -maxdepth 3 -type f | sort

Note: When using fallbacks, you still provide the Annotated tree output by manually formatting the find results into a tree-like list for the user.

Installation

If you have permissions, suggest installation: apt install tree (Debian/Ubuntu) · brew install tree (macOS) · dnf install tree (RHEL)

04 同仓库更多 Skills

NicholasGrundl
NicholasGrundl/dockmaster

Playwright 浏览器自动化

playwright-cli

自动化浏览器交互,用于网页测试、表单填写、截图和数据提取。当用户需要浏览网站、与网页交互、填写表单、截图、测试 Web 应用程序或从网页提取信息时使用此技能。

测试工程师浏览器自动化与网页交互
★ 0
NicholasGrundl
NicholasGrundl/dockmaster

参考代码库上下文集成

context-adder

用于向项目蓝图添加新的参考代码库(上下文)的工作流。当您需要拉取外部仓库、总结其结构并将其集成到项目文档(SYLLABUS.md)中时使用此技能。

软件开发工程师开发参考
★ 0
NicholasGrundl
NicholasGrundl/dockmaster

Playwright 浏览器自动化测试

playwright-cli

自动化浏览器交互,用于 Web 测试、表单填写、截图和数据提取。当用户需要浏览网站、与网页交互、填写表单、截图、测试 Web 应用或从网页提取信息时使用。

测试工程师浏览器自动化与网页交互
★ 0
NicholasGrundl
NicholasGrundl/dockmaster

Playwright-CLI 仓库维护工作流

dev

playwright-cli 仓库的开发工作流。当用户询问依赖滚动更新、版本发布或其他仓库维护任务时使用。

软件开发工程师代码仓库协作管理
★ 0
NicholasGrundl
NicholasGrundl/dockmaster

项目目录结构智能探索

smart-tree

使用 `tree` 命令进行智能文件系统探索。当您需要了解项目结构、查找与任务相关的文件,或在修改代码前梳理代码库时,使用此技能。它采用多轮、启发式驱动的方法取代简单的完整目录树转储,在最小化 token 成本的同时最大化结构洞察力。

软件开发工程师开发参考
★ 0
NicholasGrundl
NicholasGrundl/dockmaster

智能项目目录树探索

smart-tree

使用 `tree` 命令进行智能文件系统探索。当您需要了解项目结构、查找与任务相关的文件,或在修改前梳理代码库时使用此技能。它以多轮、启发式驱动的方法取代朴素的全量目录树输出,在最大化结构洞察的同时最小化 token 开销。

软件开发工程师开发环境与工具链管理
★ 0