readme-generator
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseREADME Generator
README 生成器
Expert in creating comprehensive, well-structured README files with proper formatting, sections, badges, and documentation best practices.
专业创建内容全面、结构清晰的README文件,遵循格式规范、章节划分、徽章使用及文档编写最佳实践。
README Template
README 模板
markdown
undefinedmarkdown
undefinedProject Name
项目名称
Features
功能特性
- ✅ Feature one with brief explanation
- ✅ Feature two with brief explanation
- ✅ Feature three with brief explanation
- 🚧 Upcoming feature (in development)
- ✅ 功能一(简要说明)
- ✅ 功能二(简要说明)
- ✅ 功能三(简要说明)
- 🚧 待开发功能(开发中)
Quick Start
快速开始
```bash
bash
undefinedInstall
安装
npm install package-name
npm install package-name
Run
运行
npx package-name init
```
npx package-name init
undefinedInstallation
安装步骤
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-nameyarn
yarn 安装
```bash
yarn add package-name
```
bash
yarn add package-namepnpm
pnpm 安装
```bash
pnpm add package-name
```
bash
pnpm add package-nameUsage
使用方法
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)Client(options)
Client(options)Creates a new client instance.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| | Yes | - | Your API key |
| | No | | Request timeout in ms |
| | No | | Number of retry attempts |
创建新的客户端实例。
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
| | 是 | - | 你的API密钥 |
| | 否 | | 请求超时时间(毫秒) |
| | 否 | | 重试次数 |
client.doSomething(params)
client.doSomething(params)client.doSomething(params)
client.doSomething(params)Performs the main operation.
Parameters:
- (string, required): The input to process
input - (object, optional): Additional options
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 file in your project root:
config.json```json
{
"apiKey": "${API_KEY}",
"environment": "production",
"features": {
"caching": true,
"logging": false
}
}
```
在项目根目录创建 文件:
config.jsonjson
{
"apiKey": "${API_KEY}",
"environment": "production",
"features": {
"caching": true,
"logging": false
}
}Environment Variables
环境变量
| Variable | Description | Required |
|---|---|---|
| Your API key | Yes |
| Enable debug mode | No |
| Logging level (info, warn, error) | No |
| 变量 | 说明 | 必填 |
|---|---|---|
| 你的API密钥 | 是 |
| 启用调试模式 | 否 |
| 日志级别(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
undefinedVerify 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 installContributing
贡献指南
Contributions are welcome! Please read our Contributing Guide for details.
- Fork the repository
- Create your feature branch ()
git checkout -b feature/amazing-feature - Commit your changes ()
git commit -m 'Add amazing feature' - Push to the branch ()
git push origin feature/amazing-feature - Open a Pull Request
欢迎贡献代码!请阅读我们的 贡献指南 了解详情。
- Fork 本仓库
- 创建功能分支()
git checkout -b feature/amazing-feature - 提交变更()
git commit -m 'Add amazing feature' - 推送分支()
git push origin feature/amazing-feature - 发起 Pull Request
Development
开发流程
```bash
bash
undefinedClone the repo
克隆仓库
git clone https://github.com/owner/repo.git
cd repo
git clone https://github.com/owner/repo.git
cd repo
Install dependencies
安装依赖
npm install
npm install
Run tests
运行测试
npm test
npm test
Run in development mode
启动开发模式
npm run dev
```
npm run dev
undefinedChangelog
更新日志
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
致谢
- Library Name - For providing X functionality
- Person Name - For their contributions
Made with ❤️ by Your Name
undefinedBadge Reference
徽章参考
yaml
badges:
build_status:
github_actions: "[](URL)"
travis: "[](URL)"
circleci: "[](URL)"
package_version:
npm: "[](URL)"
pypi: "[](URL)"
gem: "[](URL)"
coverage:
codecov: "[](URL)"
coveralls: "[](URL)"
license:
mit: "[](https://opensource.org/licenses/MIT)"
apache: "[](https://opensource.org/licenses/Apache-2.0)"
gpl: "[](https://www.gnu.org/licenses/gpl-3.0)"
downloads:
npm: "[](URL)"
pypi: "[](URL)"
quality:
codacy: "[](URL)"
code_climate: "[](URL)"
social:
stars: "[](URL)"
forks: "[](URL)"
watchers: "[](URL)"yaml
badges:
build_status:
github_actions: "[](URL)"
travis: "[](URL)"
circleci: "[](URL)"
package_version:
npm: "[](URL)"
pypi: "[](URL)"
gem: "[](URL)"
coverage:
codecov: "[](URL)"
coveralls: "[](URL)"
license:
mit: "[](https://opensource.org/licenses/MIT)"
apache: "[](https://opensource.org/licenses/Apache-2.0)"
gpl: "[](https://www.gnu.org/licenses/gpl-3.0)"
downloads:
npm: "[](URL)"
pypi: "[](URL)"
quality:
codacy: "[](URL)"
code_climate: "[](URL)"
social:
stars: "[](URL)"
forks: "[](URL)"
watchers: "[](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:
- "[ ] 图片包含替代文本"
- "[ ] 标题层级正确"
- "[ ] 代码块指定了语言"
- "[ ] 表格包含表头"Лучшие практики
最佳实践
- Start with Quick Start — пользователи хотят результат быстро
- Show, don't tell — код важнее объяснений
- Keep it current — обновляй при каждом релизе
- Test everything — все примеры должны работать
- Use badges wisely — только релевантные, рабочие
- Structure for scanning — заголовки, списки, таблицы
- 从快速开始入手——用户希望快速看到结果
- 展示而非说教——代码比解释更重要
- 保持内容更新——每次发布时更新文档
- 全面测试——所有示例都必须能正常运行
- 合理使用徽章——只使用相关且有效的徽章
- 为易读性优化结构——使用标题、列表、表格