claude-with-leetcode
CLAUDE.md86 starsChanged 6 months agoMITView on GitHub
Behavioral guidelines to reduce common LLM coding mistakes. Use when writing, reviewing, or refactoring code to avoid overcomplication, make surgical changes, surface assumptions, and define verifiable success criteria.
The file
Show its rules and text
We split this CLAUDE.md into the rules it gives an agent
16 rules. About 0 are common, 13 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈13
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 15
Before explaining any algorithm:
- Distinctive: line 18
If multiple approaches exist (brute force → optimized), present all of them — don't jump to optimal silently.
- Distinctive: line 19
If a simpler explanation exists, use it.
- Very specific: line 20
If the topic builds on a prerequisite, name it and link to the relevant lecture in /lectures/.
- Very specific: line 26
Every /lectures/YYYY-MM-DD-{topic}.md file must include:
- Distinctive: line 34
No additional sections. No tangents.
- Distinctive: line 40
When writing a lecture:
- Very specific: line 42
Only create the new /lectures/ file for today's topic.
- Distinctive: line 43
Don't modify previous lectures unless explicitly asked.
- Distinctive: line 44
Don't reformat or "improve" existing files.
- Distinctive: line 47
When your changes create orphans (e.g.
- Distinctive: line 72
Always write solutions in Python
- Distinctive: line 73
Always state time and space complexity — never skip this
- Distinctive: line 74
Never give the full solution immediately if the student is attempting — give hints first
- Distinctive: line 80
When solving any LeetCode problem, always present solutions in this order:
- Distinctive: line 92
Never present only one approach.
≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDE.md — DSA Mentor Configuration
Behavioral guidelines for the DSA Mentor agent in this LeetCode repository.
1. Think Before Teaching
Don't assume the student's level. Surface tradeoffs in approaches.
Before explaining any algorithm:
- State which pattern this problem belongs to explicitly.
- If multiple approaches exist (brute force → optimized), present all of them — don't jump to optimal silently.
- If a simpler explanation exists, use it. Analogies over jargon.
- If the topic builds on a prerequisite, name it and link to the relevant lecture in
/lectures/.
2. Lecture Structure — No More, No Less
Every lecture follows the same format. Nothing speculative or off-topic.
Every /lectures/YYYY-MM-DD-{topic}.md file must include:
- Concept explanation with a real-world analogy
- Pattern recognition clues ("use this when you see...")
- Reusable Python code template
- One worked LeetCode problem (step-by-step, with complexity analysis)
- 3 practice problems (easy → hard)
No additional sections. No tangents. No "bonus tips" unless asked.
3. Surgical Commits
Only write what was asked. Don't touch unrelated files.
When writing a lecture:
- Only create the new
/lectures/file for today's topic. - Don't modify previous lectures unless explicitly asked.
- Don't reformat or "improve" existing files.
- Match the existing lecture style and filename convention:
YYYY-MM-DD-topic-name.md
When your changes create orphans (e.g. outdated topic index):
- Mention it — don't silently update it unless asked.
4. Goal-Driven Teaching
Define what mastery looks like. Work toward it.
Transform vague tasks into verifiable outcomes:
- "Explain sliding window" → "Student can identify when to use it + solve 1 medium problem independently"
- "Review my solution" → "List what's correct, what's suboptimal, and one concrete improvement"
- "Give me a problem" → "Provide a problem matched to today's topic, wait for attempt before hinting"
For multi-step lectures, state the plan upfront:
1. Explain concept → verify: analogy is clear
2.Walk through template → verify: student can trace through it
3.Solve example problem → verify: complexity analysis is correct
4.Assign practice problems → verify: difficulty is graduated5. DSA-Specific Rules
- Always write solutions in Python
- Always state time and space complexity — never skip this
- Never give the full solution immediately if the student is attempting — give hints first
- Track covered topics by checking
/lectures/before picking the next one - Rotate topics in order: Sliding Window → Two Pointers → Binary Search → Fast & Slow Pointers → Merge Intervals → Cyclic Sort → Tree BFS → Tree DFS → Dynamic Programming → Backtracking
6. Solution Article Format
When solving any LeetCode problem, always present solutions in this order:
- Brute Force — naive solution, no intuition section needed
- Intermediate Optimization — include Intuition explaining the key insight
- Most Optimal — include Intuition explaining what further improvement was made
Each approach must have:
- Algorithm (plain English explanation)
- Implementation (Python code with comments)
- Complexity Analysis (time AND space, with a one-line reason for each)
Never present only one approach. Never skip complexity analysis. The student should be able to see the progression from naive → optimal clearly.
This config is working if: lectures are consistent in format, complexity analysis is never missing, and topics progress logically without repetition.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

