Files
skills/install.ps1
empty c8989efc0c Update CLAUDE.md content with complete collaboration framework
Enhanced content includes:
- Core collaboration instructions (4-step workflow)
- Complete Codex tool specification
- Mandatory rules and recommended practices
- Preserved original MCP prompt structure

Changes:
- Add "需求分析阶段", "方案设计阶段", "代码审查阶段" steps
- Include "批判性思维" principle
- Complete tool parameter reference
- Must-follow rules for safe collaboration

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-11 18:17:35 +08:00

275 lines
10 KiB
PowerShell
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Claude Code Skills 安装脚本 (Windows)
# 用法: irm https://git.let5see.xyz/let5see/skills/raw/main/install.ps1 | iex
$ErrorActionPreference = "Stop"
$RepoUrl = "https://git.let5see.xyz/let5see/skills.git"
$TempDir = Join-Path $env:TEMP "skills-install-$(Get-Random)"
$SkillsDir = Join-Path $env:USERPROFILE ".claude\skills"
$ClaudeMdContent = @'
## Codex 协作框架
本项目使用 `codex-collab` skill 进行 Codex CLI 协作。
### 核心协作指令
在任何时刻,你必须思考当前过程可以如何与 codex 进行协作,如何调用 Codex MCP 工具作为你客观全面分析的保障。
**务必执行**以下几个步骤:
1. **需求分析阶段**:在形成初步分析后,将用户需求、初始思路告知 codex并要求其完善需求分析和实施计划。
2. **方案设计阶段**:在实施具体编码任务前,**必须向 codex 索要代码实现原型**(要求 codex 仅给出 unified diff patch严禁对代码做任何真实修改。在获取代码原型后你**只能以此为逻辑参考,重新编写代码**,形成企业生产级别、高可读性、高可维护性的代码后,才能实施具体编程修改任务。
3. **代码审查阶段**:无论何时,只要完成编码行为后,**必须立即使用 codex review 代码改动和需求完成程度**。
4. **批判性思维**codex 只能提供参考,你**必须有独立思考,甚至需要对 codex 的回答提出质疑**。"尽信书则不如无书",你与 codex 的最终使命都是达成统一、全面、精准的结论,所以你们必须不断辩论以找到通向真理的唯一途径。
### Codex Tool 调用规范
#### 必选参数
- `PROMPT` (string): 发送给 codex 的任务指令
- `cd` (Path): codex 执行任务的工作目录根路径
#### 可选参数
| 参数 | 类型 | 默认值 | 说明 |
|------|------|--------|------|
| `sandbox` | string | "read-only" | 沙箱策略read-only / workspace-write / danger-full-access |
| `SESSION_ID` | UUID | None | 会话IDNone=新会话) |
| `skip_git_repo_check` | bool | False | 是否允许在非Git仓库运行 |
| `return_all_messages` | bool | False | 是否返回完整推理信息 |
#### 返回值
```json
{
"success": true,
"SESSION_ID": "uuid-string",
"agent_messages": "Codex响应内容"
}
```
#### 必须遵守
- 每次调用必须保存返回的 `SESSION_ID`,以便后续继续对话
- `cd` 参数必须指向存在的目录
- 严禁 codex 对代码进行实际修改,使用 `sandbox="read-only"`
- 要求 codex 仅给出 unified diff patch
#### 推荐用法
- 对于精准定位、debug、代码原型编写等任务优先使用 codex
- 详细追踪推理过程时,设置 `return_all_messages=True`
### 快速安装
```powershell
irm https://git.let5see.xyz/let5see/skills/raw/main/install.ps1 | iex
```
### 详细文档
参考:`$env:USERPROFILE\.claude\skills\codex-collab\SKILL.md`
或在线查看https://git.let5see.xyz/let5see/skills
---
'@
Write-Host "🚀 正在安装 Claude Code Skills..." -ForegroundColor Green
Write-Host ""
# 检查 git 是否安装
Write-Host "🔍 检查 Git..." -ForegroundColor Yellow
try {
$null = git --version
Write-Host " ✓ Git 已安装" -ForegroundColor Green
} catch {
Write-Host " ✗ 未找到 Git请先安装 Git: https://git-scm.com/download/win" -ForegroundColor Red
exit 1
}
# 创建临时目录
Write-Host "📦 下载 skills..." -ForegroundColor Yellow
New-Item -ItemType Directory -Path $TempDir -Force | Out-Null
# 克隆仓库
try {
git clone "$RepoUrl" "$TempDir" --depth 1 --quiet
Write-Host " ✓ 下载完成" -ForegroundColor Green
} catch {
Write-Host " ✗ 下载失败: $_" -ForegroundColor Red
exit 1
}
# 确保 skills 目录存在
New-Item -ItemType Directory -Path $SkillsDir -Force | Out-Null
# 复制所有 skills
Write-Host "📋 安装 skills..." -ForegroundColor Yellow
$skillDirs = Get-ChildItem -Path $TempDir -Directory
$installedCount = 0
foreach ($skillDir in $skillDirs) {
$skillName = $skillDir.Name
$skillMd = Join-Path $skillDir.FullName "SKILL.md"
if (Test-Path $skillMd) {
$destPath = Join-Path $SkillsDir $skillName
# 如果已存在,先删除
if (Test-Path $destPath) {
Remove-Item -Recurse -Force $destPath
}
Copy-Item -Recurse -Force $skillDir.FullName $destPath
Write-Host "$skillName" -ForegroundColor Green
$installedCount++
} else {
Write-Host " ⚠ 跳过 $skillName (缺少 SKILL.md)" -ForegroundColor Yellow
}
}
# 清理临时文件
Remove-Item -Recurse -Force $TempDir
Write-Host ""
Write-Host "✅ Skills 安装完成!" -ForegroundColor Green
Write-Host ""
Write-Host "已安装 $installedCount 个 skills:" -ForegroundColor Cyan
Get-ChildItem -Path $SkillsDir -Directory | ForEach-Object {
Write-Host " - $($_.Name)" -ForegroundColor White
}
Write-Host ""
Write-Host "────────────────────────────────────────" -ForegroundColor Cyan
Write-Host "📝 是否要配置 Codex 协作规则到 CLAUDE.md" -ForegroundColor Yellow
Write-Host ""
Write-Host "这将写入完整的协作框架指导,帮助 Claude Code 更好地与 Codex 协作。" -ForegroundColor Gray
Write-Host "不会被覆盖现有内容,只会追加配置。" -ForegroundColor Gray
Write-Host ""
Write-Host " [1] 用户级配置 (~/.claude/CLAUDE.md) - 所有项目生效" -ForegroundColor White
Write-Host " [2] 项目级配置 (./CLAUDE.md) - 仅当前项目生效" -ForegroundColor White
Write-Host " [0] 跳过配置" -ForegroundColor White
Write-Host ""
Write-Host "────────────────────────────────────────" -ForegroundColor Cyan
$choice = Read-Host "请选择 [0/1/2]"
switch ($choice) {
"1" {
# 用户级配置
$ClaudeMdPath = Join-Path $env:USERPROFILE ".claude\CLAUDE.md"
Write-Host ""
Write-Host "📄 写入用户级配置: $ClaudeMdPath" -ForegroundColor Cyan
# 创建目录(如果不存在)
$claudeDir = Split-Path $ClaudeMdPath -Parent
if (-not (Test-Path $claudeDir)) {
New-Item -ItemType Directory -Path $claudeDir -Force | Out-Null
}
# 检查文件是否已存在
if (Test-Path $ClaudeMdPath) {
# 检查是否已包含配置标记
$content = Get-Content $ClaudeMdPath -Raw
if ($content -match "## Codex 协作框架") {
Write-Host " ⚠ 检测到已存在 Codex 协作配置,跳过写入" -ForegroundColor Yellow
} else {
# 追加配置
Add-Content -Path $ClaudeMdPath -Value "`n$ClaudeMdContent"
Write-Host " ✓ 配置已追加到文件末尾" -ForegroundColor Green
}
} else {
# 创建新文件
$projectConstitution = @"
##
****
1. `CLAUDE.md`
2. ****
3. ""
****
- `CLAUDE.md` >
-
"@
Set-Content -Path $ClaudeMdPath -Value "$projectConstitution`n$ClaudeMdContent"
Write-Host " ✓ 已创建新配置文件" -ForegroundColor Green
}
}
"2" {
# 项目级配置
Write-Host ""
$projectDirInput = Read-Host "请输入项目目录路径 (默认为当前目录)"
$projectDir = if ([string]::IsNullOrWhiteSpace($projectDirInput)) {
Get-Location
} else {
$projectDirInput
}
# 转换为绝对路径
$projectDir = (Resolve-Path $projectDir).Path
$ClaudeMdPath = Join-Path $projectDir "CLAUDE.md"
Write-Host ""
Write-Host "📄 写入项目级配置: $ClaudeMdPath" -ForegroundColor Cyan
# 检查目录是否存在
if (-not (Test-Path $projectDir)) {
Write-Host " ✗ 错误: 目录不存在: $projectDir" -ForegroundColor Red
exit 1
}
# 检查文件是否已存在
if (Test-Path $ClaudeMdPath) {
# 检查是否已包含配置标记
$content = Get-Content $ClaudeMdPath -Raw
if ($content -match "## Codex 协作框架") {
Write-Host " ⚠ 检测到已存在 Codex 协作配置,跳过写入" -ForegroundColor Yellow
} else {
# 追加配置
Add-Content -Path $ClaudeMdPath -Value "`n$ClaudeMdContent"
Write-Host " ✓ 配置已追加到文件末尾" -ForegroundColor Green
}
} else {
# 创建新文件
$projectConstitution = @"
##
****
1. `CLAUDE.md`
2. ****
3. ""
****
- `CLAUDE.md` >
-
"@
Set-Content -Path $ClaudeMdPath -Value "$projectConstitution`n$ClaudeMdContent"
Write-Host " ✓ 已创建新配置文件" -ForegroundColor Green
}
}
"0" {
Write-Host ""
Write-Host "⏭ 跳过配置" -ForegroundColor Yellow
}
default {
Write-Host ""
Write-Host "⚠ 无效选择,跳过配置" -ForegroundColor Yellow
}
}
Write-Host ""
Write-Host "────────────────────────────────────────" -ForegroundColor Cyan
Write-Host "🎉 安装完成!" -ForegroundColor Green
Write-Host ""
Write-Host "提示: 重启 Claude Code 以加载新的 skills" -ForegroundColor Yellow
Write-Host "────────────────────────────────────────" -ForegroundColor Cyan