opentidehq/language-server/tree-sitter

Claude Code and agent skill by opentidehq/language-server

Trust tier 2
  • community
LLM review pending
Source check pending

Checking that the SKILL.md file is still in the repository.

Author and bind tree-sitter 0.25.10 grammars for opentide KQL and SPL. Covers grammar.js, vendored parser.c, the tree-sitter CLI pin, Language::from_raw, QueryCursor StreamingIterator, and highlights.scm first-wins. Use when editing grammars/, crates/opentide-syntax, or highlights/queries.

Install

npx vskill@latest install opentidehq/language-server/tree-sitter

SKILL.md

The same SKILL.md was published earlier as opentidehq/language-server/tree-sitter.

tree-sitter 0.25

The Rust crate and the CLI are both 0.25.10. CI installs tree-sitter-cli@0.25.10 (npm install --prefix /tmp/ts-cli tree-sitter-cli@0.25.10). scripts/cloud-agent-install.sh installs that same version. A parser generated by any other CLI fails scripts/check-grammars.sh.

Grammars are vendored under grammars/tree-sitter-opentide-{kql,spl,esql,eql,kuery,lucene,falco,cql,yara,exabeam,yaral}/. Only ES|QL has an external scanner (src/scanner.c, nested /* */ comments). crates/opentide-syntax/build.rs compiles src/parser.c, and src/scanner.c when present, with the cc crate. Do not publish these grammars as separate crates and do not depend on a crates.io grammar.

Read references/grammar-workflow.md before editing grammar.js. Read references/query-api.md before calling QueryCursor.

Generate, do not hand-edit

Generated files:

  • grammars/tree-sitter-opentide-<id>/src/parser.c
  • src/grammar.json
  • src/node-types.json
  • the headers under src/tree_sitter/

Edit grammar.js only, then run this from the repository root. tree-sitter generate has to see grammar.js, and scripts/check-grammars.sh is not on the path from inside the grammar directory:

bash
(cd grammars/tree-sitter-opentide-kql && tree-sitter generate) # or -spl
bash scripts/check-grammars.sh

check-grammars.sh copies the grammar to a temp directory, runs tree-sitter generate, and diffs parser.c. Commit the regenerated files. A hand-edited parser.c will not match the next generate and will fail CI.

Grammar shape this repo uses

grammar.js starts with /// <reference types="tree-sitter-cli/dsl" /> and module.exports = grammar({...}).

  • name is opentide_kql or opentide_spl (underscores). That becomes the C symbol tree_sitter_opentide_kql. It is not the LSP language id (kql).
  • extras are whitespace and $.comment.
  • word is $.identifier.
  • Pipelines are prec.left sequences of primary then repeat(seq("|", operator)).
  • KQL control commands (. plus a name) are a real production so the engine can emit kql_control_command_unsupported. They are not valid detections.
  • SPL unknown commands are a production (unknown_command), not a parse error, so spl_unknown_command can be diagnosed. ES|QL does the same for esql_unknown_command.
  • Case-insensitive keywords: ES|QL uses a regex token aliased to the keyword (kw(word)) and lists the identifier rules last so an equal-length keyword wins. kuery spells each case variant as a string so word extraction still works. A regex keyword is not extracted by word.
  • YARA-L keywords are case-insensitive in any mix. Lexical precedence beats match length in tree-sitter's lexer (a preced meta keyword lexes metadata as meta), so each keyword is a token rule (_kw_and: token(/[aA][nN][dD]/)) that kw($, "and") aliases to the lower-case node, and the keywords are a reserved set: word: identifier extraction lexes the whole name first, and a reserved word is never an identifier. reserved takes token rules, not aliases.
  • EQL keywords are lowercase and listed in reserved. Lucene reserves upper-case AND/OR/NOT only.
  • A missing token that tree-sitter inserts can be hidden (MISSING on an anonymous node). opentide_syntax::first_error falls back to the smallest visible node with has_error, so the engine still reports a parse error.
  • SQL is not a grammar. Do not add a select statement production "for later". Exabeam's SELECT … GROUP-BY layer is not SQL: it is specified as part of exabeam-1.0 and lives in the exabeam grammar only (docs/EXABEAM.md).

Prefer a JS DSL rule over an external scanner. Adding scanner.c means updating build.rs (compile the extra C file) and check-grammars.sh. Do not add one unless the DSL cannot express the token.

Corpus gate

Every production the engine claims is covered by a fixture under testdata/corpus/<id>/. The first line tags the production:

// prod:take_operator valid
SecurityEvent | take 1

crates/opentide-syntax/tests/corpus_gate.rs requires those prod:<rule> tags and checks named rules in grammar.json. A new named rule is either added to the required list and given a fixture, or added to the explicit skip set with a reason (structural rules such as expression and source_file are skipped today). docs/LANGUAGE.md gets a row: id, grammar rule, fixture, capture.

A fixture that only lives in a unit-test string does not satisfy the gate.

Highlight queries

highlights/queries/<id>/highlights.scm capture names are a subset of highlights/spec.toml [meta].legend. An unknown capture fails highlight generation.

Order matters. query_captures keeps the earliest pattern for a span, then drops overlaps so semantic tokens never overlap. Specific patterns go before (identifier) @variable. A keyword pattern listed after @variable loses.

; comments in .scm files are query comments, not KQL comments.

Rust binding

opentide-syntax does not use the crates.io LANGUAGE: LanguageFn constant. It calls the generated C symbol and Language::from_raw. That is the supported 0.25 constructor for a raw *const TSLanguage. The pointer must be non-null and point at the static language from tree_sitter_opentide_*. See references/query-api.md for the cast and for StreamingIterator.

Parser::set_language returns Result. Parser::parse returns Option<Tree>. Tree::root_node().has_error() is the parse-error bit. Do not unwrap a parse of user source; surface kql_parse_error / spl_parse_error.

Tests

bash
cargo test -p opentide-syntax
bash scripts/check-grammars.sh
cargo run -p opentide-lsp -- generate-highlights --check

A grammar change that shifts node kinds must update the .scm file and the engine's node.kind() matches in the same change. Kind strings are the rule names (where_operator), not display names.

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewNot runA model review is scheduled for the next rescan.

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
0

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/opentidehq/language-server/tree-sitter/badge)](https://verified-skill.com/skills/opentidehq/language-server/tree-sitter)

Something wrong with this skill or its page? Tell us.