SuperAPI AI Directory

tidymydesktop

Office & productivity

View repository

Updated 10-15 21:39

About this skill

TidyMyDesktop - Smart Desktop Organization Tool

Overview

When the user requests to organize the desktop or a directory, this skill will automatically:

  1. Analyze files and applications in the directory
  2. Intelligently categorize and create folders
  3. Identify and delete old versions of software
  4. Search for the purpose of unknown software
  5. Generate a detailed organization report (Markdown format)

Supported trigger commands

Users can trigger this skill in the following ways:

  • "Help me organize my desktop" - Organize ~/Desktop
  • "Help me organize the current directory" - Organize the current working directory (requires user confirmation)
  • Any keyword - First search for related content

Workflow

Step 1: Understand the user's intent

First determine the type of user input:

// 检查是否是整理指令
if (用户输入包含 "整理桌面") {
  目标路径 = ~/Desktop
} else if (用户输入包含 "整理当前目录") {
  // 需要用户确认目录路径
  await askUserToConfirmPath()
} else {
  // 如果是关键词,先搜索相关内容
  await searchKeyword(用户输入)
  return
}

Step 2: Scan and analyze the directory

Use the provided Node.js tool script to scan the target directory:

# 扫描目录并生成文件清单
node ~/.claude/skills/tidymydesktop/scripts/scan.js <目标路径>

This script will:

  • List all files and applications
  • Identify file types and extensions
  • Detect application version numbers
  • Generate an initial inventory

Step 3: Intelligent categorization and organization

When performing organization operations, follow these principles:

3.1 File categorization rules

Create category folders based on file types:

  • Applications (Applications/)

    • Development tools (Development/)
    • Office software (Office/)
    • Design tools (Design/)
    • Communication tools (Communication/)
    • Entertainment software (Entertainment/)
    • System tools (Utilities/)
  • Documents (Documents/)

    • PDF documents (PDFs/)
    • Word documents (Word/)
    • Excel spreadsheets (Excel/)
    • Text files (TextFiles/)
  • Images (Images/)

    • Photos (Photos/)
    • Screenshots (Screenshots/)
    • Design drafts (Designs/)
  • Videos (Videos/)

  • Audio (Audio/)

  • Archives (Archives/)

  • Code projects (CodeProjects/)

  • Uncategorized (Uncategorized/)

3.2 Version deduplication rules

For multiple versions of the same software:

// 识别版本号模式
// 例如: "AppName v1.2.3.dmg" 和 "AppName v2.0.0.dmg"
// 保留: 最新版本
// 删除: 旧版本

function identifyVersions(files) {
  // 1. 提取版本号
  // 2. 比较版本
  // 3. 标记要删除的旧版本
}

CRITICAL: Before deleting any files, you must:

  1. Show the user the list of files to be deleted
  2. Wait for user confirmation
  3. Only perform the deletion operation after obtaining explicit consent

3.3 Handling unknown software

When encountering software with an uncertain purpose:

# 使用 WebSearch 搜索软件信息
# 搜索查询格式: "<软件名称> 是什么软件 用途"

If still uncertain after searching:

  • Place it in the 未分类/ folder
  • Mark it as "requires manual review" in the report

Step 4: Perform the organization operation

Use the provided organization script:

# 执行整理操作
node ~/.claude/skills/tidymydesktop/scripts/organize.js \
  --source <目标路径> \
  --plan <整理计划JSON文件> \
  --dry-run  # 首次运行使用 dry-run 模式

Important safety measures:

  1. Use --dry-run mode on the first run (simulation only, no actual file movement)
  2. Show the user the organization plan
  3. After obtaining user confirmation, then perform the actual operation
  4. All deletion operations require explicit user confirmation

Step 5: Generate the organization report

Create a detailed Markdown report containing:

# 桌面整理报告

**整理时间**: YYYY-MM-DD HH:MM:SS
**整理路径**: /Users/xxx/Desktop

## 整理概要

- 总文件数: XXX
- 已分类文件: XXX
- 创建的文件夹: XXX
- 删除的重复文件: XXX
- 未分类文件: XXX

## 分类详情

### 应用程序 (XX 个)
- 开发工具 (XX 个)
  - Visual Studio Code
  - IntelliJ IDEA
  - ...

### 文档 (XX 个)
- PDF文档 (XX 个)
- ...

## 版本去重记录

