# Plan for Creating MDC Files from Library Best Practices ## Project Overview Create a script that generates Cursor rule files (.mdc) for various libraries and frameworks based on their best practices. The script will leverage: - Exa API for searching and retrieving library best practices - LiteLLM with Gemini 2.0 Flash for enhancing and structuring content - Existing utility functions from convert_to_mdc.py where applicable ## Implementation Steps 1. **Parse Libraries JSON** - Extract all libraries and frameworks from libraries.json - Create a flattened list of all technologies - Organize them by category for better file structure 2. **Set Up API Integration** - Configure Exa API client - Set up LiteLLM with proper rate limiting - Ensure proper error handling and retries 3. **Create Data Collection Pipeline** - For each library/framework: - Use Exa to search for best practices - Parse and clean the search results - If results are insufficient, enhance with Gemini 2.0 Flash 4. **Generate MDC Files** - Format data according to MDC file structure - Create appropriate glob patterns - Organize into logical categories 5. **Create File Structure** - Use categories from libraries.json (frontend, backend, etc.) - Name files according to library/framework (e.g., frontend/nextjs.mdc) - Save files to appropriate directories 6. **Implement Progress Tracking** - Track which libraries have been processed - Allow for resuming the process if interrupted ## File Structure ``` ├── frontend/ │ ├── react.mdc │ ├── nextjs.mdc │ ├── vue.mdc │ └── ... ├── backend/ │ ├── express.mdc │ ├── django.mdc │ └── ... ├── database/ │ ├── postgresql.mdc │ ├── mongodb.mdc │ └── ... └── ... ``` ## Execution Plan 1. Create main script that orchestrates the process 2. Implement utility functions for API interactions 3. Create MDC generation function based on convert_to_mdc.py 4. Test with a small subset of libraries 5. Run full generation process 6. Review and validate generated MDC files