agentleFS
bettyguobettyguo/obsidian_mcp/skills/refactor-tag-tree/SKILL.md

refactor-tag-tree

Skill8 starsChanged 11 months agoMITView on GitHub

Analyze the tag tree, surface case chaos and stragglers, and consolidate via supervised renames.

The file

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 1 is distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Call list_tags(min_count=1, include_hierarchy=True).

    line 16
  2. Very specific:

    After all renames in the issue class, call list_tags again.

    line 26
  3. Distinctive:

    Don't do silent bulk renames.

    line 42
  4. Very specific:

    Don't propose hierarchy changes (#ai → #research/ai) without asking.

    line 43
  5. Very specific:

    Don't touch tags that appear only in Dataview tags:: foo, bar inline fields.

    line 44

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

When to use

The user's tag tree has accumulated drift: case variants (#AI, #ai, #Ai), spelling variants, near-synonyms, and singletons that should be folded into a hierarchy. This skill walks the user through consolidation one decision at a time.

Procedure

  1. Call list_tags(min_count=1, include_hierarchy=True). Sort by with_descendants_count descending.
  2. Detect issue classes from the returned list:
    • Case chaos: tags whose tag.lower() collides with another tag's tag.lower().
    • Singletons: tags with exact_count == 1 that aren't part of a hierarchy.
    • Near-duplicates: pairs where Levenshtein distance ≤ 2 (e.g. agents vs agent).
    • Orphan top-levels: top-level tags with no descendants where a hierarchy parent would be obvious (e.g. rag alone when research/ exists).
  3. Surface ONE issue class at a time. Order: case chaos → near-duplicates → orphan top-levels → singletons. Don't dump the whole list.
  4. For each issue class, propose specific renames. For case chaos, default to the lowercase form. For near-duplicates, the higher-count tag wins (with the user able to override).
  5. Show usage counts and 2–3 sample paths per tag involved. The user MUST have enough context to make a judgment.
  6. For each user-approved rename, call rename_tag(old=..., new=..., confirm=true) (or merge_tags if the target already exists and merge=True is needed).
  7. After all renames in the issue class, call list_tags again. Re-check whether the issue is resolved before moving to the next class.

Output format (per issue class)

Found case chaos:
  #AI (12 uses, in [[notes...]])  ←
  #ai (37 uses, in [[notes...]])
  #Ai (2 uses, in [[notes...]])

Recommendation: merge into #ai (highest count, conventional lowercase).
Confirm? (yes / change target / skip)

Anti-patterns

  • Don't do silent bulk renames. Every rename is a separate confirm.
  • Don't propose hierarchy changes (#ai → #research/ai) without asking. That's the user's taxonomy.
  • Don't touch tags that appear only in Dataview tags:: foo, bar inline fields. Those aren't real tags.
  • Don't run on a vault where Obsidian is currently open — tag-tree refactor across hundreds of files while Obsidian holds buffers is asking for conflict. The user should close Obsidian (or open it read-only) before invoking this skill. (Automatic detection + refusal is on the v0.2 roadmap.)

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.