file-organizer

基于 AI 语义分析的智能文件整理技能,根据文件内容动态创建 Johnny Decimal 分类。 当用户提到以下内容时触发: - "整理文件"、"分类文件"、"组织下载"、"文件归档" - "文件太多了"、"下载文件夹很乱"、"文件乱七八糟" - "把文件按类别整理"、"自动分类文件" - "清理下载文件夹"、"整理文档" - "文件管理"、"文件分类整理" - 提到需要将文件从一个目录移动到另一个目录进行分类 核心功能: - AI 分析文件名语义,动态生成分类 - 使用 Johnny Decimal 编号系统(XX.YY 格式) - 自动检测重复文件(MD5 算法) - 用户确认分类计划后再执行

3,891 stars

Best use case

file-organizer is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

基于 AI 语义分析的智能文件整理技能,根据文件内容动态创建 Johnny Decimal 分类。 当用户提到以下内容时触发: - "整理文件"、"分类文件"、"组织下载"、"文件归档" - "文件太多了"、"下载文件夹很乱"、"文件乱七八糟" - "把文件按类别整理"、"自动分类文件" - "清理下载文件夹"、"整理文档" - "文件管理"、"文件分类整理" - 提到需要将文件从一个目录移动到另一个目录进行分类 核心功能: - AI 分析文件名语义,动态生成分类 - 使用 Johnny Decimal 编号系统(XX.YY 格式) - 自动检测重复文件(MD5 算法) - 用户确认分类计划后再执行

Teams using file-organizer should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/smart-file-organizer/SKILL.md --create-dirs "https://raw.githubusercontent.com/openclaw/skills/main/skills/akira82-ai/smart-file-organizer/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/smart-file-organizer/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How file-organizer Compares

Feature / Agentfile-organizerStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

基于 AI 语义分析的智能文件整理技能,根据文件内容动态创建 Johnny Decimal 分类。 当用户提到以下内容时触发: - "整理文件"、"分类文件"、"组织下载"、"文件归档" - "文件太多了"、"下载文件夹很乱"、"文件乱七八糟" - "把文件按类别整理"、"自动分类文件" - "清理下载文件夹"、"整理文档" - "文件管理"、"文件分类整理" - 提到需要将文件从一个目录移动到另一个目录进行分类 核心功能: - AI 分析文件名语义,动态生成分类 - 使用 Johnny Decimal 编号系统(XX.YY 格式) - 自动检测重复文件(MD5 算法) - 用户确认分类计划后再执行

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

Related Guides

SKILL.md Source

# File Organizer Skill

基于 AI 语义分析的智能文件整理技能,根据文件内容动态创建分类。

## 核心特性

| 特性 | 说明 |
|------|------|
| **分类方式** | AI 分析文件名语义,动态生成分类 |
| **交互模式** | AskUserQuestion 询问源/目标目录 |
| **用户确认** | 显示分类计划后等待确认 |
| **目标优先** | 优先使用目标目录现有分类 |
| **重复检测** | 使用 MD5 算法自动检测重复文件 |

## 使用方式

本技能通过自然语言触发,你可以用多种方式描述需求:

**示例:**
- "把我的 Downloads 文件夹整理到 Documents/Archives"
- "我的下载文件夹太乱了,帮我按类别整理一下"
- "整理这些文件:~/Downloads → ~/Documents/Organized"
- "清理下载文件夹,把文件按类型分类"

**如果需要指定特定目录:**
- 可以在对话中直接提供路径
- 技能会通过 `AskUserQuestion` 询问源目录和目标目录
- 支持绝对路径和相对路径(如 `~/Downloads`, `./files`)

## Johnny Decimal 分类标准

本技能使用 Johnny Decimal 编号系统进行文件分类。详细规范请参考:`references/johnny_decimal.md`

**核心要点:**
- 使用 `XX.YY` 格式的分类编号(如 `01-01`, `10-05`)
- 主编号按主题领域递增(如 `01-XX` 技术类,`02-XX` 商业类)
- 子编号在同一领域内按顺序递增
- 分类命名格式:`编号_类别名称`

**快速示例:**
```
01-01_人工智能技术    # 技术领域
01-02_网络安全        # 技术领域
01-03_编程开发        # 技术领域
02-01_金融经济        # 商业领域(新主题,主编号递增)
02-02_消费零售        # 商业领域
```

## 执行流程

### 1. 解析参数
检查用户是否提供了源目录和目标目录参数。

### 2. 确定源目录(如未指定)
使用 `AskUserQuestion` 询问用户,提供常用目录选项。

### 3. 确定目标目录(如未指定)
使用 `AskUserQuestion` 询问用户,提供常用目录选项。

### 4. 扫描目标目录
```bash
ls -la "$target"
```
- 检查是否已有分类目录
- 如有,记录现有分类列表供后续匹配

