Agent skill

Generate AI Rules

by divar-ir in divar-ir/ai-doc-gen

Generate AI assistant configuration files for a repository — CLAUDE.md, AGENTS.md, and Cursor rules (.cursor/rules/.mdc) — from codebase analysis.

MITAuto-check passedAgent Workflows

Install Generate AI Rules

skills CLI
$ npx skills add divar-ir/ai-doc-gen --skill generate-ai-rules -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install divar-ir/ai-doc-gen generate-ai-rules --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/divar-ir/ai-doc-gen.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/generate-ai-rules .claude/skills/generate-ai-rules && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
generate-ai-rules
GitHub stars
767
Token cost
~1.2k tokens
SKILL.md length
598 words
Files
1
Skills in repo
3
Repo updated
First seen
Licence
MIT

At a glance

Generate AI assistant configuration files for a repository — CLAUDE.md, AGENTS.md, and Cursor rules (.cursor/rules/.mdc) — from codebase analysis.

  • Works in 4 steps: Determine targets and gather data → Generate the files → When existing files are provided → …
  • The user wants to create
  • Calls uv
  • Update CLAUDE.md

What it does

Generate AI Rules is an agent skill from divar-ir/ai-doc-gen. Generate AI assistant configuration files for a repository — CLAUDE.md, AGENTS.md, and Cursor rules (.cursor/rules/.mdc) — from codebase analysis. Use whenever the user wants to create or update CLAUDE.md, AGENTS.md, agent rules, Cursor rules, AI coding assistant configuration, or "onboard AI tools" to a project, even if they only mention one of the file types.

Its SKILL.md is about 1.2k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Agent Workflows, covering Agent instruction files. It works with Pydantic AI and Python. The repository describes itself as: AI-powered multi-agent system that automatically analyzes codebases and generates comprehensive documentation. Features GitLab integration, concurrent processing, and multiple… The licence is MIT.

When your agent uses it

  • The user wants to create
  • Update CLAUDE.md
  • AI coding assistant configuration
  • Onboard AI tools to a project

Example prompts

  • “onboard AI tools”
  • “/generate-ai-rules”

Workflow steps

4 steps, taken from the step headings in SKILL.md.

  1. Determine targets and gather data
  2. Generate the files
  3. When existing files are provided
  4. Report

What it can do on your machine

Read from SKILL.md and the folder at commit bd3aba7. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • uv

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use uv, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Generate AI Rules loads about 1.2k tokens when it runs. Until then it costs about 96 tokens; SKILL.md has 598 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~96
When it runs · the whole SKILL.md, loaded when a task matches
~1.2k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from divar-ir/ai-doc-gen at commit bd3aba7, republished under its MIT licence (© divar-ir). 598 words, ~1,216 tokens.

