Best for
- Eloquent/Query Builder queries (use eloquent or database skill)
- Schema design (use database skill)
event4u-app/agent-config/src/skills/sql-writing/SKILL.md
Use when writing raw SQL — MariaDB/MySQL syntax, parameterization, raw migrations, seeders with `DB::statement`; fires even on a pasted query asking 'why is this slow'.
Decision brief
Grounded corpus: tuning decisions (indexes, keyset pagination, N+1, trigram search, lock contention) ground via the database corpus — ./scripts-run /corpus-grounding/scripts/ground search --manifest /database/data/manifest.json "".
Compatibility matrix
| Platform | Status | Evidence | What to check |
|---|---|---|---|
| Codex | Not declared | No explicit evidence | Portability before use |
| Claude Code | Not declared | No explicit evidence | Portability before use |
| Cursor | Not declared | No explicit evidence | Portability before use |
| Gemini CLI | Not declared | No explicit evidence | Portability before use |
Installation
The source command is displayed only when detected. A safe inspection prompt is always available so your agent can explain every action before execution.
npx skills add https://github.com/event4u-app/agent-config --skill "src/skills/sql-writing"Inspect the Agent Skill "sql-writing" from https://github.com/event4u-app/agent-config/blob/6a5670b7881a676c0da90d2afb950298087c4ccb/src/skills/sql-writing/SKILL.md at commit 6a5670b7881a676c0da90d2afb950298087c4ccb. List every install step, command, network request, credential, file read/write, external action, and rollback step. Explain whether it fits my task. Do not install or execute anything until I approve.
Workflow
1. Inspect call site & choose approach — identify every dynamic value flowing into the query, then pick: query builder when possible. Raw SQL only when query builder can't express the query. 2. Parameterize — Every variable must use ? binding or named :param. Never interpolate P…
Use when writing or reviewing raw SQL queries, migrations with raw statements, or seeders with raw SQL.
→ See guideline php/sql.md for parameterization patterns, common mistakes, MariaDB syntax reference.
1. Verify every variable in SQL uses parameter binding (? or named :param). 2. Confirm MariaDB/MySQL syntax — not PostgreSQL or MSSQL. 3. Run EXPLAIN on complex queries to check index usage. 4. Check that no PHP variable interpolation ("$var", '{$var}') appears in SQL strings.
Permission review
No configured static risk pattern was detected
This is not proof of safety. Runtime behavior, indirect dependencies, and hidden external systems are outside the static scan.
Evidence record
| Signal | Value | Evidence type | Meaning |
|---|---|---|---|
| Quality score | 94/100 | Computed | Documentation, specificity, maintenance, and trust rules |
| Repository stars | 9 | Source | Repository attention, not individual Skill quality |
| Compatibility | 0 platforms | Source | Declared in the catalog source record |
| Usage guide | automated source guide | Editorial | Generated or reviewed according to the visible evidence level |
Pinned source
Grounded corpus: tuning decisions (indexes, keyset pagination, N+1, trigram search, lock contention) ground via the
databasecorpus —./scripts-run <skills-root>/corpus-grounding/scripts/ground search --manifest <skills-root>/database/data/manifest.json "<symptom>".
Use when writing or reviewing raw SQL queries, migrations with raw statements, or seeders with raw SQL.
Do NOT use when:
eloquent or database skill)database skill)? binding or named :param. Never interpolate PHP variables into SQL strings.config/database.php default connection, DB_CONNECTION), a docker-compose.yml service image, a migration using engine-specific syntax. MySQL and MariaDB share the query-syntax world this skill writes in; PostgreSQL and MSSQL do not. If none of those declare an engine, say so and ask — do not assume one. A query written for the wrong engine passes review and fails in production."$var", '{$var}') appears in SQL.NEVER build SQL strings with PHP variable interpolation or concatenation.
ALWAYS use parameterized queries or query builder.
→ See guideline php/sql.md for parameterization patterns, common mistakes, MariaDB syntax reference.
// ✅ Safe
DB::select('SELECT * FROM users WHERE email = ?', [$email]);
// ❌ SQL injection
DB::select("SELECT * FROM users WHERE email = '{$email}'");
? or named :param)."$var", '{$var}') appears in SQL strings.MySQL and MariaDB share a query-syntax world. They never share a migration
one. Same principle as database: one engine for writing a SELECT, two for
online-DDL semantics, lock behavior under ALTER, feature availability and
EXPLAIN output. Never carry a claim from the second group across the two
without naming the engine and version it was measured on.
$variable in SQL strings instead of ? placeholders.GROUP BY with ONLY_FULL_GROUP_BY requires all non-aggregated columns.NULL, 1/0, JSON_ARRAY()) — not PHP equivalents.Frequently asked questions
Grounded corpus: tuning decisions (indexes, keyset pagination, N+1, trigram search, lock contention) ground via the database corpus — ./scripts-run /corpus-grounding/scripts/ground search --manifest /database/data/manifest.json "".
The source record exposes this install command: npx skills add https://github.com/event4u-app/agent-config --skill "src/skills/sql-writing". Inspect the command and pinned source before running it.
Alternatives
JasonColapietro/suede-creator-skills
Suede-owned experimentation discipline for hypotheses, sample sizing, test duration, significance, and repeatable experiment programs. Use when comparing variants, deciding whether a result is reliable, or building an experiment backlog and cadence. NOT FOR: analytics instrumentation (use suede-analytics), post-click conversion diagnosis (use suede-site-alchemy), or writing the variant copy itself (use suede-copy).
narrative-io/narrative-skills-marketplace
Translate a fuzzy analytical question into a rigorous investigation plan. Interrogates the ask, grounds the plan in the available data dictionary, applies analytical best practices, and produces a structured brief of query specifications for a downstream query-writing skill. Plans, does not write SQL. Use when: "why did X drop", "is there a relationship between A and B", "who are our highest-value customers", "what's driving the change in Y", "investigate this trend", "design an analysis for", "
Ratimon/openquok-monorepo
Schedule and manage social posts with the openquok CLI — authenticate, upload media, create drafts and scheduled posts, configure internal plugs, and read channel analytics for integrations in your OpenQuok workspace.
K-Dense-AI/scientific-agent-skills
Distributed computing for larger-than-RAM pandas/NumPy workflows. Use when you need to scale existing pandas/NumPy code beyond memory or across clusters. Best for parallel file processing, distributed ML, integration with existing pandas code. For out-of-core analytics on single machine use vaex; for in-memory speed use polars.