| 软件名称 | 保留版本 | 删除版本 | 状态 |
|---------|---------|---------|------|
| Example App | v2.0.0 | v1.0.0, v1.5.0 | 已删除 |

## 未知软件

| 文件名 | 搜索结果 | 处理方式 |
|-------|---------|---------|
| Unknown.app | 未找到相关信息 | 放入"未分类"文件夹 |

## 建议

- [可选] 进一步整理建议
- [可选] 可能需要手动审核的项目

Report save location:

  • Desktop organization: ~/Desktop/整理报告_YYYYMMDD_HHMMSS.md
  • Directory organization: <目标路径>/整理报告_YYYYMMDD_HHMMSS.md

Tool script usage instructions

scan.js - Directory scanning tool

Scan a directory and generate a file list:

node ~/.claude/skills/tidymydesktop/scripts/scan.js <目标路径>

Output the file list in JSON format.

organize.js - Organization execution tool

Execute file move and delete operations according to the organization plan:

# Dry-run 模式(推荐首次使用)
node ~/.claude/skills/tidymydesktop/scripts/organize.js \
  --source <目标路径> \
  --plan <整理计划.json> \
  --dry-run

# 实际执行
node ~/.claude/skills/tidymydesktop/scripts/organize.js \
  --source <目标路径> \
  --plan <整理计划.json>

classify.js - Intelligent classification tool

Use AI-assisted classification for unknown files:

node ~/.claude/skills/tidymydesktop/scripts/classify.js \
  --file <文件路径> \
  --search  # 启用网络搜索

Usage examples

Example 1: Organize the desktop

User: "Help me organize the desktop"

Claude execution flow:

  1. Recognize the trigger phrase "organize the desktop"
  2. Set the target path to ~/Desktop
  3. Run the scanning tool
  4. Generate a classification plan
  5. Preview the organization results in dry-run mode
  6. Show the organization plan to the user
  7. Wait for user confirmation
  8. Execute the actual organization operations
  9. Generate and save the organization report
  10. Show the report summary to the user

Example 2: Organize the current directory

User: "Help me organize the current directory"

Claude:

"I will organize the current directory. Please confirm the target path:/Users/xxx/Downloads

Continue? (yes/no)"

User: "yes"

Claude execution flow: (Same flow as Example 1)

Example 3: Keyword search

User: "VS Code"

Claude execution flow:

  1. Recognize as a keyword (not an organization instruction)
  2. Use WebSearch to search for "VS Code"
  3. Return the search results
  4. Do not perform organization operations

Safety precautions

  1. Never automatically delete files - All delete operations must be explicitly confirmed by the user
  2. Use dry-run mode - Always use simulation mode for the first organization
  3. Backup reminder - Remind the user to back up before performing important operations
  4. Path confirmation - When organizing a directory, the user must confirm the path
  5. Version identification accuracy - Version number identification may be inaccurate; mark as "to be confirmed"

Dependencies

Node.js packages (managed via nvm):

  • fs-extra - File system operations
  • glob - File matching
  • semver - Version number comparison
  • commander - Command-line argument parsing

Install dependencies:

# 使用 nvm 切换到合适的 Node 版本
nvm use 18

# 安装依赖
cd ~/.claude/skills/tidymydesktop
npm install

Limitations and precautions

  1. macOS-specific features:

    • .app Application bundle identification
    • Finder tags and colors (not currently supported)
  2. Unsupported operations:

    • Move system files
    • Organize protected directories
    • Modify file contents
  3. Performance considerations:

    • Large directories (>1000 files) may take a long time
    • Web search will increase processing time

Troubleshooting

Script execution failed

# 检查 Node.js 版本
node --version  # 应该 >= 14.0.0

# 检查依赖安装
cd ~/.claude/skills/tidymydesktop
npm list

Permission errors

Some directories may require additional permissions. If you encounter permission issues:

  • Check the read and write permissions of the target directory
  • Avoid organizing system directories
  • Use user directories (such as ~/Desktop, ~/Downloads)

Development and Extension

To add a new file classification rule, edit scripts/classify.js:

const CATEGORY_RULES = {
  // 添加新的分类规则
  'NewCategory': {
    extensions: ['.ext1', '.ext2'],
    keywords: ['keyword1', 'keyword2'],
    subfolder: 'NewCategory'
  }
}

Version: 1.0.0 Author: Claude AI License: MIT