lc-java
БесплатноБез исполняемых скриптовНе проверенFile a LeetCode **Java** solution into this repo the way the existing ones are filed — put it in the package its pattern owns, write the file-level javadoc…
от yennanliu★ 141 звезда на GitHubОб этом скилле
Add a LeetCode Java solution
Turn an LC number (plus, usually, a draft sitting in ws/Workspace26.java) into a
committed-quality Java file and the [Java] link on its README row, in the shape the
other ~1626 files under leetcode_java/ already use.
Invocation: /lc-java <LC number> <Package> — e.g. /lc-java 25 LinkedList.
A draft pasted under the command is used as the solution; with no draft, it is usually
already in the workspace scratch file (step 2).
Missing arguments are inferred, not asked about: the package from the technique the solution actually uses, the class name from the problem title. Ask only if the number itself is missing or the package is genuinely ambiguous.
Wrong skill? This one owns leetcode_java/ only. A Python solution goes to
/lc-python.
The two are counterparts and share one README row — see
directive 4.
Prime directives
- The marker names the method.
// V1-2documentsfindMedianSortedArrays_1_2;// V0-1documents<method>_0_1; bare// V0documents the plain LC method name. The two are a pair, which is why markers are never renumbered to close a gap — renumbering silently renames a method. A new block takes the next free marker, and only a genuine collision (two blocks answering to one name) is reassigned. - The directory is the
packageline.LeetCodeJava/LinkedList/⇒package LeetCodeJava.LinkedList;. A file in the wrong directory compiles nowhere, and the mismatch is invisible until a whole-treejavac. - The url comment is load-bearing, not decoration.
script/find_missing_java.pyjoins Python to Java on three signals — the LC number in the javadoc header, theleetcode.com/problems/<slug>url, and the title normalised to a class name — because LeetCode renames slugs and ~60 files have no url at all. Leave the url out and the file is invisible to coverage counting. - The README row already exists — update it, never add a second. Most problems here are
Python-first. The Java link goes into that row's Solution cell, after the Python one. A
duplicate row is the single most expensive mistake this skill can make, because nothing
in the build catches it.
The number can match two rows. README carries two sets of topic tables — the main
##ones and the imported## Newly Added (kamyu104 gap)/###ones, whose rows carry the statusimported. No number may appear in both any more (check_readme.pyand the site build fail on one), but if a grep ever returns two hits, edit the one under a##heading; that is the row/lc-pythonmaintains and the one the user reads. - Untested is unfinished.
javacit and run it against the javadoc's own examples before reporting done. - Readable beats clever. These files are read back months later by someone who has to say the solution in an interview. Every block is the standard, well-known approach written the way a reviewer would approve it in production: explicit loops, named intermediate variables, a comment on every step that is not obvious, and no syntactic sugar that has to be decoded before the idea is visible (step 4 lists what that means). When two spellings run in the same complexity, the plainer one wins.
- Every good approach is worth filing. If the problem has more than one solution that
passes LC's constraints and is worth knowing — BFS and DFS, a heap and quickselect,
memo and bottom-up DP — each gets its own block (
// V0,// V1,// V2, …), not only the one in the draft (step 5).
The steps
1. Settle the problem, and find the row that already exists
grep -n "^| *0*<number> " README.md # the existing row: title, difficulty, tags, status
grep -rn "leetcode.com/problems/" leetcode_python/*/*<slug>*.py
If README has the row, it is the source of truth for the title, the difficulty, the leetcode url and the complexity columns — they were settled when the Python file was filed, and this skill does not re-derive or "correct" them.
If there is no row (a Java-first problem), the problem page is the authority on the exact
title, and the row is inserted in ascending LC-number order exactly as
/lc-python step 6 describes.
Check whether the file is already there under another spelling before writing a new one —
LC 1217 is play-with-chips in Python and
minimum-cost-to-move-chips-to-the-same-position on the problem page:
grep -rln "problems/<slug>\|^ \* <number>\. " leetcode_java/src/main/java/
2. Pick up the draft from the workspace
Drafts are written in leetcode_java/src/main/java/ws/Workspace26.java and filed later —
that is what the update ws commits are:
grep -n "// LC <number>" l
Установить lc-java в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadGlobGrepBashWriteEditFAQ
Что делает скилл lc-java?
File a LeetCode **Java** solution into this repo the way the existing ones are filed — put it in the package its pattern owns, write the file-level javadoc header (`<number>. <Title>` then difficulty then the statement), mark the solution blocks `// V0` / `// V0-1` / `// V1-1` so the markers match the method names, add the `time =` / `space =` javadoc, compile and run it, write every block as the standard, readable approach with explanatory comments and no clever syntactic sugar, file each other good approach as `// V1`, `// V2`, …, then add the `[Java]` link to the README row the problem already has. Use when asked to "add LC <number> in Java", to file a draft out of `ws/Workspace26.java`, to port an existing Python solution to Java, or to close part of the Java coverage gap. Triggers - "add LC 25 to LinkedList in java", "/lc-java 239 SlideWindow", "file my workspace draft", "port LC 207 to java".
Как установить скилл lc-java?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл lc-java запускает скрипты?
Нет, скилл состоит только из инструкций (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