MCPInstall

indexion-kgf

Debug and inspect KGF specs — view tokenization results, parse trees, and extracted edges from source files. Use when adding/fixing language support or when indexion's analysis output looks wrong.

Installs
4.9K
Last 24h
—
Trending rank
—
Security
Pass

Install

Works with every agent the skills CLI supports.

npx skills add https://github.com/trkbt10/indexion-skills --skill indexion-kgf
  1. 01

    Install

    Run the command in your project. The CLI asks which agents to install for.

  2. 02

    Describe the task

    Ask your agent for something this skill covers. It loads indexion-kgf automatically when relevant.

  3. 03

    Review the result

    The agent follows the SKILL.md steps, scripts and references bundled with the skill.

Security audits

Independent scans of the skill's instructions and bundled files.

Gen Agent Trust Hub PassSAFE ·The skill provides instructions for using the 'indexion' CLI to debug and inspect language specification files. It includes standard commands for updating specifications from GitHub and analyzing source code structure. No malicious patterns were detected.
Socket PassNo alerts
Snyk PassLOW ·Risk: LOW · No issues

SKILL.md

The instructions your agent reads when the skill is triggered.

indexion kgf

Inspect and debug KGF language specs by viewing tokens, parse events, and extracted edges.

When to Use

  • User wants to debug how indexion processes a specific file
  • User is developing or modifying a KGF spec
  • User asks "how does indexion parse this file?"
  • Verifying that tokenization/parsing works correctly for a language
  • Debugging grep patterns: when a grep pattern doesn't match, use kgf tokens to see the actual token kinds

Subcommands

indexion kgf list — List Installed Specs

indexion kgf list

indexion kgf update — Update All Specs

Download the latest specs from GitHub.

indexion kgf update

indexion kgf add — Install a Single Spec

indexion kgf add <spec-name>

indexion kgf inspect — Full Inspection

Show tokens, events, and edges all at once.

indexion kgf inspect <file>
indexion kgf inspect --spec=typescript src/app.ts

indexion kgf tokens — Tokenization Only

Show how a file is tokenized.

indexion kgf tokens <file>
indexion kgf tokens --spec=go-mod go.mod

indexion kgf events — Parse Events Only

Show parse events generated from tokens.

indexion kgf events <file>

indexion kgf edges — Extracted Edges Only

Show the dependency edges extracted from a file.

indexion kgf edges <file>
indexion kgf edges fixtures/project/npm/package.json

Options

OptionDefaultDescription
--spec=NAMEauto-detectKGF spec name to use
--kgf-dir=PATHkgfsKGF specs directory

Relationship to grep

indexion grep uses KGF tokenization under the hood. Pattern aliases (pub → KW_pub) are derived from the === lex section of KGF specs.

When a grep pattern doesn't match as expected:

# 1. See the actual tokens for a file
indexion kgf tokens src/config/paths.mbt

# 2. Check which token kinds exist
indexion kgf tokens src/config/paths.mbt | head -20

# 3. Then adjust your grep pattern to match the actual token kinds
indexion grep "KW_pub KW_fn Ident" src/config/paths.mbt

Common token kinds (MoonBit):

  • KW_pub, KW_fn, KW_struct, KW_enum, KW_type, KW_trait, KW_let, KW_for
  • Ident (lowercase identifiers), TypeIdent (PascalCase type names)
  • LPAREN, RPAREN, LBRACE, RBRACE, LBRACKET, RBRACKET
  • NL (newline), SKIP (whitespace — filtered from grep patterns)
  • DocComment, DocLine, DocSection, LineComment, BlockComment
  • String, Number, Char

Workflow

  1. Run indexion kgf inspect <file> to see the full processing pipeline
  2. If something looks wrong, drill down with tokens, events, or edges
  3. Compare with the KGF spec file (kgfs/<lang>.kgf) to diagnose issues

KGF Development Pitfalls

Common bugs found when writing or modifying KGF specs:

PEG Item Ordering (first-match-wins)

KGF uses PEG parsing. In Item -> A / B / C, if A matches, B and C are never tried. DocComment as a standalone alternative before declaration rules will consume doc comments that should be attached to declarations.

# BAD: DocComment before FuncDecl — doc is consumed as standalone item
Item -> NL / DocComment / FuncDecl / Other

# GOOD: DocComment after declarations — FuncDecl's doc:DocComment? gets it
Item -> NL / FuncDecl / DocComment / Other

NL Between Doc and Keyword

Source code has newlines between doc comments and declarations. Without NL? or NL*, the optional doc capture fails silently:

# BAD: DocComment immediately followed by keyword — NL breaks the match
FuncDecl -> doc:DocComment? KW_fn id:Ident ...

# GOOD: NL? allows the typical newline between doc and keyword
FuncDecl -> doc:DocComment? NL? KW_fn id:Ident ...

Bottom-Up Event Order (bind/scope)

Events fire bottom-up: child rules before parent rules. If ExportDecl wraps FunctionDecl, FunctionDecl fires first. Use bind/$scope to pass data from child to parent:

on FunctionDecl {
  bind ns "value" name "child_decl_id" to $id
  edge declares from $file to sym_id attrs obj(...)
}
on ExportDecl when $doc {
  let id = $scope("value", "child_decl_id")
  edge declares from $file to sym_id attrs obj("doc", $doc, ...)
}

Token Priority Conflicts

Tokens defined earlier take priority. A generic Operator /[=+\-*]+/ before EQ /=/ will consume = as Operator. Define specific tokens first:

# BAD: Operator matches = before EQ can
TOKEN Operator /[!$%&*+\-.\/:<=>?@^|~]+/
TOKEN EQ       /=/

# GOOD: EQ defined first, takes priority
TOKEN EQ       /=/
TOKEN Operator /[!$%&*+\-.\/:<=>?@^|~]+/

Verifying Doc Extraction

After modifying a KGF, always verify doc appears in declares edges:

# Must show doc="..." in the declares edge
indexion kgf edges test_file.ts --spec=typescript | grep declares

# If doc is missing, check events to see where the DocComment went
indexion kgf events test_file.ts --spec=typescript | grep DocComment

FAQ

What does the indexion-kgf skill do?

Debug and inspect KGF specs — view tokenization results, parse trees, and extracted edges from source files. Use when adding/fixing language support or when indexion's analysis output looks wrong.

How do I install indexion-kgf?

Run npx skills add https://github.com/trkbt10/indexion-skills --skill indexion-kgf in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/indexion-kgf/ (personal) or .claude/skills/indexion-kgf/ (project).

Which AI agents can use indexion-kgf?

Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.

Is indexion-kgf safe to install?

Security partners have reviewed it: Gen Agent Trust Hub passed; Socket passed; Snyk passed. As with any skill, read the SKILL.md and bundled scripts before installing.

Who maintains indexion-kgf?

It is published by trkbt10 in trkbt10/indexion-skills. It has 4,921 recorded installs.

More from trkbt10/indexion-skills

View all →

indexion-readme

trkbt10/indexion-skills

README construction — initialize template structure, generate per-package READMEs from doc comments, plan writing tasks, assemble root README from docs/ and package READMEs via doc.json config, and verify edits with plan drift.

Docs & Writing5.1K installs

indexion-sdd

trkbt10/indexion-skills

Generate SDD requirements from RFCs/specs and quantitatively verify implementation conformance. spec draft → spec align → spec verify → automated validation loop with codex/claude. Operate spec-to-impl drift gates as CI checks.

indexion-documentation

trkbt10/indexion-skills

Documentation analysis — assess coverage, detect code-to-doc drift with plan reconcile, visualize dependencies with doc graph. Answers "what needs docs?" and "are docs still accurate?"

Docs & Writing5K installs

indexion-refactor

trkbt10/indexion-skills

After writing code, detect and clean up duplication at three levels — copy-paste blocks, cross-package shared code, unnecessary wrappers, and concept-level SoT violations. Detect with indexion, fix, and verify.

indexion-segment

trkbt10/indexion-skills

Split text into contextual chunks for RAG/embedding pipelines. Document segmentation and section extraction using window, tfidf, punctuation, or hybrid strategies chosen by intent.

AI & Agents4.9K installs

indexion-wiki

trkbt10/indexion-skills

Project wiki lifecycle — create pages, track source changes with ingest, update stale pages, lint structural integrity, detect code-to-doc drift with reconcile, and manage search indexes. A runbook for navigating and maintaining the wiki as an agent.

Popular code quality & workflow skills

View category →

grill-me

mattpocock/skills

A relentless interview to sharpen a plan or design.

Scan a codebase for deepening opportunities, present them as a visual HTML report, then grill through whichever one you pick.

handoff

mattpocock/skills

Compact the current conversation into a handoff document for another agent to pick up.

domain-modeling

mattpocock/skills

Build and sharpen a project's domain model. Use when discussing codebase terminology, writing or editing a GLOSSARY.md, or recording or editing an ADR.

codebase-design

mattpocock/skills

Shared vocabulary for designing deep modules. Use when the user wants to design or improve a module's interface, find deepening opportunities, decide where a seam goes, make code more testable or AI-navigable, or when another skill needs the deep-module vocabulary.

diagnosing-bugs

mattpocock/skills

Diagnosis loop for hard bugs and performance regressions. Use when the user says "diagnose"/"debug this", or reports something broken/throwing/failing/slow.