Skip to content
Agentmart
Submit a tool

sa-isolation

当开始撰写需要与当前工作区隔离的新章节,或在执行撰写计划之前使用——通过智能目录选择和安全验证创建隔离的草稿分支

Skill by kun4ai

IndexedMIT★ 7
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/kun4ai-sa-isolation

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

当开始撰写需要与当前工作区隔离的新章节,或在执行撰写计划之前使用——通过智能目录选择和安全验证创建隔离的草稿分支

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/sa-isolation

What's inside

Skill name
sa-isolation
Description
当开始撰写需要与当前工作区隔离的新章节,或在执行撰写计划之前使用——通过智能目录选择和安全验证创建隔离的草稿分支
License
MIT
Instructions
198 lines in SKILL.md · view on GitHub

Before installing

  • Instructions read files in your home folder (~/.ssh, ~/.aws…)

Agent Skills spec issues

  • body: contains an absolute path from the author's machine

Files (1)

  • SKILL.md

SKILL.md (first lines)

# 使用草稿分支 (Using Draft Branches)

## 概述

草稿分支创建共享同一存储库的隔离工作区,允许同时处理多个章节的草稿而无需切换上下文。

**核心原则:** 系统化目录选择 + 安全验证 = 可靠的写作隔离。

**开始时声明:** “我正在使用 isolation 技能来设置隔离的写作工作区。”

## 目录选择流程

遵循此优先级顺序:

### 1. 检查现有目录

```bash
# 按优先级检查
ls -d .worktrees 2>/dev/null     # 首选 (隐藏)
ls -d worktrees 2>/dev/null      # 替代
```

**如果找到:** 使用该目录。如果两者都存在,`.worktrees` 优先。

### 2. 检查 CLAUDE.md

```bash
grep -i "worktree.*director" CLAUDE.md 2>/dev/null
```

**如果指定了偏好:** 直接使用,无需询问。

### 3. 询问研究者

如果不存在目录且无 CLAUDE.md 偏好:

```
未找到草稿目录。我应该在哪里创建草稿分支?

1. .worktrees/ (项目本地,隐藏)
2. ~/.config/superpowers/worktrees/<project-name>/ (全局位置)

你倾向于哪个?
```

## 安全验证

### 对于项目本地目录 (.worktrees 或 worktrees)

**必须在创建工作树之前验证目录是否被忽略:**

```bash
# 检查目录是否被忽略(遵守本地、全局和系统 gitignore)
git check-ignore -q .worktrees 2>/dev/null || git check-ignore -q worktrees 2>/dev/null
```

**如果未被忽略:**

根据“立即修复损坏的东西”规则:
1. 向 .gitignore 添加相应的行
2. 提交更改
3. 继续创建工作树

**为什么关键:** 防止意外将临时草稿目录提交到存储库。

### 对于全局目录 (~/.config/superpowers/worktrees)

不需要 .gitignore 验证——完全在项目之外。

## 创建步骤

### 1. 检测项目名称

```bash
project=$(basename "$(git rev-parse --show-toplevel)")
```

### 2. 创建工作树

```bash
# 确定完整路径
case $LOCATION in
  .worktrees|worktrees)
    path="$LOCATION/$BRANCH_NAME"
    ;;
  ~/.config/superpowers/worktrees/*)
    path="~/.config/superpowers/worktrees/$project/$BRANCH_NAME"
    ;;
esac

# 创建带有新分支的工作树
git worktree add "$path" -b "$BRANCH_NAME"
cd "$path"
```

### 3. 运行项目设置

自动检测并运行适当的设置(针对学术写作环境,如 LaTeX 或 Markdown):

```bash
# LaTeX 项目
if [ -f main.tex ]; then echo "LaTeX project detected"; fi

# Markdown/Pandoc 项目
if [ -f Makefile ]; then make setup; fi
```

### 4. 验证干净基线

运行验证脚本以确草稿从干净状态开始:

```bash
# 示例
make verify
# 或
./scripts/validate_structure.sh
```

**如果验证失败:** 报告失败,询问是否继续或调查。

From kun4ai/superpowers-academic, MIT.

More from kun4ai/superpowers-academic

Signals

Stars
7
Forks
1
Open issues
0
Last commit (this folder)
Jan 23, 2026 (9 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from kun4ai

Cite this page

sa-isolation skill. Agent Mart. https://agentmart.dev/skills/kun4ai-sa-isolation (last updated 2026-10-24)