readme-generator

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

README Generator

README 生成器

Expert in creating comprehensive, well-structured README files with proper formatting, sections, badges, and documentation best practices.
专业创建内容全面、结构清晰的README文件,遵循格式规范、章节划分、徽章使用及文档编写最佳实践。

README Template

README 模板

markdown
undefined
markdown
undefined

Project Name

项目名称

Build Status npm version License: MIT Coverage
Brief, compelling description of what the project does and why it's useful.
Build Status npm version License: MIT Coverage
简洁有力的项目功能及价值说明。

Features

功能特性

  • ✅ Feature one with brief explanation
  • ✅ Feature two with brief explanation
  • ✅ Feature three with brief explanation
  • 🚧 Upcoming feature (in development)
  • ✅ 功能一(简要说明)
  • ✅ 功能二(简要说明)
  • ✅ 功能三(简要说明)
  • 🚧 待开发功能(开发中)

Quick Start

快速开始

```bash
bash
undefined

Install

安装

npm install package-name
npm install package-name

Run

运行

npx package-name init ```
npx package-name init
undefined

Installation

安装步骤

Prerequisites

前置要求

  • Node.js 18+
  • npm 9+ or yarn 1.22+
  • Node.js 18+
  • npm 9+ 或 yarn 1.22+

npm

npm 安装

```bash npm install package-name ```
bash
npm install package-name

yarn

yarn 安装

```bash yarn add package-name ```
bash
yarn add package-name

pnpm

pnpm 安装

```bash pnpm add package-name ```
bash
pnpm add package-name

Usage

使用方法

Basic Example

基础示例

```javascript import { Client } from 'package-name';
const client = new Client({ apiKey: process.env.API_KEY });
const result = await client.doSomething({ input: 'Hello, World!' });
console.log(result); ```
javascript
import { Client } from 'package-name';

const client = new Client({
  apiKey: process.env.API_KEY
});

const result = await client.doSomething({
  input: 'Hello, World!'
});

console.log(result);

Advanced Configuration

高级配置

```javascript const client = new Client({ apiKey: process.env.API_KEY, timeout: 30000, retries: 3, debug: process.env.NODE_ENV === 'development' }); ```
javascript
const client = new Client({
  apiKey: process.env.API_KEY,
  timeout: 30000,
  retries: 3,
  debug: process.env.NODE_ENV === 'development'
});

API Reference

API 参考

Client(options)

Client(options)

Creates a new client instance.
ParameterTypeRequiredDefaultDescription
apiKey
string
Yes-Your API key
timeout
number
No
10000
Request timeout in ms
retries
number
No
0
Number of retry attempts
创建新的客户端实例。
参数类型必填默认值说明
apiKey
string
-你的API密钥
timeout
number
10000
请求超时时间(毫秒)
retries
number
0
重试次数

client.doSomething(params)

client.doSomething(params)

Performs the main operation.
Parameters:
  • input
    (string, required): The input to process
  • options
    (object, optional): Additional options
Returns:
Promise<Result>
Example:
```javascript const result = await client.doSomething({ input: 'test', options: { format: 'json' } }); ```
执行主要操作。
参数:
  • input
    (字符串,必填):待处理的输入内容
  • options
    (对象,可选):额外配置选项
返回值:
Promise<Result>
示例:
javascript
const result = await client.doSomething({
  input: 'test',
  options: { format: 'json' }
});

Configuration

配置说明

Create a
config.json
file in your project root:
```json { "apiKey": "${API_KEY}", "environment": "production", "features": { "caching": true, "logging": false } } ```
在项目根目录创建
config.json
文件:
json
{
  "apiKey": "${API_KEY}",
  "environment": "production",
  "features": {
    "caching": true,
    "logging": false
  }
}

Environment Variables

环境变量

VariableDescriptionRequired
API_KEY
Your API keyYes
DEBUG
Enable debug modeNo
LOG_LEVEL
Logging level (info, warn, error)No
变量说明必填
API_KEY
你的API密钥
DEBUG
启用调试模式
LOG_LEVEL
日志级别(info, warn, error)

Examples

更多示例

