How sanjeed5/awesome-cursor-rules-mdc works
1. What this repository is
- This is a Python-based content generation pipeline, not an application runtime.
- Its job is to turn a structured library catalog in rules.json into many Cursor MDC rule files under rules-mdc/.
2. Core data model boundary
- The primary input is rules.json, which lists libraries and tags.
- The generator treats that file as the source of truth for what should be produced, while existing generated files in rules-mdc/ represent the output artifact set.
3. Main orchestration script
- src/generate_mdc_files.py is the central entry point and likely coordinates the whole workflow.
- The README shows it supports selective processing (--library, --tag), test runs, regeneration, verbosity, worker count, and rate limiting.
4. Configuration and runtime settings
- src/config.yaml holds operational settings such as rate limits, output directories, model selection, and processing parameters.
- Environment variables from .env supply API credentials, so secret management is separated from code and config.
5. External service dependencies
- Exa is used for semantic search to collect best-practice material and supporting context.
- A large-language-model provider, typically Gemini but optionally OpenAI or Anthropic, generates the final rule content.
- These are the only materially important external integrations in the repo’s architecture.
6. Generation pipeline
- The workflow is: read the library definition → gather supporting information via Exa → feed that context plus instructions into the LLM → write an MDC file.
- src/mdc-instructions.txt appears to define the generation prompt or content constraints that shape the output format.
7. Parallelism and throughput control
- The generator is designed to process multiple libraries concurrently via worker settings.
- API usage is controlled by a rate-limit mechanism, which matters because the pipeline depends on two external APIs and is sensitive to quota and throttling.
8. Resume and failure handling
- src/mdc_generation_progress.json tracks progress across runs so interrupted jobs can resume.
- The default mode only retries libraries that previously failed, which makes the process incremental rather than fully stateless.
9. Intermediate artifacts
- src/exa-example.py suggests there is an example or helper path for Exa integration, likely separate from the main batch workflow.
- src/logs/ and the progress JSON provide observability and recovery rather than persisting application state in a database.
10. Output layer
- Generated MDC files are emitted into rules-mdc/, with one file per library or rule topic.
- That directory is effectively the product of the pipeline and the handoff point for downstream Cursor usage.
11. Legacy and migration area
- rules-v0-deprecated/ contains older prompt files, conversion scripts, and a conversion report.
- Architecturally, this looks like an archive of prior-generation formats and migration tooling, distinct from the active generator path.
12. Project tooling
- The project is Python-managed with uv (pyproject.toml, uv.lock, .python-version).
- The repository also includes .env.example and a MIT license, indicating a lightweight CLI/tooling project rather than a deployed service.
13. How to draw the architecture
- The diagram should center on a CLI batch processor in src/generate_mdc_files.py.
- Show inputs from rules.json, config.yaml, and .env; external calls to Exa and an LLM API; internal progress/log tracking; and final writes to rules-mdc/.
- Treat rules-v0-deprecated/ as a secondary archival branch, not part of the active execution path.
Main entry points: generate_mdc_files.py Generate MDC · rules-v0-deprecated V0 archive · convert_to_mdc.py Convert script · rules-mdc rules-mdc
Components 17
Active pipeline
Current generation flow and runtime settings
- rules.json · Structured library and tag inventory used as the generation source of truth
rules.json - Generate MDC · Main batch entry point coordinating the generation workflow
src/generate_mdc_files.py - Config · Operational settings for output, models, rate limits, and processing
src/config.yaml - Secrets env · Environment-based provider credentials and other secrets
.env.example - Prompt rules · Instruction text shaping the produced MDC content
src/mdc-instructions.txt - Progress log · Tracks completed and failed items across runs for resumption
src/mdc_generation_progress.json - Exa example · Sample path for Exa integration
src/exa-example.py - README · Primary usage and workflow documentation
README.md - uv tooling · Project management and dependency lock files
pyproject.toml
Output artifacts
Generated MDC rule files consumed by Cursor
- rules-mdc · Output directory containing generated Cursor MDC rule files
rules-mdc - Cursor rules · Workspace Cursor rule file used by the repository itself
.cursor/rules/python.mdc
Deprecated archive
Older prompt sets and conversion tooling
- V0 archive · Archived earlier-generation rule sets and conversion artifacts
rules-v0-deprecated - Convert script · Legacy converter for older prompt files into MDC format
rules-v0-deprecated/convert_to_mdc.py - Conv report · Report summarizing legacy conversion outcomes
rules-v0-deprecated/conversion_report.json - Legacy checks · Old validation or conversion test script
rules-v0-deprecated/test_conversion.py
Other components
- Exa search · Semantic search source for supporting context and best practices
- LLM API · Generates final rule text from context and instructions
Connections 18
- rules.json → Generate MDC: catalog input · Source library definitions drive generation targets
- Config → Generate MDC: runtime config · Controls model, rate, and output behavior
- Secrets env → Generate MDC: credentials · Provides API keys for external services
- Prompt rules → Generate MDC: prompt constraints · Shapes content and formatting of generated MDC files
- Generate MDC → Exa search: search context · Fetches supporting material before generation
- Generate MDC → LLM API: generate content · Sends context and instructions to the model
- Exa search → LLM API: context feed · Search results inform the final prompt payload
- Generate MDC → Progress log: resume state · Reads and updates progress for incremental runs
- Generate MDC → rules-mdc: write files · Materializes generated MDC artifacts
- Generate MDC → README: usage guided by · CLI options and workflow are documented here
- uv tooling → Generate MDC: python env · Manages project dependencies and runtime setup
- Exa example → Exa search: sample integration · Demonstrates the Exa integration path
- V0 archive → Convert script: contains · Archive includes old conversion tooling
- V0 archive → Conv report: contains · Archive includes conversion report artifacts
- V0 archive → Legacy checks: contains · Archive includes validation script
- Convert script → Conv report: produces · Legacy conversion script emits summary output
- Legacy checks → Convert script: validates · Legacy checks likely exercise conversion behavior
- rules-mdc → Cursor rules: coexists with · Generated rule corpus sits alongside repository Cursor rules