agentleFS
Stewie-pixelStewie-pixel/claude-with-leetcode/CLAUDE.md

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
  1. Distinctive:

    Before explaining any algorithm:

    line 15
  2. Distinctive:

    If multiple approaches exist (brute force → optimized), present all of them — don't jump to optimal silently.

    line 18
  3. Distinctive:

    If a simpler explanation exists, use it.

    line 19
  4. Very specific:

    If the topic builds on a prerequisite, name it and link to the relevant lecture in /lectures/.

    line 20
  5. Very specific:

    Every /lectures/YYYY-MM-DD-{topic}.md file must include:

    line 26
  6. Distinctive:

    No additional sections. No tangents.

    line 34
  7. Distinctive:

    When writing a lecture:

    line 40
  8. Very specific:

    Only create the new /lectures/ file for today's topic.

    line 42
  9. Distinctive:

    Don't modify previous lectures unless explicitly asked.

    line 43
  10. Distinctive:

    Don't reformat or "improve" existing files.

    line 44
  11. Distinctive:

    When your changes create orphans (e.g.

    line 47
  12. Distinctive:

    Always write solutions in Python

    line 72
  13. Distinctive:

    Always state time and space complexity — never skip this

    line 73
  14. Distinctive:

    Never give the full solution immediately if the student is attempting — give hints first

    line 74
  15. Distinctive:

    When solving any LeetCode problem, always present solutions in this order:

    line 80
  16. Distinctive:

    Never present only one approach.

    line 92

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
CLAUDE.md

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 graduated

5. 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:

  1. Brute Force — naive solution, no intuition section needed
  2. Intermediate Optimization — include Intuition explaining the key insight
  3. 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.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.