@clawhub-subingshe-d4255ea5d0
This skill should be used when the user wants to clear, remove, or clean up AI agent rules, skills, or instruction files from their coding environment. It su...
---
name: clear-skills
description: >
This skill should be used when the user wants to clear, remove, or clean up AI agent rules,
skills, or instruction files from their coding environment. It supports one-click cleanup
of rule/instruction files for all major AI coding platforms on Windows, macOS, and Linux,
including Cursor, Windsurf, Claude Code, Codex CLI, GitHub Copilot, Gemini CLI, Cline,
Trae IDE, Amazon Q, Continue.dev, Aider, OpenCode, Amp, Goose, Kilo Code, Kiro,
Neovate, OpenHands, PI, Qoder, Roo Code, Zencoder, Droid, OpenClaw, QClaw,
CoPaw, EasyClaw, ArkClaw, LobsterAI, HiClaw, AutoClaw, AntiClaw, Manus,
HappyCapy, QoderWork, and WorkBuddy/CodeBuddy. Triggers on phrases like "清除agent技能",
"删除规则文件", "清空所有AI规则", "clear agent rules", "remove AI skills", "一键清除技能".
---
# Clear Skills Skill
## Overview
Scans and removes AI agent rules/skills files from all major AI coding platforms on your machine. Supports **50+ platforms**, covering both **project-level** and **user-global** scopes, running on **Windows · macOS · Linux**.
**Core Features:**
- ✅ **Smart Scanning**: Only removes files/directories that actually exist. Platforms not installed or without rules won't be shown or removed
- ✅ **Self-Protection**: By default, this skill (clear-skills) is protected and won't be cleared, allowing safe cleanup of other platforms
- ✅ **Auto Backup**: Automatically backs up to desktop before deletion, allowing recovery anytime
- ✅ **Preview Mode**: Use `--dry-run` to confirm which files will be deleted before actually removing them
- ✅ **Flexible Control**: Supports filtering by platform, scope, project directory, and more
- ✅ **Pure Python**: Uses only Python 3 standard library, no external dependencies required
**All Supported Platforms:**
### Mainstream AI IDE
Cursor · Windsurf(Codeium) · Cline · Trae IDE · Amazon Q · Continue.dev
### Agent Framework / CLI
Claude Code · Codex CLI · GitHub Copilot · Gemini CLI · Aider · OpenCode
### Emerging AI Tools
Amp · Goose · Kilo Code · Kiro (AWS) · Neovate · OpenHands · PI · Qoder · Roo Code · Zencoder
### OpenClaw Ecosystem
OpenClaw · QClaw · CoPaw · EasyClaw · ArkClaw · LobsterAI · HiClaw · AutoClaw · AntiClaw
### Other AI Agents
Manus · HappyCapy · QoderWork · Droid (Factory)
### WorkBuddy
WorkBuddy / CodeBuddy
---
## Usage
### Step 1: Confirm User Intent
After receiving a cleanup request, confirm the following with the user (skip if already specified):
1. **Cleanup Scope**: Current project only (`project`), global only (`global`), or both (`all`, default)?
2. **Platform Scope**: All platforms, or specific platforms only?
3. **Backup**: Back up to desktop by default. Users can disable with `--no-backup` (not recommended).
### Step 2: Execute Script
Call `scripts/clear_agent_rules.py`. This script uses **pure Python 3 standard library only**, no additional dependencies needed.
**Quick Start Examples**
```bash
# Preview mode (recommended to see what will be deleted first)
python scripts/clear_agent_rules.py --dry-run
# Clear current project + global, all platforms, auto backup (default behavior)
# Note: This skill is protected by default and won't be cleared
python scripts/clear_agent_rules.py
```
# Clear only specified platforms
python scripts/clear_agent_rules.py --platforms cursor,claude,copilot
# Clear only OpenClaw ecosystem (including QClaw, CoPaw, etc.)
python scripts/clear_agent_rules.py --platforms openclaw,qclaw,copaw
# Clear only QoderWork skills
python scripts/clear_agent_rules.py --platforms qoderwork
# Clear only current project rules
python scripts/clear_agent_rules.py --mode project
# Clear only global rules
python scripts/clear_agent_rules.py --mode global
# Specify project directory
python scripts/clear_agent_rules.py --project /path/to/myproject
# No backup (dangerous, use with caution)
python scripts/clear_agent_rules.py --no-backup
# Non-interactive execution (skip YES confirmation, suitable for scripts/CI)
python scripts/clear_agent_rules.py --yes
# Clear all WorkBuddy skills including this one (dangerous)
python scripts/clear_agent_rules.py --mode global --include-self
```
### Advanced Usage
```bash
# Clear only AI IDE platforms (Cursor, Windsurf, Cline, etc.)
python scripts/clear_agent_rules.py --platforms cursor,windsurf,cline,trae,amazonq,continue
# Clear only CLI tools (Claude Code, Copilot, Aider, etc.)
python scripts/clear_agent_rules.py --platforms claude,copilot,aider,gemini,codex
# Clear only project-level rules for specific platforms
python scripts/clear_agent_rules.py --mode project --platforms cursor,copilot
# Scan specific project directory
python scripts/clear_agent_rules.py --project /path/to/specific/project
# Export scan results without deleting (for manual review)
python scripts/clear_agent_rules.py --dry-run > scan_results.txt
```
> **Note**: On Windows, `python` command might be `python3` or `py`, depending on your environment.
#### Parameter Reference
| Parameter | Description | Default |
|-----------|-------------|---------|
| `--mode` | `project` / `global` / `all` | `all` |
| `--project` | Project root directory path | Current working directory |
| `--platforms` | Specify platforms (comma-separated) | `all` |
| `--no-backup` | Disable backup | Disabled (backup by default) |
| `--dry-run` | Preview mode, don't actually delete | Disabled |
| `--yes` | Skip YES confirmation prompt | Disabled |
| `--include-self` | Don't protect this skill, will also clear clear-skills itself | Disabled (protected by default) |
**Available Platform Identifiers:**
```
cursor, windsurf, cline, trae, amazonq, continue,
claude, codex, copilot, gemini, aider, opencode,
amp, goose, kilocode, kiro, neovate, openhands, pi, qoder,
roocode, zencoder, droid,
openclaw, qclaw, copaw, easyclaw, arkclaw, lobsterai,
hiclaw, autoclaw, anticlaw, manus, happycapy,
qoderwork,
workbuddy
```
---
## Platform Rule File Reference
For detailed paths, see `references/platforms.md`.
### Project-Level Rules (relative to project root)
| Category | Platform | Main Files/Directories |
|----------|----------|----------------------|
| **AI IDE** | Cursor | `.cursorrules`, `.cursor/rules/` |
| | Windsurf | `.windsurfrules`, `.windsurf/rules/` |
| | Cline | `.clinerules`, `.clinerules/` |
| | Trae IDE | `.trae/project_rules.md` |
| | Amazon Q | `.amazonq/rules/` |
| | Continue.dev | `.continuerc.json`, `.continue/rules/` |
| **CLI** | Claude Code | `CLAUDE.md` |
| | Codex CLI | `AGENTS.md` |
| | GitHub Copilot | `.github/copilot-instructions.md` |
| | Gemini CLI | `GEMINI.md` |
| | Aider | `.aider.conf.yml` |
| | OpenCode | `AGENTS.md`, `CLAUDE.md` |
| **Emerging Tools** | Amp | `AGENTS.md` |
| | Goose | `.goosehints`, `.goose/` |
| | Kilo Code | `.kilocode/rules/` |
| | Kiro (AWS) | `.kiro/steering/`, `.kiro/` |
| | Neovate | `AGENTS.md` |
| | OpenHands | `config.toml`, `.openhands/` |
| | PI | `.pi/settings.json`, `.pi/` |
| | Qoder | `.qoder/rules/` |
| | Roo Code | `.roo/rules/`, `.roorules` |
| | Zencoder | `.zencoder/rules/` |
| | Droid (Factory) | `.droid/`, `AGENTS.md` |
| **Others** | Antigravity | `.antigravity/rules.md` |
| | OpenClaw | `.openclaw/` |
| | QoderWork | `.qoderwork/skills/` |
| | WorkBuddy | `.workbuddy/skills/` |
### Global-Level Rules (user home directory)
| Category | Platform | Path |
|----------|----------|------|
| **AI IDE** | Cursor | `~/.cursor/rules/` |
| | Cline | `~/Documents/Cline/Rules/` |
| | Trae IDE | `~/.trae/user_rules.md` |
| | Continue.dev | `~/.continue/` |
| **CLI** | Claude Code | `~/.claude/` |
| | Gemini CLI | `~/.gemini/GEMINI.md` |
| | Aider | `~/.aider.conf.yml` |
| | OpenCode | `~/.config/opencode/` |
| **Emerging Tools** | Amp | `~/.factory/AGENTS.md` |
| | Goose | `~/.config/goose/` |
| | Kilo Code | `~/.kilocode/rules/` |
| | Kiro (AWS) | `~/.kiro/` |
| | Neovate | `~/.neovate/AGENTS.md` |
| | OpenHands | `~/.openhands/` |
| | PI | `~/.pi/agent/settings.json` |
| | Roo Code | `~/.roo/rules/` |
| | Droid (Factory) | `~/.factory/` |
| **OpenClaw Ecosystem** | OpenClaw/QClaw etc. | `~/.openclaw/` |
| | CoPaw | `~/.copaw/` |
| **Others** | Manus | `~/.manus/` |
| | HappyCapy | `~/.happycapy/` |
| | QoderWork | `~/.qoderwork/skills/` |
| | WorkBuddy | `~/.workbuddy/skills/` |
| **Note** | Qoder/Zencoder | Project-level only, no global config |
---
## Safety Mechanisms
- **Default Backup**: Backs up all files to desktop before deletion (`~/Desktop/agent-rules-backup-timestamp/`), allowing recovery anytime.
- **Preview Mode**: Use `--dry-run` to confirm which files will be deleted before actually executing.
- **Confirmation Prompt**: Requires manual `YES` confirmation by default to prevent accidental operations.
- **Self-Protection (Enabled by Default)**:
- When running `--mode global` or `--mode all`, this skill (clear-skills) is **protected by default** and won't be cleared.
- This allows safe cleanup of other platforms' rules without worrying about deleting the tool itself.
- If you truly need to delete this skill, use `--include-self` to disable self-protection.
- **Smart Scanning**: The script only scans and deletes files/directories that **actually exist**. If certain platforms are not installed on your system or their rule files don't exist, those empty targets won't be shown or deleted.
---
## FAQ
**Q: Will this delete my project code?**
A: No. This tool only removes AI agent rule/skill files (e.g., `.cursorrules`, `CLAUDE.md`, `.workbuddy/skills/`). Your source code and other files are completely safe.
**Q: Can I recover deleted files?**
A: Yes. All files are automatically backed up to your desktop before deletion. You can manually copy them back if needed.
**Q: What if I only want to clear one platform?**
A: Use the `--platforms` parameter to specify which platforms to clean. Example: `python scripts/clear_agent_rules.py --platforms cursor,copilot`
**Q: Why doesn't this skill get deleted when I clear global rules?**
A: This is an intentional self-protection feature. The skill needs to exist to be able to clear itself. Use `--include-self` if you really want to delete it too.
**Q: Does this work on Windows/macOS/Linux?**
A: Yes. The script uses pure Python and handles all three operating systems automatically.
**Q: Can I run this in a CI/CD pipeline?**
A: Yes. Use `--yes --no-backup` flags for non-interactive execution. Use with caution in automated environments.
---
## Troubleshooting
**Permission Denied Errors**
- If you encounter permission errors, try running the script with appropriate permissions (e.g., administrator/root)
- On Windows, some directories may require elevated privileges
**Large Backup Size**
- If the backup is too large, use `--no-backup` (not recommended) or manually manage backup location
- Consider cleaning up old backup folders from your desktop
**Platform Not Found**
- If a platform isn't detected, it means the platform isn't installed or has no rule files
- This is normal behavior—the script only targets existing files
FILE:scripts/clear_agent_rules.py
#!/usr/bin/env python3
"""
clear_agent_rules.py — 一键清除所有 AI Agent 规则/技能文件
支持平台(50+):
# 主流 AI IDE
Cursor · Windsurf(Codeium) · Cline · Trae IDE · Amazon Q · Continue.dev
# Agent 框架 / CLI
Claude Code · Codex CLI · GitHub Copilot · Gemini CLI · Aider · OpenCode
# 新兴 AI 工具
Amp · Goose · Kilo Code · Kiro (AWS) · Neovate · OpenHands · PI (pi-coding-agent) · Roo Code · Zencoder
# OpenClaw 生态
OpenClaw · QClaw · CoPaw · EasyClaw · ArkClaw · LobsterAI · HiClaw · AutoClaw · AntiClaw
# 其他 AI Agent
Manus · HappyCapy · QoderWork · Qoder · Droid (Factory)
# WorkBuddy
WorkBuddy/CodeBuddy
支持操作系统:Windows · macOS · Linux
用法:
python clear_agent_rules.py [选项]
选项:
--mode project | global | all 清除范围(默认 all)
--project <路径> 项目根目录(默认当前目录)
--platforms <p1,p2,...> 指定平台,逗号分隔(默认 all)
--no-backup 不备份(危险,谨慎使用)
--dry-run 预览模式,不实际删除
--yes 跳过确认提示(非交互式执行)
--include-self 不保护本技能,也会清除 clear-agent-rules 本身
特性:
- 自我保护:默认情况下不会删除 clear-agent-rules 技能本身
- 智能扫描:只删除实际存在的文件/目录
- 自动备份:删除前自动备份到桌面
示例:
# 预览将被删除的内容(安全,不实际操作)
python clear_agent_rules.py --dry-run
# 清除当前项目 + 全局,自动备份(推荐,本技能受保护)
python clear_agent_rules.py --mode all
# 只清除指定平台
python clear_agent_rules.py --platforms cursor,claude,copilot
# 指定项目目录
python clear_agent_rules.py --project /home/user/myproject
# 非交互式(CI/脚本中使用)
python clear_agent_rules.py --yes
# 清除包括本技能在内的所有 WorkBuddy 技能(危险)
python clear_agent_rules.py --mode global --include-self
"""
import argparse
import os
import platform
import shutil
import sys
from datetime import datetime
from pathlib import Path
# ─── 终端颜色 ─────────────────────────────────────────────────────────────────
RESET = "\033[0m"
BOLD = "\033[1m"
RED = "\033[31m"
GREEN = "\033[32m"
YELLOW = "\033[33m"
CYAN = "\033[36m"
GRAY = "\033[90m"
def c(text, color):
"""在支持颜色的终端输出彩色文本"""
if sys.stdout.isatty() or platform.system() == "Windows":
return f"{color}{text}{RESET}"
return text
def section(title):
print()
print(c("━" * 52, CYAN))
print(c(f" {title}", CYAN))
print(c("━" * 52, CYAN))
# ─── 系统路径解析 ──────────────────────────────────────────────────────────────
HOME = Path.home()
IS_WINDOWS = platform.system() == "Windows"
def home(*parts):
return HOME.joinpath(*parts)
def docs_cline():
"""Cline 全局规则目录(跨平台)"""
if IS_WINDOWS:
docs = Path(os.environ.get("USERPROFILE", HOME)) / "Documents"
else:
docs = HOME / "Documents"
candidates = [docs / "Cline" / "Rules", HOME / "Cline" / "Rules"]
for c_ in candidates:
if c_.exists():
return c_
return candidates[0] # 返回主候选路径(不存在时也记录)
# ─── 规则目标定义 ──────────────────────────────────────────────────────────────
# 每条记录:
# name 显示名称
# platform 平台标识
# scope project | global
# path Path 对象(项目级为相对路径字符串,全局级为绝对 Path)
PROJECT_TARGETS = [
# ===== 主流 AI IDE =====
# Cursor
{"name": "Cursor 旧版规则文件", "platform": "cursor", "path": ".cursorrules"},
{"name": "Cursor 新版规则目录", "platform": "cursor", "path": ".cursor/rules"},
# Windsurf
{"name": "Windsurf 旧版规则文件", "platform": "windsurf", "path": ".windsurfrules"},
{"name": "Windsurf 新版规则目录", "platform": "windsurf", "path": ".windsurf/rules"},
# Cline
{"name": "Cline 规则文件/目录", "platform": "cline", "path": ".clinerules"},
# Trae IDE
{"name": "Trae 项目规则文件", "platform": "trae", "path": ".trae/project_rules.md"},
# Amazon Q
{"name": "Amazon Q 规则目录", "platform": "amazonq", "path": ".amazonq/rules"},
# Continue.dev
{"name": "Continue 工作区配置", "platform": "continue", "path": ".continuerc.json"},
{"name": "Continue 规则目录", "platform": "continue", "path": ".continue/rules"},
# ===== Agent 框架 / CLI =====
# Claude Code
{"name": "Claude Code 项目指令文件", "platform": "claude", "path": "CLAUDE.md"},
# Codex CLI
{"name": "Codex CLI / 通用 AGENTS.md", "platform": "codex", "path": "AGENTS.md"},
# GitHub Copilot
{"name": "Copilot 主指令文件", "platform": "copilot", "path": ".github/copilot-instructions.md"},
{"name": "Copilot 作用域规则目录", "platform": "copilot", "path": ".github/instructions"},
# Gemini CLI
{"name": "Gemini CLI 项目指令文件", "platform": "gemini", "path": "GEMINI.md"},
# Aider
{"name": "Aider 项目配置文件", "platform": "aider", "path": ".aider.conf.yml"},
# OpenCode
{"name": "OpenCode 项目规则文件", "platform": "opencode", "path": "AGENTS.md"},
{"name": "OpenCode CLAUDE.md 兼容文件", "platform": "opencode", "path": "CLAUDE.md"},
# ===== 新兴 AI 工具 =====
# Amp
{"name": "Amp 项目规则文件", "platform": "amp", "path": "AGENTS.md"},
# Goose
{"name": "Goose 提示文件", "platform": "goose", "path": ".goosehints"},
{"name": "Goose 规则目录", "platform": "goose", "path": ".goose"},
# Kilo Code
{"name": "Kilo Code 规则目录", "platform": "kilocode", "path": ".kilocode/rules"},
# Kiro (AWS)
{"name": "Kiro Steering 规则目录", "platform": "kiro", "path": ".kiro/steering"},
{"name": "Kiro 配置目录", "platform": "kiro", "path": ".kiro"},
# Neovate
{"name": "Neovate 项目规则文件", "platform": "neovate", "path": "AGENTS.md"},
# OpenHands
{"name": "OpenHands 配置文件", "platform": "openhands", "path": "config.toml"},
{"name": "OpenHands 项目目录", "platform": "openhands", "path": ".openhands"},
# PI (pi-coding-agent)
{"name": "PI 编码代理配置文件", "platform": "pi", "path": ".pi/settings.json"},
{"name": "PI 配置目录", "platform": "pi", "path": ".pi"},
# Qoder
{"name": "Qoder 规则目录", "platform": "qoder", "path": ".qoder/rules"},
# Roo Code
{"name": "Roo Code 规则目录", "platform": "roocode", "path": ".roo/rules"},
{"name": "Roo Code 规则文件", "platform": "roocode", "path": ".roorules"},
# Zencoder
{"name": "Zencoder 规则目录", "platform": "zencoder", "path": ".zencoder/rules"},
# Droid (Factory)
{"name": "Factory Droid 配置目录", "platform": "droid", "path": ".droid"},
{"name": "Factory Droid 规则文件", "platform": "droid", "path": "AGENTS.md"},
# ===== Google Antigravity =====
{"name": "Antigravity 规则目录", "platform": "antigravity", "path": ".antigravity/rules.md"},
# ===== OpenClaw 生态 =====
# OpenClaw 项目级配置
{"name": "OpenClaw 项目配置", "platform": "openclaw", "path": ".openclaw/"},
# ===== QoderWork =====
{"name": "QoderWork 项目技能目录", "platform": "qoderwork","path": ".qoderwork/skills"},
# ===== WorkBuddy =====
{"name": "WorkBuddy 项目技能目录", "platform": "workbuddy","path": ".workbuddy/skills"},
]
GLOBAL_TARGETS = [
# ===== 主流 AI IDE =====
# Cursor
{"name": "Cursor 全局规则目录", "platform": "cursor", "path": home(".cursor", "rules")},
# Cline
{"name": "Cline 全局规则目录", "platform": "cline", "path": docs_cline()},
# Trae IDE
{"name": "Trae 全局用户规则文件", "platform": "trae", "path": home(".trae", "user_rules.md")},
# Continue.dev
{"name": "Continue 全局配置目录", "platform": "continue", "path": home(".continue")},
# ===== Agent 框架 / CLI =====
# Claude Code
{"name": "Claude Code 全局指令文件", "platform": "claude", "path": home(".claude", "CLAUDE.md")},
{"name": "Claude Code 全局配置目录", "platform": "claude", "path": home(".claude")},
# Gemini CLI
{"name": "Gemini CLI 全局指令文件", "platform": "gemini", "path": home(".gemini", "GEMINI.md")},
# Aider
{"name": "Aider 全局配置文件", "platform": "aider", "path": home(".aider.conf.yml")},
# OpenCode
{"name": "OpenCode 全局配置目录", "platform": "opencode", "path": home(".config", "opencode")},
{"name": "OpenCode 全局 AGENTS.md", "platform": "opencode", "path": home(".config", "opencode", "AGENTS.md")},
{"name": "OpenCode Claude 兼容目录", "platform": "opencode", "path": home(".claude")},
# ===== 新兴 AI 工具 =====
# Amp
{"name": "Amp 全局规则文件", "platform": "amp", "path": home(".factory", "AGENTS.md")},
# Goose
{"name": "Goose 配置目录", "platform": "goose", "path": home(".config", "goose")},
# Kilo Code
{"name": "Kilo Code 全局规则目录", "platform": "kilocode", "path": home(".kilocode", "rules")},
# Kiro (AWS)
{"name": "Kiro 全局配置目录", "platform": "kiro", "path": home(".kiro")},
{"name": "Kiro MCP 配置文件", "platform": "kiro", "path": home(".kiro", "mcp-config.json")},
# Neovate
{"name": "Neovate 全局规则文件", "platform": "neovate", "path": home(".neovate", "AGENTS.md")},
# OpenHands
{"name": "OpenHands 全局配置目录", "platform": "openhands", "path": home(".openhands")},
# PI (pi-coding-agent)
{"name": "PI 编码代理全局配置", "platform": "pi", "path": home(".pi", "agent", "settings.json")},
{"name": "PI 全局配置目录", "platform": "pi", "path": home(".pi")},
# Roo Code
{"name": "Roo Code 全局规则目录", "platform": "roocode", "path": home(".roo", "rules")},
# Zencoder
# (无全局配置目录,仅项目级)
# Qoder
# (无全局配置目录,仅项目级)
# ===== OpenClaw 生态 =====
# OpenClaw
{"name": "OpenClaw 全局配置目录", "platform": "openclaw", "path": home(".openclaw")},
{"name": "OpenClaw 配置文件", "platform": "openclaw", "path": home(".openclaw", "openclaw.json")},
# QClaw (腾讯,基于 OpenClaw)
{"name": "QClaw 配置目录", "platform": "qclaw", "path": home(".openclaw")}, # 与 OpenClaw 共享
# CoPaw (阿里)
{"name": "CoPaw 全局配置目录", "platform": "copaw", "path": home(".copaw")},
{"name": "CoPaw 配置文件", "platform": "copaw", "path": home(".copaw", "config.json")},
{"name": "CoPaw 工作区目录", "platform": "copaw", "path": home(".copaw", "workspaces")},
# EasyClaw (基于 OpenClaw)
{"name": "EasyClaw 配置目录", "platform": "easyclaw", "path": home(".openclaw")}, # 共享
# ArkClaw (火山引擎)
{"name": "ArkClaw 配置目录", "platform": "arkclaw", "path": home(".openclaw")}, # 可能共享
# LobsterAI (网易)
{"name": "LobsterAI 配置目录", "platform": "lobsterai", "path": home(".openclaw")}, # 可能共享
# HiClaw
{"name": "HiClaw 配置目录", "platform": "hiclaw", "path": home(".openclaw")}, # 可能共享
# AutoClaw (智谱)
{"name": "AutoClaw 配置目录", "platform": "autoclaw", "path": home(".openclaw")}, # 可能共享
# AntiClaw
{"name": "AntiClaw 配置目录", "platform": "anticlaw", "path": home(".openclaw")}, # 可能共享
# Manus
{"name": "Manus 配置目录", "platform": "manus", "path": home(".manus")},
# HappyCapy
{"name": "HappyCapy 配置目录", "platform": "happycapy", "path": home(".happycapy")},
# Droid (Factory)
{"name": "Factory Droid 全局配置", "platform": "droid", "path": home(".factory")},
# ===== QoderWork =====
{"name": "QoderWork 用户技能目录", "platform": "qoderwork","path": home(".qoderwork", "skills")},
# ===== WorkBuddy =====
{"name": "WorkBuddy 用户技能目录", "platform": "workbuddy","path": home(".workbuddy", "skills")},
]
ALL_PLATFORMS = [
# 主流 AI IDE
"cursor", "windsurf", "cline", "trae", "amazonq", "continue",
# Agent 框架 / CLI
"claude", "codex", "copilot", "gemini", "aider", "opencode",
# 新兴 AI 工具
"amp", "goose", "kilocode", "kiro", "neovate", "openhands", "pi",
"qoder", "roocode", "zencoder", "droid",
# OpenClaw 生态
"openclaw", "qclaw", "copaw", "easyclaw", "arkclaw", "lobsterai",
"hiclaw", "autoclaw", "anticlaw", "manus", "happycapy",
# QoderWork
"qoderwork",
# WorkBuddy
"workbuddy"
]
# ─── 解析参数 ──────────────────────────────────────────────────────────────────
def parse_args():
parser = argparse.ArgumentParser(
description="一键清除所有 AI Agent 规则/技能文件",
formatter_class=argparse.RawDescriptionHelpFormatter
)
parser.add_argument("--mode", choices=["project", "global", "all"],
default="all", help="清除范围(默认 all)")
parser.add_argument("--project", default=os.getcwd(),
help="项目根目录路径(默认当前目录)")
parser.add_argument("--platforms", default="all",
help="指定平台,逗号分隔,默认 all")
parser.add_argument("--no-backup", action="store_true",
help="不备份(危险)")
parser.add_argument("--dry-run", action="store_true",
help="预览模式,不实际删除")
parser.add_argument("--yes", action="store_true",
help="跳过确认提示(非交互式执行)")
parser.add_argument("--include-self", action="store_true",
help="不保护本技能,也会清除 clear-agent-rules 本身(默认受保护)")
return parser.parse_args()
# ─── 主逻辑 ───────────────────────────────────────────────────────────────────
def resolve_targets(mode, project_root, target_platforms, exclude_self=True):
"""收集所有符合条件的目标,返回 list of (name, platform, full_path)"""
results = []
# 获取当前技能的绝对路径,用于自我保护
current_skill_path = None
if exclude_self:
try:
# 获取脚本所在目录的父目录(技能根目录)
script_dir = Path(__file__).parent.resolve()
skill_root = script_dir.parent.resolve()
current_skill_path = skill_root
except Exception:
pass
if mode in ("project", "all"):
for t in PROJECT_TARGETS:
if t["platform"] not in target_platforms:
continue
full = project_root / t["path"]
if full.exists():
# 检查是否为当前技能路径
if exclude_self and current_skill_path and full.resolve() == current_skill_path:
continue
results.append({
"name": t["name"],
"platform": t["platform"],
"scope": "project",
"path": full,
})
if mode in ("global", "all"):
for t in GLOBAL_TARGETS:
if t["platform"] not in target_platforms:
continue
full = Path(t["path"])
if full.exists():
# 检查是否包含当前技能路径
if exclude_self and current_skill_path:
# 如果目标是目录且包含当前技能路径,则跳过
if full.is_dir():
try:
if current_skill_path.is_relative_to(full) or full.is_relative_to(current_skill_path):
continue
except ValueError:
pass
# 如果目标是文件且等于当前技能路径,则跳过
elif full == current_skill_path:
continue
results.append({
"name": t["name"],
"platform": t["platform"],
"scope": "global",
"path": full,
})
return results
def do_backup(targets, project_root):
"""将所有目标备份到桌面,返回备份目录路径"""
ts = datetime.now().strftime("%Y%m%d_%H%M%S")
desktop = HOME / "Desktop"
desktop.mkdir(parents=True, exist_ok=True)
backup_root = desktop / f"agent-rules-backup-{ts}"
backup_root.mkdir(parents=True, exist_ok=True)
section("执行备份")
for t in targets:
try:
rel = (f"project/{t['path'].relative_to(project_root)}"
if t["scope"] == "project"
else f"global/{t['path'].relative_to(HOME)}")
except ValueError:
rel = f"{t['scope']}/{t['path'].name}"
dest = backup_root / rel
dest.parent.mkdir(parents=True, exist_ok=True)
try:
if t["path"].is_dir():
shutil.copytree(str(t["path"]), str(dest), dirs_exist_ok=True)
else:
shutil.copy2(str(t["path"]), str(dest))
print(f" {c('✔', GREEN)} 已备份: {t['name']}")
print(f" {c(str(t['path']), GRAY)}")
except Exception as e:
print(f" {c('✘', RED)} 备份失败: {t['name']} — {e}")
print()
print(f" {c('📦 备份保存在:', GREEN)} {backup_root}")
return backup_root
def do_delete(targets):
"""执行删除,返回 (success_count, fail_count)"""
section("执行清除")
success, fail = 0, 0
for t in targets:
try:
if t["path"].is_dir():
shutil.rmtree(str(t["path"]))
else:
t["path"].unlink()
print(f" {c('✔', GREEN)} [{t['platform'].upper()}] {t['name']}")
success += 1
except Exception as e:
print(f" {c('✘', RED)} [{t['platform'].upper()}] {t['name']}")
print(f" {c(str(e), RED)}")
fail += 1
return success, fail
def main():
args = parse_args()
# 解析平台列表
if args.platforms.strip().lower() == "all":
target_platforms = ALL_PLATFORMS
else:
target_platforms = [p.strip().lower() for p in args.platforms.split(",")]
invalid = [p for p in target_platforms if p not in ALL_PLATFORMS]
if invalid:
print(c(f"⚠ 未知平台: {', '.join(invalid)}", YELLOW))
print(c(f" 可用平台: {', '.join(ALL_PLATFORMS)}", YELLOW))
sys.exit(1)
project_root = Path(args.project).resolve()
# ── 打印摘要 ──
section("AI Agent 规则清除工具")
print(f" 操作系统 : {platform.system()} {platform.machine()}")
print(f" 清除模式 : {args.mode}")
print(f" 项目目录 : {project_root}")
print(f" 平台数量 : {len(target_platforms)}")
backup_flag = not args.no_backup
print(f" 备份 : {c('是', GREEN) if backup_flag else c('否(危险!)', RED)}")
if args.dry_run:
print(c(" ⚡ 预览模式(--dry-run),不会实际删除任何文件", YELLOW))
# ── 扫描 ──
exclude_self = not args.include_self
targets = resolve_targets(args.mode, project_root, target_platforms, exclude_self)
# 检查是否自我保护生效
current_skill_path = None
try:
script_dir = Path(__file__).parent.resolve()
skill_root = script_dir.parent.resolve()
current_skill_path = skill_root
except Exception:
pass
section("扫描结果")
if not targets:
print(c(" ✅ 未发现任何 AI Agent 规则文件,已经很干净!", GREEN))
sys.exit(0)
# 提示自我保护
if current_skill_path and args.mode in ("global", "all"):
print(c(f" 🔒 已自动保护本技能: {current_skill_path}", CYAN))
print(c(" 不会被清除(可以安全使用本工具清理其他平台)", CYAN))
print()
print(c(f" 发现 {len(targets)} 个规则文件/目录:", YELLOW))
for t in targets:
icon = "📁" if t["path"].is_dir() else "📄"
scope_tag = c(f"[{t['scope']}]", CYAN)
plat_tag = c(f"[{t['platform'].upper()}]", YELLOW)
print(f" {icon} {scope_tag} {plat_tag} {t['name']}")
print(f" {c(str(t['path']), GRAY)}")
if args.dry_run:
print()
print(c(" ℹ️ 预览模式结束,以上文件未被删除。", CYAN))
print(c(" 去掉 --dry-run 参数即可执行实际删除。", CYAN))
sys.exit(0)
# ── 确认 ──
print()
print(c(f"⚠️ 即将删除以上 {len(targets)} 个文件/目录!", RED + BOLD))
if backup_flag:
print(c(" 删除前将自动备份到桌面。", GREEN))
if not args.yes:
confirm = input("确认继续?输入 YES 继续,其他任意键取消:").strip()
if confirm != "YES":
print(c("已取消操作。", CYAN))
sys.exit(0)
# ── 备份 ──
backup_root = None
if backup_flag:
backup_root = do_backup(targets, project_root)
# ── 删除 ──
success, fail = do_delete(targets)
# ── 报告 ──
section("清除完成")
print(c(f" ✅ 成功删除: {success} 个", GREEN))
if fail:
print(c(f" ❌ 失败: {fail} 个", RED))
if backup_root:
print(c(f" 📦 备份位置: {backup_root}", CYAN))
print()
if __name__ == "__main__":
main()
FILE:references/platforms.md
# AI Agent Rule/Skill File Path Reference
This document lists the rule file storage locations for all major AI IDE / coding platforms on **Windows / macOS / Linux**.
---
## 1. Project-Level Rule Files (relative to project root, common across all platforms)
| Platform | File/Directory Path | Notes |
|----------|---------------------|-------|
| **Cursor** | `.cursorrules` | Legacy single file |
| **Cursor** | `.cursor/rules/*.mdc` | New multi-file directory |
| **Windsurf (Codeium)** | `.windsurfrules` | Legacy single file |
| **Windsurf (Codeium)** | `.windsurf/rules/*.md` | New multi-file directory |
| **Claude Code** | `CLAUDE.md` | Project root |
| **Codex CLI** | `AGENTS.md` | Project root |
| **GitHub Copilot** | `.github/copilot-instructions.md` | Main config file |
| **GitHub Copilot** | `.github/instructions/*.instructions.md` | Scoped rules |
| **Gemini CLI** | `GEMINI.md` | Project root |
| **Cline** | `.clinerules` | Legacy single file |
| **Cline** | `.clinerules/` | New multi-file directory |
| **Trae IDE** | `.trae/project_rules.md` | Project rules |
| **Amazon Q** | `.amazonq/rules/*.md` | Multi-file directory |
| **Continue.dev** | `.continuerc.json` | Workspace config |
| **Continue.dev** | `.continue/rules/*.md` | Rules directory |
| **Aider** | `.aider.conf.yml` | Project config file |
| **OpenCode** | `AGENTS.md` or `CLAUDE.md` | Project root |
| **Antigravity** | `.antigravity/rules.md` | Google Antigravity |
| **Amp** | `AGENTS.md` | Unified standard |
| **Goose** | `.goosehints`, `.goose/` | Project-level hints and rules |
| **Kilo Code** | `.kilocode/rules/` | Multi-file rules directory |
| **Kiro (AWS)** | `.kiro/steering/`, `.kiro/` | Steering rules |
| **Neovate** | `AGENTS.md` | Compatible with AGENTS.md standard |
| **OpenHands** | `config.toml`, `.openhands/` | Config and project directory |
| **PI (pi-coding-agent)** | `.pi/settings.json`, `.pi/` | Coding agent config |
| **Qoder** | `.qoder/rules/` | Project-level rules |
| **Roo Code** | `.roo/rules/`, `.roorules` | Directory structure and single file |
| **Zencoder** | `.zencoder/rules/` | Project-level Zen Rules |
| **Droid (Factory)** | `.droid/`, `AGENTS.md` | Factory AI platform |
| **WorkBuddy/CodeBuddy** | `.workbuddy/skills/` | Project-level skills |
| **OpenClaw Ecosystem** | `.openclaw/` | Project-level config directory |
| **QoderWork** | `.qoderwork/skills/` | Project-level skills directory |
---
## 2. User Global-Level Rule Files (by OS)
### Windows (`HOME` = `%USERPROFILE%`, e.g., `C:\Users\admin`)
| Platform | Path |
|----------|------|
| **Cursor** | `%USERPROFILE%\.cursor\rules\` |
| **Claude Code** | `%USERPROFILE%\.claude\CLAUDE.md` |
| **Claude Code (directory)** | `%USERPROFILE%\.claude\` |
| **Gemini CLI** | `%USERPROFILE%\.gemini\GEMINI.md` |
| **Cline** | `%USERPROFILE%\Documents\Cline\Rules\` |
| **Trae IDE** | `%USERPROFILE%\.trae\user_rules.md` |
| **WorkBuddy/CodeBuddy** | `%USERPROFILE%\.workbuddy\skills\` |
| **Continue.dev** | `%USERPROFILE%\.continue\` |
| **Aider** | `%USERPROFILE%\.aider.conf.yml` |
| **OpenCode** | `%USERPROFILE%\.config\opencode\` |
| **Amp** | `%USERPROFILE%\.factory\AGENTS.md` |
| **Goose** | `%APPDATA%\Block\goose\config\` |
| **Kilo Code** | `%USERPROFILE%\.kilocode\rules\` |
| **Kiro (AWS)** | `%USERPROFILE%\.kiro\` |
| **Neovate** | `%USERPROFILE%\.neovate\AGENTS.md` |
| **OpenHands** | `%USERPROFILE%\.openhands\` |
| **PI (pi-coding-agent)** | `%USERPROFILE%\.pi\agent\settings.json` |
| **Roo Code** | `%USERPROFILE%\.roo\rules\` |
| **Droid (Factory)** | `%USERPROFILE%\.factory\` |
| **OpenClaw** | `%USERPROFILE%\.openclaw\` |
| **QClaw** | `%USERPROFILE%\.openclaw\` (shared with OpenClaw) |
| **CoPaw** | `%USERPROFILE%\.copaw\` |
| **Manus** | `%USERPROFILE%\.manus\` |
| **HappyCapy** | `%USERPROFILE%\.happycapy\` |
| **QoderWork** | `%USERPROFILE%\.qoderwork\skills\` |
### macOS (`HOME` = `/Users/<username>`)
| Platform | Path |
|----------|------|
| **Cursor** | `~/.cursor/rules/` |
| **Claude Code** | `~/.claude/CLAUDE.md` |
| **Claude Code (directory)** | `~/.claude/` |
| **Gemini CLI** | `~/.gemini/GEMINI.md` |
| **Cline** | `~/Documents/Cline/Rules/` |
| **Trae IDE** | `~/.trae/user_rules.md` |
| **WorkBuddy/CodeBuddy** | `~/.workbuddy/skills/` |
| **Continue.dev** | `~/.continue/` |
| **Aider** | `~/.aider.conf.yml` |
| **OpenCode** | `~/.config/opencode/` |
| **Amp** | `~/.factory/AGENTS.md` |
| **Goose** | `~/.config/goose/` |
| **Kilo Code** | `~/.kilocode/rules/` |
| **Kiro (AWS)** | `~/.kiro/` |
| **Neovate** | `~/.neovate/AGENTS.md` |
| **OpenHands** | `~/.openhands/` |
| **PI (pi-coding-agent)** | `~/.pi/agent/settings.json` |
| **Roo Code** | `~/.roo/rules/` |
| **Droid (Factory)** | `~/.factory/` |
| **OpenClaw** | `~/.openclaw/` |
| **CoPaw** | `~/.copaw/` |
| **Manus** | `~/.manus/` |
| **HappyCapy** | `~/.happycapy/` |
| **QoderWork** | `~/.qoderwork/skills/` |
| **Note** | Qoder/Zencoder | Project-level only, no global config |
### Linux (`HOME` = `/home/<username>`)
| Platform | Path |
|----------|------|
| **Cursor** | `~/.cursor/rules/` |
| **Claude Code** | `~/.claude/CLAUDE.md` |
| **Claude Code (directory)** | `~/.claude/` |
| **Gemini CLI** | `~/.gemini/GEMINI.md` |
| **Cline** | `~/Documents/Cline/Rules/` or `~/Cline/Rules/` |
| **Trae IDE** | `~/.trae/user_rules.md` |
| **WorkBuddy/CodeBuddy** | `~/.workbuddy/skills/` |
| **Continue.dev** | `~/.continue/` |
| **Aider** | `~/.aider.conf.yml` |
| **OpenCode** | `~/.config/opencode/` |
| **Amp** | `~/.factory/AGENTS.md` |
| **Goose** | `~/.config/goose/` |
| **Kilo Code** | `~/.kilocode/rules/` |
| **Kiro (AWS)** | `~/.kiro/` |
| **Neovate** | `~/.neovate/AGENTS.md` |
| **OpenHands** | `~/.openhands/` |
| **PI (pi-coding-agent)** | `~/.pi/agent/settings.json` |
| **Roo Code** | `~/.roo/rules/` |
| **Droid (Factory)** | `~/.factory/` |
| **OpenClaw** | `~/.openclaw/` |
| **CoPaw** | `~/.copaw/` |
| **Manus** | `~/.manus/` |
| **HappyCapy** | `~/.happycapy/` |
| **QoderWork** | `~/.qoderwork/skills/` |
| **Note** | Qoder/Zencoder | Project-level only, no global config |
---
## 3. Universal Cross-Platform Files (read by multiple platforms)
| Filename | Supported Platforms |
|----------|---------------------|
| `AGENTS.md` | Codex CLI, Cursor, Claude Code, Cline, Continue, OpenCode, Amp, Neovate, Droid |
| `CLAUDE.md` | Claude Code, OpenCode, Neovate (compatible read) |
| `.cursorrules` | Cursor, Cline (automatic compatible read) |
| `.windsurfrules` | Windsurf, Cline (automatic compatible read) |
---
## 4. OpenClaw Ecosystem
The following platforms are based on or derived from OpenClaw, and their config directories may be compatible:
| Platform | Description | Config Path |
|----------|-------------|-------------|
| **OpenClaw** | Original open-source AI Agent | `~/.openclaw/` |
| **QClaw** | Tencent WeChat/QQ version | `~/.openclaw/` (shared) |
| **EasyClaw** | Zero-config desktop version | `~/.openclaw/` (shared) |
| **ArkClaw** | Volcano Engine version | `~/.openclaw/` (possibly shared) |
| **LobsterAI** | NetEase version | `~/.openclaw/` (possibly shared) |
| **HiClaw** | Hi version | `~/.openclaw/` (possibly shared) |
| **AutoClaw** | Zhipu version | `~/.openclaw/` (possibly shared) |
| **AntiClaw** | Anti version | `~/.openclaw/` (possibly shared) |
> Note: Some derivative versions may use independent config directories. If unsure about the specific path, you can use `--platforms openclaw` to clear them uniformly.
---
## 5. Emerging AI Tools
The following are emerging AI coding tools that have risen rapidly in recent years, supporting diverse configuration methods:
| Platform | Type | Description | Main Paths |
|----------|------|-------------|------------|
| **Amp** | AI coding agent | Developed by Sourcegraph, supports AGENTS.md unified standard | `AGENTS.md` / `~/.factory/AGENTS.md` |
| **Goose** | Open-source AI Agent | Open-sourced by Block, supports MCP protocol and skill extensions | `.goosehints` / `~/.config/goose/` |
| **Kilo Code** | VS Code extension | Based on Roo Code/Cline, multi-mode support | `.kilocode/rules/` / `~/.kilocode/rules/` |
| **Kiro** | AWS Agentic IDE | Official Amazon AI development environment | `.kiro/steering/` / `~/.kiro/` |
| **Neovate** | Terminal AI assistant | Compatible with AGENTS.md standard | `AGENTS.md` / `~/.neovate/AGENTS.md` |
| **OpenHands** | AI-driven development | Open-source multi-agent collaboration platform | `.openhands/` / `~/.openhands/` |
| **PI (pi-coding-agent)** | Coding agent CLI | Developed by badlogic, minimalist design | `.pi/settings.json` / `~/.pi/agent/settings.json` |
| **Qoder** | Alibaba intelligent coding platform | Supports project-level rule configuration | `.qoder/rules/` |
| **Roo Code** | VS Code extension | "Aggressive" fork of Cline | `.roo/rules/`, `.roorules` / `~/.roo/rules/` |
| **Zencoder** | AI coding Agent | Supports VS Code/JetBrains plugins | `.zencoder/rules/` |
| **Droid (Factory)** | Factory AI terminal agent | Enterprise-level AI coding assistant | `.droid/`, `AGENTS.md` / `~/.factory/` |
> Note: The Command Code tool currently lacks sufficient information and is not included in the list. If needed, please refer to relevant official documentation.