Download SKILL.mdSave it as .claude/skills/generate-ai-rules/SKILL.md (or your agent's skills folder).
name
generate-ai-rules
description
Generate AI assistant configuration files for a repository — CLAUDE.md, AGENTS.md, and Cursor rules (.cursor/rules/*.mdc) — from codebase analysis. Use whenever the user wants to create or update CLAUDE.md, AGENTS.md, agent rules, Cursor rules, AI coding assistant configuration, or "onboard AI tools" to a project, even if they only mention one of the file types.

Generate AI Rules

Generate configuration files that help AI coding assistants work effectively with a codebase. Three targets, generated from the same analysis so they stay consistent:

  1. AGENTS.md — the cross-tool standard (agents.md), read by most AI coding tools including Claude Code, Cursor, Codex, and Gemini CLI.
  2. CLAUDE.md — Claude Code's project instructions file.
  3. .cursor/rules/*.mdc — Cursor's scoped project rules.

Workflow

1. Determine targets and gather data
  • Generate all three targets by default; the user may skip any (e.g., "skip cursor rules", "keep my existing CLAUDE.md").
  • If a target file already exists and the user didn't say to regenerate it, ask whether to update it or leave it alone.
  • Check <repo>/.ai/docs/ for analysis documents from the analyze-codebase skill. If present, use them as the primary source (spot-check against the code — they may be stale). If absent, offer to run analyze-codebase first, or explore the codebase directly for a quicker pass.
2. Generate the files

Shared principles for all targets:

  • Accuracy: every command, path, and convention must come from the actual project. Test that commands at least look right against the manifest files (e.g., scripts in package.json, tasks in Makefile, uv run vs pip).
  • Actionability: specific, executable instructions beat vague guidance. "Run uv run ruff format src/" beats "format your code".
  • Conciseness: these files are loaded into every AI session — every line costs context. Only include what the AI cannot cheaply discover by reading the code: commands, non-obvious conventions, gotchas, things that have gone wrong before. Do not restate what the code structure makes obvious.
  • Consistency: same terminology and architecture descriptions across all generated files.
AGENTS.md

The primary file — write it first, and write it best. Target well under 150 lines.

  • Project overview (1–2 sentences)
  • Build, test, run, lint commands (in backticks, copy-pasteable)
  • Architecture overview (3–5 bullets)
  • Code style conventions
  • Testing instructions
  • Git workflow (commit format, PR process)
  • Key project-specific conventions and gotchas
Show full SKILL.md (286 more words)Show less
CLAUDE.md

Claude Code reads AGENTS.md natively, so avoid duplicating content between the two files. Pick based on what exists and what the user wants:

  • If AGENTS.md is generated/present (recommended): make CLAUDE.md a thin complement — a single line See AGENTS.md for project instructions. plus only Claude-specific additions if any (e.g., skill/subagent usage preferences, permission notes). If there is nothing Claude-specific, ask the user whether they want CLAUDE.md at all.
  • If the user wants a standalone CLAUDE.md (no AGENTS.md): include the full content — overview, commands, style, architecture, key components, gotchas, known issues. Target under 300 lines; long CLAUDE.md files degrade rather than improve AI performance.
.cursor/rules/*.mdc

Generate 2–3 focused, composable rule files in MDC format (markdown with YAML frontmatter):

markdown
---
description: Brief description of what this rule covers
globs:
  - "src/**/*.py"
alwaysApply: false
---

# Rule Title

Content...
  • project-overview.mdc — project context, architecture, conventions (alwaysApply: true, no globs needed)
  • code-patterns.mdc — code style, testing patterns, anti-patterns to avoid (globbed to source files)
  • api-conventions.mdc — only if the project has a significant API surface (globbed to API/handler files)

Keep each file to 50–100 lines. Rules should be prescriptive and project-specific, with short code examples from the actual codebase. Reference files with @path syntax where helpful. If a legacy .cursorrules file exists, migrate its still-valid content into the new files and tell the user the legacy file can be removed.

3. When existing files are provided

When updating rather than creating:

  • Preserve the existing structure, tone, and any manually added sections not derivable from analysis (they usually encode hard-won knowledge).
  • Refresh outdated information: stale commands, renamed paths, removed components.
  • Tell the user specifically what you changed and why.
4. Report

List the files written, their line counts, and anything you left out or couldn't verify. If the repo's docs and reality diverged notably, mention it — that's a signal the team should know.

© divar-ir, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in skills/generate-ai-rules of divar-ir/ai-doc-gen.

Open the folder on GitHubat commit bd3aba7

Compare with similar skills

Generate AI Rules next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Generate AI Rules compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Generate AI Rules this skilldivar-ir/ai-doc-gen767—~1.2kAutomated safety check: PassMIT
Mspm0 Ccsmc3545dada/mspm0-skill374—~4.5kAutomated safety check: PassMIT
Goal Prompt Builderwin4r/goal-prompt-builder229—~3.1kAutomated safety check: PassMIT
Requirement Ledger CLI Workflowadand-91/gpt-6-astra-skill126—~1.5kAutomated safety check: PassMIT
Migrating Claude Agent SDK To Pydantic AIpydantic/pydantic-ai20k—~1.6kAutomated safety check: PassMIT
Migrating Google Adk To Pydantic AIpydantic/pydantic-ai20k—~1.6kAutomated safety check: PassMIT

Similar skills

  • Mspm0 Ccs

    mc3545dada/mspm0-skill

    Tool-neutral CLI agent rules for TI MSPM0 development with Code Composer Studio, Keil/uVision, CMake/GCC/OpenOCD, SysConfig, and DriverLib.

    374 GitHub stars~4.5k tokensUpdated 2 mo ago
    Agent WorkflowsAuto-check passed
  • Goal Prompt Builder

    win4r/goal-prompt-builder

    Build high-quality /goal commands for OpenAI Codex CLI 0.128+ that maximize audit-friendliness and minimize false-completion.

    229 GitHub stars~3.1k tokensUpdated 5 mo ago
    Agent WorkflowsAuto-check passed
  • Requirement Ledger CLI Workflow

    adand-91/gpt-6-astra-skill

    Runs an evidence-bound audit, daily or weekly review through the requirement-ledger CLI, binding scope and authority first and blocking the final report until a handoff check passes.

    126 GitHub stars~1.5k tokensUpdated 23 days ago
    Agent WorkflowsAuto-check passed
  • Official

    Migrate Python applications from the Claude Agent SDK to Pydantic AI and, only when needed, Pydantic AI Harness.

    20k GitHub stars~1.6k tokensUpdated today
    Agent WorkflowsAuto-check passed
  • Official

    Migrate Python Google Agent Development Kit (ADK) applications to Pydantic AI.

    20k GitHub stars~1.6k tokensUpdated today
    Agent WorkflowsAuto-check passed
  • Lintlang

    hermes-labs-ai/lintlang

    Lint AI agent instruction files (SKILL.md, CLAUDE.md, AGENTS.md, GEMINI.md), tool definitions, system prompts, and agent configs with the deterministic LintLang CLI.

    138 GitHub stars~1.7k tokensUpdated today
    Agent WorkflowsAuto-check passed

More from divar-ir/ai-doc-gen

  • Analyze Codebase

    divar-ir/ai-doc-gen

    Run a multi-agent deep analysis of a codebase, producing AI-readable analysis documents in .ai/docs/ covering structure, dependencies, data flow, request flow, and APIs.

    767 GitHub stars~899 tokensUpdated 2 mo ago
    Auto-check passed
  • Generate Readme

    divar-ir/ai-doc-gen

    Generate or refresh a comprehensive, professional README.md for a repository, with architecture overview, mermaid and optional C4 diagrams, repository structure, dependencies, and API documentation.

    767 GitHub stars~996 tokensUpdated 2 mo ago
    Auto-check passed

Categories

Questions about Generate AI Rules

What does Generate AI Rules do?

Generate AI assistant configuration files for a repository — CLAUDE.md, AGENTS.md, and Cursor rules (.cursor/rules/.mdc) — from codebase analysis. Generate AI Rules is an agent skill from divar-ir/ai-doc-gen.mdc) — from codebase analysis.

When should I use Generate AI Rules?

Generate AI Rules fits situations like: the user wants to create; update CLAUDE.md; AI coding assistant configuration; onboard AI tools to a project.

How do I install Generate AI Rules in Claude Code?

Run `npx skills add divar-ir/ai-doc-gen --skill generate-ai-rules -a claude-code`. Or copy the skill folder (skills/generate-ai-rules in divar-ir/ai-doc-gen) into .claude/skills/generate-ai-rules in your project. Claude Code loads it when a task matches its description.

How do I install Generate AI Rules in Codex?

Run `npx skills add divar-ir/ai-doc-gen --skill generate-ai-rules -a codex`. Or copy the skill folder (skills/generate-ai-rules in divar-ir/ai-doc-gen) into .agents/skills/generate-ai-rules in your project. Codex loads it when a task matches its description.

Can I use Generate AI Rules in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add divar-ir/ai-doc-gen --skill generate-ai-rules -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/generate-ai-rules, .gemini/skills/generate-ai-rules, .github/skills/generate-ai-rules and .opencode/skills/generate-ai-rules in your project.

What does Generate AI Rules need to run?

Going by SKILL.md and its folder, Generate AI Rules needs the command-line tools its instructions call (uv).

Does Generate AI Rules access the network?

SKILL.md contains no URLs. Its commands use uv, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Generate AI Rules safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Generate AI Rules use?

Generate AI Rules is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Generate AI Rules use?

About 1.2k tokens (SKILL.md is roughly 4.9k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Generate AI Rules?

Skills that share tags, products or a category with Generate AI Rules: Mspm0 Ccs (mc3545dada/mspm0-skill, 374 stars), Goal Prompt Builder (win4r/goal-prompt-builder, 229 stars), Requirement Ledger CLI Workflow (adand-91/gpt-6-astra-skill, 126 stars) and Migrating Claude Agent SDK To Pydantic AI (pydantic/pydantic-ai, 20k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Generate AI Rules?

divar-ir (a GitHub organization) maintains it in divar-ir/ai-doc-gen, which has 767 GitHub stars. The repository holds 3 skills in this directory. The repository was last updated on July 21, 2026.

Source: divar-ir/ai-doc-gen on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.