Files
zclaw_openfang/skills/file-operations/SKILL.md
iven d60d445cbf feat(phase4-5): add Workflow types and expand Skills ecosystem
Phase 4: Type System Completion (P2)
- Add comprehensive Workflow type definitions:
  - WorkflowStepType: hand, skill, agent, condition, parallel, delay
  - WorkflowStep: individual step configuration
  - Workflow: complete workflow definition
  - WorkflowRunStatus: pending, running, completed, failed, cancelled, paused
  - WorkflowRun: execution instance tracking
  - Request/Response types for API operations
  - Control types for pause/resume/cancel
- Update types/index.ts with workflow exports

Phase 5: Skills Ecosystem Expansion (P2)
- Add 5 new Skills with SKILL.md definitions:
  - git: Git version control operations
  - file-operations: File system operations
  - web-search: Web search capabilities
  - data-analysis: Data analysis and visualization
  - shell-command: Shell command execution
- Skills coverage now at 9/60+ (15%)

Documentation:
- Update SYSTEM_ANALYSIS.md Phase 4 & 5 status
- Mark Phase 4 as completed
- Update Phase 5 progress tracking

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-15 01:51:45 +08:00

143 lines
2.6 KiB
Markdown

---
name: file-operations
description: 文件系统操作 - 读取、写入、创建、删除、复制文件和目录
triggers:
- "读取文件"
- "写入文件"
- "创建文件"
- "删除文件"
- "复制文件"
- "移动文件"
- "创建目录"
- "列出文件"
- "查找文件"
tools:
- read
- write
- edit
- glob
- bash
---
# 文件系统操作
执行文件和目录的读写、创建、删除、复制等操作。
## 能力
- 读取文件:查看文件内容
- 写入文件:创建或覆盖文件
- 编辑文件:修改文件内容
- 删除文件:删除指定文件
- 复制文件:复制文件到新位置
- 移动文件:移动或重命名文件
- 创建目录:创建新目录
- 列出文件:查看目录内容
- 查找文件:按模式搜索文件
## 工具依赖
- read: 读取文件内容
- write: 写入文件
- edit: 编辑文件(字符串替换)
- glob: 按模式查找文件
- bash: 执行复杂文件操作(复制、移动、删除目录等)
## 安全原则
1. **确认操作**: 删除或覆盖文件前确认
2. **路径验证**: 使用绝对路径,避免路径遍历
3. **备份重要**: 修改重要文件前建议备份
4. **权限检查**: 确保有足够的文件系统权限
## 常用操作
### 读取文件
```typescript
// 使用 read 工具
read: { file_path: "/path/to/file" }
```
### 写入文件
```typescript
// 使用 write 工具
write: {
file_path: "/path/to/file",
content: "文件内容"
}
```
### 编辑文件
```typescript
// 使用 edit 工具(替换字符串)
edit: {
file_path: "/path/to/file",
old_string: "old content",
new_string: "new content"
}
```
### 查找文件
```typescript
// 使用 glob 工具
glob: {
pattern: "**/*.ts",
path: "/project/src"
}
```
### 复制/移动/删除
```bash
# 复制文件
cp /source/file /dest/file
# 复制目录
cp -r /source/dir /dest/dir
# 移动/重命名
mv /old/path /new/path
# 删除文件
rm /path/to/file
# 删除目录
rm -rf /path/to/dir
```
## 示例用法
```
用户: 读取 src/config.ts 文件
助手: 读取文件内容...
[使用 read 工具]
文件内容如下:
```typescript
export const config = {
apiUrl: "https://api.example.com",
timeout: 5000
};
```
用户: 把 apiUrl 改成 http://localhost:3000
助手: 修改配置...
[使用 edit 工具]
已将 apiUrl 从 "https://api.example.com" 修改为 "http://localhost:3000"
```
## 输出规范
- 显示操作的目标文件路径
- 显示操作结果(成功/失败)
- 读取文件时显示完整内容
- 编辑时显示变更的 diff
- 中文描述操作结果