SkillAgentSearch skills...

Linguist

Github's Linguist for Rust

Install / Use

/learn @drshade/Linguist
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

Linguist

A Rust library for programming language detection, inspired by GitHub Linguist. Detects programming languages by file extension, filename, and content-based heuristics.

Features

  • Zero configuration and setup required, just add the crate and call the detection functions
  • Detect languages by exact filename match (e.g., Makefile, Dockerfile)
  • Detect languages by file extension (e.g., .rs, .py, .js)
  • Disambiguate between multiple languages using content heuristics
  • Identify vendored/third-party files

Usage

Detect by Extension

use linguist::detect_language_by_extension;

let languages = detect_language_by_extension("script.py")?;
assert_eq!(languages[0].name, "Python");

Detect by Filename

use linguist::detect_language_by_filename;

let languages = detect_language_by_filename("Makefile")?;
assert_eq!(languages[0].name, "Makefile");

Disambiguate by Content

use linguist::disambiguate;

let content = "#include <iostream>\nint main() {}";
let result = disambiguate("test.h", content)?;
if let Some(languages) = result {
    assert_eq!(languages[0].name, "C++");
}

Check if Vendored

use linguist::is_vendored;

assert!(is_vendored("node_modules/react/index.js")?);
assert!(!is_vendored("src/main.rs")?);

Acknowledgments

Special thanks to @vcfxb for graciously donating the crates.io name "linguist" to this project!

This project is inspired by and uses language definitions from GitHub Linguist, maintained by GitHub and its contributors. The language definitions (definitions/languages.yml, definitions/heuristics.yml, definitions/vendor.yml) are derived from this project.

Related Skills

View on GitHub
GitHub Stars10
CategoryDevelopment
Updated7d ago
Forks2

Languages

Rust

Security Score

90/100

Audited on Mar 25, 2026

No findings