Skip to main content

generate-sql-route

Create a pREST custom SQL template route under /_QUERIES. Use when the user needs a parameterized SQL script with curl examples.

소스 정보

저장소
prest/prest-openclaw
최근 소스 활동
2026년 7월 10일 15:50
감지된 SKILL.md 언어
영어
스타
0
포크
0

설치 방법

기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.

소스 파일 검토

설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.

SKILL.md 표시 중

SKILL.md
소스 지침 · 읽기 전용 미리보기
name
generate-sql-route
description
Create a pREST custom SQL template route under /_QUERIES. Use when the user needs a parameterized SQL script with curl examples.
# Generate SQL template route ## When to use - User has a SQL query that should become a REST endpoint - User asks for a custom report or filtered read via pREST - User needs verb-specific templates (read/write/update/delete) ## Ask first 1. HTTP verb (default GET / read) 2. Folder and script name (e.g. `reports` / `users`) 3. Query parameters and types 4. Target schema/table(s) 5. Single-DB vs multi-DB alias prefix 6. Path to `queries.location` if already configured ## Instructions 1. Place scripts under the configured queries directory: ```text queries/ └── <folder>/ └── <name>.read.sql # GET └── <name>.write.sql # POST └── <name>.update.sql # PUT/PATCH └── <name>.delete.sql # DELETE ``` 2. Use template params as `{{.field}}`. Prefer helpers when useful (`isSet`, `defaultOrValue`, `inFormat`, `limitOffset`). 3. Ensure `prest.toml` includes: ```toml [queries] location = "./queries" ``` 4. Document the **real** URL shape (never invent `/reports/users/:id`): ```text GET /_QUERIES/<folder>/<name>?field=value GET /_QUERIES/<database>/<folder>/<name>?field=value ``` 5. Include curl examples and a sample JSON response. 6. Note that template parameters are sanitized in current pREST mainline — still warn against injecting raw SQL fragments via params. ## Safety notes to include - Prefer parameterized filters over `SELECT *` without limits. - Restrict which roles can call write/update/delete scripts. - Avoid destructive scripts unless explicitly requested. - Call out that custom queries bypass table ACL patterns differently than CRUD table endpoints — keep them least-privilege. ## Docs https://docs.prestd.com/api-reference/custom-queries
GitHub에서 보기