# Agents Md Generator

> Generate or update AGENTS.md/CLAUDE.md files for AI coding agents through auto-scanning project files combined with interactive Q&A. Supports multiple tech stacks, development environments, and preserves customizations when updating.

- **Type:** Skill
- **Install:** `agentstack add skill-thienanblog-awesome-ai-agent-skills-agents-md-generator`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [thienanblog](https://agentstack.voostack.com/s/thienanblog)
- **Installs:** 0
- **Category:** [Agent Skills](https://agentstack.voostack.com/c/agent-skills)
- **Latest version:** 0.1.0
- **License:** Apache-2.0
- **Upstream author:** [thienanblog](https://github.com/thienanblog)
- **Source:** https://github.com/thienanblog/awesome-ai-agent-skills/tree/main/skills/agents-md-generator

## Install

```sh
agentstack add skill-thienanblog-awesome-ai-agent-skills-agents-md-generator
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# AGENTS.md / CLAUDE.md Generator

## Overview

This skill helps you generate comprehensive instruction files (AGENTS.md with optional CLAUDE.md compatibility) that teach AI coding agents how to work effectively in your project. It combines automatic project scanning with interactive questions to create tailored guidelines.

**When to use this skill:**
- Setting up a new project for AI-assisted development
- Updating existing instruction files after project changes
- Standardizing AI agent behavior across team members
- Migrating from one AI tool to another

## Key Principle

**Do not duplicate specialized skills.** If a request falls into a specialized domain (e.g., Design System), delegate to the specialized skill when available.

**Use `AGENTS.md` as the shared project manual.** `AGENTS.md` is plain Markdown with no required fields. Cover the details an agent needs to work effectively: project overview, build and test commands, code style, testing expectations, security notes, PR/commit rules, and deployment gotchas.

**Handle `AGENTS.override.md` as a Codex-specific override, not the default.** Codex checks `AGENTS.override.md` before `AGENTS.md` at both global and project-directory scopes, and includes at most one instruction file per directory. If both files exist in the same directory, Codex uses `AGENTS.override.md` and ignores that directory's `AGENTS.md`. Create or update `AGENTS.override.md` only when the user explicitly wants a Codex-specific or nested-directory override.

**Respect Codex instruction discovery.** Codex builds its instruction chain once per run/session: global instructions first, then project files from repository root down to the current working directory. The global Codex directory defaults to `~/.codex` and can be changed with `CODEX_HOME`. Files closer to the current directory appear later and override earlier guidance. Codex skips empty files and stops adding files when the combined size reaches `project_doc_max_bytes` (32 KiB by default). If `~/.codex/config.toml` defines `project_doc_fallback_filenames`, Codex checks those names after `AGENTS.override.md` and `AGENTS.md`.

**Use `CLAUDE.md` only as Claude Code compatibility by default.** Claude Code reads `CLAUDE.md`, not `AGENTS.md` directly, so a shared setup needs a `CLAUDE.md` file that imports `AGENTS.md`.

## Quick Start

To generate a new AGENTS.md file:
1. Navigate to your project root
2. Tell the AI agent: "Use the agents-md-generator skill to create an AGENTS.md file"
3. Answer the interactive questions about your project
4. Review and customize the generated file

### Answering Questions (Convenient Formats)

When this skill asks numbered questions with lettered options, users can answer in any style:

- Short form (fast): `1a 2b 3c`
- Mixed form: `1a 2b 3c 4b (also scan packages/*) 5d`
- Full sentences: “Use medium scan depth and Docker Compose; service name is app.”

Short form is never required; it is only provided for convenience.

### Generation Modes

**Interactive Mode (Default):**
- Guides you through each phase with questions
- Best for first-time setup or complex projects
- Maximum customization

**Quick Mode:**
- Tell the AI: "Generate AGENTS.md in quick mode"
- Skips all questions, uses auto-detection only
- Best for experienced users or simple projects
- Uses Medium scan depth by default
- Generates all standard sections based on detection

## Interactive Workflow

### Phase 1: Initialization & Discovery

**Check for existing files:**
1. Look for `CLAUDE.md`, `AGENTS.md`, and `AGENTS.override.md` in the project root.
2. If `AGENTS.md` exists, ask user: "I found an existing AGENTS.md. Would you like to:"
   1. Update it (merge new content while preserving customizations)
   2. Replace it (generate fresh, backup existing)
   3. Cancel
   - Reply examples (optional): `1` or `update`; `2` or `replace`; `3` or `cancel`
3. If `CLAUDE.md` exists but `AGENTS.md` does not, ask user before changing it:
   1. Migrate to `AGENTS.md` as the primary file and replace `CLAUDE.md` with a compatibility reference to `AGENTS.md`
   2. Keep `CLAUDE.md` and `AGENTS.md` side by side with separate instructions for different AI agents
   3. Cancel
   - Reply examples (optional): `1` or `migrate`; `2` or `keep both`; `3` or `cancel`
4. If both `AGENTS.md` and `CLAUDE.md` exist, ask whether `AGENTS.md` should become the single source of truth with `CLAUDE.md` referencing it, or whether the user intentionally wants both files to remain independent.
5. If `AGENTS.override.md` exists, explain that Codex gives it priority over `AGENTS.md` in that directory. Ask whether to update the override, merge it back into `AGENTS.md`, or leave it as a Codex-specific override.

**Determine primary file:**
- Default: `AGENTS.md` as primary source of truth.
- `AGENTS.override.md` is not the primary file. Use it only for Codex-specific overrides, temporary overrides, or nested directory rules that should supersede broader `AGENTS.md` guidance for Codex.
- `CLAUDE.md` is a secondary compatibility file for Claude Code, because Claude Code reads `CLAUDE.md` rather than `AGENTS.md` directly. Do not use symbolic links; some AI agents may read both files and duplicate context.
- When sharing the same instructions with Claude Code, make `CLAUDE.md` a normal text file whose first line is:
  ```markdown
  @AGENTS.md
  ```
- Additional Claude-specific instructions may be added below the import only when the user explicitly wants them.
- If the project already has a meaningful `CLAUDE.md`, ask the user before replacing it. The user may prefer to keep both files with different guidance for different AI tools.

### Phase 1b: Agent Tooling & System Prompt Alignment (Scripted)

**Goal:** Detect AI tool instruction files, global system prompts, and MCP configs using scripts (not AI scanning) to save tokens and avoid missing overrides.

**Run the detection script (best effort):**
- bash/zsh: `bash skills/agents-md-generator/scripts/detect-agent-context --root .`
- Windows cmd: `skills\agents-md-generator\scripts\detect-agent-context.cmd --root .`

The script should report:
- Project instruction files for AI tools (Copilot, Cursor, Cline, Kilo Code, Roo Code, OpenCode, Codex, Claude Code)
- Global instruction files (e.g., `~/.claude/CLAUDE.md`, `~/.codex/AGENTS.override.md`, `~/.codex/AGENTS.md`, `~/.codex/config.toml`, `~/.roo/rules/`, `~/.kilocode/rules/`)
- MCP config files and server names (from `.mcp.json`, `.roo/mcp.json`, `mcp_settings.json`, plus any `--mcp-path` entries)

**If script is unavailable:**
- Do a minimal manual check using the paths listed in `references/tech-stack-detection.md` under **AI Agent Tooling Detection**.

**Warn the user about overrides:**
- If `~/.claude/CLAUDE.md` or other global instruction files exist, explicitly warn that they can override project prompts.
- Ask the user to review or adjust those system prompts to avoid conflicts with this repo.

**Ask the user to confirm tool usage:**
```
I detected these AI tool instruction sources:
- .github/copilot-instructions.md (GitHub Copilot)
- .cursorrules (Cursor)
- .clinerules or .clinerules/ (Cline)
- .kilocoderules / .kilo/ / .kilocodemodes (Kilo Code)
- .roo/rules/ / .roo/rules-* / .roorules* (Roo Code)
- opencode.jsonc (OpenCode)
- AGENTS.override.md / AGENTS.md (Codex project instructions)
- ~/.codex/AGENTS.override.md / ~/.codex/AGENTS.md / ~/.codex/config.toml (Codex global instructions and config)
- .claude/CLAUDE.md or ~/.claude/CLAUDE.md (Claude Code)

Which of these do you actively use for this project, and should we align or ignore any of them?
```

**If MCP servers are detected:**
- Ask whether they should be used in this project.
- Capture a short purpose/usage note for each server.

### Phase 1c: Skill Library Duplicate Scan (Scripted)

If a `skills/` folder exists, run the duplicate scan script to avoid copy-pasted skills:
- bash/zsh: `bash skills/agents-md-generator/scripts/scan-skill-duplicates --skills-dir skills`
- Windows cmd: `skills\agents-md-generator\scripts\scan-skill-duplicates.cmd --skills-dir skills`

If duplicates are detected:
- Recommend choosing one canonical folder under `skills/` and merging any unique content into it.
- Do not recommend symbolic links for duplicate skill folders; agent scanners may count both paths as separate context.
- If a duplicate only exists under `plugins//skills/`, treat it as a generated package copy. Edit the source under `skills/` and run `npm run sync`.

### Phase 2: Scan Depth Selection

**Ask the user:**
```
What scan depth should I use to analyze your project?

1. Quick (approximately 30 seconds)
   Scans: package.json, composer.json, docker-compose.yml, pyproject.toml,
          Gemfile, go.mod, Cargo.toml, and other root config files
   Best for: When you know your stack well and want fast generation

2. Medium (approximately 1-2 minutes) [RECOMMENDED]
   Scans: Root configs + src/, app/, lib/, config/, routes/, components/,
          pages/, views/, controllers/, models/, services/
   Best for: Most projects - good balance of accuracy and speed

3. Deep (approximately 3-5 minutes)
   Scans: Entire project tree including tests/, docs/, scripts/, all
          subdirectories, hidden configs, and build artifacts
   Best for: Complex projects, monorepos, or unfamiliar codebases

Reply examples:
- Short: `2` (or `1` / `3`)
- With extra notes: `2 (also scan packages/*)`
```

**Scan actions per depth:**

| Depth | Files Scanned | Directories Explored |
|-------|---------------|---------------------|
| Quick | Root configs only | None (root level) |
| Medium | Configs + source headers | src/, app/, lib/, config/, routes/ |
| Deep | All files | Full tree traversal |

### Phase 3: Environment Detection

**Ask the user:**
```
What development environment does this project use?

1. Docker Compose
   - Commands run via: docker compose exec  
   - Example: docker compose exec app php artisan migrate

2. Laravel Sail
   - Commands run via: ./vendor/bin/sail 
   - Example: ./vendor/bin/sail artisan migrate

3. Native/Host Machine
   - Commands run directly on your machine
   - Example: php artisan migrate

4. Dev Containers / Codespaces
   - Commands run inside the container environment

5. Other (please describe)
   - Specify your custom environment setup

Reply examples:
- Short: `1` (or `2` / `3` / `4` / `5`)
- Detailed: `1; main service is app; node runs in node service`
```

**Follow-up questions based on selection:**
- Docker: "What is the main service name? (e.g., app, web, php)"
- Docker: "Do you have separate services for different runtimes? (e.g., app for PHP, node for JS)"
- Native: "Do you use any version managers? (nvm, rbenv, pyenv, etc.)"

### Phase 4: Auto-Detection + Confirmation

**Scan the project based on selected depth and detect:**

1. **Backend Framework:**
   - Laravel (composer.json + artisan)
   - Express/Node (package.json + server files)
   - Django/Flask (requirements.txt + manage.py/app.py)
   - Rails (Gemfile + config/routes.rb)
   - Spring Boot (pom.xml/build.gradle + @SpringBootApplication)

2. **Frontend Framework:**
   - Vue.js (package.json + .vue files)
   - React (package.json + .jsx/.tsx files)
   - Angular (angular.json)
   - Svelte (svelte.config.js)
   - Next.js/Nuxt.js (next.config.js/nuxt.config.ts)

3. **Package Manager:**
   - npm/yarn/pnpm/bun (package-lock.json/yarn.lock/pnpm-lock.yaml/bun.lockb)
   - Composer (composer.lock)
   - pip/poetry (requirements.txt/poetry.lock)

4. **Testing Framework:**
   - PHPUnit (phpunit.xml)
   - Pest (pestphp/pest in composer.json)
   - Jest (jest.config.js)
   - Vitest (vitest.config.ts)
   - pytest (pytest.ini/conftest.py)

5. **Code Style/Linting:**
   - Laravel Pint (pint.json)
   - ESLint (.eslintrc.*)
   - Prettier (.prettierrc.*)
   - PHP CS Fixer (.php-cs-fixer.php)

6. **Database:**
   - MySQL/MariaDB (config references)
   - PostgreSQL (config references)
   - SQLite (database/*.sqlite)
   - MongoDB (mongoose in package.json)

7. **AI Agent Tooling (scripted detection):**
   - GitHub Copilot (`.github/copilot-instructions.md`)
   - Cursor (`.cursorrules`)
   - Cline (`.clinerules` or `.clinerules/`)
   - Kilo Code (`.kilocoderules`, `.kilo/`, `.kilocodemodes`, `.kilocode/config.json`)
   - Roo Code (`.roo/rules/`, `.roo/rules-*`, `.roorules*`, `.roo/mcp.json`, `mcp_settings.json`)
   - OpenCode (`opencode.jsonc`, `OPENCODE_CONFIG`)
   - Codex (`AGENTS.override.md`, `AGENTS.md`, `~/.codex/AGENTS.override.md`, `~/.codex/AGENTS.md`, `~/.codex/config.toml`)
   - Claude Code (`.claude/CLAUDE.md`, `~/.claude/CLAUDE.md`, `.mcp.json`)

**Present findings to user:**
```
I detected the following tech stack:

Backend:
  - Laravel 11 (high confidence)
  - PHP 8.3 (from composer.json)

Frontend:
  - Vue.js 3 with Composition API (high confidence)
  - TailwindCSS v3 (from package.json)

Testing:
  - Pest PHP (from composer.json)
  - Vitest (from package.json)

Code Style:
  - Laravel Pint (pint.json found)
  - ESLint + Prettier (configs found)

Environment:
  - Docker Compose detected (docker-compose.yml)
  - Services: app, mysql, redis

Is this correct? Would you like to add or modify anything?
```

### Phase 4b: Optional Sections (Interactive Mode Only)

**Ask the user about optional sections:**
```
Would you like to include any of these optional sections?

1. CI/CD Configuration
   - Detect: GitHub Actions, GitLab CI, CircleCI, Jenkins
   - Include: Pipeline commands, deployment notes

2. Git Workflow Guidelines
   - Include: Branch naming, commit message format, PR guidelines
   - Detect: .github/PULL_REQUEST_TEMPLATE.md, commitlint config

3. Security Guidelines
   - Include: Env file handling, secrets management, input validation
   - Best practices for the detected stack

4. API Documentation
   - Detect: OpenAPI/Swagger specs, Postman collections
   - Include: Documentation conventions and tooling

5. Mobile App Guidelines (if detected)
   - React Native / Flutter specific patterns
   - Platform-specific considerations

6. Monorepo Guidelines (if detected)
   - Nx / Turborepo / Lerna workspace patterns
   - Package management and dependencies

7. System Prompt Alignment (if detected)
   - Document global or editor-level prompts that can override project rules
   - Remind contributors to review and align prompts

8. MCP Servers & Tooling (if detected)
   - List MCP servers and when to use them
   - Include required environment variables or access notes

9. Project Progress Memory (PROGRESS.md)
   - Ask if the team wants `PROGRESS.md` for continuity across tasks
   - Require an `Original Prompt` section so future runs can compare intent vs current status

Select the sections you need (comma-separated numbers, or 'none' to skip):

Reply examples:
- Short: `none`
- Multiple: `1,3,4`
- With extra notes: `2,3,7 (also include branch naming rules)`
```

**Note:** In Quick Mode, these optional sections are skipped unless auto-detected with high confidence.

### Phase 5: Section Generation

Generate the following sections based on detected stack and user input:

#### Section 1: Header & Role
```markdown
# AI Agent Guidelines & Repository Manual

**Role:** You are an expert Senior [DETECTED_ROLE] and Technical Lead.
You are responsible for the entire lifecycle of a task: understanding,
planning, [STACK_SPECIFIC_RESPONSIBILITIES].
```

**Role detection rules:**
- Laravel only → "Laravel Backend Engineer"
- Vue/React only → "[Framework] Frontend Engineer"
- Laravel + Vue/React → "Full-Stack Developer"
- Node.js backend → "Node.js Backend Engineer"
- Generic → "Software Engineer"

#### Section 2: Auto-Pilot Workflow

Generate the 6-step workflow cycle:
1. **Discovery & Context** - What to read first, where to find docs
2. **Plan** - How to break down tasks, constraints to check
3. **Documentation** - When to update docs, what format to use
4. **Implementation** - Coding standards, patterns to follow
5. **Verification & Refinement** - Test

…

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [thienanblog](https://github.com/thienanblog)
- **Source:** [thienanblog/awesome-ai-agent-skills](https://github.com/thienanblog/awesome-ai-agent-skills)
- **License:** Apache-2.0

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** yes
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-thienanblog-awesome-ai-agent-skills-agents-md-generator
- Seller: https://agentstack.voostack.com/s/thienanblog
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
