Agent同步
- 作者仓库星标 435
- 作者更新于 实时读取
- 作者仓库 nvim
- 领域
- 效率工具
- 兼容 Agent
-
- Claude Code
- Cursor
- Cline
- Codex
- Windsurf
- Gemini CLI
- +20
- 信任分
- 88 / 100 · 社区维护
- 作者 / 版本 / 许可
- @benbrastmckie · 未声明 license
- Token 消耗评级
- 低消耗
- 接入复杂程度
- 需简单配置
- 是否需要外部 API Key
- 不需要
- 兼容的系统
- 未声明(默认跨平台)
- 底层运行要求
- 无特殊要求
- 文件与系统权限
-
- 只读
- 允许写入 / 修改
- Shell 执行
- 网络行为
- 仅限本地
- 安装命令数
- 26 条
档案由构建时根据 SKILL.md 与安装命令自动衍生,可能与作者实际意图存在差异。
需要注意: 未限定 allowed-tools,默认拥有全部工具权限。
---
name: skill-status-sync
description: Atomically update task status across TODO.md and state.json. For standalone use only. Direct exe…
category: 效率工具
runtime: 无特殊运行时
---
# skill-status-sync 输出预览
## PART A: 任务判断
- 适用问题:日常重复事务、资料整理、邮件或工作流提效。
- 输入要求:目标材料、限制条件、期望输出和验收方式。
- 证据边界:围绕“Context References / Standalone Use Only / Trigger Conditions”读取原文规则,不把推断写成作者承诺。
## PART B: 执行结果
- **01** 任务判断:确认你的需求是否属于日常重复事务、资料整理、邮件或工作流提效,并标出输入、限制和预期结果。
- **02** 执行计划:优先按“Context References / Standalone Use Only / Trigger Conditions”拆成步骤,说明每一步会读取什么、修改什么、产出什么。
- **03** 交付结果:给出可复制的命令、文件改动、检查清单或内容草稿,并说明如何继续迭代。
- **04** 风险边界:结合 读取文件、写入/修改文件、执行终端命令、主要在本地完成、通常不需要额外 API Key 给出执行前确认项。
## Running Rules
- 读取文件、写入/修改文件、执行终端命令;主要在本地完成;通常不需要额外 API Key。
- 先小样例验证,再放大到真实任务。
- 交付时同时给结果、检查口径和下一步迭代建议。 原文出现了 `/plan`、`/implement`、`/revise` 这类斜杠命令;如果你的 Agent 支持命令触发,优先用命令开场,再补充目标和边界。
告诉 Agent 目标文件或材料、期望结果、不可改范围、是否允许联网或执行命令。本 Skill 的权限画像是:读取文件、写入/修改文件、执行终端命令。
先用一个小任务确认它会围绕“Context References / Standalone Use Only / Trigger Conditions”工作;涉及文件或命令时,先看 diff、日志、预览或测试结果。
检查最终产物是否包含明确结果、必要证据和下一步动作;如果输出泛泛而谈,就补充输入、边界和验收标准后重跑。
---
name: skill-status-sync
description: Atomically update task status across TODO.md and state.json. For standalone use only. Direct exe…
category: 效率工具
source: benbrastmckie/nvim
---
# skill-status-sync
## 什么时候使用
- 把日常协作方向的常用动作沉淀成 Agent 可调用的技能 适合处理重复事务、信息整理、邮件和日常工作流提效,核心价值是把输入、判断、执行、验证和交付边界固定下来,避免 Agent 泛泛回答。 把任务拆成可执行、可检查、可继续迭代的步骤…
- 面向日常重复事务、资料整理、邮件或工作流提效,优先处理能明确输入、步骤和验收标准的工作。
## 需要提供什么
- 目标材料、目录范围、期望结果和不可改动内容。
- 是否允许联网、执行命令、读写文件或调用外部服务。
## 执行规则
- 围绕「Context References / Standalone Use Only / Trigger Conditions」组织步骤,不把推断写成作者事实。
- 读取文件、写入/修改文件、执行终端命令;主要在本地完成;通常不需要额外 API Key。
- 先跑小样例,确认结果可检查后再扩大任务范围。
## 输出要求
- 给出最终产物、关键证据、验证方式和下一步动作。
- 信息不足时标记 unknown,不编造命令、平台或依赖。 作者原文负责流程事实;仓库文件负责来源和命令;流狐只补充适用场景、限制和质量判断。
skill "skill-status-sync" {
输入层 -> 用户目标 + 目标文件 + 禁止范围 + 验收标准
上下文层 -> Context References / Standalone Use Only / Trigger Conditions
规则层 -> SKILL.md 触发条件 / 执行顺序 / 输出格式
运行层 -> 无特殊运行时 | 读取文件、写入/修改文件、执行终端命令 | 主要在本地完成
安全层 -> 通常不需要额外 API Key + 小任务验证 + diff / 日志复核
输出层 -> 可复制结果 + 检查清单 + 下一步迭代
} Status Sync Skill (Direct Execution)
Direct execution skill for atomic status synchronization across TODO.md and state.json. This skill executes inline without spawning a subagent, avoiding memory issues.
Context References
Reference (do not load eagerly):
- Path:
.claude/context/patterns/jq-escaping-workarounds.md- jq escaping patterns (Issue #1132)
Standalone Use Only
IMPORTANT: This skill is for STANDALONE USE ONLY.
Workflow skills (skill-researcher, skill-planner, skill-implementer, etc.) now handle their own preflight/postflight status updates inline. This eliminates the multi-skill halt boundary problem where Claude may pause between skill invocations.
Use this skill for:
- Manual task status corrections
- Standalone scripts that need to update task state
- Recovery operations when workflow skills fail
- Testing status update behavior in isolation
Do NOT use this skill in workflow commands (/research, /plan, /implement, /revise) - those commands now invoke a single skill that handles its own status updates.
Trigger Conditions
This skill activates when:
- Manual status correction is needed
- Artifacts need to be linked outside normal workflow
- Status synchronization recovery is needed between TODO.md and state.json
API Operations
This skill exposes three primary operations:
| Operation | Purpose | When to Use |
|---|---|---|
preflight_update |
Set in-progress status | GATE IN checkpoint |
postflight_update |
Set final status + link artifacts | GATE OUT checkpoint |
artifact_link |
Add single artifact link (idempotent) | Post-artifact creation |
Execution
1. Input Validation
Validate required inputs based on operation type:
For preflight_update:
task_number- Must be provided and exist in state.jsontarget_status- Must be an in-progress variant (researching, planning, implementing)session_id- Must be provided for traceability
For postflight_update:
task_number- Must be provided and existtarget_status- Must be a final variant (researched, planned, implemented, partial)artifacts- Array of {path, type} to linksession_id- Must be provided
For artifact_link:
task_number- Must be provided and existartifact_path- Relative path to artifactartifact_type- One of: research, plan, summary
2. Execute Operation Directly
Route to appropriate operation and execute using Bash (jq) and Edit tools.
Operation: preflight_update
Purpose: Set in-progress status at GATE IN checkpoint
Execution:
- Validate task exists:
task_data=$(jq -r --arg num "{task_number}" \
'.active_projects[] | select(.project_number == ($num | tonumber))' \
specs/state.json)
if [ -z "$task_data" ]; then
echo "Error: Task {task_number} not found"
exit 1
fi
- Update state.json:
jq --arg ts "$(date -u +%Y-%m-%dT%H:%M:%SZ)" --arg status "{target_status}" \
'(.active_projects[] | select(.project_number == {task_number})) |= . + {
status: $status,
last_updated: $ts
}' specs/state.json > specs/tmp/state.json && mv specs/tmp/state.json specs/state.json
- Update TODO.md status marker:
- Find task entry:
grep -n "^### {task_number}\." specs/TODO.md - Use Edit tool to change
[OLD_STATUS]to[NEW_STATUS]
- Find task entry:
Status Mapping:
| state.json | TODO.md |
|---|---|
| not_started | [NOT STARTED] |
| researching | [RESEARCHING] |
| planning | [PLANNING] |
| implementing | [IMPLEMENTING] |
Return: JSON object with status "synced" and previous/new status fields.
Operation: postflight_update
Purpose: Set final status and link artifacts at GATE OUT checkpoint
Execution:
- Update state.json status and timestamp:
jq --arg ts "$(date -u +%Y-%m-%dT%H:%M:%SZ)" --arg status "{target_status}" \
'(.active_projects[] | select(.project_number == {task_number})) |= . + {
status: $status,
last_updated: $ts
}' specs/state.json > specs/tmp/state.json && mv specs/tmp/state.json specs/state.json
- Add artifacts to state.json (for each artifact):
IMPORTANT: Use two-step jq pattern to avoid Issue #1132 escaping bug. See jq-escaping-workarounds.md.
# Step 1: Update timestamp
jq --arg ts "$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
'(.active_projects[] | select(.project_number == {task_number})) |= . + {
last_updated: $ts
}' specs/state.json > specs/tmp/state.json && mv specs/tmp/state.json specs/state.json
# Step 2: Add artifact (append to array)
jq --arg path "{artifact_path}" \
--arg type "{artifact_type}" \
'(.active_projects[] | select(.project_number == {task_number})).artifacts += [{"path": $path, "type": $type}]' \
specs/state.json > specs/tmp/state.json && mv specs/tmp/state.json specs/state.json
Update TODO.md status marker:
- Use Edit to change status:
[RESEARCHING]->[RESEARCHED]
- Use Edit to change status:
Link artifacts in TODO.md:
- Add research/plan/summary links in appropriate location
Status Mapping:
| state.json | TODO.md |
|---|---|
| researched | [RESEARCHED] |
| planned | [PLANNED] |
| implemented | [IMPLEMENTED] |
| partial | [PARTIAL] |
Return: JSON object with target_status and artifacts_linked fields.
Operation: artifact_link
Purpose: Add single artifact link (idempotent)
Execution:
- Idempotency check:
if grep -A 30 "^### {task_number}\." specs/TODO.md | grep -q "{artifact_path}"; then
echo "Link already exists"
# Return "skipped" status
fi
- Add to state.json artifacts array:
IMPORTANT: Use two-step jq pattern to avoid Issue #1132 escaping bug. See jq-escaping-workarounds.md.
# Step 1: Update timestamp
jq --arg ts "$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
'(.active_projects[] | select(.project_number == {task_number})) |= . + {
last_updated: $ts
}' specs/state.json > specs/tmp/state.json && mv specs/tmp/state.json specs/state.json
# Step 2: Add artifact (append to array)
jq --arg path "{artifact_path}" \
--arg type "{artifact_type}" \
'(.active_projects[] | select(.project_number == {task_number})).artifacts += [{"path": $path, "type": $type}]' \
specs/state.json > specs/tmp/state.json && mv specs/tmp/state.json specs/state.json
- Add link to TODO.md using Edit tool:
| Type | Format in TODO.md |
|---|---|
| research | Count-aware format (see "Artifact Linking Format" in state-management.md) |
| plan | Count-aware format (see "Artifact Linking Format" in state-management.md) |
| summary | Count-aware format (see "Artifact Linking Format" in state-management.md) |
Count-Aware Logic: Use inline format for 1 artifact, multi-line list for 2+. See state-management.md for detection patterns and insertion examples.
Insertion order:
- research: after Language line
- plan: after Research line (or Language if no Research)
- summary: after Plan line
Return: JSON object with status "linked" or "skipped".
Return Format
preflight_update returns:
{
"status": "synced",
"summary": "Updated task #{N} to [{STATUS}]",
"previous_status": "not_started",
"new_status": "researching"
}
postflight_update returns:
{
"status": "{target_status}",
"summary": "Updated task #{N} to [{STATUS}] with {M} artifacts",
"artifacts_linked": ["path1", "path2"],
"previous_status": "researching",
"new_status": "researched"
}
artifact_link returns:
{
"status": "linked|skipped",
"summary": "Linked artifact to task #{N}" | "Link already exists",
"artifact_path": "path/to/artifact.md",
"artifact_type": "research"
}
Error Handling
Task Not Found
Return failed status with recommendation to verify task number.
Invalid Status Transition
Return failed status with current status and allowed transitions.
File Write Failure
Return failed status with recommendation to check permissions.
jq Parse Failure
If jq commands fail with INVALID_CHARACTER or syntax error (Issue #1132):
- Log to errors.json with session_id and original command
- Retry with two-step pattern from
jq-escaping-workarounds.md - If retry succeeds, log recovery action
Integration Notes
For Workflow Commands: Do NOT use this skill directly. Workflow skills now handle their own status updates inline.
For Manual Operations: Use this skill for standalone status corrections:
### Manual Status Correction
Invoke skill-status-sync with:
- operation: preflight_update or postflight_update
- task_number: {N}
- target_status: {valid_status}
- session_id: manual_correction
- artifacts: [{path, type}, ...] (for postflight only)
This skill ensures:
- Atomic updates across both files
- Consistent jq/Edit patterns
- Proper error handling
- Direct execution without subagent overhead
先判断是否适合
作者设计意图
作者的方法与取舍
边界和复核