Rule Smith banner
haasonsaas haasonsaas

Rule Smith

Development community

Description

A lightweight, repo-native agent that writes Cursor rules automatically for your project

Installation

This entry records only its repository, not the path inside it, so there is no exact command to give. Open the source below and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

README

Rule-Smith

A lightweight, repo-native agent that writes [Cursor](https://cursor.sh) rules automatically for your project. Rule-Smith analyzes merged pull requests and generates documentation rules that help developers understand your codebase's patterns and practices.

How It Works

When a pull request is merged, Rule-Smith:

  1. Analyzes the PR content, including title, description, and changed files
  2. Uses AI to understand the significance of the changes
  3. Generates a Cursor rule (.mdc file) that documents the changes
  4. Creates a new PR with the generated rule

For example, if you merge a PR that adds error handling to API endpoints, Rule-Smith might generate a rule like:

# .cursor/rules/implement-error-handling.mdc
---
description: "Ensure all API endpoints implement proper error handling and logging"
globs:
  - "src/api/**/*.ts"
alwaysApply: true
---

# Implement Error Handling

All API endpoints should:
- Use try/catch blocks for async operations
- Log errors with appropriate severity levels
- Return standardized error responses

Features

  • 🤖 Automated Documentation: Generates Cursor rules automatically when PRs are merged
  • 🔍 Smart Analysis: Uses AI to understand PR context and generate meaningful rules
  • 📁 Well-Formatted Rules: Creates .mdc files with appropriate glob patterns
  • 🔄 GitHub Integration: Seamlessly integrates with GitHub Actions
  • 🛠️ Manual Mode: Supports both automated and manual rule generation

Setup

Prerequisites

  • Bun installed
  • GitHub repository with Actions enabled
  • OpenAI API key

Installation

  1. Clone and install dependencies:

    git clone https://github.com/yourusername/rule-smith.git
    cd rule-smith
    bun install
  2. Create a `.env` file:

    GITHUB_TOKEN=your_github_token
    OPENAI_API_KEY=your_openai_api_key
  3. Configure GitHub repository secrets:

    • GITHUB_TOKEN (automatically provided by GitHub Actions)