### 5. 扫描源文件
```bash
ls -1 "$source"
```
- 获取所有文件列表
- 跳过隐藏文件(以 `.` 开头)

### 6. AI 分析并生成分类

**如果目标目录有分类**:将文件匹配到现有分类

**如果目标目录无分类**:AI 分析所有文件名,动态创建分类

**重要:生成的分类名称必须带编号前缀,格式为 `编号_类别名称`**
- 编号使用 Johnny Decimal 格式:`01-01`, `01-02`, `02-01`, `10-05` 等
- 编号与类别名称之间用下划线 `_` 分隔
- 类别名称可以使用中文或英文,允许包含下划线

**编号递增规则(关键):**
- **主分类编号(第一部分)**:根据**主题领域**递增
  - 同一大类主题下的所有子分类共享相同的主分类编号
  - 例如:所有技术相关用 `01-XX`,所有商业相关用 `02-XX`,所有行业相关用 `03-XX`
  - 每个主分类编号最多包含 99 个子分类(`01-01` 到 `01-99`)
  - 当发现不同的主题领域时,必须递增主分类编号
- **子分类编号(第二部分)**:在同一主题领域内按顺序递增(`01`, `02`, `03`...)

**示例:**
```
01-01_人工智能技术    # 技术领域
01-02_网络安全        # 技术领域
01-03_编程开发        # 技术领域
02-01_金融经济        # 商业领域(新主题,主编号递增)
02-02_消费零售        # 商业领域
02-03_商业管理        # 商业领域
03-01_教育培训        # 行业领域(新主题,主编号再递增)
03-02_医疗健康        # 行业领域
```

分类原则:
- 根据文件名的语义相似性分组
- **先识别主题领域**(技术/商业/行业/娱乐等),再细分具体类别
- 分类名称简洁明了(中文或英文)
- 每个分类包含相关联的文件
- 优先识别常见模式(代码、文档、图片、压缩包等)

### 7. 显示分类计划

根据步骤 6 生成的分类,向用户展示整理计划。

**显示策略:**
- **文件总数 ≤ 30**:显示完整文件列表(当前模式)
- **文件总数 > 30**:智能摘要模式
  - 显示:分类名称 + 文件数量 + 前 3 个代表性文件
  - 提供:`[展开查看全部]` 选项

**统计文件总数(Bash):**
```bash
total_files=$(ls -1 "$source" | wc -l | tr -d ' ')
```

**示例格式(使用实际变量):**

**模式 A:完整列表(≤30 个文件)**
```
📁 源目录: $source (13 个文件)
📂 目标目录: $target (新建分类)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  📚 01-01_学习资料 (3 files)
     ├── 学习笔记Python.pdf
     ├── 课程视频.mp4
     └── 教程.md
  💻 01-02_代码项目 (2 files)
     ├── React组件.tsx
     └── script.py
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
```

**模式 B:智能摘要(>30 个文件)**
```
📁 源目录: $source (127 个文件)
📂 目标目录: $target (新建分类)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  📚 01-01_学习资料 (45 files)  [展开查看全部]
     ├── 学习笔记Python.pdf
     ├── 课程视频.mp4
     └── 教程.md
     ... 还有 42 个文件
  💻 01-02_代码项目 (38 files)  [展开查看全部]
     ├── React组件.tsx
     ├── script.py
     └── index.html
     ... 还有 35 个文件
  📦 01-03_压缩备份 (44 files)  [展开查看全部]
     ├── backup.zip
     ├── archive.tar.gz
     └── documents.7z
     ... 还有 41 个文件
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

💡 提示:文件数量较多,显示为智能摘要模式
```

**注意:** 显示时使用实际的 `$source` 和 `$target` 变量值,不要硬编码路径。

### 8. 用户确认(必须)

使用 `AskUserQuestion` 询问是否执行:

**选项:**
- **确认执行** - 按照上述分类计划移动文件
- **展开查看全部** - 显示完整的文件列表(适用于摘要模式)
- **调整分类** - 修改某些文件的分类
- **取消操作** - 放弃本次整理

**必须等待用户确认后才能执行移动操作**

**模式切换说明:**
- 如果用户在摘要模式下选择"展开查看全部",重新以完整列表模式显示步骤 7
- 再次确认时,`展开查看全部` 选项替换为 `返回摘要模式`

### 9. 创建目录结构
根据步骤 6 生成的分类,动态创建目录。

**格式:** `$target/编号_类别名称`

示例(根据实际分类动态创建):
```bash
# 假设 AI 生成的分类为:
# - 01-01_Claude相关
# - 01-02_AI综合应用
# - 01-03_代码项目

mkdir -p "$target/01-01_Claude相关"
mkdir -p "$target/01-02_AI综合应用"
mkdir -p "$target/01-03_代码项目"
```

**注意:** 必须使用 `$target` 变量,不要硬编码路径。

