AI Project Rules Generator is a production-grade AI Agent Skill designed to solve Context Bloat and Agent Drift in AI-assisted development. By utilizing Deterministic JIT (Just-In-Time) Retrieval, it automatically discovers and integrates relevant AI skills from your local environment without saturating the LLM's context window.
Give your project professional AI Rules: Claude Code | Gemini CLI | Codex CLI | Local Installation
It starts the moment you fire up your coding agent and ask it to generate project rules. Rather than dumping an entire folder of skills into your context window, the generator steps back and indexes available skills across your local, global, and remote environments.
Once it understands the intent of your project (e.g., frontend, backend, UI design), it uses Semantic Fallback and fuzzy matching to dynamically select the top 5 most relevant skills.
It then compiles these into a highly structured .cursorrules or AGENTS.md file, providing your AI assistant with the exact constraints, design tokens, and architectural patterns it needs to work autonomouslyβwithout overwhelming its token limits.
Installation differs by harness. If you use more than one, install the generator separately for each one.
The generator can be installed directly via Claude's plugin manager:
/plugin install https://github.com/naravid19/ai-project-rules-generatorInstall the generator globally via Gemini's native extension manager:
gemini extensions install https://github.com/naravid19/ai-project-rules-generatorInstall the generator via the Codex extensions manager:
codex extensions install https://github.com/naravid19/ai-project-rules-generatorIf you prefer to install the generator manually or via shell scripts directly into your workspace:
Linux / macOS:
curl -sL https://raw.githubusercontent.com/naravid19/ai-project-rules-generator/main/setup.sh | bashWindows (PowerShell):
irm https://raw.githubusercontent.com/naravid19/ai-project-rules-generator/main/setup.ps1 | iexSimply ask your AI assistant to generate the rules, and it will automatically invoke the skill.
Basic Invocation:
"Please generate project rules for this repository using the Superpowers methodology."
Explicit Invocation:
"@SKILL.md please generate my project rules."
You can configure, index, and query skills from multiple scopes: local (project-level), global (machine-level), and remote (git repositories cloned on demand).
New in v1.9.5: The engine features robust fault tolerance. Remote sources securely fallback to local offline .cache copies if a network timeout occurs, ensuring your agent never breaks mid-workflow.
skill_sources:
- path: ".agent"
confirmed: true
type: local
source_name: project-local
- path: "https://github.com/obra/superpowers.git"
type: remote
source_name: community-skillspython scripts/indexer.py --unified --skill-mapThis produces a unified JSON catalog for the JIT engine and a human-readable skill_map.md.
ai-project-rules-generator/
βββ SKILL.md # The core autonomous agent workflow instructions
βββ scripts/ # Enhanced execution scripts (Mode A)
β βββ indexer.py # Builds skill_catalog.json and skill_map.md
β βββ wizard.py # Interacts with rules generation
β βββ rules_config.py # Configuration parsing logic
β βββ remote_source.py# Git-based remote source caching
βββ tests/ # Comprehensive Pytest suite
βββ setup.sh / ps1 # Installation scripts
- User Intent: The user asks the AI to generate rules.
- JIT Routing: The AI parses
SKILL.mdand reads.rulesrc.yaml. - Multi-Source Indexing:
scripts/indexer.pyaggregates and deduplicates skills into a lightweight JSON catalog. - Semantic Matching: The AI cross-references the user's intent against the catalog using synonym matching and exact-word boundaries.
- Rules Generation: High-fidelity
.cursorrulesandAGENTS.mdare drafted based on the matched top 5 skills. - Audit Check: Execution logs and decision reasoning are securely written to
.agent/logs/.
This project adheres strictly to Test-Driven Development (TDD) and maintains robust test coverage across fault tolerance and core features.
Ensure you have pytest installed, then run the test suite:
# Run all tests natively
py -m pytest tests/ -v
# Run with coverage
py -m pytest tests/ --cov=scripts --cov-report=term-missing- Agent Hallucinates Incorrect Skills: Ensure the AI is invoking the skill correctly. Explicitly mention the skill file in your prompt:
"Using @SKILL.md, regenerate the project rules. Strictly adhere to the JIT Retrieval constraint." - Installation Script Fails: Ensure you are using a modern terminal (Git Bash, WSL, or native macOS Terminal). If
curlis missing, download the files manually. - Cache Discovery Bug: Ensure you are running
v1.9.5or later. Earlier versions had an issue where remote skills cloned into.cachewere skipped by the indexer.
Distributed under the MIT License. See LICENSE for more information.
