create-readme-from-codebase

A rule for creating a README file by examining an existing codebase. It covers the project structure, dependencies, entry points, configuration, testing, and purpose.

In plain words
What is it for?
Analyzing a repository, identifying its technology and setup, asking about unclear project details, and producing an accurate README.md.
Why use it?
Documentation written from assumptions can describe the wrong project. Reading the code first helps keep the README aligned with what the software actually contains.

Cursor rule

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/holasoymalva/readme-generator-toolkit/create-readme-from-codebase
Clone the repo
git clone --depth 1 https://github.com/holasoymalva/README-Generator-Toolkit
Per session 10 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,336 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00010 $0.01336
Opus 5 $0.00005 $0.00668
Sonnet 5 $0.00002 $0.00267
Haiku 4.5 $0.00001 $0.00134

Measured 2d ago against content hash 1909bd964f6a, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

create-readme-from-codebase scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

mdc/create-readme-from-codebase.mdc · 165 lines

How it starts

The opening of the file, as written. The whole thing — 165 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Rule: Generate README from Codebase Analysis

Goal

To guide an AI assistant in creating a comprehensive, accurate README.md file by analyzing an existing codebase. The README should reflect the actual project structure, dependencies, and functionality found in the code.

Process

  1. Receive Codebase Reference: The user provides access to relevant files and directories using @ tags (e.g., @package.json @src/ @components/).

  2. Analyze Codebase: Systematically examine the provided files to understand:

    • Project structure and architecture
    • Dependencies and technology stack
    • Main entry points and key components
    • Configuration files and build processes
    • Existing documentation or comments
    • Testing setup and patterns
  3. Ask Clarifying Questions: Based on the analysis, ask specific questions to fill gaps:

    • Project Purpose: "Based on the code, this appears to be a [description]. Is this correct? What specific problem does it solve?"
    • Target Audience: "Who is the intended user - developers, end-users, or both?"
    • Key Features: "I can see functionality for [list discovered features]. Are there other important features to highlight?"
    • Environment: "What are the typical deployment environments or platforms?"
    • Project Status: "What's the current development status and stability level?"
    • Missing Context: "Are there any important aspects not evident from the code that should be documented?"
  4. Generate README: Create a comprehensive README based on code analysis and user responses.

  5. Save File: Save as README.md in the project root directory.

Codebase Analysis Strategy

Phase 1: Project Structure Analysis

  • Examine root directory files (package.json, requirements.txt, Cargo.toml, etc.)
  • Identify main entry points (main.js, index.html, app.py, etc.)
  • Map directory structure and organization patterns
  • Identify configuration files and environment settings

Phase 2: Technology Stack Detection

  • Parse dependency files to identify frameworks and libraries
  • Analyze import/require statements to understand usage patterns
  • Identify build tools, bundlers, and development tools
  • Detect testing frameworks and CI/CD configurations

Read the full file on GitHub · 165 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 165 lines · 10 tokens per session scan A 1909bd964f6a

Subscribe to this mod's changes

create-readme-from-codebase is a cursor rule published in the GitHub repository holasoymalva/README-Generator-Toolkit (4 stars, last pushed 1y ago), licensed Apache-2.0. It adds 10 tokens to every session and 1,336 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.