lc-sql
БесплатноБез исполняемых скриптовНе проверенFile a LeetCode **SQL** (Database) solution into this repo the way the existing ones are filed — find the problem's real slug offline, write…
от yennanliu★ 141 звезда на GitHubОб этом скилле
Add a LeetCode SQL solution
Turn an LC number (plus, usually, a query the user already wrote) into a committed-quality
MySQL solution file and its README row, in the shape of the 166 files under
leetcode_SQL/ and the 165-row ## SQL table in README.
Invocation: /lc-sql <LC number> — e.g. /lc-sql 584. A query pasted under the
command is used as V0. /lc-sql todo lists the SQL problems not filed yet (step 1).
There is no pattern dir to pick: every SQL solution lives flat in leetcode_SQL/, and every
row goes in the one ## SQL table. Ask only if the number itself is missing.
Wrong skill? This one owns leetcode_SQL/ and the ## SQL table only. A Pandas
solution to a database problem is Python and goes to
/lc-python;
an algorithm problem in Java goes to
/lc-java.
If the user pasted a Pandas DataFrame function, say so and switch rather than translating
it to SQL.
Prime directives
- The slug comes from a record, never from the title. LC 580 is
count-student-number-in-departments; the file here iscount-student-numbers-in-departments.sql, and LC 1988's README link readsfind-cutoff-score-for-each-schooly. A guessed slug is a wrong file name and a link that 404s.script/lc_sql.py lookupreads the canonical one offline (step 1). - The header carries the problem's link and its example. Of the 166 files filed before
this skill, one has the problem's URL in its
/* */header (17 more bury it in a comment further down), so the rest tie back to LeetCode only through a file name that may be guessed; 48 have no example tables, so nothing can check them and nobody has. A new file putshttps://leetcode.com/problems/<slug>/on the line under the title, then copies the schema, the example's input tables and its result table as ASCII grids — the grids are what step 5 runs the query against, and step 5 fails a link whose slug is not the file name. - The user's query is the solution. When a draft is pasted, fix its bugs and keep its
idea as
V0. Keeping the idea does not mean keeping the spelling: a one-line query is reformatted to the readable form of directive 6, with the same logic underneath. - Untested is unfinished. Run
script/lc_sql.py smokeon the file before reporting done. A query that only "looks right" is howWHERE referee_id != 2ships — it silently drops everyNULLrow. - LeetCode grades MySQL 8; the smoke test runs SQLite. The helper bridges the common
gap (decimal
/,IF,DATEDIFF,YEAR,DATE_FORMAT,CONCAT,LEFT), and reports anything else SQLite cannot run asSKIP, notPASS. ASKIPis reported to the user as not run locally, never as tested. - Readable beats clever. These files are read back months later by someone who has to
explain the query. Every block is the standard approach for the problem — a join,
a
GROUP BY/HAVING, a window function, a CTE — written one clause per line, with the NULL behaviour and every non-obvious step commented (step 3 lists the rules). - Every good approach is worth filing. A self-join and a window function,
NOT INandLEFT JOIN … IS NULL, a correlated subquery and aGROUP BY— each that runs in LC's limits and is worth knowing is its own version (step 4). - One table, in order. README has exactly one
## SQLtable (the imported## Newly Added (kamyu104 gap)set has none — the audit skipped SQL), sorted by LC number. A row goes in that table at its numeric position, never appended at the end.
The steps
1. Find the problem's record
python3 script/lc_sql.py lookup 570 # -> slug, title, difficulty, 🔒, file path, README status
python3 script/lc_sql.py todo --limit 20 # the SQL problems README's ## SQL table lacks
lookup reads the kamyu104 coverage audit's SQL list (doc/lc-coverage-kamyu/skipped_*.json,
156 problems not filed yet) and README's ## SQL table, both offline. Three outcomes:
- In the audit — the slug, title, difficulty and premium flag printed are the canonical ones. Use them as given.
- Already filed — README has the row; the job is improving the existing file, not adding a second one. Read it before touching it.
- Unknown — a problem newer than the audit. The slug comes from the problem URL the user gave, or the problem page; ask for the URL rather than deriving it from the title.
todo is the backlog. With no number given, offer its first few, Easy before Medium.
2. Read a neighbour before writing
ls leetcode_SQL/ | head -20
python3 script/lc_sql.py smoke leetcode_SQL/confirmation-rate.sql
Open a file whose header has example grids (confirmation-rate.sql,
`find-the-subtasks-that-did
Установить lc-sql в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadGlobGrepBashWriteEditFAQ
Что делает скилл lc-sql?
File a LeetCode **SQL** (Database) solution into this repo the way the existing ones are filed — find the problem's real slug offline, write `leetcode_SQL/<slug>.sql` in the house layout (a /* */ header holding the number and title, the LC problem link, the schema and the example's input and result tables, then V0 with an IDEA block and a time/space line; the standard, readable MySQL query with each clause on its own line, CTEs over nested subqueries, and the NULL handling commented; every other good approach filed as V1, V2, …), smoke-test it against the header's own example with script/lc_sql.py, and insert the row into README's `## SQL` table. Use when asked to "add LC <number>" for a database problem, to file a SQL query just solved, to turn a pasted MySQL draft into a committed solution, or to work through the SQL problems not filed yet. Triggers - "/lc-sql 584", "add LC 1934 sql", "file this MySQL solution", "which SQL problems are missing?".
Как установить скилл lc-sql?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл lc-sql запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic