A parser, formatter, validator, and language server for SQLite SQL, built on SQLite's own grammar and tokenizer. If SQLite accepts it, syntaqlite parses it. If SQLite rejects it, so does syntaqlite. Note: syntaqlite is at 0.x.
$ npx -y skills add LalitMaganti/syntaqlite --agent claude-code
Run the curl in your terminal, the rest in Claude Code.
Repo: LalitMaganti/syntaqlite
What's inside
A parser, formatter, validator, and language server for SQLite SQL, built on SQLite's own grammar and tokenizer. If SQLite accepts it, syntaqlite parses it. If SQLite rejects it, so does syntaqlite.
Docs · Playground · VS Code Extension
Note: syntaqlite is at 0.x. APIs and CLI flags may change before 1.0.
Most SQLite tools build a generic SQL parser and bolt SQLite on as a "flavor" with hand-written grammars, regex-based tokenizers, or subsets that approximate the language. That falls apart because SQLite has a deep surface area of syntax that generic parsers don't handle.
syntaqlite uses SQLite's own Lemon-generated grammar and tokenizer, compiled from C. Its parser is that grammar compiled into a reusable library, not an approximation of it.
SQLite SQL is also not one fixed language. It has 22 compile-time flags that change what syntax the parser accepts, another 12 that gate built-in functions, and the language evolves across versions. Because SQLite is embedded, you can't assume everyone is on the latest version (Android 15 ships SQLite 3.44.3, seven major versions behind latest). syntaqlite tracks all of this:
syntaqlite --sqlite-version 3.32.0 validate \
-e "DELETE FROM users WHERE id = 1 RETURNING *;"
error: syntax error near 'RETURNING'
--> <stdin>:1:32
|
1 | DELETE FROM users WHERE id = 1 RETURNING *;
| ^~~~~~~~~
RETURNING was added in SQLite 3.35.0; Android 13 still ships SQLite 3.32.2.
We've tested against ~396K statements from SQLite's upstream test suite with ~99.7% agreement on parse acceptance. See the detailed comparison for how syntaqlite stacks up against other tools.
Finds unknown tables, columns, and functions against your schema, the same errors sqlite3_prepare would catch but without needing a database. Unlike sqlite3, syntaqlite finds all errors in one pass:
CREATE TABLE orders (id, status, total, created_at);
WITH
monthly_stats(month, revenue, order_count) AS (
SELECT strftime('%Y-%m', o.created_at), SUM(o.total)
FROM orders o WHERE o.status = 'completed'
GROUP BY strftime('%Y-%m', o.created_at)
)
SELECT ms.month, ms.revenue, ms.order_count,
ROUDN(ms.revenue / ms.order_count, 2) AS avg_order
FROM monthly_stats ms;
sqlite3 stops at the first error and misses the function typo entirely:
Error: in prepare, table monthly_stats has 2 values for 3 columns
syntaqlite finds both the CTE column count mismatch and the ROUDN typo, with source locations and suggestions:
error: table 'monthly_stats' has 2 values for 3 columns
|
2 | monthly_stats(month, revenue,
| ^~~~~~~~~~~~~
warning: unknown function 'ROUDN'
|
14 | ROUDN(ms.revenue / ms.order_count,
| ^~~~~
= help: did you mean 'round'?
Deterministic formatting with configurable line width, keyword casing, and indentation:
echo "select u.id,u.name, p.title from users u join posts p on u.id=p.user_id
where u.active=1 and p.published=true order by p.created_at desc limit 10" \
| syntaqlite fmt
SELECT u.id, u.name, p.title
FROM users u
JOIN posts p ON u.id = p.user_id
WHERE u.active = 1
AND p.published = true
ORDER BY p.created_at DESC
LIMIT 10;
Pin the parser to a specific SQLite version or enable compile-time flags to match your exact build:
# Reject syntax your target SQLite version doesn't support
syntaqlite --sqlite-version 3.32.0 validate query.sql
# Enable optional syntax from compile-time flags
syntaqlite --sqlite-cflag SQLITE_ENABLE_MATH_FUNCTIONS validate query.sql
SQL lives inside Python and TypeScript strings in most real codebases. syntaqlite extracts and validates it, handling interpolation holes:
# app.py
def get_user_stats(user_id: int):
return conn.execute(
f"SELECT nme, ROUDN(score, 2) FROM users WHERE id = {user_id}"
)
syntaqlite analyze --experimental-lang python app.py
warning: unknown function 'ROUDN'
--> app.py:3:23
|
3 | f"SELECT nme, ROUDN(score, 2) FROM users WHERE id = {user_id}"
| ^~~~~
= help: did you mean 'round'?
Scripts for the sqlite3 CLI mix SQL with dot-commands like .read and .print. syntaqlite recognizes the dot-commands and skips over them rather than reporting a syntax error, so the surrounding SQL still formats and validates. The editor integration handles them the same way.
syntaqlite fmt schema.sql
.read tables.sql
.read views.sql
CREATE TABLE users (id INTEGER PRIMARY KEY, name TEXT);
Create a syntaqlite.toml in your project root to configure schemas and formatting. The LSP, CLI, and all editor integrations read it automatically:
# Map SQL files to schema DDL files for validation and completions.
[schemas]
"src/**/*.sql" = ["schema/main.sql", "schema/views.sql"]
"tests/**/*.sql" = ["schema/main.sql", "schema/test_fixtures.sql"]
"migrations/*.sql" = [] # no schema validation for migrations
# Default schema for SQL files that don't match any glob above.
# schema = ["schema.sql"]
# Formatting options (all optional, shown with defaults).
[format]
line-width = 80
indent-width = 2
keyword-case = "upper" # "upper" | "lower"
semicolons = true
The config file is discovered by walking up from the file being processed, same as rustfmt.toml or ruff.toml. CLI flags override config file values.
Full language server with no database connection required. Diagnostics, format on save, completions, and semantic highlighting.
VS Code — install the syntaqlite extension from the marketplace.
Other editors — point your LSP client at:
syntaqlite lsp
Claude Code — claude plugin install syntaqlite@lalitmaganti-plugins (docs)
Full abstract syntax tree with side tables for tokens, comments, and whitespace, for code generation, migration tooling, or static analysis.
syntaqlite parse -e "SELECT 1 + 2"
Want to try syntaqlite without installing anything? The web playground runs entirely in your browser via WASM. Parse, format, and validate SQL instantly.
Download and run (all platforms, no install)
curl -sSf https://raw.githubusercontent.com/LalitMaganti/syntaqlite/main/tools/syntaqlite | python3 - fmt -e "select 1"
Downloads the binary on first run, caches it, auto-updates weekly.
mise
mise use github:LalitMaganti/syntaqlite
pip (all platforms, bundled binary)
pip install syntaqlite
Homebrew (macOS)
brew install LalitMaganti/tap/syntaqlite
Cargo
cargo install syntaqlite-cli
Rust (API docs)
[dependencies]
syntaqlite = { version = "0.7.1", features = ["fmt"] }
Python (API docs)
pip install syntaqlite
JavaScript / WASM (API docs)
npm install syntaqlite
C — the parser, tokenizer, formatter, and validator all have C APIs. See the C API docs.
The parser and tokenizer are written in C, directly wrapping SQLite's own grammar. Everything else (formatter, validator, LSP) is written in Rust with C bindings available.
The split is intentional. The C parser is as portable as SQLite itself: it can run inside database engines, embedded systems, or anywhere SQLite runs. The Rust layer moves fast for developer tooling where the standard library and crate ecosystem matter.
tools/install-build-deps
tools/cargo build
See the contributing guide for architecture overview and testing instructions.
Apache 2.0. SQLite components are public domain under the SQLite blessing. See LICENSE for details.
.agents/
skills/
cp/
SKILL.md
cpfast/
SKILL.md
debug-formatter/
SKILL.md
release/
SKILL.md
run-codegen/
SKILL.md
run-tests/
SKILL.md
.clang-format
.claude/
hooks/
worktree-create.sh
worktree-remove.sh
settings.json
skills
.gitattributes
.github/
PULL_REQUEST_TEMPLATE.md
workflows/
c-api-sanitize.yml
ci-docs-noop.yml
ci.yml
deploy-docs.yml
deploy-playground-autopush.yml
deploy-playground.yml
nix.yml
publish-crates.yml
publish-npm.yml
release.yml
test-install.yml
vscode-extension.yml
.gitignore
AGENTS.md
AUTHORS
Cargo.lock
Cargo.toml
CHANGELOG.md
CLAUDE.md
dialects/
perfetto/
actions/
perfetto.y
nodes/
perfetto.synq
dist-workspace.toml
docs/
config-file-ai-plan.md
distribution-ai-plan.md
distribution-impl-ai-plan.md
embedded-sql-ai-plan.md
embedded-sql-extraction-ai.md
ethos.md
extensions-ai-plan.md
formatter-ai-plan.md
lsp-plan.md
macro-expansion-ai-plans.md
plan.md
python-rpc-module-resolver-plan.md
python-rpc-msgpack-plan.md
semantic-analyzer-ai-plan.md
semantic-refactor-ai-plan.md
semantic-roles-plan.md
sqlite-multiversion-ai-plan.md
sqlite-version-analysis.md
text-expansion-model-plan.md
upstream-tests-ai-plan.md
validation-ownership-ai-discussion.md
wasm-site-journal.md
wasm-site-plan.md
examples/
Makefile
select_columns.c
select_columns.cc
flake.lock
flake.nix
integrations/
claude-code/
.claude-plugin/
plugin.json
LICENSE
README.md
skills/
format/
SKILL.md
parse/
SKILL.md
validate/
SKILL.md
vscode/
.gitignore
.vscodeignore
icon.png
language-configuration.json
LICENSE
package-lock.json
package.json
README.md
scripts/
package-target.mjs
src/
extension.ts
syntaxes/
sqlite.tmLanguage.json
tsconfig.json
zed/
.gitignore
Cargo.toml
extension.toml
LICENSE
src/
lib.rs
LICENSE
python/
__init__.py
.gitignore
dev/
__init__.py
checks/
__init__.py
c_deps.py
comparison/
__init__.py
collect.py
comparison-details.md.tmpl
comparison.md.tmpl
render.py
diff_tests/
__init__.py
amalg_executor.py
idempotency_runner.py
lsp_client.py
lsp_executor.py
lsp_runner.py
perfetto_common.py
runner.py
test_executor.py
test_loader.py
testing.py
utils.py
integration_tests/
__init__.py
runner.py
suite.py
suites/
__init__.py
amalg_api_surface.py
amalg.py
analyze.py
ast.py
c_api.py
fmt.py
grammar.py
introspect.py
lineage.py
lsp_diff.py
lsp.py
perfetto_fmt.py
perfetto_val.py
python_api.py
semantic.py
serve.py
sql_idempotency.py
upstream_sqlite.py
pyproject.toml
README.md
setup.py
syntaqlite/
__init__.py
__main__.py
enums.py
nodes.py
tools/
__init__.py
build_pyodide_wheel.py
build_web_playground.py
cargo_slots.py
check_public_api.py
format_c.py
install_build_deps.py
pre_push.py
release.py
run_bootstrap_test.py
run_codegen.py
run_rust_binary.py
sqlite_data.py
README.md
syntaqlite/
syntaqlite-buildtools/
build.rs
Cargo.toml
parser-actions/
_common.y
aggregate.y
cast.y
column_ref_select.y
column_refs.y
compound.y
conditionals.y
create_table.y
cte.y
dml.y
expressions.y
exprlists.y
functions.y
identifiers.y
literals.y
misc_expr.y
orderby.y
raise_expr.y
schema_ops.y
select.y
table_source.y
trigger.y
utility_stmts.y
values.y
virtual_table.y
window.y
ztokens.y
parser-nodes/
aggregate.synq
cast.synq
column_ref.synq
common.synq
compound.synq
conditionals.synq
create_table.synq
cte.synq
dml.synq
expressions.synq
functions.synq
misc_expr.synq
raise_expr.synq
schema_ops.synq
select.synq
SYNTAX.md
table_source.synq
trigger.synq
utility_stmts.synq
values.synq
window.synq
README.md
sqlite-vendored/
data/
cflags.json
functions.json
version_cflags.json
sources/
fragments/
ai_class.c
cc_defines.c
char_map.c
ctype_map.c
get_token_fn.c
id_char.c
is_macros.c
upper_to_lower.c
window_keyword_analysis.c
lemon.c
lempar.c
mkkeywordhash_modified.c
mkkeywordhash.c
src/
codegen_api.rs
commands.rs
dialect_codegen/
c_dialect.rs
c_meta_codegen.rs
c_nodes_codegen.rs
fmt_compiler.rs
mod.rs
python_codegen.rs
rust_ast.rs
rust_dialect.rs
semantic_roles_codegen.rs
extract/
amalgamation_probe.rs
base_files.rs
functions.rs
keywords_and_parser.rs
mkkeywordhash.rs
mod.rs
tokenizer.rs
virtual_tables.rs
grammar_verify.rs
lib.rs
main.rs
no_sqlite_compile.rs
output_resolver.rs
parser_tools/
amalgamate.rs
base_files_tables.rs
base_files.rs
grammar_codegen.rs
keyword_hash.rs
lemon.rs
mkkeyword.rs
mod.rs
parser_pipeline.rs
sqlite_fragments.rs
tokenizer_assembly.rs
util/
c_extractor.rs
c_transformer.rs
c_writer.rs
cflag_entries_codegen.rs
cflag_registry.rs
functions_codegen.rs
grammar_parser.rs
mkkeywordhash_parser.rs
mod.rs
rust_writer.rs
self_subcommand.rs
synq_parser.rs
text_writer.rs
tool_run.rs
version_analysis/
diff.rs
extract.rs
grammar.rs
hash.rs
mod.rs
syntaqlite-cli/
build.rs
Cargo.toml
examples/
cli_wrapper.rs
README.md
src/
cli.rs
commands/
analyze.rs
codegen.rs
fmt.rs
lineage.rs
lsp.rs
mcp.rs
mod.rs
parse.rs
serve/
json.rs
mod.rs
tokenize.rs
config.rs
lib.rs
main.rs
util.rs
tests/
dynload_omit_runtime.rs
lineage_json.rs
syntaqlite-common/
Cargo.toml
README.md
src/
lib.rs
syntaqlite-syntax/
build.rs
Cargo.toml
csrc/
dialect_dispatch.h
dialect_load.c
parser_dump.c
parser_extents.c
parser_internal.h
parser_macros.c
parser_spans.c
parser.c
sqlite/
dialect_builder.h
dialect_fmt.h
dialect_meta.h
dialect_roles.h
dialect_tokens.h
dialect.c
sqlite_keyword.c
sqlite_keyword.h
sqlite_parse.c
sqlite_parse.h
sqlite_tokenize.c
sqlite_tokenize.h
token_wrapped.c
token_wrapped.h
tokenizer.c
tokens.h
util.h
include/
syntaqlite/
syntaqlite_dialect/
arena.h
ast_builder.h
dialect_abi.h
dialect_macros.h
dialect_types.h
extent_hooks.h
sqlite_compat.h
... 480 moreFAQ
syntaqlite is a Claude Code plugin with 3 hand-picked skills for development work, indexed on Flowy. Install it with the command on its page. It includes format, parse, validate. Its skills do not fire on their own yet. Request auto-invocation to have Flowy route them as you prompt. Free and open source.