### 10. 执行移动操作
使用 Bash 命令批量移动文件到对应分类目录。

### 11. 重复文件检查与处理

在移动文件完成后,检查目标目录是否存在重复文件。

```bash
# 调用 Python 脚本检查重复文件
python3 scripts/check_duplicates.py "$target"
```

**脚本输出示例:**
```
🔍 重复文件检查报告
============================================================
📂 目标目录: /Users/user/Documents/Archives
📄 总文件数: 45
✅ 唯一文件: 42
🔄 重复组数: 1

⚠️  发现以下重复文件:

MD5: a1b2c3d4e5f6...
  大小: 1,234,567 字节
  ✅ 保留: 01-01_学习资料/document.pdf
       时间: 2025-02-10 14:30:00
  🗑️  重复: 01-02_代码项目/document.pdf
       时间: 2025-02-15 09:20:00
```

**处理重复文件(如果发现重复):**

使用 `AskUserQuestion` 询问用户处理方式:

**选项:**
- **自动删除重复文件**(保留每组最早创建的文件)
- **保留所有文件**(不做任何修改)
- **查看详细报告**(显示完整 JSON 报告)

**如果选择自动删除:**
```bash
python3 scripts/check_duplicates.py "$target" --delete
```

**删除策略:**
- 每个 MD5 组保留修改时间最早的文件
- 删除其余重复文件
- 显示删除文件数和释放空间

**如果选择保留所有:**
- 跳过此步骤,继续流程

**如果未发现重复文件:**
- 显示 "✨ 未发现重复文件!"
- 直接继续下一步

### 12. 输出报告
```bash
# 检查源目录是否清空
ls -1 "$source" | wc -l

# 显示各分类文件数
echo ""
echo "📊 分类统计:"
for dir in "$target"/*/; do
  dir_name=$(basename "$dir")
  echo "  $dir_name"
done
```

## 技术说明

- 文件名语义分析不依赖扩展名
- 支持中文和英文文件名
- 动态生成分类,无固定模板
- 优先匹配目标目录现有分类
- 自动创建不存在的目录结构
- 跳过隐藏文件(`.` 开头)

Related Skills

filesystem

3891
from openclaw/skills

Advanced filesystem operations for listing files, searching content, batch processing, and directory analysis. Supports recursive search, file type filtering, size analysis, and batch operations like copy/move/delete. Use when you need to: list directory contents, search for files by name or content, analyze directory structures, perform batch file operations, or analyze file sizes and distribution.

General Utilities

file-organizer-skill

3891
from openclaw/skills

Organize files in directories by grouping them into folders based on their extensions or date. Includes Dry-Run, Recursive, and Undo capabilities.

General Utilities

file-upload

3891
from openclaw/skills

上传文件到内部 BS3 存储(免签名)。Use when user asks to upload files, images, documents to storage, or get a shareable URL for a file.

hinge-profile-optimizer

3891
from openclaw/skills

Comprehensive, research-backed Hinge dating profile optimization. Use when someone wants to improve their Hinge profile, audit an existing profile, write better prompts/captions, select and order photos strategically, or understand why they're not getting quality matches. This is the thorough process (~45 mins) - discovery interview, honest market math, photo strategy, copy creation, settings cleanup, and implementation support. Grounded in peer-reviewed behavioral research, platform data, and signaling theory.

static-files

3891
from openclaw/skills

Host static files on subdomains with optional authentication. Use when you need to serve HTML, images, CSS, JS, or any static content on a dedicated subdomain. Supports file upload, basic auth, quota management, and automatic SSL via Caddy. Commands include sf sites (create/list/delete), sf upload (files/directories), sf files (list/delete).

obsidian-organizer

3891
from openclaw/skills

Organize and standardize Obsidian vaults for reliability and long-term maintainability. Use when designing or cleaning vault folder structure, enforcing file naming conventions, migrating messy vaults, reducing duplicate/ambiguous notes, or creating repeatable audit-and-fix workflows for Obsidian notes.

Twitter/X Profile Scraper

3891
from openclaw/skills

A browser-based Twitter/X profile discovery and scraping tool.

TikTok Profile Scraper

3891
from openclaw/skills

A browser-based TikTok profile discovery and scraping tool.

Instagram Profile Scraper

3891
from openclaw/skills

A browser-based Instagram profile discovery and scraping tool.

visual-file-sorter

3891
from openclaw/skills

自动遍历下载文件夹或桌面,利用视觉模型“看”文件内容并重命名,最后归档到指定分类目录。

durable-files-weekly-review-public

3891
from openclaw/skills

Run a weekly token-optimization audit for durable instruction files in any OpenClaw workspace, generate a markdown report, and propose approval-gated cleanup actions. Use when users want to keep AGENTS/USER/TOOLS/MEMORY-style docs lean without silent deletions.

everything-find-files

3891
from openclaw/skills

使用Everything SDK快速搜索本地文件