Source profileQuality 94/100

event4u-app/agent-config/src/skills/sql-writing/SKILL.md

sql-writing

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'.

Source repository stars
9
Declared platforms
0
Static risk flags
0
Last source update
2026-08-28
Source checked
2026-08-28

Decision brief

What it does: where it fits

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 "".

Best for

  • Eloquent/Query Builder queries (use eloquent or database skill)
  • Schema design (use database skill)

Not for

  • Tasks that require unconfirmed production actions or broad system permissions.
  • Environments where the pinned source and install steps cannot be inspected.

Compatibility matrix

Platform support, with evidence labels

PlatformStatusEvidenceWhat to check
CodexNot declaredNo explicit evidencePortability before use
Claude CodeNot declaredNo explicit evidencePortability before use
CursorNot declaredNo explicit evidencePortability before use
Gemini CLINot declaredNo explicit evidencePortability before use
Open the compatibility checker

Installation

Inspect first. Install second.

The source command is displayed only when detected. A safe inspection prompt is always available so your agent can explain every action before execution.

Source-detected install commandSource
npx skills add https://github.com/event4u-app/agent-config --skill "src/skills/sql-writing"
Safe inspection promptEditorial

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

What the source asks the agent to do

  1. 01

    Procedure: Write raw SQL

    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…

    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.Parameterize — Every variable must use ? binding or named :param. Never interpolate PHP variables into SQL strings.Read the engine, then choose the syntax — check, in order: the project's DB config (config/database.php default connection, DBCONNECTION), a docker-compose.yml service image, a migration using engine-specific syntax. My…
  2. 02

    When to use

    Use when writing or reviewing raw SQL queries, migrations with raw statements, or seeders with raw SQL.

    Eloquent/Query Builder queries (use eloquent or database skill)Schema design (use database skill)Use when writing or reviewing raw SQL queries, migrations with raw statements, or seeders with raw SQL.
  3. 03

    Conventions

    → See guideline php/sql.md for parameterization patterns, common mistakes, MariaDB syntax reference.

    → See guideline php/sql.md for parameterization patterns, common mistakes, MariaDB syntax reference.
  4. 04

    Quick 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.

    Verify every variable in SQL uses parameter binding (? or named :param).Confirm MariaDB/MySQL syntax — not PostgreSQL or MSSQL.Run EXPLAIN on complex queries to check index usage.

Permission review

Static risk signals and limitations

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

Why each signal appears

EvidenceSourceComputedTestedEditorial
SignalValueEvidence typeMeaning
Quality score94/100ComputedDocumentation, specificity, maintenance, and trust rules
Repository stars9SourceRepository attention, not individual Skill quality
Compatibility0 platformsSourceDeclared in the catalog source record
Usage guideautomated source guideEditorialGenerated or reviewed according to the visible evidence level

Pinned source

Provenance and original SKILL.md

Repository
event4u-app/agent-config
Skill path
src/skills/sql-writing/SKILL.md
Commit
6a5670b7881a676c0da90d2afb950298087c4ccb
License
MIT
Collected
2026-08-28
Default branch
main
View the original SKILL.md

sql

Grounded corpus: tuning decisions (indexes, keyset pagination, N+1, trigram search, lock contention) ground via the database corpus — ./scripts-run <skills-root>/corpus-grounding/scripts/ground search --manifest <skills-root>/database/data/manifest.json "<symptom>".

When to use

Use when writing or reviewing raw SQL queries, migrations with raw statements, or seeders with raw SQL.

Do NOT use when:

  • Eloquent/Query Builder queries (use eloquent or database skill)
  • Schema design (use database skill)

Procedure: Write raw SQL

  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 PHP variables into SQL strings.
  3. Read the engine, then choose the syntax — check, in order: the project's DB config (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.
  4. Verify — Run EXPLAIN on complex queries. Check that no PHP interpolation ("$var", '{$var}') appears in SQL.
NEVER build SQL strings with PHP variable interpolation or concatenation.
ALWAYS use parameterized queries or query builder.

Conventions

→ See guideline php/sql.md for parameterization patterns, common mistakes, MariaDB syntax reference.

Quick reference

// ✅ Safe
DB::select('SELECT * FROM users WHERE email = ?', [$email]);

// ❌ SQL injection
DB::select("SELECT * FROM users WHERE email = '{$email}'");

Validate

  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.

Output format

  1. Parameterized SQL query using MariaDB/MySQL syntax
  2. EXPLAIN output for performance-critical queries

Gotcha

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.

  • MariaDB and MySQL have subtle syntax differences.
  • The model writes $variable in SQL strings instead of ? placeholders.
  • GROUP BY with ONLY_FULL_GROUP_BY requires all non-aggregated columns.
  • Use SQL types (NULL, 1/0, JSON_ARRAY()) — not PHP equivalents.

Do NOT

  • Do NOT interpolate PHP variables into SQL strings — always parameterize.
  • Do NOT use PHP syntax (arrays, booleans, null) in raw SQL — use SQL equivalents.
  • Do NOT write raw SQL when the query builder can express the same thing clearly.

Auto-trigger keywords

  • raw SQL
  • SQL query
  • parameterized query
  • MariaDB syntax
  • SQL injection

Frequently asked questions

What to verify before installation and use

What does the sql-writing source document cover?

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 "".

How do I install sql-writing?

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

Compare before choosing

Computed 100133

JasonColapietro/suede-creator-skills

suede-ab-testing

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).

Computed 1008

narrative-io/narrative-skills-marketplace

design-analysis

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", "

Computed 9944

Ratimon/openquok-monorepo

openquok-core

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.

Computed 9836,049

K-Dense-AI/scientific-agent-skills

dask

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.