See the examples directory for more detailed examples:
  • Basic Usage
  • With TypeScript
  • Error Handling
  • Custom Configuration
查看 examples 目录获取更详细的示例:
  • 基础使用
  • TypeScript 示例
  • 错误处理
  • 自定义配置

Troubleshooting

问题排查

Common Issues

常见问题

"Authentication failed" error
Ensure your API key is valid and has the required permissions.
```bash
“Authentication failed” 错误
确保你的API密钥有效且具备所需权限。
bash
undefined

Verify your API key

验证API密钥

curl -H "Authorization: Bearer $API_KEY" https://api.example.com/verify ```
"Module not found" error
Make sure you have installed all dependencies:
```bash rm -rf node_modules package-lock.json npm install ```
curl -H "Authorization: Bearer $API_KEY" https://api.example.com/verify

**“Module not found” 错误**

确保已安装所有依赖:

```bash
rm -rf node_modules package-lock.json
npm install

Contributing

贡献指南

Contributions are welcome! Please read our Contributing Guide for details.
  1. Fork the repository
  2. Create your feature branch (
    git checkout -b feature/amazing-feature
    )
  3. Commit your changes (
    git commit -m 'Add amazing feature'
    )
  4. Push to the branch (
    git push origin feature/amazing-feature
    )
  5. Open a Pull Request
欢迎贡献代码!请阅读我们的 贡献指南 了解详情。
  1. Fork 本仓库
  2. 创建功能分支(
    git checkout -b feature/amazing-feature
  3. 提交变更(
    git commit -m 'Add amazing feature'
  4. 推送分支(
    git push origin feature/amazing-feature
  5. 发起 Pull Request

Development

开发流程

```bash
bash
undefined

Clone the repo

克隆仓库

Install dependencies

安装依赖

npm install
npm install

Run tests

运行测试

npm test
npm test

Run in development mode

启动开发模式

