ワンクリックで
cortexfs-dry-refactor
在 CortexFS 仓库中继续去重、减少重复逻辑、合并等价代码、减少代码量或函数数量、恢复上次 DRY 重构现场,或在新增代码前避免写出重复 helper 时使用。
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
在 CortexFS 仓库中继续去重、减少重复逻辑、合并等价代码、减少代码量或函数数量、恢复上次 DRY 重构现场,或在新增代码前避免写出重复 helper 时使用。
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Use this skill when working in the CortexFS repository and the user asks to test CortexFS, test FUSE, test /ctx, test ctx, test agent.sh, run live tests, use Ollama or smollm2:135m, verify file/socket ABI behavior, check tests/mounts/cortexfs, inspect the systemd mount, update the AUR package, or diagnose mount/socket permission failures.
This skill should be used when the user asks to "build a CortexFS tool", "create a CortexFS agent", "package a CortexFS extension", "write a cortexfs.object/v1 or cortexfs.object/v2 manifest", "install an external tool", or "install an external agent".
Benchmark live CortexFS multi-agent system with Inspect AI ctx CLI. Use when asked test ctx agents, compare architect/coder/reviewer/worker performance, measure quality, latency, TTFT, throughput, tokens or errors, diagnose benchmark regressions, produce repeatable agent evaluation report.
| name | cortexfs-dry-refactor |
| description | 在 CortexFS 仓库中继续去重、减少重复逻辑、合并等价代码、减少代码量或函数数量、恢复上次 DRY 重构现场,或在新增代码前避免写出重复 helper 时使用。 |
用这个 skill 恢复 CortexFS 去重现场。目标是减少真实重复逻辑,但保持行为、错误文本、错误类型和 ABI 稳定。只有共享语义已经清楚时才合并。
AGENTS.md 和 docs/DESIGN.md。.codegraph/,定位代码前先用 CodeGraph。rtk;只有过滤输出影响判断时才用原始命令。mod.rs。cargo add。/ctx 顶层 ABI 名称、后台循环、轮询、热加载命令或 provider 特殊默认路径。每次继续去重,先测当前状态:
rtk git status --short
rtk git diff --shortstat
rtk proxy bash -lc '
set -euo pipefail
files=$(git diff --name-only -- "*.rs")
base=0
work=0
for f in $files; do
b=$(git show "HEAD:$f" 2>/dev/null | rg -c "^[[:space:]]*(pub(\\([^)]*\\))?[[:space:]]+)?(async[[:space:]]+)?fn[[:space:]]+[A-Za-z0-9_]+" || true)
w=$(rg -c "^[[:space:]]*(pub(\\([^)]*\\))?[[:space:]]+)?(async[[:space:]]+)?fn[[:space:]]+[A-Za-z0-9_]+" "$f" || true)
b=${b:-0}
w=${w:-0}
base=$((base + b))
work=$((work + w))
done
printf "changed-rs-fn-count HEAD=%s worktree=%s delta=%+d\n" "$base" "$work" "$((work - base))"
'
再找剩余 clone:
rtk proxy jscpd --reporters ai --min-lines 10 --min-tokens 80 crates/cortexfs/src --ignore "**/target/**"
新增 Rust helper 或本地实现前,先查相邻模块和共享 helper 是否已有等价行为。优先检查这些族:
support/plain.rs 和 cli/directory.rs:普通目录、文件创建和同步。support/path.rs:host workspace 路径校验。support/process.rs:有限读取进程输出、终止进程组。cli/nofollow.rs:CLI 侧 no-follow 打开文件。cli/text.rs:有限读取小文本。cli/stderr.rs、cli/json.rs、cli/uid.rs、cli/alias.rs、cli/shell.rs、cli/terminal.rs、cli/procfd.rs:CLI 共享工具逻辑。如果新代码像这些 helper,优先调用已有 helper,或在正确边界抽一个窄 helper。不要复制实现后只改变量名。
全部满足时才合并:
任一满足时跳过:
宏可以用于减少重复源码模式并降低函数数量,但优先保持局部;只有多个模块确实共享同一模式时才外提。
jscpd 选择一个 clone family。jscpd。每个有意义的代码改动后至少跑:
rtk cargo fmt --check
rtk cargo check --locked --workspace --all-targets --all-features
代码改动收尾前跑完整 gate:
rtk cargo fmt --check
rtk cargo check --locked --workspace --all-targets --all-features
rtk cargo clippy --locked --workspace --all-targets --all-features -- -D warnings
rtk cargo test --locked --workspace --all-targets --all-features
rtk git diff --check
最终汇报净行数变化、changed-Rust 函数数量 delta、剩余重复率,以及主动跳过的 clone family。