claude-init

claude-init

Generates AI context files (CLAUDE.md, AGENTS.md, Cursor/Windsurf/Cline/Continue/Kilo Code/Trae rules, GEMINI.md, Copilot, Aider, Junie, Warp) for any repository. Runs as CLI or MCP server, 100% local.

Category
访问服务器

README

<div align="center">

claude-init

One command generates the AI context files for every coding assistant - from one repo scan.

CLAUDE.md · AGENTS.md · Cursor · Windsurf · Cline · Continue · Kilo Code · Trae · Copilot · GEMINI.md · Aider · Junie · Warp

npx @horiastanxd/claude-init

npm version CI license node Glama MCP

</div>

<div align="center">

claude-init demo

</div>


Why

Every AI coding tool wants a file describing your project - and they all use a different name and format. Keeping over a dozen of them in sync by hand is busywork, and the moment your stack changes they go stale.

claude-init scans your repo once - stack, scripts, structure, env vars, conventions, git - and writes all of them in seconds. No API key, no network, 100% local.

$ npx @horiastanxd/claude-init
✔ Analyzed my-app (TypeScript, Next.js)
  + CLAUDE.md
  + AGENTS.md
  + .cursor/rules/project.mdc
  + .windsurf/rules/project.md
  + .clinerules/project.md
  + .continue/rules/project.md
  + .kilocode/rules/project.md
  + .trae/rules/project_rules.md
  + .github/copilot-instructions.md
  + GEMINI.md
  + CONVENTIONS.md
  + .junie/guidelines.md
  + WARP.md

Done. 13 file(s) generated.

Supported tools

Target (-t) File written Read by
claude CLAUDE.md Claude Code
agents AGENTS.md OpenAI Codex, Jules, Amp, Zed, Devin, RooCode, Factory, +20 agents
cursor .cursor/rules/project.mdc Cursor (modern .mdc rules)
windsurf .windsurf/rules/project.md Windsurf / Codeium
cline .clinerules/project.md Cline, Roo Code
continue .continue/rules/project.md Continue
kilocode .kilocode/rules/project.md Kilo Code
trae .trae/rules/project_rules.md Trae IDE
copilot .github/copilot-instructions.md GitHub Copilot
gemini GEMINI.md Gemini CLI
aider CONVENTIONS.md Aider
junie .junie/guidelines.md JetBrains Junie
warp WARP.md Warp terminal

AGENTS.md is becoming the shared standard - one file read by a growing list of agents. claude-init generates it alongside each tool's native format, so you are covered both ways.

Usage

npx @horiastanxd/claude-init                      # generate everything in the current repo
npx @horiastanxd/claude-init ./path/to/repo       # analyze a different directory
npx @horiastanxd/claude-init -t claude,cursor     # only specific tools
npx @horiastanxd/claude-init --overwrite          # refresh files that already exist
npx @horiastanxd/claude-init --dry-run            # print the analysis as JSON, write nothing
npx @horiastanxd/claude-init --recurse            # also generate into each workspace package (monorepo)
npx @horiastanxd/claude-init --enrich             # opt-in: sharpen the description with an LLM (needs ANTHROPIC_API_KEY)
npx @horiastanxd/claude-init list                 # show all targets and their paths

By default existing files are left untouched - re-run with --overwrite to refresh them after your stack changes.

claude-init [generate] [dir]   analyze a repo and write context files (default)
claude-init check [dir]        verify files are up to date (exit 1 on drift)
claude-init list               list supported targets
claude-init mcp                run as an MCP server over stdio

Options:
  -t, --targets <list>   comma-separated target ids, or "all"   (default: all)
  -o, --output <dir>     output directory                        (default: .)
  --overwrite            overwrite existing files
  --dry-run              print the analysis as JSON, write nothing
  --recurse              also generate into each workspace package (monorepo)
  --enrich               use an LLM to enrich the project description (opt-in)
  --enrich-model <model> model for --enrich            (default: claude-opus-4-8)

--enrich is the one feature that leaves your machine, and it is off by default - everything else is 100% local. It needs ANTHROPIC_API_KEY and the Anthropic SDK (npm install @anthropic-ai/sdk); if either is missing, generation continues without enrichment, so nothing breaks.

For a monorepo, --recurse reads the workspaces from package.json (workspaces) or pnpm-workspace.yaml, then generates context files in the root and in each package, analyzing every package on its own. It works for both generate --recurse and check --recurse (and the MCP tools take a recurse flag).

Keep context files fresh

claude-init check regenerates in memory and compares against disk, exiting non-zero on drift. Wire it into CI or a pre-commit hook so your context never rots.

pre-commit (.git/hooks/pre-commit or pre-commit):

npx @horiastanxd/claude-init check || {
  echo "AI context files are stale - run: npx @horiastanxd/claude-init --overwrite"
  exit 1
}

GitHub Actions:

- run: npx @horiastanxd/claude-init check

Example output

<details> <summary><code>CLAUDE.md</code> generated for a Next.js + Prisma app</summary>

# my-app

A demo application.

## Stack
- Language: TypeScript
- Framework: Next.js
- Runtime: Node.js
- Package manager: pnpm
- Database: Prisma ORM
- Testing: Vitest

## Commands
```bash
pnpm install   # install
pnpm run dev   # dev
pnpm run test  # test

Code conventions

  • TypeScript strict mode is enabled - keep full type safety, avoid any.
  • Linter: ESLint. Run it before committing.
  • Formatter: Prettier. Do not hand-format against it.

Environment variables

Copy .env.example to .env and set:

  • DATABASE_URL (required) - Postgres connection string

</details>

## MCP server

`claude-init` also runs as a [Model Context Protocol](https://modelcontextprotocol.io)
server, so an agent can analyze a repo and write the context files itself.

```bash
# Claude Code
claude mcp add claude-init -- npx @horiastanxd/claude-init --mcp

Tools exposed: analyze_project, generate_context_files, check_context_files.

What gets detected

  • Stack - language, framework, runtime, package manager, database, test runner, build tool
  • Commands - install / dev / build / test / lint / format, plus other scripts, Makefile / justfile / Taskfile targets, and commands from .github/workflows
  • Structure - a trimmed file tree, entry points, config files
  • Conventions - strict mode, linter, formatter, import style, commit convention
  • Env vars - parsed from .env.example, with inline comments as descriptions
  • Git - default branch, remote, top authors, frequently changed files

Languages: JS/TS (npm, pnpm, yarn, bun), Python (pip, uv, poetry), Rust (cargo), Go (modules), Java (Maven, Gradle), Ruby (Bundler), and PHP (Composer).

Use as a library

import { analyzeProject, generateClaudeMd, buildFiles } from 'claude-init';

const analysis = await analyzeProject(process.cwd());
const md = generateClaudeMd(analysis);

// or render every target in memory
for (const file of buildFiles(analysis)) {
  console.log(file.relPath, file.content.length);
}

Development

npm install
npm run dev -- --dry-run   # run from source
npm test
npm run build

Contributions welcome - adding a new tool is usually a single entry in src/generators/registry.ts. See CONTRIBUTING.md.

Roadmap

  • More tools as their formats stabilize

Ideas and PRs welcome.

Star History

Star History Chart

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选