npm run dev ```
npm run dev
undefined

Changelog

更新日志

See CHANGELOG.md for a list of changes.
查看 CHANGELOG.md 获取变更记录。

License

许可证

This project is licensed under the MIT License - see the LICENSE file for details.
本项目采用 MIT 许可证 - 查看 LICENSE 文件了解详情。

Acknowledgments

致谢


Made with ❤️ by Your Name
undefined

Made with ❤️ by Your Name
undefined

Badge Reference

徽章参考

yaml
badges:
  build_status:
    github_actions: "[![Build](https://img.shields.io/github/actions/workflow/status/OWNER/REPO/WORKFLOW.yml?branch=BRANCH)](URL)"
    travis: "[![Build Status](https://img.shields.io/travis/OWNER/REPO.svg)](URL)"
    circleci: "[![CircleCI](https://img.shields.io/circleci/build/github/OWNER/REPO)](URL)"

  package_version:
    npm: "[![npm](https://img.shields.io/npm/v/PACKAGE.svg)](URL)"
    pypi: "[![PyPI](https://img.shields.io/pypi/v/PACKAGE.svg)](URL)"
    gem: "[![Gem](https://img.shields.io/gem/v/PACKAGE.svg)](URL)"

  coverage:
    codecov: "[![codecov](https://img.shields.io/codecov/c/github/OWNER/REPO)](URL)"
    coveralls: "[![Coverage](https://img.shields.io/coveralls/github/OWNER/REPO)](URL)"

  license:
    mit: "[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)"
    apache: "[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)"
    gpl: "[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)"

  downloads:
    npm: "[![Downloads](https://img.shields.io/npm/dm/PACKAGE.svg)](URL)"
    pypi: "[![Downloads](https://img.shields.io/pypi/dm/PACKAGE.svg)](URL)"

  quality:
    codacy: "[![Codacy Badge](https://img.shields.io/codacy/grade/PROJECT_ID)](URL)"
    code_climate: "[![Maintainability](https://img.shields.io/codeclimate/maintainability/OWNER/REPO)](URL)"

  social:
    stars: "[![GitHub stars](https://img.shields.io/github/stars/OWNER/REPO)](URL)"
    forks: "[![GitHub forks](https://img.shields.io/github/forks/OWNER/REPO)](URL)"
    watchers: "[![GitHub watchers](https://img.shields.io/github/watchers/OWNER/REPO)](URL)"
yaml
badges:
  build_status:
    github_actions: "[![Build](https://img.shields.io/github/actions/workflow/status/OWNER/REPO/WORKFLOW.yml?branch=BRANCH)](URL)"
    travis: "[![Build Status](https://img.shields.io/travis/OWNER/REPO.svg)](URL)"
    circleci: "[![CircleCI](https://img.shields.io/circleci/build/github/OWNER/REPO)](URL)"

  package_version:
    npm: "[![npm](https://img.shields.io/npm/v/PACKAGE.svg)](URL)"
    pypi: "[![PyPI](https://img.shields.io/pypi/v/PACKAGE.svg)](URL)"
    gem: "[![Gem](https://img.shields.io/gem/v/PACKAGE.svg)](URL)"

  coverage:
    codecov: "[![codecov](https://img.shields.io/codecov/c/github/OWNER/REPO)](URL)"
    coveralls: "[![Coverage](https://img.shields.io/coveralls/github/OWNER/REPO)](URL)"

  license:
    mit: "[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)"
    apache: "[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)"
    gpl: "[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)"

  downloads:
    npm: "[![Downloads](https://img.shields.io/npm/dm/PACKAGE.svg)](URL)"
    pypi: "[![Downloads](https://img.shields.io/pypi/dm/PACKAGE.svg)](URL)"

  quality:
    codacy: "[![Codacy Badge](https://img.shields.io/codacy/grade/PROJECT_ID)](URL)"
    code_climate: "[![Maintainability](https://img.shields.io/codeclimate/maintainability/OWNER/REPO)](URL)"

  social:
    stars: "[![GitHub stars](https://img.shields.io/github/stars/OWNER/REPO)](URL)"
    forks: "[![GitHub forks](https://img.shields.io/github/forks/OWNER/REPO)](URL)"
    watchers: "[![GitHub watchers](https://img.shields.io/github/watchers/OWNER/REPO)](URL)"

Section Guidelines

章节指南

yaml
essential_sections:
  title_and_badges:
    purpose: "Immediate project identification"
    elements:
      - "Project name (H1)"
      - "Key status badges"
      - "One-line description"

  features:
    purpose: "Highlight key capabilities"
    format: "Bullet list with checkmarks"
    length: "5-8 items maximum"

  quick_start:
    purpose: "Fastest path to running code"
    requirements:
      - "Copy-pasteable commands"
      - "Under 5 steps"
      - "Working example"

  installation:
    purpose: "Complete setup instructions"
    include:
      - "Prerequisites with versions"
      - "Multiple package managers"
      - "Platform-specific notes"

  usage:
    purpose: "Demonstrate core functionality"
    include:
      - "Basic example"
      - "Advanced configuration"
      - "Real-world use case"

  api_reference:
    purpose: "Complete function documentation"
    format:
      - "Function signature"
      - "Parameter table"
      - "Return type"
      - "Code example"

optional_sections:
  - "Architecture diagram"
  - "Benchmarks/Performance"
  - "FAQ"
  - "Roadmap"
  - "Security policy"
  - "Code of conduct"
yaml
essential_sections:
  title_and_badges:
    purpose: "快速识别项目"
    elements:
      - "项目名称(H1)"
      - "关键状态徽章"
      - "一行式描述"

  features:
    purpose: "突出核心能力"
    format: "带勾选标记的项目符号列表"
    length: "最多5-8项"

  quick_start:
    purpose: "最快运行代码的路径"
    requirements:
      - "可直接复制粘贴的命令"
      - "步骤不超过5个"
      - "可运行的示例"

  installation:
    purpose: "完整的安装说明"
    include:
      - "带版本要求的前置条件"
      - "多种包管理器支持"
      - "平台特定说明"

  usage:
    purpose: "演示核心功能"
    include:
      - "基础示例"
      - "高级配置"
      - "真实使用场景"

  api_reference:
    purpose: "完整的函数文档"
    format:
      - "函数签名"
      - "参数表格"
      - "返回类型"
      - "代码示例"

optional_sections:
  - "架构图"
  - "基准测试/性能"
  - "常见问题"
  - "路线图"
  - "安全政策"
  - "行为准则"

Writing Guidelines

写作指南

yaml
tone:
  - "Clear and concise"
  - "Action-oriented"
  - "Beginner-friendly"
  - "Scannable"

structure:
  headings: "Use H2 for main sections, H3 for subsections"
  lists: "Prefer bullet points over paragraphs"
  code: "Always include language identifier"
  tables: "Use for structured data (parameters, options)"

code_blocks:
  requirements:
    - "Always specify language"
    - "Include necessary imports"
    - "Show expected output when helpful"
    - "Use realistic values, not 'foo/bar'"

  example:
    good: |
      ```javascript
      import { Client } from 'my-package';

      const client = new Client({ apiKey: process.env.API_KEY });
      const result = await client.search('nodejs tutorials');
      console.log(result.items);
      ```
    bad: |
      ```
      const x = new X();
      x.foo();
      ```

anti_patterns:
  - "Wall of text without headings"
  - "Missing installation instructions"
  - "Outdated badges or broken links"
  - "Code examples that don't work"
  - "Assuming reader knowledge"
  - "Missing license information"
yaml
tone:
  - "清晰简洁"
  - "注重实操"
  - "对新手友好"
  - "易于快速浏览"

structure:
  headings: "主章节使用H2,子章节使用H3"
  lists: "优先使用项目符号列表而非段落"
  code: "始终指定语言标识"
  tables: "用于展示结构化数据(参数、选项)"

code_blocks:
  requirements:
    - "始终指定语言"
    - "包含必要的导入语句"
    - "必要时展示预期输出"
    - "使用真实值,而非'foo/bar'"

  example:
    good: |
      ```javascript
      import { Client } from 'my-package';

      const client = new Client({ apiKey: process.env.API_KEY });
      const result = await client.search('nodejs tutorials');
      console.log(result.items);
      ```
    bad: |
      ```
      const x = new X();
      x.foo();
      ```

anti_patterns:
  - "无标题的大段文字"
  - "缺少安装说明"
  - "过时的徽章或失效的链接"
  - "无法运行的代码示例"
  - "假设读者已有相关知识"
  - "缺少许可证信息"

Project Type Templates

项目类型模板

yaml
templates:
  library:
    sections:
      - "Title + Badges"
      - "Features"
      - "Installation"
      - "Quick Start"
      - "API Reference"
      - "Examples"
      - "Contributing"
      - "License"

  cli_tool:
    sections:
      - "Title + Badges"
      - "Features"
      - "Installation"
      - "Usage (with commands)"
      - "Configuration"
      - "Examples"
      - "Contributing"
      - "License"

  api_service:
    sections:
      - "Title + Badges"
      - "Features"
      - "Getting Started"
      - "Authentication"
      - "API Reference"
      - "Rate Limits"
      - "Error Handling"
      - "SDKs"
      - "Support"

  framework:
    sections:
      - "Title + Badges"
      - "Why This Framework"
      - "Features"
      - "Quick Start"
      - "Documentation"
      - "Examples"
      - "Ecosystem"
      - "Migration Guide"
      - "Contributing"
      - "License"
yaml
templates:
  library:
    sections:
      - "标题 + 徽章"
      - "功能特性"
      - "安装步骤"
      - "快速开始"
      - "API参考"
      - "示例"
      - "贡献指南"
      - "许可证"

  cli_tool:
    sections:
      - "标题 + 徽章"
      - "功能特性"
      - "安装步骤"
      - "使用方法(含命令)"
      - "配置说明"
      - "示例"
      - "贡献指南"
      - "许可证"

  api_service:
    sections:
      - "标题 + 徽章"
      - "功能特性"
      - "快速上手"
      - "认证方式"
      - "API参考"
      - "速率限制"
      - "错误处理"
      - "SDKs"
      - "支持"

  framework:
    sections:
      - "标题 + 徽章"
      - "选择本框架的理由"
      - "功能特性"
      - "快速开始"
      - "文档"
      - "示例"
      - "生态系统"
      - "迁移指南"
      - "贡献指南"
      - "许可证"

Visual Elements

视觉元素

yaml
diagrams:
  architecture: |
    ```
    ┌─────────────┐     ┌─────────────┐     ┌─────────────┐
    │   Client    │────▶│   Server    │────▶│  Database   │
    └─────────────┘     └─────────────┘     └─────────────┘
    ```

  flow: |
    ```
    Input ──▶ Validate ──▶ Process ──▶ Output
              Error
    ```

tables:
  comparison: |
    | Feature | This Project | Alternative A | Alternative B |
    |---------|--------------|---------------|---------------|
    | Speed   | ⚡ Fast      | 🐢 Slow       | 🚀 Fastest    |
    | Size    | 📦 Small     | 📦 Medium     | 📦 Large      |

  features: |
    | Feature | Free | Pro | Enterprise |
    |---------|:----:|:---:|:----------:|
    | Basic   | ✅   | ✅  | ✅         |
    | Advanced| ❌   | ✅  | ✅         |
    | Support | ❌   | ❌  | ✅         |
yaml
diagrams:
  architecture: |
    ```
    ┌─────────────┐     ┌─────────────┐     ┌─────────────┐
    │   Client    │────▶│   Server    │────▶│  Database   │
    └─────────────┘     └─────────────┘     └─────────────┘
    ```

  flow: |
    ```
    Input ──▶ Validate ──▶ Process ──▶ Output
              Error
    ```

tables:
  comparison: |
    | Feature | This Project | Alternative A | Alternative B |
    |---------|--------------|---------------|---------------|
    | Speed   | ⚡ Fast      | 🐢 Slow       | 🚀 Fastest    |
    | Size    | 📦 Small     | 📦 Medium     | 📦 Large      |

  features: |
    | Feature | Free | Pro | Enterprise |
    |---------|:----:|:---:|:----------:|
    | Basic   | ✅   | ✅  | ✅         |
    | Advanced| ❌   | ✅  | ✅         |
    | Support | ❌   | ❌  | ✅         |

Checklist

检查清单

yaml
validation_checklist:
  structure:
    - "[ ] Title and description present"
    - "[ ] Badges are current and working"
    - "[ ] Installation instructions complete"
    - "[ ] Quick start works on fresh clone"
    - "[ ] API documentation accurate"
    - "[ ] License file present"

  quality:
    - "[ ] No broken links"
    - "[ ] Code examples tested and working"
    - "[ ] Screenshots/GIFs current"
    - "[ ] No typos or grammar issues"
    - "[ ] Consistent formatting"

  accessibility:
    - "[ ] Alt text for images"
    - "[ ] Proper heading hierarchy"
    - "[ ] Code blocks have language specified"
    - "[ ] Tables have headers"
yaml
validation_checklist:
  structure:
    - "[ ] 包含标题和描述"
    - "[ ] 徽章为最新且可正常显示"
    - "[ ] 安装说明完整"
    - "[ ] 快速开始步骤可在新克隆的仓库上运行"
    - "[ ] API文档准确"
    - "[ ] 包含许可证文件"

  quality:
    - "[ ] 无失效链接"
    - "[ ] 代码示例已测试并可运行"
    - "[ ] 截图/GIF为最新"
    - "[ ] 无拼写或语法错误"
    - "[ ] 格式一致"

  accessibility:
    - "[ ] 图片包含替代文本"
    - "[ ] 标题层级正确"
    - "[ ] 代码块指定了语言"
    - "[ ] 表格包含表头"

Лучшие практики

最佳实践

  1. Start with Quick Start — пользователи хотят результат быстро
  2. Show, don't tell — код важнее объяснений
  3. Keep it current — обновляй при каждом релизе
  4. Test everything — все примеры должны работать
  5. Use badges wisely — только релевантные, рабочие
  6. Structure for scanning — заголовки, списки, таблицы
  1. 从快速开始入手——用户希望快速看到结果
  2. 展示而非说教——代码比解释更重要
  3. 保持内容更新——每次发布时更新文档
  4. 全面测试——所有示例都必须能正常运行
  5. 合理使用徽章——只使用相关且有效的徽章
  6. 为易读性优化结构——使用标题、列表、表格