leetcode-problem-fetcher
Fetch and parse LeetCode problems with metadata, constraints, examples, hints, difficulty ratings, and related problems. Integrates with LeetCode API for comprehensive problem data retrieval.
Best use case
leetcode-problem-fetcher is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Fetch and parse LeetCode problems with metadata, constraints, examples, hints, difficulty ratings, and related problems. Integrates with LeetCode API for comprehensive problem data retrieval.
Teams using leetcode-problem-fetcher should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/leetcode-problem-fetcher/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How leetcode-problem-fetcher Compares
| Feature / Agent | leetcode-problem-fetcher | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Fetch and parse LeetCode problems with metadata, constraints, examples, hints, difficulty ratings, and related problems. Integrates with LeetCode API for comprehensive problem data retrieval.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# leetcode-problem-fetcher
A specialized skill for fetching and parsing LeetCode problems with complete metadata, suitable for competitive programming practice, interview preparation, and algorithm learning workflows.
## Purpose
Extract comprehensive problem data from LeetCode including:
- Problem statements and descriptions
- Input/output constraints and formats
- Test cases and hidden constraints
- Problem difficulty, tags, and acceptance rate
- Related problems and pattern tags
- Hints and solution approaches
## Capabilities
### Core Features
1. **Problem Retrieval**
- Fetch problems by title slug (URL-friendly name)
- Retrieve daily challenge problems
- Search problems by category, tags, difficulty, or keywords
- Access premium problem alternatives when available
2. **Metadata Extraction**
- Difficulty level (Easy, Medium, Hard)
- Acceptance rate and submission statistics
- Problem tags and categories
- Related problems and similar questions
- Company tags (when available)
3. **Content Parsing**
- Problem description in markdown format
- Input/output examples with explanations
- Constraints and edge cases
- Follow-up questions and optimizations
- Code templates for multiple languages
4. **User Data Access**
- User profile and statistics
- Contest ranking and history
- Submission history and solutions
- Progress tracking across problem sets
## Integration Options
### MCP Server (Recommended)
```bash
# Install LeetCode MCP Server by jinzcdev
claude mcp add-json "leetcode" '{"type":"stdio","command":"npx","args":["-y","@jinzcdev/leetcode-mcp-server","--site","global"]}'
```
**Available MCP Tools:**
- `get_daily_challenge` - Fetch daily LeetCode challenge
- `get_problem` - Retrieve problem by titleSlug
- `search_problems` - Filter by category, tags, difficulty, keywords
- `get_user_profile` - Access user data
- `get_user_contest_ranking` - Track contest performance
### Direct API Integration
```javascript
// GraphQL endpoint for LeetCode
const LEETCODE_GRAPHQL = 'https://leetcode.com/graphql';
// Query for problem details
const problemQuery = `
query getProblem($titleSlug: String!) {
question(titleSlug: $titleSlug) {
questionId
title
titleSlug
content
difficulty
topicTags { name slug }
hints
sampleTestCase
codeSnippets { lang code }
stats
}
}
`;
```
### Browser Extension
**Competitive Companion** - Parses problems from LeetCode and 115+ other online judges:
- Chrome: [competitive-companion](https://chrome.google.com/webstore/detail/competitive-companion)
- Firefox: [competitive-companion](https://addons.mozilla.org/en-US/firefox/addon/competitive-companion)
## Usage
### Fetch a Problem
```bash
# Using MCP Server
leetcode get_problem --titleSlug "two-sum"
# Output includes:
# - Problem title and description
# - Difficulty and acceptance rate
# - Topic tags
# - Examples and constraints
# - Code templates
```
### Search Problems
```bash
# Search by difficulty and tags
leetcode search_problems --difficulty MEDIUM --tags "dynamic-programming,array"
# Search by keyword
leetcode search_problems --keyword "substring"
```
### Get Daily Challenge
```bash
# Fetch today's daily challenge
leetcode get_daily_challenge
```
## Output Schema
```json
{
"problem": {
"id": "string",
"title": "string",
"titleSlug": "string",
"difficulty": "Easy|Medium|Hard",
"acceptanceRate": "number",
"description": "string (markdown)",
"constraints": ["string"],
"examples": [
{
"input": "string",
"output": "string",
"explanation": "string"
}
],
"hints": ["string"],
"topicTags": ["string"],
"similarQuestions": ["string"],
"codeTemplates": {
"python3": "string",
"cpp": "string",
"java": "string"
}
},
"metadata": {
"fetchedAt": "ISO8601 timestamp",
"source": "leetcode.com|leetcode.cn"
}
}
```
## Integration with Processes
This skill enhances the following processes:
- `leetcode-problem-solving` - Core problem-solving workflow
- `pattern-recognition` - Identifying algorithmic patterns
- `faang-interview-prep` - FAANG interview preparation
## References
- [LeetCode MCP Server (jinzcdev)](https://github.com/jinzcdev/leetcode-mcp-server)
- [LeetCode MCP Server (doggybee)](https://github.com/doggybee/mcp-server-leetcode)
- [Competitive Companion](https://github.com/jmerle/competitive-companion)
- [Competitive Programming Helper (CPH)](https://github.com/agrawal-d/cph)
## Error Handling
| Error | Cause | Resolution |
|-------|-------|------------|
| `PROBLEM_NOT_FOUND` | Invalid titleSlug | Verify problem URL or slug |
| `RATE_LIMITED` | Too many requests | Implement exponential backoff |
| `AUTH_REQUIRED` | Premium problem | Use alternative or authenticate |
| `NETWORK_ERROR` | Connection failed | Check network, retry with backoff |
## Best Practices
1. **Caching**: Cache problem data to reduce API calls
2. **Rate Limiting**: Respect LeetCode's rate limits (use delays between requests)
3. **Error Handling**: Gracefully handle premium/locked problems
4. **Offline Mode**: Store fetched problems for offline practice
5. **Data Freshness**: Re-fetch periodically for updated statisticsRelated Skills
a3-problem-solver
A3 problem-solving and status reporting skill with structured thinking and coaching support
interview-problem-bank
Curated bank of interview problems organized by company, pattern, and difficulty. Provides problem recommendations, coverage tracking, weak area identification, and premium problem alternatives for FAANG interview preparation.
process-builder
Scaffold new babysitter process definitions following SDK patterns, proper structure, and best practices. Guides the 3-phase workflow from research to implementation.
babysitter
Orchestrate via @babysitter. Use this skill when asked to babysit a run, orchestrate a process or whenever it is called explicitly. (babysit, babysitter, orchestrate, orchestrate a run, workflow, etc.)
yolo
Run Babysitter autonomously with minimal manual interruption.
user-install
Install the user-level Babysitter Codex setup.
team-install
Install the team-pinned Babysitter Codex workspace setup.
retrospect
Summarize or retrospect on a completed Babysitter run.
resume
Resume an existing Babysitter run from Codex.
project-install
Install the Babysitter Codex workspace integration into the current project.
plan
Plan a Babysitter workflow without executing the run.
observe
Observe, inspect, or monitor a Babysitter run.