Skip to content

Commit e23f189

Browse files
committed
feat: add anki flashcards automation, update docs and prompts
1 parent 9391dcc commit e23f189

File tree

19 files changed

+1269
-62
lines changed

19 files changed

+1269
-62
lines changed

README.md

Lines changed: 100 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,115 @@
22

33
**Every Accepted was paid in blood, sweat, and runtime errors.**
44

5+
> **Note:** This documentation and workflow are a work in progress. Expect ongoing improvements and refinements.
6+
7+
---
8+
9+
## What is This?
10+
11+
Scars of LeetCode is an automation-driven workflow for mastering LeetCode problems, generating high-quality spaced-repetition flashcards, and tracking your progress. It is designed for power users who want:
12+
13+
- Effortless problem management and documentation
14+
- Automated, evidence-based Anki flashcard generation
15+
- Seamless integration with Anki (including WSL support)
16+
- A single source of truth for all your LeetCode learning
17+
518
---
619

7-
## Overview
20+
## Quick Start
21+
22+
### 1. Add a New Problem
23+
24+
Use the `new-problem.sh` script to scaffold a new problem:
25+
26+
```bash
27+
./new-problem.sh <problem_number> <problem_slug> <neetcode_150>
28+
# Example:
29+
./new-problem.sh 21 merge-two-sorted-lists true
30+
```
31+
32+
- **<problem_number>**: The LeetCode problem number (e.g., 21)
33+
- **<problem_slug>**: The LeetCode slug (e.g., merge-two-sorted-lists)
34+
- **<neetcode_150>**: 'true' if part of NeetCode 150, else 'false'
35+
36+
This creates a folder under `problems/` with:
37+
- A ready-to-edit `README.md` (with all required sections)
38+
- A starter `solution.py`
39+
- Automatic update of the main tracker in `problems/README.md`
840

9-
A collection of battle-tested LeetCode problems.
41+
### 2. Document and Solve
42+
43+
Edit the generated `README.md` and `solution.py` for your problem. Follow the template for concise, memory-friendly notes. The tracker will always reflect your current progress.
1044

1145
---
1246

13-
## Automation: `new-problem.sh`
47+
## Advanced: Automated Flashcard Generation
48+
49+
### 3. Use the Prompts for Consistent, High-Quality Notes & Cards
1450

15-
Add new problems effortlessly. This script:
51+
Prompts in `prompts/` ensure your documentation and flashcards are world-class:
1652

17-
- Creates a dedicated folder with starter files for your problem
18-
- Generates a ready-to-edit README template to capture the problem statement, approach, complexity, and notes
19-
- Sets up a boilerplate Python solution file to get you coding right away
20-
- Automatically updates the main problem tracker with every new addition
53+
- **`autofill-problem-readme.txt`**: Guidance for writing the perfect problem README, focusing on intuition, approach, complexity, and key notes. Use this as a reference or with LLMs to auto-generate your README.
54+
- **`create-update-anki-json.txt`**: The gold standard for generating Anki flashcards from your README and solution. Cards are designed for active recall, cloze deletions, and spaced repetition. Use this prompt with LLMs to generate a `cards.json` for each problem.
2155

22-
### Usage
56+
### 4. Generate and Merge Anki Flashcards
57+
58+
For each problem, generate a `cards.json` (using the above prompt and your README/solution). Place it in the problem's folder.
59+
60+
To merge all cards and import them into Anki:
2361

2462
```bash
25-
./new-problem.sh <problem_number> <problem_slug>
63+
python3 scripts/create_import_anki_flashcards.py
2664
```
65+
66+
This script will:
67+
- Merge all `cards.json` files into a master deck (`anki/scars-of-leetcode.json`)
68+
- Prevent duplicate cards
69+
- Add the `NeetCode150` tag automatically if the problem is part of NeetCode 150
70+
- Import all cards into your Anki deck via AnkiConnect
71+
72+
---
73+
74+
## AnkiConnect Setup (WSL & Linux)
75+
76+
**Prerequisite:** You must have the [AnkiConnect](https://ankiweb.net/shared/info/2055492159) add-on installed in your Anki desktop app.
77+
78+
**For WSL users:**
79+
1. Open Anki on Windows.
80+
2. Go to `Tools``Add-ons` → select AnkiConnect → `Config`.
81+
3. Change the config to:
82+
```json
83+
{ "webBindAddress": "0.0.0.0" }
84+
```
85+
4. Restart Anki.
86+
87+
This allows the Python script in WSL to connect to Anki running on Windows.
88+
89+
---
90+
91+
## File/Folder Structure
92+
93+
- `problems/` — Each problem gets its own folder with `README.md`, `solution.py`, and `cards.json`
94+
- `scripts/create_import_anki_flashcards.py` — Merges and imports all flashcards into Anki
95+
- `anki/scars-of-leetcode.json` — Master deck (auto-generated)
96+
- `prompts/` — LLM prompts for README and flashcard generation
97+
- `new-problem.sh` — Script to scaffold new problems and update the tracker
98+
99+
---
100+
101+
## Best Practices
102+
103+
- Always use the provided prompts for README and flashcard generation for consistency and quality.
104+
- Run the Python script regularly to keep your Anki deck up to date.
105+
- Use the NeetCode 150 flag accurately for tagging and filtering.
106+
- Review the generated tracker in `problems/README.md` for your progress overview.
107+
108+
---
109+
110+
## Contributing & Support
111+
112+
Contributions, suggestions, and improvements are welcome! Please open an issue or PR.
113+
114+
---
115+
116+
**Happy grinding — and may your scars become your strength.**

0 commit comments

Comments
 (0)