An Agent Skill that teaches an LLM agent to drive the SQL Coder CLI end to end: from installing the tool and preparing a runtime configuration, through semantic-file generation and plan approval, to read-only SQL validation and reporting the result back to the user.
The skill is a single SKILL.md file: frontmatter declares when the skill applies, the body states the commands, the return contracts, the exit codes and the failure handling an agent needs in order to act without guessing.
| Section | Content |
|---|---|
| Installation and detection | Verify coder --version; clone and install sql-coder-cli with the [mysql] extra; diagnose four common installation failures |
| Quick path | Six steps from loading environment variables to reporting a result |
| Preparation | Environment variables, semantic-file generation, model service, workspace naming |
| Querying | Schema reconnaissance, chat and run/resume, the run return contract, plan review, clarification answers, partial and failed runs |
| Debugging | Segment listing, CTE and UNION-branch targeting, read-only limits, evidence |
| Command reference | Every subcommand and the options an agent actually needs |
| Prohibitions | Actions that must not be taken (direct SDK calls, database writes, hand-written SQL as deliverable) |
- SQL Coder CLI — installed from https://github.com/AskSqlAI/asksql_coding_assistant; Python 3.11 or newer, installed with
pip install -e ".[mysql]" - A read-only MySQL account on the target database
- A model API key for any Chat Completions-compatible endpoint
The skill installs the CLI itself when it is absent; see section 0 of SKILL.md.
Copy the directory into the skills folder your agent reads.
WorkBuddy, user level (available in every project):
mkdir -p ~/.workbuddy/skills/sql-coder-cli
cp SKILL.md ~/.workbuddy/skills/sql-coder-cli/SKILL.mdWorkBuddy, project level (shared with the repository):
mkdir -p .workbuddy/skills/sql-coder-cli
cp SKILL.md .workbuddy/skills/sql-coder-cli/SKILL.mdClaude Code:
mkdir -p .claude/skills/sql-coder-cli
cp SKILL.md .claude/skills/sql-coder-cli/SKILL.mdCodex, user level (every repository):
mkdir -p ~/.codex/skills/sql-coder-cli
cp SKILL.md ~/.codex/skills/sql-coder-cli/SKILL.mdCodex, repository level (committed with the project, shared with the team):
mkdir -p .agents/skills/sql-coder-cli
cp SKILL.md .agents/skills/sql-coder-cli/SKILL.mdCodex reads skills from $CODEX_HOME/skills (default ~/.codex/skills) and, inside a repository, from every .agents/skills directory between the working directory and the repository root. When both a user-level and a repository-level skill share a name, Codex lists both rather than merging them.
A new session picks the skill up on start; a running session keeps the description it loaded at launch. Codex detects edits automatically — restart it if a change does not appear.
The frontmatter must contain name and description, and the name must match the directory:
python - <<'PY'
import yaml, pathlib
text = pathlib.Path("SKILL.md").read_text(encoding="utf-8")
meta = yaml.safe_load(text.split("---", 2)[1])
assert meta["name"] == "sql-coder-cli", meta
assert len(meta["description"]) > 40
print(meta["name"], "ok")
PY- SQL Coder CLI: https://github.com/AskSqlAI/asksql_coding_assistant
- Web interface guide: https://github.com/AskSqlAI/asksql_coding_assistant/blob/master/web/docs/web-interface-guide.md
MIT — see LICENSE.