tree-sitter-parse-testing

tree-sitter-parse-testing is a skill for Claude Code, Codex from ionide/tree-sitter-fsharp. It costs 21 tokens per session (729 once invoked), scanned A, original, MIT.

A testing guide for checking how the Tree-sitter parser handles F# code snippets. Tree-sitter is a tool that turns source code into a structure a program can analyze.

In plain words
What is it for?
It is for running debug parses on F# examples and interpreting the parser’s state transitions and error nodes.
Why use it?
It helps identify exactly where parsing fails, including unexpected or missing tokens, instead of relying on vague error messages.

Skill for Claude CodeCodex

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.

agentmods
npx agentmods add skills/ionide/tree-sitter-fsharp/tree-sitter-parse-testing
Any agent
npx skills add ionide/tree-sitter-fsharp --skill tree-sitter-parse-testing
Clone the repo
git clone --depth 1 https://github.com/ionide/tree-sitter-fsharp

Made for: Claude Code, Codex.

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 tree-sitter-parse-testing

README.md
[![agentmods](https://agentmods.dev/badge/skills/ionide/tree-sitter-fsharp/tree-sitter-parse-testing.svg)](https://agentmods.dev/skills/ionide/tree-sitter-fsharp/tree-sitter-parse-testing)
Your own site
<a href="https://agentmods.dev/skills/ionide/tree-sitter-fsharp/tree-sitter-parse-testing"><img src="https://agentmods.dev/badge/skills/ionide/tree-sitter-fsharp/tree-sitter-parse-testing.svg" alt="Measured on agentmods" height="20"></a>
Per session 21 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 729 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00021 $0.00729
Opus 5 $0.00010 $0.00365
Sonnet 5 $0.00004 $0.00146
Haiku 4.5 $0.00002 $0.00073

Measured 4d ago against content hash 28aec311d583, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

tree-sitter-parse-testing 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 4d 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.

.opencode/skills/tree-sitter-parse-testing/SKILL.md · 98 lines

How it starts

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

Tree-Sitter Parse Testing

Overview

Use tree-sitter parse -d to debug parsing issues. The debug output shows the state machine transitions, helping identify where parsing fails.

Parsing a Code Snippet

Run from the parser directory (fsharp/ or fsharp_signature/):

echo 'let x = 1' | npx tree-sitter parse -d

Interpreting Output

Successful Parse

(file [0, 0] - [1, 0]
  (declaration_expression [0, 0] - [0, 9]
    ...))
  • Node format: (nodename [start_row, start_col] - [end_row, end_col])
  • Children indented inside parent nodes

Parse Errors

(ERROR [0, 0] - [0, 7]
  ...)
  • ERROR nodes indicate parsing failure at that location

Missing Tokens

(MISSING identifier [0, 8] - [0, 8])
  • MISSING indicates expected token that wasn't found

Debug Output Analysis

Key patterns to look for:

Pattern Meaning
detect_error Parser encountered unexpected token
recover_with_missing Parser inserted placeholder to recover
recover_with_error Parser skipped tokens to recover
shift state:N Parser shifted to state N
reduce sym:X Parser reduced using rule X
accept Parse completed successfully

Debugging Workflow

  1. Run parse without -d to see the tree
  2. If tree looks wrong (ERROR nodes, unexpected structure):
  3. Run with -d to see the debug output
  4. Look for detect_error near the problem location
  5. Check which state the parser was in when error occurred
  6. Compare expected tokens at that state against actual input

Infinite Loops

If the debug output repeatedly emits the same token or state indefinitely, the parser has entered an infinite loop. This typically happens when:

  • A grammar rule injects tokens without consuming any input
  • The scanner (src/scanner.c) is returning tokens that don't advance the parse position

** Symptoms:**

  • Debug output shows the same token being processed repeatedly
  • The parser never reaches accept or an error state
  • Command appears to hang

Read the full file on GitHub · 98 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. 4d ago First seen · 98 lines · 21 tokens per session scan A 28aec311d583

Subscribe to this mod's changes

tree-sitter-parse-testing is a skill published in the GitHub repository ionide/tree-sitter-fsharp (96 stars, last pushed yesterday), licensed MIT. It adds 21 tokens to every session and 729 once invoked, about $0.0001 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.