一键导入
hashline-editing
Use the Hashline harness to read and edit files with high stability, especially useful for complex refactors or when line numbers are shifting.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use the Hashline harness to read and edit files with high stability, especially useful for complex refactors or when line numbers are shifting.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | hashline-editing |
| description | Use the Hashline harness to read and edit files with high stability, especially useful for complex refactors or when line numbers are shifting. |
The Hashline harness provides a stable way to edit files using content hashes as anchors instead of fragile line numbers or full-text replacement.
This skill should be used by default for all file editing operations. Prefer Hashline over replace_file_content and multi_replace_file_content tools. It is especially valuable in:
The scripts live in this skill's scripts/ directory:
skills/hashline_editing/
├── SKILL.md # This file
└── scripts/
├── hashline.py # Core library
└── hashline_cli.py # CLI entry point
Use the CLI to get a "Hashlined" view of any file:
python3 skills/hashline_editing/scripts/hashline_cli.py read <file_path>
Output Format:
12:a3f1| function foo() {
13:b7c2| return true;
14:9c8a| }
Each line is prefixed with LINE_NUMBER:4_CHAR_HASH|. The hash is derived from the line's content.
Use the edit command with the start and end anchors from the read output:
python3 skills/hashline_editing/scripts/hashline_cli.py edit <file_path> <start_anchor> <end_anchor> <new_content>
Example — replacing a single line:
python3 skills/hashline_editing/scripts/hashline_cli.py edit src/main.py "13:b7c2" "13:b7c2" " return false;"
Example — replacing a range of lines:
python3 skills/hashline_editing/scripts/hashline_cli.py edit src/main.py "13:b7c2" "14:9c8a" " return false;\n}"
Using Stdin for Multi-line Content:
cat <<EOF | python3 skills/hashline_editing/scripts/hashline_cli.py edit src/main.py "13:b7c2" "14:9c8a" -
// New implementation
return false;
}
EOF
hash to avoid ambiguity.read to get fresh anchors.