detecting-languages

detecting-languages is a skill for Claude Code from xberg-io/tree-sitter-language-pack. It costs 60 tokens per session (686 once invoked), scanned A, original, MIT.

Instructions for identifying which programming language a file or code snippet uses. The tool can use a file path, extension, or—through its software library—the content itself.

In plain words
What is it for?
It is for choosing the right parser before analysis, checking supported languages, and detecting languages from paths, extensions, or raw source content.
Why use it?
It removes guesswork when a file has no extension, has a misleading extension, or comes from input such as a terminal pipe. It also helps confirm whether a language is supported and already downloaded.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the tree-sitter-language-pack plugin — 7 skills, 1 MCP server shipped together

Good fit It is for choosing the right parser before analysis, checking supported languages, and detecting languages from paths, extensions, or raw source content.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/xberg-io/tree-sitter-language-pack/detecting-languages
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add xberg-io/tree-sitter-language-pack --skill detecting-languages
Clone the repo
git clone --depth 1 https://github.com/xberg-io/tree-sitter-language-pack

Made for: Claude Code.

Or install tree-sitter-language-pack, the plugin that ships this one along with the rest of its 7 skills, 1 MCP server.

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 detecting-languages

README.md
[![agentmods](https://agentmods.dev/badge/skills/xberg-io/tree-sitter-language-pack/detecting-languages/github.svg)](https://agentmods.dev/skills/xberg-io/tree-sitter-language-pack/detecting-languages)
Your own site
<a href="https://agentmods.dev/skills/xberg-io/tree-sitter-language-pack/detecting-languages"><img src="https://agentmods.dev/badge/skills/xberg-io/tree-sitter-language-pack/detecting-languages/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 detecting-languages

Your own site · 80×15
<a href="https://agentmods.dev/skills/xberg-io/tree-sitter-language-pack/detecting-languages"><img src="https://agentmods.dev/badge/skills/xberg-io/tree-sitter-language-pack/detecting-languages.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 60 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 686 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. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.00060 $0.00686
Opus 5 $0.00030 $0.00343
Sonnet 5 $0.00012 $0.00137
Haiku 4.5 $0.00006 $0.00069

Measured 9d ago against content hash edf69831314c, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

detecting-languages 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 9d 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.

plugin/.ai-rulez/skills/detecting-languages/SKILL.md · 89 lines

How it starts

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

Detecting languages

tree-sitter-language-pack maps a file to one of 371 supported languages. Detection works from a file path, a bare extension, or — via the SDK — the file content itself.

On the CLI: detection is implicit

There is no standalone ts-pack detect command. parse and process auto-detect the language from the file extension and act on it:

ts-pack parse src/app.ts      # detects "typescript", parses
ts-pack process app.py        # detects "python", extracts

When detection fails (no extension, ambiguous, or stdin), pass --language:

cat snippet | ts-pack parse - --language go

To check whether a language name is supported and cached without parsing anything, use list and info:

ts-pack list --filter type      # languages whose name contains "type"
ts-pack list --manifest         # every language in the remote manifest
ts-pack info typescript         # is it known? is it downloaded? cache path?

In the SDK: explicit detection

The core exposes three detection functions, including content-based detection that the CLI does not surface:

Function Detects from
detect_language_from_path(path) Full path (uses the extension).
detect_language_from_extension(ext) A bare extension like "rs".
detect_language_from_content(content) Raw source text — no path needed.

Each returns the language name or null/None when no grammar matches.

Python

from tree_sitter_language_pack import (
    detect_language_from_path,
    detect_language_from_extension,
    detect_language_from_content,
)

detect_language_from_path("src/app.py")      # "python"
detect_language_from_extension("rs")          # "rust"
detect_language_from_content(open("x").read())  # from the shebang line, if present

Node.js / TypeScript

import { detectLanguageFromPath, detectLanguageFromContent } from "@xberg-io/tree-sitter-language-pack";

const lang = detectLanguageFromPath("src/app.ts") ?? detectLanguageFromContent(source);

Read the full file on GitHub · 89 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. 9d ago First seen · 89 lines · 60 tokens per session scan A edf69831314c

Subscribe to this mod's changes

detecting-languages is a skill published in the GitHub repository xberg-io/tree-sitter-language-pack (464 stars, last pushed 3d ago), licensed MIT. It adds 60 tokens to every session and 686 once invoked, about $0.0003 per session on Opus 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

gograph

Go repository intelligence for Claude Code. Use when reading, navigating, editing, reviewing, or refactoring a Go codebase. Exposes 64 query, analysis, and workflow capabilities through the local gograph MCP server, including bounded first-call exploration, AST-aware call graphs, blast-radius analysis, impact, and…

ozgurcd/gograph · 69 tokens

crawlberg

Crawl, scrape, and convert websites to Markdown using the local crawlberg CLI and its MCP server. Use when the user wants to fetch a page, follow links across a domain, enumerate URLs, or drive a real browser. Covers installation, the subcommands (scrape, crawl, map, interact, batch-scrape, batch-crawl, download…

xberg-io/crawlberg · 107 tokens

automating-the-browser

Use when extracting a page needs scripted interaction first — click, type, press a key, scroll, wait, screenshot, or run JS before capturing the DOM. Covers crawlberg interact URL --actions with the real action schema, result shape, limits, and external-CDP options.

xberg-io/crawlberg · 63 tokens

crawling-a-site

Use when the user wants to follow links across a domain and capture every reachable page as Markdown. Covers crawlberg crawl with depth, page caps, concurrency, rate limiting, domain scoping, robots, and output selection.

xberg-io/crawlberg · 52 tokens

headless-fallback

Use when a static fetch returns nothing useful and the page needs a real browser. Covers --browser-mode auto|always|never, external CDP via --browser-endpoint, symptoms of JS-only pages and WAF blocks, and the performance cost.

xberg-io/crawlberg · 57 tokens

scraping-html-to-markdown

Use when the user wants a single page rendered as clean Markdown plus structured metadata. Covers crawlberg scrape URL, JSON vs Markdown output, what metadata is returned, and how to handle JS-heavy pages.

xberg-io/crawlberg · 48 tokens