Skip to content

Commit 68521e3

Browse files
authored
docs: improve docs (#49)
- update README.md, CONTRIBUTING.md, docs/cli-usage.md, docs/llm-assisted-problem-creation.md
1 parent bab3827 commit 68521e3

File tree

4 files changed

+149
-77
lines changed

4 files changed

+149
-77
lines changed

CONTRIBUTING.md

Lines changed: 72 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,50 +6,97 @@ Thank you for your interest in contributing! This repository welcomes contributi
66

77
### 1. Add New Problems
88

9-
Use an LLM assistant (Cursor, GitHub Copilot Chat, Amazon Q) with the rule files:
9+
For adding new LeetCode problems, please refer to the comprehensive guide:
1010

11-
- Include `.amazonq/rules/problem-creation.md` in your LLM context
12-
- Ask: "Create LeetCode problem [number] ([name])"
11+
📖 **[LLM-Assisted Problem Creation Guide](docs/llm-assisted-problem-creation.md)**
1312

14-
### 2. Enhance Test Cases
13+
This document provides detailed instructions for using LLM assistants to generate new problems with proper templates, test cases, and documentation.
1514

16-
- Include `.amazonq/rules/test-quality-assurance.md` in your LLM context
17-
- Ask: "Enhance test cases for [problem_name] problem"
15+
**Acceptance Criteria:**
1816

19-
### 3. Improve Helper Classes
17+
- All GitHub Actions CI checks must pass (includes linting, testing, security scanning, reproducibility verification, and minimum 10 test cases per problem)
18+
- Proper type hints and code formatting
19+
- Complete the solution (documentation is auto-generated)
2020

21-
- Add new data structure helpers in `leetcode_py/data_structures/`
22-
- Follow existing patterns with generic types and visualization support
21+
### 2. Other Contributions
2322

24-
### 4. Bug Fixes & Improvements
23+
All other contributions are welcome! This includes:
2524

26-
- Fix issues in existing problems
27-
- Improve documentation
28-
- Enhance CI/CD workflows
25+
- Bug fixes and improvements
26+
- Documentation enhancements
27+
- Helper class improvements
28+
- CI/CD workflow enhancements
29+
- Test case enhancements
30+
- New data structure visualizations
31+
32+
**For small changes:** Feel free to open a pull request directly.
33+
34+
**For larger changes:** Please open an issue for discussion first.
35+
36+
I'm also open to feedback and suggestions for improving the project!
2937

3038
## Development Setup
3139

40+
### Prerequisites
41+
42+
- **Python 3.10+** - Modern Python runtime
43+
- **Poetry** - Dependency management ([install guide](https://python-poetry.org/docs/#installation))
44+
- **Make** - Build automation (usually pre-installed on Unix systems)
45+
- **Git** - Version control
46+
- **Graphviz** - Graph visualization ([install guide](https://graphviz.org/download/))
47+
48+
## Development Workflow
49+
50+
### 1. Fork and Setup
51+
3252
```bash
33-
git clone https://github.com/wisarootl/leetcode-py.git
53+
# Fork the repository on GitHub, then clone your fork
54+
git clone https://github.com/YOUR_USERNAME/leetcode-py.git
3455
cd leetcode-py
3556
poetry install
57+
58+
# Add upstream remote
59+
git remote add upstream https://github.com/wisarootl/leetcode-py.git
60+
61+
# Verify setup
3662
make test
63+
make lint
3764
```
3865

39-
## Code Standards
66+
### 2. Create Feature Branch
67+
68+
```bash
69+
git checkout -b your-feature-name
70+
```
4071

41-
- Follow [PEP 8](https://peps.python.org/pep-0008/) Python style guide
42-
- Use modern type hints per [PEP 585](https://peps.python.org/pep-0585/)/[PEP 604](https://peps.python.org/pep-0604/): `list[str]`, `dict[str, int]`, `Type | None`
43-
- Automated linting enforced by CI (black, isort, ruff, mypy)
44-
- Minimum 12 test cases per problem
72+
### 3. Make Changes and Test
4573

46-
## Pull Request Process
74+
```bash
75+
# Test specific problem
76+
make p-test PROBLEM=problem_name
77+
78+
# Test all
79+
make test
80+
81+
# Lint your changes
82+
make lint
83+
84+
# Generate/regenerate problems (if needed)
85+
make p-gen PROBLEM=problem_name
86+
```
87+
88+
### 4. Submit Pull Request
89+
90+
```bash
91+
# Commit and push to your fork
92+
git add .
93+
git commit -m "feat: your descriptive commit message"
94+
git push origin your-feature-name
95+
96+
# Then create a pull request on GitHub from your fork to the main repository
97+
```
4798

48-
1. Fork the repository
49-
2. Create a feature branch
50-
3. Make your changes
51-
4. Run `make lint` and `make test`
52-
5. Submit a pull request with clear description
99+
**Ensure all GitHub Actions CI checks pass before requesting review.**
53100

54101
## Questions?
55102

README.md

Lines changed: 38 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -4,52 +4,64 @@
44
[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=wisarootl_leetcode-py&metric=security_rating)](https://sonarcloud.io/summary/new_code?id=wisarootl_leetcode-py)
55
[![Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=wisarootl_leetcode-py&metric=vulnerabilities)](https://sonarcloud.io/summary/new_code?id=wisarootl_leetcode-py)
66
[![codecov](https://codecov.io/gh/wisarootl/leetcode-py/graph/badge.svg?token=TI97VUIA4Z)](https://codecov.io/gh/wisarootl/leetcode-py)
7-
[![tests](https://img.shields.io/github/actions/workflow/status/wisarootl/leetcode-py/ci-test.yml?branch=main&label=tests&logo=github)](https://github.com/wisarootl/zerv/actions/workflows/ci-test.yml)
8-
[![release](https://img.shields.io/github/actions/workflow/status/wisarootl/leetcode-py/cd.yml?branch=main&label=release&logo=github)](https://github.com/wisarootl/zerv/actions/workflows/cd.yml)
7+
[![tests](https://img.shields.io/github/actions/workflow/status/wisarootl/leetcode-py/ci-test.yml?branch=main&label=tests&logo=github)](https://github.com/wisarootl/leetcode-py/actions/workflows/ci-test.yml)
8+
[![release](https://img.shields.io/github/actions/workflow/status/wisarootl/leetcode-py/cd.yml?branch=main&label=release&logo=github)](https://github.com/wisarootl/leetcode-py/actions/workflows/cd.yml)
9+
[![downloads](https://static.pepy.tech/personalized-badge/leetcode-py-sdk?period=total&units=international_system&left_color=grey&right_color=brightgreen&left_text=pypi%20downloads)](https://pepy.tech/projects/leetcode-py-sdk)
10+
[![python](https://img.shields.io/badge/python-3.10%20%7C%203.11%20%7C%203.12%20%7C%203.13-brightgreen?logo=python)](https://pypi.org/project/leetcode-py-sdk/)
911

1012
A Python package to generate professional LeetCode practice environments. Features automated problem generation from LeetCode URLs, beautiful data structure visualizations (TreeNode, ListNode, GraphNode), and comprehensive testing with 10+ test cases per problem. Built with professional development practices including CI/CD, type hints, and quality gates.
1113

14+
## Table of Contents
15+
16+
- [What's Included](#whats-included)
17+
- [Quick Start](#quick-start)
18+
- [Problem Structure](#problem-structure)
19+
- [Key Features](#key-features)
20+
- [Usage Patterns](#usage-patterns)
21+
- [Development Setup](#development-setup)
22+
- [Helper Classes](#helper-classes)
23+
- [Commands](#commands)
24+
- [Architecture](#architecture)
25+
- [Quality Metrics](#quality-metrics)
26+
1227
**What makes this different:**
1328

14-
- 🤖 **[LLM-Assisted Workflow](https://github.com/wisarootl/leetcode-py#llm-assisted-problem-creation)**: Generate new problems instantly with AI assistance
29+
- 🤖 **[LLM-Assisted Workflow](https://github.com/wisarootl/leetcode-py/blob/main/docs/llm-assisted-problem-creation.md)**: Generate new problems instantly with AI assistance
1530
- 🎨 **Visual Debugging**: Interactive tree/graph rendering with Graphviz and anytree
1631
- 🧪 **Production Testing**: Comprehensive test suites with edge cases and reproducibility verification
1732
- 🚀 **Modern Python**: PEP 585/604 type hints, Poetry, and professional tooling
1833
- 📊 **Quality Assurance**: 95%+ test coverage, security scanning, automated linting
34+
-**[Powerful CLI](https://github.com/wisarootl/leetcode-py/blob/main/docs/cli-usage.md)**: Generate problems anywhere with `lcpy` command
1935

20-
## 🎯 What's Included
36+
## <a id="whats-included"></a>🎯 What's Included
2137

2238
**Current**: All 75 problems from [Grind 75](https://www.techinterviewhandbook.org/grind75/) - the most essential coding interview questions curated by the creator of Blind 75.
2339

24-
**Future**: Planned expansion to all free Grind problems for comprehensive interview preparation.
40+
**Future**: Planned expansion to all free Grind problems for comprehensive interview preparation. [Contributions welcome!](CONTRIBUTING.md)
2541

26-
## 🚀 Quick Start
42+
## <a id="quick-start"></a>🚀 Quick Start
2743

2844
### System Requirements
2945

30-
- **Python 3.13+** - Modern Python runtime with latest type system features
31-
- **Poetry** - Dependency management and packaging
32-
- **Make** - Build automation (development workflows)
33-
- **Git** - Version control system
34-
- **Graphviz** - Graph visualization library (for data structure rendering)
46+
- **Python 3.10+** - Python runtime
47+
- **Graphviz** - Graph visualization library ([install guide](https://graphviz.org/download/))
3548

3649
```bash
3750
# Install the package
38-
pip install leetcode-py
51+
pip install leetcode-py-sdk
3952

4053
# Generate problems anywhere
4154
lcpy gen -n 1 # Generate Two Sum
4255
lcpy gen -t grind-75 # Generate all Grind 75 problems
4356
lcpy list -t grind-75 # List available problems
44-
lcpy scrape -n 1 # Fetch problem data
4557

4658
# Start practicing
4759
cd leetcode/two_sum
4860
python -m pytest test_solution.py # Run tests
4961
# Edit solution.py, then rerun tests
5062
```
5163

52-
### Example
64+
### Bulk Generation Example
5365

5466
```bash
5567
lcpy gen --problem-tag grind-75 --output leetcode # Generate all Grind 75 problems
@@ -63,7 +75,7 @@ _Bulk generation output showing "Generated problem:" messages for all 75 Grind p
6375

6476
_Generated folder structure showing all 75 problem directories after command execution_
6577

66-
## 📁 Problem Structure
78+
## <a id="problem-structure"></a>📁 Problem Structure
6779

6880
Each problem follows a consistent, production-ready template:
6981

@@ -93,7 +105,7 @@ _Comprehensive parametrized tests with 10+ test cases - executable and debuggabl
93105

94106
_Beautiful colorful test output with loguru integration for enhanced debugging and test result visualization_
95107

96-
## ✨ Key Features
108+
## <a id="key-features"></a>✨ Key Features
97109

98110
### Production-Grade Development Environment
99111

@@ -143,33 +155,23 @@ _Simple arrow-based list representation for console output and test debugging_
143155

144156
_Interactive multi-cell playground with rich data structure visualization for each problem_
145157

146-
## 🔄 Usage Patterns
158+
## <a id="usage-patterns"></a>🔄 Usage Patterns
147159

148160
### CLI Usage (Global Installation)
149161

150-
Perfect for quick problem generation anywhere:
151-
152-
```bash
153-
# Generate specific problems
154-
lcpy gen -n 1 -n 125 -n 206 # Multiple problems by number
155-
lcpy gen -s two-sum -s valid-palindrome # Multiple problems by slug
156-
157-
# Bulk generation
158-
lcpy gen -t grind-75 # All Grind 75 problems
159-
lcpy gen -t grind-75 -d Easy # Only Easy problems from Grind 75
162+
Perfect for quick problem generation anywhere. See the 📖 **[Complete CLI Usage Guide](https://github.com/wisarootl/leetcode-py/blob/main/docs/cli-usage.md)** for detailed documentation with all options and examples.
160163

161-
# Explore available problems
162-
lcpy list # All problems
163-
lcpy list -t grind-75 # Filter by tag
164-
lcpy list -d Medium # Filter by difficulty
164+
## <a id="development-setup"></a>🛠️ Development Setup
165165

166-
# Fetch problem data
167-
lcpy scrape -n 1 > two_sum.json # Save problem data
168-
```
166+
For working within this repository to generate additional LeetCode problems using LLM assistance:
169167

170-
## 🛠️ Development Setup
168+
### Development Requirements
171169

172-
For working within this repository to generate additional LeetCode problems using LLM assistance:
170+
- **Python 3.10+** - Modern Python runtime with latest type system features
171+
- **Poetry** - Dependency management and packaging
172+
- **Make** - Build automation (development workflows)
173+
- **Git** - Version control system
174+
- **Graphviz** - Graph visualization library ([install guide](https://graphviz.org/download/))
173175

174176
```bash
175177
# Clone repository for development

docs/cli-usage.md

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,23 @@ lcpy gen -s two-sum
6565
# Multiple problems by slug
6666
lcpy gen -s two-sum -s valid-palindrome
6767

68-
# All problems with specific tag
68+
# All problems with specific tag (bulk generation)
6969
lcpy gen -t grind-75
7070

71+
# Example: Generate all Grind 75 problems
72+
lcpy gen --problem-tag grind-75 --output leetcode
73+
```
74+
75+
![Problem Generation](https://raw.githubusercontent.com/wisarootl/leetcode-py/main/docs/images/problems-generation.png)
76+
77+
_Bulk generation output showing "Generated problem:" messages for all 75 Grind problems_
78+
79+
![Problem Generation 2](https://raw.githubusercontent.com/wisarootl/leetcode-py/main/docs/images/problems-generation-2.png)
80+
81+
_Generated folder structure showing all 75 problem directories after command execution_
82+
83+
```bash
84+
7185
# Filter by difficulty
7286
lcpy gen -t grind-75 -d Easy
7387

@@ -151,15 +165,24 @@ problem_name/
151165
└── __init__.py # Package marker
152166
```
153167

168+
![README Example](https://raw.githubusercontent.com/wisarootl/leetcode-py/main/docs/images/readme-example.png)
169+
170+
_README format that mirrors LeetCode's problem description layout_
171+
172+
![Solution Boilerplate](https://raw.githubusercontent.com/wisarootl/leetcode-py/main/docs/images/solution-boilerplate.png)
173+
174+
_Solution boilerplate with type hints and TODO placeholder_
175+
176+
![Test Example](https://raw.githubusercontent.com/wisarootl/leetcode-py/main/docs/images/test-example.png)
177+
178+
_Comprehensive parametrized tests with 10+ test cases - executable and debuggable in local development environment_
179+
154180
## Tags
155181

156182
Available tags for bulk operations:
157183

158184
- `grind-75` - Essential 75 coding interview problems
159-
- `blind-75` - Original Blind 75 problems
160-
- `neetcode-150` - NeetCode 150 problems
161-
- `top-interview` - Top interview questions
162-
- `easy`, `medium`, `hard` - Difficulty-based tags
185+
- `grind` - Original Blind 75 problems
163186

164187
## Output Directory
165188

docs/llm-assisted-problem-creation.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -75,27 +75,25 @@ Each problem includes 10+ test cases covering edge cases (note: generated test c
7575

7676
_Generated test_solution.py with parametrized tests and comprehensive test cases_
7777

78-
## Test Enhancement Workflow
78+
## Test Enhancement & Verification
7979

80-
### Enhancing Existing Problems
80+
### Enhancing and Verifying Test Cases
8181

82-
Improve test coverage for existing problems:
82+
Improve test coverage and verify correctness for existing or newly generated problems:
83+
84+
**1. Run the tests:**
8385

8486
```bash
85-
"Enhance test cases for two_sum problem"
86-
"Add more edge cases to binary_tree_inorder_traversal"
87-
"Fix test reproducibility for valid_palindrome"
87+
make p-test PROBLEM={problem_name}
8888
```
8989

90-
### Quality Assurance
91-
92-
The assistant can identify problems needing more test cases and verify test case correctness and reproducibility:
90+
**2. Ask LLM to enhance or verify:**
9391

9492
```bash
93+
"Enhance test cases for {problem_name} problem"
94+
"Fix test reproducibility for {problem_name}"
9595
"Check which problems need more test cases"
9696
"Find problems with less than 12 test cases"
97-
"Verify test case correctness for house_robber"
98-
"Fix test reproducibility for binary_tree_inorder_traversal"
9997
```
10098

10199
## Best Practices
@@ -107,11 +105,13 @@ The assistant can identify problems needing more test cases and verify test case
107105
- "Add problem 198. House Robber with grind tag"
108106
- "Create problem 70. Climbing Stairs for grind-75"
109107
- "Enhance test cases for two_sum problem"
108+
- "Verify and fix test cases for binary_search problem"
110109

111110
**Avoid:**
112111

113112
- Vague requests without problem numbers
114113
- Requests for non-existent problems
114+
- Assuming generated test cases are always correct
115115

116116
## Troubleshooting
117117

0 commit comments

Comments
 (0)