Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

96 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Turns Codebase into Cursor Rules with AI

License: MIT

Why bother reading a whole tutorial in the days of agentic coding? This is an AI agent that analyzes GitHub repositories and creates Cursor Rules that teaches AI how to develop with and/or for them.

This is a project inspired by and forked from a great project of Pocket Flow, which generates tutorials for humans. We just thought, tutorials are for humans, rules are for AI. Hence, we modified it to generate Cursor Rules instead of beginner-friendly tutorials for humans. It crawls GitHub repositories and builds a knowledge base from the code. It analyzes entire codebases to identify core abstractions and how they interact, and creates Project Rules with code samples, default and optional values, architecture and design patterns, and an overview of the inner working of the code.

Cursor rules:

Control how the Agent model behaves with reusable, scoped instructions.

Rules allow you to provide system-level guidance to the Agent and Cmd-K AI. Think of them as a persistent way to encode context, preferences, or workflows for your projects or for yourself.

Having Cursor Rules is especially useful for developing with recent releases or developing for your own codebase.

⭐ Example Results

🤯 All these Cursor Rules are generated entirely by AI by crawling the GitHub repo!

  • flax - Flax is neural network library for JAX that is designed for flexibility.

  • google-genai - Google Gen AI Python SDK provides an interface for developers to integrate Google's generative models into their Python applications.

  • google-adk - An open-source, code-first Python toolkit for building, evaluating, and deploying sophisticated AI agents with flexibility and control.

  • letsearch - A vector DB so easy, even your grandparents can build a RAG system.

  • letsearch-client - Python client for letsearch.

  • Tell us in Discussions how you're using AI-generated Cursor Rules and how it's contributing to your agentic coding experience!

🚀 Getting Started

  1. Clone this repository and then set your Gemini API key environment variable:
export GOOGLE_API_KEY=your_api_key_here
  1. Install dependencies:

    pip install -r requirements.txt
  2. Generate a complete codebase tutorial by running the main script:

    # Analyze a GitHub repository
    python main.py --repo https://github.com/username/repo --include "*.py" "*.js" --exclude "tests/*" --max-size 50000
    
    # Or, analyze a local directory
    python main.py --dir /path/to/your/codebase --include "*.py" --exclude "*test*"
    • --repo or --dir - Specify either a GitHub repo URL or a local directory path (required, mutually exclusive)
    • -n, --name - Project name (optional, derived from URL/directory if omitted)
    • -t, --token - GitHub token (or set GITHUB_TOKEN environment variable)
    • -o, --output - Output directory (default: ./output)
    • -i, --include - Files to include (e.g., ".py" ".js")
    • -e, --exclude - Files to exclude (e.g., "tests/" "docs/")
    • -s, --max-size - Maximum file size in bytes (default: 100KB)

The application will crawl the repository, analyze the codebase structure, generate Cursor Rules, and save the output in the specified directory (default: ./output).

About

Tutorials are for humans, rules are for AI!

Resources

Stars

2 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages