tree-sitter-analyzer: Skill for Claude Code

.claude/skills/tsa-refactor-queue/SKILL.md

tsa-refactor-queue is a skill for Claude Code from aimasteracc/tree-sitter-analyzer. It costs 265 tokens per session (3,286 once invoked), scanned A, original, MIT.

A tool that ranks files for refactoring by combining code-health grades, how often files change, and likely dead code. Refactoring means improving code structure without changing what it does.

In plain words
What is it for?
Use it during engineering triage, cleanup after new features, sprint planning, or after a code-health warning.
Why use it?
It turns a broad cleanup task into a short, ordered list of files and suggested actions.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: mentions CLAUDE.md.

This is aimasteracc/tree-sitter-analyzer's own configuration. It tells Claude Code how to work on tree-sitter-analyzer itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything tree-sitter-analyzer configures →

Not installable: its command points at a path on the author’s own machine, so it runs nowhere else. The line is /Users/aisheng.yu/git-private/tree-sitter-analyzer.

Reuse

Borrowing it

Nothing to install: this file belongs to aimasteracc/tree-sitter-analyzer. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/aimasteracc/tree-sitter-analyzer/main/.claude/skills/tsa-refactor-queue/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/aimasteracc/tree-sitter-analyzer

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for tsa-refactor-queue

README.md
[![agentmods](https://agentmods.dev/badge/skills/aimasteracc/tree-sitter-analyzer/tsa-refactor-queue/github.svg)](https://agentmods.dev/skills/aimasteracc/tree-sitter-analyzer/tsa-refactor-queue)
Your own site
<a href="https://agentmods.dev/skills/aimasteracc/tree-sitter-analyzer/tsa-refactor-queue"><img src="https://agentmods.dev/badge/skills/aimasteracc/tree-sitter-analyzer/tsa-refactor-queue/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for tsa-refactor-queue

Your own site · 80×15
<a href="https://agentmods.dev/skills/aimasteracc/tree-sitter-analyzer/tsa-refactor-queue"><img src="https://agentmods.dev/badge/skills/aimasteracc/tree-sitter-analyzer/tsa-refactor-queue.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 265 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,286 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00265 $0.03286
Opus 5.5 $0.00106 $0.01314
Sonnet 5.5 $0.00053 $0.00657
Haiku 4.5 $0.00026 $0.00329

Measured 1mo ago against content hash faf036e536aa, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

tsa-refactor-queue scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/skills/tsa-refactor-queue/SKILL.md · 306 lines

How it starts

The opening of the file, as written. The whole thing — 306 lines — stays where its author put it; the contents beside it link to each section on GitHub.

tsa-refactor-queue — Top-N prioritized refactor slices

Three signals, one ranked list. Health × churn × dead-code → the five files you'd refactor first if you had a week. Each row carries a target symbol, a blast radius, and a concrete action.

When to use

  • "What should we refactor next?" — daily/weekly engineering triage
  • Post-feature cleanup pass — find rot that accumulated while shipping
  • Pre-sprint planning — turn "we should clean up" into 5 concrete tickets
  • After a CI grade-drop alert from tsa-health-watch — re-rank with churn

Don't use when:

  • You already know the file (one-file deep dive → health action=file or tsa-edit-safety)
  • The codebase is brand-new (<2 weeks of git history) — churn signal is noise
  • You want to optimize one hot function — use tsa-graph + edit action=refactor directly
  • Shallow clone in CI — git_state=shallow makes mod_count_30d unreliable

Procedure

Step 0 — Try the one-call route first (RFC-0027 §L8)

The three-signal join and the Step 2 formula now live in code:

health action=refactor_queue top_n=5          # MCP
uv run python -m tree_sitter_analyzer --refactor-queue --refactor-queue-top-n 5   # CLI

It returns the ranked rows directly (rank, file_path, grade, weakest_dimension, churn_30d, dead_symbols, total_symbols, priority, action) and echoes the formula it used. If it answers status=CHURN_UNAVAILABLE, the AST index has no 30-day churn — build the index and retry rather than hand-computing zeros.

Fall through to Steps 1-4 below only when you need signals the action does not carry (e.g. the heatmap view, or a per-candidate blast radius).

Step 1 — Single fan-out (parallel, 3 MCP calls)

Call these in ONE message:

  1. health action=project with min_grade: "D" and max_files: 20 — F/D files + per-file weakest_dimension
  2. health action=dead with max_dead: 200 — symbol-level dead candidates, grouped by file
  3. health action=heatmap with top_n: 20 — complexity-weighted file list (covers structural smell)

Read the full file on GitHub · 306 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago Changed · +25 lines faf036e536aa
  2. 2mo ago First seen · 281 lines · 265 tokens per session scan A 322a12e7604c

Subscribe to this mod's changes

tsa-refactor-queue is a skill published in the GitHub repository aimasteracc/tree-sitter-analyzer (61 stars, last pushed today), licensed MIT. It adds 265 tokens to every session and 3,286 once invoked, about $0.0011 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

plan-eng-review

Eng manager-mode plan review. Lock in the execution plan — architecture, data flow, diagrams, edge cases, test coverage, performance. Walks through issues interactively with opinionated recommendations. Use when asked to "review the architecture", "engineering review", or "lock in the plan". Proactively suggest when…

GCWing/BitFun · 116 tokens

memstack-development-code-reviewer

Use this skill when the user says 'review code', 'code review', 'check my code', 'audit this', 'review PR', 'review changes', 'what's wrong with this', or is requesting a structured review of code quality, security, performance, or maintainability. Do NOT use for refactoring plans or test generation.

cwinvestments/memstack · 75 tokens

autoplan

Auto-review pipeline — reads the full CEO, design, eng, and DX review skills from disk and runs them sequentially with auto-decisions using 6 decision principles. Surfaces taste decisions (close approaches, borderline scope, codex disagreements) at a final approval gate. One command, fully reviewed plan out. Use when…

GCWing/BitFun · 152 tokens

pre-landing-review

Pre-landing PR review. Analyzes diff against the base branch for SQL safety, LLM trust boundary violations, conditional side effects, and other structural issues. Use when explicitly asked for the specialized pre-landing workflow. Product /review requests are handled by OpenBitFun's unified Review mechanism instead.…

GCWing/BitFun · 75 tokens

shard

Use when the user says 'shard this', 'split file', or when working with files over 1000 lines.

cwinvestments/memstack · 28 tokens

pr-review-canvas

Create a OpenBitFun Canvas for reviewing a pull request, branch diff, or change set with Cursor-style diff cards, review maps, risk callouts, and focused reviewer flow. Use when the user asks for a PR review canvas, diff walkthrough, change-set overview, or visual review summary.

GCWing/BitFun · 64 tokens