mcpField
C
cloning-project

cloning-project

github.com/oaustegardAgent 工作流15747 次安装1 天前更新
代码仓库

关于 cloning-project

这是一个导出 Claude.ai 项目说明和上传知识文件的 skill,可生成单个文件或 ZIP 包。它面向备份或复制项目配置,不用于 Git 代码仓库。

主要功能

  1. 01检查 Claude 项目上下文
  2. 02提取项目说明
  3. 03查找上传的知识文件
  4. 04导出文件或 ZIP 包
  5. 05处理空项目或无法访问的文件

适用场景

  1. 01备份 Claude 项目
  2. 02将项目配置复制到其他位置
  3. 03打包说明与上传文档

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/oaustegard/claude-skills --skill cloning-project

安装后在 Claude Code 中输入/cloning-project确认已加载。

附带文件CHANGELOG.mdREADME.md

详细介绍

克隆项目

当用户请求克隆、复制、导出或备份当前项目时:

何时不应使用此技能

此处的“项目”指 Claude.ai 工作区,而不是代码仓库。这个词很容易造成混淆,因此应根据实际要复制的内容选择对应方式:

情况使用
克隆或获取 git 仓库accessing-github-repos
“我刚克隆了这个,这是什么?”exploring-codebases
代码库包含或提供的内容tree-sitting
备份仓库文件使用 git,而不是此技能

此技能会读取你当前所在的 Claude.ai 工作区,不会接触任何检出内容,也不了解代码。

步骤 1:确认项目上下文

检查用户是否在项目中,可查看以下项目专属标识:

  • 上下文窗口中的项目说明
  • 在 <available_skills> 或类似部分中提及的知识文件
  • 用户明确说明自己在项目中

如果不在项目中,请告知用户,此技能要求在 Claude 项目中使用。

步骤 2:收集项目说明

项目说明通常以 XML 或 Markdown 内容的形式出现在上下文窗口中,用于描述项目的用途和配置。提取这些说明并保存到文件中。

创建说明文件:

cat > /home/claude/project-instructions.md << 'INSTRUCTIONS'
[Extracted project instructions content]
INSTRUCTIONS

步骤 3:定位知识文件

知识文件是用户上传并存储在 /mnt/user-data/uploads/ 中的文档。列出所有文件:

ls -lh /mnt/user-data/uploads/

如果存在知识文件,将它们复制到工作目录中以便打包:

cp /mnt/user-data/uploads/* /home/claude/project-export/

步骤 4:创建导出包

如果只有项目说明(没有知识文件):

  • 将说明直接复制到输出目录:
    cp /home/claude/project-instructions.md /mnt/user-data/outputs/
    

如果项目同时包含说明和知识文件:

  • 创建有条理的导出目录:
    mkdir -p /home/claude/project-export
    cp /home/claude/project-instructions.md /home/claude/project-export/
    cp /mnt/user-data/uploads/* /home/claude/project-export/ 2>/dev/null || true
    
  • 创建 zip 包:
    cd /home/claude
    zip -r /mnt/user-data/outputs/project-export.zip project-export/
    
  • 显示压缩包内容:
    unzip -l /mnt/user-data/outputs/project-export.zip
    

步骤 5:向用户提供文件和说明

提供导出文件的链接:

对于单个说明文件:

[Download project-instructions.md](computer:///mnt/user-data/outputs/project-instructions.md)

对于打包导出:

[Download project-export.zip](computer:///mnt/user-data/outputs/project-export.zip)

然后提供清晰的设置说明:

## How to Import Into a New Project

1. **Create a new Claude project** (or open an existing one where you want to clone this configuration)

2. **Add project instructions:**
   - Open the new project's settings
   - Navigate to the "Instructions" section
   - Copy and paste the content from `project-instructions.md`
   - Save the instructions

3. **Upload knowledge files** (if applicable):
   - In the new project, go to the "Knowledge" section
   - Upload all files from the export (except project-instructions.md)
   - Files will become available as project knowledge

Your project is now cloned with the same configuration and knowledge base.

特殊情况

空项目(没有自定义说明或知识文件):

  • 告知用户,该项目没有可导出的自定义配置
  • 说明项目默认只能使用 Claude 的基础功能

大型知识库:

  • 如果 zip 文件超过合理大小(约 50MB),请提醒用户并建议选择性导出
  • 提供单个文件的链接作为备用方案

文件损坏或无法访问:

  • 跳过无法读取的文件
  • 报告成功导出和跳过的文件
  • 使用可用内容继续导出

评论

支持 Markdown