sql-embedder
npx skills add https://github.com/fartlabs/sql-embedder --skill sql-embedder
Agent 安装分布
Skill 文档
sql-embedder
This skill provides guidance for working with sql-embedder generated files.
About sql-embedder
sql-embedder embeds SQL into TypeScript source code. It makes developing and distributing TypeScript applications easier when you need access to SQL databases at runtimeâno special permissions required. It generates statically analyzable modules.
How It Works
The tool converts .sql files into TypeScript modules (.sql.ts). Each SQL
statement with a preceding comment becomes an exported constant:
books.sql â books.sql.ts
queries.sql â queries.sql.ts
Identifying Generated Files
Generated files always start with this exact comment:
// This file was generated by sql-embedder. Do not edit manually.
Critical Rule
NEVER edit .sql.ts files directly. These files are auto-generated and any
manual changes will be overwritten.
If you see the generated file comment, find the corresponding .sql file (same
name, without the .ts extension) and edit that instead.
Correct Workflow
- Edit the source
.sqlfile (e.g.,books.sql) - Identify the generation command by checking the project’s task runner config:
deno.jsonâ look for ageneratetaskpackage.jsonâ look for ageneratescript inscriptsMakefileâ look for ageneratetargetjustfileâ look for ageneraterecipe
- Run the identified command to regenerate the TypeScript files
Example
To add a new query called findBooksByAuthor:
-
Edit
books.sql:-- findBooksByAuthor finds all books by a given author. SELECT * FROM books WHERE author_id = ?; -
Check the project config (e.g.,
deno.json,package.json) for the generate command -
Run the generation command
The new query will appear in books.sql.ts as an exported constant.