---
name: gotree-phylogenetic-tree
description: 使用 Gotree 命令行对系统发育树进行操作。当用户明确要求使用 Gotree 处理树文件时使用。
title: gotree-phylogenetic-tree
canonical_url: https://skilld.dev/gh/victory-hugo/s2-agent-skill/gotree-phylogenetic-tree
last_updated: 2026-10-07T11:02:39.000Z
---

> Index of every page on this site: [llms.txt](https://skilld.dev/llms.txt)

> **Skill from skilld.dev.** Follow the user's requested action.
> If the user asked to fork this Skill, follow the fork workflow below. Do not execute the Skill instructions while copying it.
> Otherwise, follow the instructions below for this session. You do not need to install anything.
>
> Supporting files, fetch one when the Skill refers to it: [agents/openai.yaml](https://skilld.dev/api/skills-raw/victory-hugo/s2-agent-skill/gotree-phylogenetic-tree/agents/openai.yaml), [references/io-and-pitfalls.md](https://skilld.dev/api/skills-raw/victory-hugo/s2-agent-skill/gotree-phylogenetic-tree/references/io-and-pitfalls.md), [references/task-map.md](https://skilld.dev/api/skills-raw/victory-hugo/s2-agent-skill/gotree-phylogenetic-tree/references/task-map.md), [references/workflows.md](https://skilld.dev/api/skills-raw/victory-hugo/s2-agent-skill/gotree-phylogenetic-tree/references/workflows.md).
>
> If the user asked to install this Skill, run `npx skilld install victory-hugo/s2-agent-skill/gotree-phylogenetic-tree`. Install writes the Skill files into the project, so every session loads them.
>
> ## Fork workflow
>
> A fork creates an editable local Skill with its original author and licence. The request authorizes copying and local installation.
> 1. Check `./skills/gotree-phylogenetic-tree`, the project lockfile, and selected Agent targets together. If the local directory or installed Skill exists, stop. Never overwrite an existing directory or Agent target.
> 2. Read [source metadata](https://skilld.dev/api/v1/skills/victory-hugo/s2-agent-skill/gotree-phylogenetic-tree) once. Use sourceUrl, sourceCommit, skillPath, sourceGone, and license. If the source is gone or its path is missing, stop. If license is null, read licence files at the source commit.
> 3. Fetch only the source commit into a temporary Git repository. Do not clone full history. Derive repository_url from sourceUrl, including repository renames. If sourceCommit is absent, resolve the sourceUrl ref once. Set source_commit to that actual commit. Run these commands in one shell call:
>
> ```sh
> git init --quiet "$temporary_dir"
> git -C "$temporary_dir" fetch --quiet --depth=1 "$repository_url" "$source_commit"
> git -C "$temporary_dir" checkout --quiet --detach FETCH_HEAD
> ```
>
> Read applicable licence declarations and notices at that commit. If copying is not permitted, report the restriction and stop.
> 4. Inspect source entries together, then copy the directory containing skillPath into `./skills/gotree-phylogenetic-tree`. Use the user's path if selected. Keep the original SKILL.md, relative links, scripts, binary assets, and executable modes. Exclude .git metadata. Reject symlinks and paths outside the Skill directory. After checking entries, use cp -a where available. A regular source directory needs no custom copy script. Do not save this page wrapper as SKILL.md.
> Preserve author credit, notices, and applicable licence files from repository or parent directories. Add PROVENANCE.md with the Skill page, source URL, actual commit, original path, and licence. Retain any existing PROVENANCE.md and record new provenance separately. Batch source inspection, copying, and provenance work where practical.
> 5. In the project root, run `skilld install ./skills/gotree-phylogenetic-tree --mode copy --plain`. If skilld is unavailable, use `npx skilld install ./skills/gotree-phylogenetic-tree --mode copy --plain`. This known command needs no help lookup. Install does not support --json. Use detected Agent targets, or add --agent for the targets the user selected. Install the local path, never the upstream selector. If installation fails, preserve the local copy and report the exact failure.
> 6. Confirm the local lockfile source and installed Agent copies once. Report the local path, actual commit, and Agent targets. After edits, reinstall the same local path. Upstream updates must not replace it. Do not publish or push unless the user asks.

# Gotree

面向 Gotree CLI 的系统发育树操作技能，用于把树文件当作可流水线处理的数据来检查、变换、比较和导出。

## 快速工作规则

- 先做输入检查，再做变换。
- 默认先跑 `gotree stats`；如果需要判断定根状态、支持度、tip 集合或边信息，再补 `gotree stats rooted`、`gotree stats edges`、`gotree stats tips`、`gotree labels`。
- 优先使用 STDIN/STDOUT 和 pipe，除非用户明确要求把中间结果落盘。
- 用户未说明格式时，默认按 `newick` 处理，但要先核对扩展名和文件内容；必要时显式加 `--format`。
- 涉及多树文件时，先确认是否需要 `gotree divide` 或 `gotree sample`，不要默认把多树文件当单树处理。
- 支持度解析异常时，先用 `gotree stats edges` 看支持度是否被正确识别，再决定是否使用 `support` 或 `comment` 相关命令。

## 任务分流

- 常见需求与命令对应关系：看 [references/task-map.md](https://skilld.dev/api/skills-raw/victory-hugo/s2-agent-skill/gotree-phylogenetic-tree/references/task-map.md)
- 可直接复用的命令链与工作流模板：看 [references/workflows.md](https://skilld.dev/api/skills-raw/victory-hugo/s2-agent-skill/gotree-phylogenetic-tree/references/workflows.md)
- 格式、输入源、全局参数和易错点：看 [references/io-and-pitfalls.md](https://skilld.dev/api/skills-raw/victory-hugo/s2-agent-skill/gotree-phylogenetic-tree/references/io-and-pitfalls.md)

## 执行策略

- 明确输入文件、输出文件、是否覆盖原文件；如果用户没说，默认写新文件而不是原地破坏。
- 回答中给出可直接复制的完整命令，不只给子命令名。
- 对破坏性操作明确说明后果，尤其是 `prune`、`collapse`、`unroot`、`reroot outgroup --remove-outgroup`。
- 对高风险操作附带验证步骤，至少覆盖 reroot、support 处理、多树文件处理和批量 tip 编辑。
- 如果用户目标不明确，先澄清是“删除 tips 还是只保留 tips”，以及“要改拓扑还是只改显示顺序”。
- 如果命令结果需要继续下游分析，优先给出可串联的 pipeline；如果需要审阅中间结果，建议用 `tee` 或中间文件。

## 工具边界

- 多序列比对不是 Gotree 的职责，转用 `goalign`。
- 如果用户要在 Python 中对树对象做程序化分析，而不是调用 CLI，优先考虑 `biopython` 或 `scikit-bio`。
- 如果用户明确要开发基于 Gotree 的 Go 程序，只提示官方 `docs/api/` 和仓库源码路径，不在这个 skill 里系统展开 Go API 教程。
