# LeetCode Animation Contribution Guidelines and Pull Request Process

> Contribute to LeetCode Animation! Follow simple guidelines: install Python, scaffold new problems with the CLI, implement your solution and docs, then submit a pull request via GitHub. Get started today!

- Repository: [吴师兄学算法/LeetCodeAnimation](https://github.com/MisterBooo/LeetCodeAnimation)
- Tags: how-to-guide
- Published: 2026-03-01

---

**To contribute to the LeetCode Animation repository, install Python 3.6+, run the CLI scaffold command `python anima.py new <id> "<title>"` to generate the problem structure, implement your solution and documentation, then submit a pull request following the standard GitHub workflow.**

The LeetCode Animation project visualizes algorithmic solutions through animated explanations. Understanding the contribution guidelines and pull request process ensures your LeetCode solutions integrate seamlessly with the repository's automated tooling and maintain the project's consistent structure.

## Prerequisites and Environment Setup

Before generating new content, configure your local environment. The project requires **Python 3.6 or higher**. Clone the repository and install dependencies:

```bash
git clone https://github.com/MisterBooo/LeetCodeAnimation.git
cd LeetCodeAnimation
pip install -r requirements.txt

```

This setup enables the [`anima.py`](https://github.com/MisterBooo/LeetCodeAnimation/blob/main/anima.py) CLI tool located in the repository root.

## Creating a New Solution with the Animation CLI

The repository automates folder generation through a custom Python package. Instead of manually creating directories, use the built-in scaffolding command.

### Understanding the [`anima.py`](https://github.com/MisterBooo/LeetCodeAnimation/blob/main/anima.py) Scaffold Command

Execute the `new` command with the LeetCode problem ID and title:

```bash
python anima.py new 1 "Two Sum"

```

This invokes the creation logic defined in [`anima/create.py`](https://github.com/MisterBooo/LeetCodeAnimation/blob/main/anima/create.py)【2†L7-L19】, which instantiates the directory structure using data classes from [`anima/model.py`](https://github.com/MisterBooo/LeetCodeAnimation/blob/main/anima/model.py). The script handles slug generation and folder naming conventions automatically.

### File Structure Generated by [`anima/create.py`](https://github.com/MisterBooo/LeetCodeAnimation/blob/main/anima/create.py)

The scaffolding creates a standardized folder hierarchy following the `<id>-<slug>` naming convention. For problem #1, the command generates:

```

1-two-sum/
├── solution.py
└── Article/
    └── 1-two-sum.md

```

The [`template/template.md`](https://github.com/MisterBooo/LeetCodeAnimation/blob/main/template/template.md) file serves as the base for the Markdown article, which you must populate with the problem description, complexity analysis, and animation assets.

## Implementing Your Solution and Documentation

After scaffolding, complete the generated stubs with your algorithmic implementation and explanatory content.

### Writing the Algorithm Code

Edit the generated solution file (e.g., [`1-two-sum/solution.py`](https://github.com/MisterBooo/LeetCodeAnimation/blob/main/1-two-sum/solution.py)) to implement the algorithm. The repository accepts solutions in Python and other languages. Ensure your code compiles and handles the problem constraints correctly.

### Completing the Markdown Article

Fill the generated Markdown file in the `Article/` subdirectory with:

- **Problem description** and constraints
- **Algorithm analysis** and intuition
- **Time and space complexity** discussion
- **Animation assets** (GIF or MP4 links) if available

Reference existing problem folders for formatting standards.

## Submitting Your Pull Request

Once implementation is complete, submit your changes through the standard GitHub pull request workflow.

### Commit Message Conventions

Use descriptive commit messages that reference the problem ID:

```bash
git checkout -b add-two-sum
git add 1-two-sum/
git commit -m "feat: add solution for #1 Two Sum"
git push origin add-two-sum

```

Clear commit history facilitates maintainer review.

### PR Description Best Practices

When opening the pull request from your fork to the original repository:

1. **Reference the problem ID** (e.g., "Closes #1" or "Implements solution for #1")
2. **Describe the algorithm** approach briefly
3. **Confirm folder naming** follows the `<id>-<slug>` convention
4. **Note any animation assets** included

The repository does not enforce a formal PR template, but these elements accelerate the review process.

## The Pull Request Review Process

After submission, maintainers evaluate contributions through a structured review cycle.

**Automated checks**: Currently, the repository does not configure CI pipelines, so no automatic build failures block submission.

**Maintainer review criteria**:
- **Folder structure**: Verification of `<id>-<slug>` naming in [`anima/model.py`](https://github.com/MisterBooo/LeetCodeAnimation/blob/main/anima/model.py) conventions
- **Documentation completeness**: Presence of populated Markdown in `Article/<id>.md`
- **Code validity**: Working solution with reasonable algorithmic complexity
- **Asset integration**: Properly linked animation files (GIF/MP4) when applicable

**Feedback and iteration**: If revisions are necessary, maintainers comment on the PR, and contributors update their branch accordingly.

**Merge strategy**: Upon approval, maintainers typically use **squash and merge** to maintain a clean linear history.

## Summary

- **Environment**: Python 3.6+ required; install dependencies via [`requirements.txt`](https://github.com/MisterBooo/LeetCodeAnimation/blob/main/requirements.txt)
- **Scaffolding**: Use `python anima.py new <id> "<title>"` to generate standardized folder structures via [`anima/create.py`](https://github.com/MisterBooo/LeetCodeAnimation/blob/main/anima/create.py)
- **Implementation**: Complete solution code and Markdown documentation in the generated `<id>-<slug>/` directory
- **Submission**: Commit with descriptive messages referencing problem IDs, then open a GitHub Pull Request describing the algorithm and confirming folder conventions
- **Review**: Maintainers check structure, documentation, code validity, and assets before squash-merging approved contributions

## Frequently Asked Questions

### What Python version is required to contribute?

The LeetCode Animation tooling requires **Python 3.6 or higher**. This ensures compatibility with the `anima/` package scripts that handle directory scaffolding and template generation. Install dependencies by running `pip install -r requirements.txt` after cloning the repository.

### How does the `anima.py new` command work?

The command `python anima.py new <id> "<title>"` invokes the creation logic in [`anima/create.py`](https://github.com/MisterBooo/LeetCodeAnimation/blob/main/anima/create.py), which uses data classes from [`anima/model.py`](https://github.com/MisterBooo/LeetCodeAnimation/blob/main/anima/model.py) to generate a folder named `<id>-<slug>`. This folder contains a solution stub and an `Article/` subdirectory with a Markdown template copied from [`template/template.md`](https://github.com/MisterBooo/LeetCodeAnimation/blob/main/template/template.md).

### What should I include in my pull request description?

Your PR description should reference the **LeetCode problem ID** (e.g., "Implements solution for #1"), briefly describe the **algorithmic approach**, confirm adherence to the **`<id>-<slug>` folder naming convention**, and note any **animation assets** (GIFs or MP4s) included. While no formal template exists, these elements align with the repository's contribution guidelines.

### How long does the review process take?

The review timeline depends on maintainer availability. Since the repository lacks automated CI checks, the process relies on manual verification of folder structure, documentation completeness, and code validity. Contributors should monitor their PR for feedback requests and be prepared to iterate based on reviewer comments regarding the `anima/` tooling conventions or solution quality.