Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

lc-python

БесплатноБез исполняемых скриптовНе проверен

File a LeetCode **Python** solution into this repo the way the existing ones are filed — find the problem's real slug, write the Python file in the house…

yennanliuот yennanliu★ 141 звезда на GitHub

Об этом скилле

Add a LeetCode Python solution

Turn an LC number (plus, usually, a draft the user already wrote) into a committed-quality Python solution file and its README row, in the shape the other ~826 files under leetcode_python/ already use.

Invocation: /lc-python <LC number> <pattern dir> — e.g. /lc-python 4038 Hash_table. A reference or draft solution pasted under the command is used as V0; with no draft, the draft is usually already in the contest scratch file (step 1).

Missing arguments are inferred, not asked about: the pattern dir from the technique the solution actually uses. Ask only if the number itself is missing or the dir is genuinely ambiguous.

Wrong skill? This one owns leetcode_python/ only. A Java solution goes to /lc-java — it files into leetcode_java/src/main/java/LeetCodeJava/ and updates the README row this skill created rather than adding a second one. If the user pasted Java, say so and switch rather than translating it to Python.

Prime directives

  1. The problem page is the authority on the title; the class name is not. LC 4038's method is countSpecialIntegers and its problem is Count Integers Appearing in a Single Block. A slug guessed from a method name lands on the wrong file name and a dead README link.
  2. Copy a neighbour, never invent the layout. Every file in a pattern dir has the same shape. Read one from the target dir before writing.
  3. The user's approach is the solution. When a draft is pasted, fix its bugs and keep its idea as V0. Replacing it with a cleverer one teaches nothing and hides the bug they wanted found. Keeping the idea does not mean keeping the spelling: a draft written as a dense one-liner is rewritten to the readable form of directive 7, with the same algorithm underneath.
  4. Untested is unfinished. Run the docstring's own examples before reporting done.
  5. Say what was assumed. Difficulty inferred from contest position, examples written from the rule rather than copied from LC — state it, so it can be corrected.
  6. README has TWO sets of topic tables; only the main one takes a new row. The ## headings near the top are the real index. Everything under ## Newly Added (kamyu104 gap) is an imported index with its own ### sub-tables whose every row carries the status imported — and it is the bigger of the two (1971 rows against 1310), duplicating 23 topic names (### Stack, ### Math, ### Array, …). Every one of the 17 most recent contest rows (LC 3964-4054) lives in a main ## table and none in the imported one. A row filed there renders fine and is ~2500 lines from where the user looks; script/check_readme.py and the site build both fail on it now (a row under that heading without the imported cell), but only after the fact.
  7. Readable beats clever. These files are read back months later, under interview pressure, by someone who has to say the solution out loud. Every block is written the way a strong candidate would write it on a whiteboard and a reviewer would approve it in production: the standard, well-known approach for the problem, explicit loops and named intermediate variables, a comment on every step that is not obvious, and no syntactic sugar that has to be decoded before the idea can be seen (step 3 lists what that means). When two spellings run in the same complexity, the plainer one wins.
  8. Every good approach is worth filing. If the problem has more than one solution that passes LC's constraints and is worth knowing in an interview — BFS and DFS, a heap and quickselect, top-down memo and bottom-up DP — file each as its own version (V0, V1, V2, …), not only the one the user happened to write (step 4).

The steps

1. Find the problem's source of truth

For a contest problem it is leetcode_python/lc_weekly/weekly_<n>/ws.txt — it records the LC number, the problem URL, the user's idea notes and their draft (often with the bug they hit, then a (fixed) version below it):

grep -rn "LC <number>" leetcode_python/lc_weekly/*/ws.txt
sed -n '/# LC <number>/,/^# LC /p' leetcode_python/lc_weekly/weekly_<n>/ws.txt

Two things to read out of it:

  • The URL slug is the file name — count-integers-appearing-in-a-single-block.
  • Position implies difficulty. The LC numbers appear in contest order, so the first is Q1 (Easy), then Medium, Medium/Hard, Hard. Mark it as an assumption in the report.

If the user pasted a URL or a full problem statement instead, that is the source of truth and this step is already done.

2. Read a neighbour before writing

ls leetcode_python/<Pattern_Dir>/
git log --oneline -12 --name-only        # the last few files added, in any dir

Open one recent file from the target dir and match it. The layout below is t

Полный SKILL.md на GitHub

Установить lc-python в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Read
Glob
Grep
Bash
Write
Edit

FAQ

Что делает скилл lc-python?

File a LeetCode **Python** solution into this repo the way the existing ones are filed — find the problem's real slug, write the Python file in the house layout (problem docstring, V0 with an IDEA block and a time/space line; the standard, readable approach with explanatory comments and no clever syntactic sugar; every other good approach filed as V1, V2, …), smoke-test it against the examples, and insert the README row. Use when asked to "add LC <number>" in Python, to file a problem just solved in a weekly contest, to turn a pasted draft into a committed solution, or to wire an existing solution file into README. For the Java counterpart use lc-java instead. Triggers - "add LC 4038 to Hash_table", "/lc-python 239 slide_window", "add this python solution and update the README", "file yesterday's contest Q1".

Как установить скилл lc-python?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл lc-python запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить lc-python с