sql-parser-cst

Parse SQL statements into a Concrete Syntax Tree preserving comments and whitespace.

4|Updated Jun 10, 2026
One-click install
npx skills add https://github.com/mymx2/foreman --skill sql-parser-cst
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sql-parser-cst
Source: https://github.com/mymx2/foreman/tree/main/.qoder/skills.collected/skills/sql-parser-cst
Command: npx skills add https://github.com/mymx2/foreman --skill sql-parser-cst

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires sql-parser-cst.

What problem does it solve?

This skill solves the challenge of accurately parsing SQL into a Concrete Syntax Tree (CST) that preserves every detail, including comments, whitespace, and formatting, which standard AST parsers often discard.

Core Features & Use Cases

  • DDL Metadata Extraction: Automatically extract table, column, and index definitions from schema files for documentation or migration planning.
  • SQL Analysis & Linting: Build custom SQL linters, formatters, or static analysis tools that require full fidelity to the original source code.
  • Use Case: When you need to refactor a large legacy database schema, use this skill to parse the DDL, identify all foreign key constraints, and generate a dependency graph without needing a live database connection.

Quick Start

Use the sql-parser-cst skill to parse the provided schema.sql file and extract all table names and their corresponding column definitions.

Frequently Asked Questions about sql-parser-cst

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I parse SQL while preserving comments and whitespace for static analysis?

To parse SQL while preserving comments and whitespace, you need a Concrete Syntax Tree (CST) parser. A CST maintains full source code fidelity, capturing every detail discarded by standard AST parsers, enabling accurate structural analysis and metadata extraction.

How do I extract table and column definitions from DDL schema files without a live database connection?

You can extract table and column definitions from DDL schema files without a live database connection by parsing the SQL statements into a Concrete Syntax Tree. This enables automatic metadata extraction directly from the schema file for documentation or migration planning.

Does sql-parser-cst support static analysis for multiple SQL dialects like PostgreSQL and MySQL?

Yes, SQL static analysis supports multiple dialects including PostgreSQL, MySQL, and BigQuery. This allows you to parse DDL and DML statements across different database engines to build linters, formatters, or structural transformation tools.

What is the best way to build a custom SQL linter or formatter?

The best way to build a custom SQL linter or formatter is by parsing SQL into a Concrete Syntax Tree. This approach provides high-fidelity static analysis capabilities by preserving the original source code formatting, allowing precise structural transformations and linting rules.

How do I identify foreign key constraints in a large legacy database schema for refactoring?

To identify foreign key constraints in a large legacy database schema, parse the DDL into a Concrete Syntax Tree. This allows you to analyze the structural dependencies and generate a relationship graph without needing to connect to a live database.

When do I need a Concrete Syntax Tree instead of an Abstract Syntax Tree for SQL parsing?

You need a Concrete Syntax Tree instead of an Abstract Syntax Tree when your SQL parsing requires full source code fidelity. If your task involves building formatters, linters, or structural transformations that must preserve comments and whitespace, a CST is essential.