open-source-contributions by jezweb/claude-skills
npx skills add https://github.com/jezweb/claude-skills --skill open-source-contributions版本 : 1.2.0 | 最后验证 : 2026-01-09 | 生产环境测试 : ✅
自动触发 : "submit PR to", "contribute to", "pull request for", "open source contribution"
创建维护者友好的 PR,同时避免导致被拒绝的 16 个常见错误。
规划与笔记文档:
❌ SESSION.md # 会话跟踪笔记
❌ NOTES.md # 个人开发笔记
❌ TODO.md # 个人待办事项列表
❌ planning/* # 规划文档目录
❌ IMPLEMENTATION_PHASES.md # 项目规划
❌ DATABASE_SCHEMA.md # 除非为项目添加新架构
❌ ARCHITECTURE.md # 除非记录新架构
❌ SCRATCH.md # 临时笔记
❌ DEBUGGING.md # 调试笔记
❌ research-logs/* # 研究笔记
截图与视觉资源:
❌ screenshots/debug-*.png # 调试截图
❌ screenshots/test-*.png # 测试截图
❌ screenshot-*.png # 临时截图
❌ screen-recording-*.mp4 # 屏幕录制
❌ before-after-local.png # 本地对比图片
✅ screenshots/feature-demo.png # 如果在 PR 描述中演示功能
✅ docs/assets/ui-example.png # 如果是文档更新的一部分
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
测试文件(视情况而定):
❌ test-manual.js # 手动测试脚本
❌ test-debug.ts # 调试测试文件
❌ quick-test.py # 快速验证脚本
❌ scratch-test.sh # 临时测试脚本
❌ example-local.json # 本地测试数据
✅ tests/feature.test.js # 正确的测试套件添加
✅ tests/fixtures/data.json # 必需的测试夹具
✅ __tests__/component.tsx # 组件测试
构建与依赖:
❌ node_modules/ # 依赖项(在 .gitignore 中)
❌ dist/ # 构建输出(在 .gitignore 中)
❌ build/ # 构建产物(在 .gitignore 中)
❌ .cache/ # 缓存文件(在 .gitignore 中)
❌ package-lock.json # 除非项目明确要求
❌ yarn.lock # 除非项目明确要求
IDE 与操作系统文件:
❌ .vscode/ # VS Code 设置
❌ .idea/ # IntelliJ 设置
❌ .DS_Store # macOS 文件系统
❌ Thumbs.db # Windows 缩略图
❌ *.swp, *.swo # Vim 交换文件
❌ *~ # 编辑器备份文件
密钥与敏感数据:
❌ .env # 环境变量(绝对不要!)
❌ .env.local # 本地环境配置
❌ config/local.json # 本地配置
❌ credentials.json # 凭证(绝对不要!)
❌ *.key, *.pem # 私钥(绝对不要!)
❌ secrets/* # 密钥目录(绝对不要!)
临时与调试文件:
❌ temp/* # 临时文件
❌ tmp/* # 临时目录
❌ debug.log # 调试日志
❌ *.log # 日志文件
❌ dump.sql # 数据库转储
❌ core # 核心转储
❌ *.prof # 性能分析输出
✅ 源代码变更 # 实际的功能/修复
✅ 变更的测试 # 新代码所需的测试
✅ 文档更新 # README、API 文档、内联注释
✅ 配置变更 # 如果是功能的一部分
✅ 迁移脚本 # 如果功能需要
✅ Package.json 更新 # 如果添加/移除依赖项
✅ 架构变更 # 如果是功能的一部分(附带迁移)
✅ CI/CD 更新 # 如果新工作流需要
使用捆绑的 scripts/pre-pr-check.sh 扫描产物:
./scripts/pre-pr-check.sh
检查内容:
git status
git diff --stat
自问:
手动移除:
git rm --cached SESSION.md
git rm --cached -r planning/
git rm --cached screenshots/debug-*.png
git rm --cached test-manual.js
或使用清理脚本:
./scripts/clean-branch.sh
将个人模式添加到 .git/info/exclude(仅影响你的检出):
# 个人开发产物
SESSION.md
NOTES.md
TODO.md
planning/
screenshots/debug-*.png
test-manual.*
scratch.*
模板(参见 references/pr-template.md):
## What?
[简要描述此 PR 的功能]
## Why?
[解释原因、业务价值或解决的问题]
## How?
[描述实现方法和关键决策]
## Testing
[供审阅者测试的分步说明]
## Checklist
- [ ] 测试已添加/更新
- [ ] 文档已更新
- [ ] CI 通过
- [ ] 重大变更已记录
## Related Issues
Closes #123
Relates to #456
约定式提交 : <type>(<scope>): <subject>
类型:feat、fix、docs、refactor、test、ci、chore
示例:feat(auth): add OAuth2 support for Google and GitHub
完整指南请参见 references/commit-message-guide.md。
基于研究的指导原则:
保持 PR 小巧:
每个 PR 一个变更
对未完成的工作使用功能标志:
if (featureFlags.newAuth) {
// 新的 OAuth 流程(未完成但隐藏在标志后)
} else {
// 现有流程
}
按层拆分:架构 → API → 前端 → 测试
贡献前:
阅读 CONTRIBUTING.md(检查 /、/.github/、/docs/)
运行格式化工具:npm run lint、npm run format
匹配现有模式(查看最近合并的 PR)
提交前测试:
npm test && npm run lint && npm run build
回复模板:
详细指导请参见关键工作流规则部分关于规则 1-3 的内容
规则 1:务必在功能分支上工作
# ✅ 正确
git checkout main
git pull upstream main
git checkout -b feature/add-oauth-support
# 在功能分支上修改
git commit -m "feat(auth): add OAuth support"
分支命名 : feature/name、fix/issue-123、docs/update-readme、refactor/utils、test/add-tests
规则 2:提交 PR 前彻底测试
绝不未经以下步骤提交:
npm test && npm run lint && npm run build测试清单模板:
## 已执行的测试
### 自动化测试
- ✅ 所有现有测试通过
- ✅ 为 OAuth 流程添加了 12 个新测试
- ✅ 覆盖率从 85% 提升至 87%
### 手动测试
- ✅ 端到端测试了 Google/GitHub OAuth 流程
- ✅ 验证了错误处理
- ✅ 在 Chrome、Firefox、Safari 上测试
规则 3:保持 PR 专注和连贯
一个 PR = 一个功能/修复
保持专注:
git diff - 每个变更对当前功能都是必需的吗?将大型功能拆分为阶段:
PR #1: 数据库架构和模型
PR #2: API 端点
PR #3: 前端组件
PR #4: 集成和测试
创建 : gh pr create --draft 标记就绪 : gh pr ready(当代码完成、测试通过、CI 通过时)
自动关闭关键词(在 PR 描述中):
Closes #123
Fixes #456
Resolves #789
# 多个:Fixes #10, closes #20, resolves #30
# 跨仓库:Fixes owner/repo#123
gh pr create --fill # 从提交自动填充
gh pr create --draft # 草稿 PR
gh pr status # 查看你的 PR
gh pr checks # 查看 CI 状态
gh pr ready # 将草稿标记为就绪
完整版本请参见 references/pr-checklist.md。
贡献前:
开发:
npm test && npm run lint && npm run build清理:
./scripts/pre-pr-check.shPR 质量:
提交后:
参见捆绑的示例和脚本:
scripts/pre-pr-check.sh - 提交前扫描产物scripts/clean-branch.sh - 移除常见个人产物references/pr-template.md - PR 描述模板references/pr-checklist.md - 完整检查清单references/commit-message-guide.md - 约定式提交指南assets/good-pr-example.md - 结构良好的 PR 示例assets/bad-pr-example.md - 要避免的常见错误./scripts/pre-pr-check.sh : 提交前扫描产物生产环境测试 : 真实世界的开源贡献和维护者反馈
令牌效率 : 相比试错节省约 70%
防止的错误 : 16 个常见错误
最后验证 : 2026-01-09
每周安装数
309
仓库
GitHub 星标数
643
首次出现
2026年1月20日
安全审计
安装于
claude-code258
gemini-cli213
opencode209
cursor194
antigravity189
codex184
Version : 1.2.0 | Last Verified : 2026-01-09 | Production Tested : ✅
Auto-triggers : "submit PR to", "contribute to", "pull request for", "open source contribution"
Create maintainer-friendly PRs while avoiding the 16 common mistakes that cause rejection.
Planning & Notes Documents:
❌ SESSION.md # Session tracking notes
❌ NOTES.md # Personal development notes
❌ TODO.md # Personal todo lists
❌ planning/* # Planning documents directory
❌ IMPLEMENTATION_PHASES.md # Project planning
❌ DATABASE_SCHEMA.md # Unless adding new schema to project
❌ ARCHITECTURE.md # Unless documenting new architecture
❌ SCRATCH.md # Temporary notes
❌ DEBUGGING.md # Debugging notes
❌ research-logs/* # Research notes
Screenshots & Visual Assets:
❌ screenshots/debug-*.png # Debugging screenshots
❌ screenshots/test-*.png # Testing screenshots
❌ screenshot-*.png # Ad-hoc screenshots
❌ screen-recording-*.mp4 # Screen recordings
❌ before-after-local.png # Local comparison images
✅ screenshots/feature-demo.png # IF demonstrating feature in PR description
✅ docs/assets/ui-example.png # IF part of documentation update
Test Files (Situational):
❌ test-manual.js # Manual testing scripts
❌ test-debug.ts # Debugging test files
❌ quick-test.py # Quick validation scripts
❌ scratch-test.sh # Temporary test scripts
❌ example-local.json # Local test data
✅ tests/feature.test.js # Proper test suite additions
✅ tests/fixtures/data.json # Required test fixtures
✅ __tests__/component.tsx # Component tests
Build & Dependencies:
❌ node_modules/ # Dependencies (in .gitignore)
❌ dist/ # Build output (in .gitignore)
❌ build/ # Build artifacts (in .gitignore)
❌ .cache/ # Cache files (in .gitignore)
❌ package-lock.json # Unless explicitly required by project
❌ yarn.lock # Unless explicitly required by project
IDE & OS Files:
❌ .vscode/ # VS Code settings
❌ .idea/ # IntelliJ settings
❌ .DS_Store # macOS file system
❌ Thumbs.db # Windows thumbnails
❌ *.swp, *.swo # Vim swap files
❌ *~ # Editor backup files
Secrets & Sensitive Data:
❌ .env # Environment variables (NEVER!)
❌ .env.local # Local environment config
❌ config/local.json # Local configuration
❌ credentials.json # Credentials (NEVER!)
❌ *.key, *.pem # Private keys (NEVER!)
❌ secrets/* # Secrets directory (NEVER!)
Temporary & Debug Files:
❌ temp/* # Temporary files
❌ tmp/* # Temporary directory
❌ debug.log # Debug logs
❌ *.log # Log files
❌ dump.sql # Database dumps
❌ core # Core dumps
❌ *.prof # Profiling output
✅ Source code changes # The actual feature/fix
✅ Tests for changes # Required tests for new code
✅ Documentation updates # README, API docs, inline comments
✅ Configuration changes # If part of the feature
✅ Migration scripts # If needed for the feature
✅ Package.json updates # If adding/removing dependencies
✅ Schema changes # If part of feature (with migrations)
✅ CI/CD updates # If needed for new workflows
Use the bundled scripts/pre-pr-check.sh to scan for artifacts:
./scripts/pre-pr-check.sh
What it checks:
git status
git diff --stat
Ask yourself:
Manual removal:
git rm --cached SESSION.md
git rm --cached -r planning/
git rm --cached screenshots/debug-*.png
git rm --cached test-manual.js
Or use the clean script:
./scripts/clean-branch.sh
Add personal patterns to .git/info/exclude (affects only YOUR checkout):
# Personal development artifacts
SESSION.md
NOTES.md
TODO.md
planning/
screenshots/debug-*.png
test-manual.*
scratch.*
Template (see references/pr-template.md):
## What?
[Brief description of what this PR does]
## Why?
[Explain the reasoning, business value, or problem being solved]
## How?
[Describe the implementation approach and key decisions]
## Testing
[Step-by-step instructions for reviewers to test]
## Checklist
- [ ] Tests added/updated
- [ ] Documentation updated
- [ ] CI passing
- [ ] Breaking changes documented
## Related Issues
Closes #123
Relates to #456
Conventional Commits : <type>(<scope>): <subject>
Types: feat, fix, docs, refactor, test, ci, chore
Example: feat(auth): add OAuth2 support for Google and GitHub
See references/commit-message-guide.md for complete guide.
Research-backed guidelines:
Keep PRs small:
One change per PR
Use feature flags for incomplete work:
if (featureFlags.newAuth) {
// New OAuth flow (incomplete but behind flag)
} else {
// Existing flow
}
Break by layer: schema → API → frontend → tests
Before contributing:
Read CONTRIBUTING.md (check /, /.github/, /docs/)
Run formatters: npm run lint, npm run format
Match existing patterns (review recent merged PRs)
Test before submitting:
npm test && npm run lint && npm run build
Response templates:
See Critical Workflow Rules section for detailed guidance on Rules 1-3
RULE 1: ALWAYS Work on a Feature Branch
# ✅ CORRECT
git checkout main
git pull upstream main
git checkout -b feature/add-oauth-support
# make changes on feature branch
git commit -m "feat(auth): add OAuth support"
Branch naming : feature/name, fix/issue-123, docs/update-readme, refactor/utils, test/add-tests
RULE 2: Test Thoroughly BEFORE Submitting PR
Never submit without:
npm test && npm run lint && npm run buildTesting checklist template:
## Testing Performed
### Automated Tests
- ✅ All existing tests pass
- ✅ Added 12 new tests for OAuth flow
- ✅ Coverage increased from 85% to 87%
### Manual Testing
- ✅ Tested Google/GitHub OAuth flows end-to-end
- ✅ Verified error handling
- ✅ Tested on Chrome, Firefox, Safari
RULE 3: Keep PRs Focused and Cohesive
One PR = One Feature/Fix
Keep focused:
git diff - Is every change necessary for THIS feature?Break large features into phases:
PR #1: Database schema and models
PR #2: API endpoints
PR #3: Frontend components
PR #4: Integration and tests
Create : gh pr create --draft Mark ready : gh pr ready (when code complete, tests passing, CI passing)
Auto-closing keywords (in PR description):
Closes #123
Fixes #456
Resolves #789
# Multiple: Fixes #10, closes #20, resolves #30
# Cross-repo: Fixes owner/repo#123
gh pr create --fill # Auto-fill from commits
gh pr create --draft # Draft PR
gh pr status # See your PRs
gh pr checks # View CI status
gh pr ready # Mark draft as ready
See references/pr-checklist.md for complete version.
Pre-Contribution:
Development:
npm test && npm run lint && npm run buildCleanup:
./scripts/pre-pr-check.shPR Quality:
Post-Submission:
See bundled examples and scripts:
scripts/pre-pr-check.sh - Scan for artifacts before submissionscripts/clean-branch.sh - Remove common personal artifactsreferences/pr-template.md - PR description templatereferences/pr-checklist.md - Complete checklistreferences/commit-message-guide.md - Conventional commits guideassets/good-pr-example.md - Well-structured PR exampleassets/bad-pr-example.md - Common mistakes to avoid./scripts/pre-pr-check.sh: Scan for artifacts before submissionProduction Tested : Real-world open source contributions and maintainer feedback
Token Efficiency : ~70% savings vs trial-and-error
Errors Prevented : 16 common mistakes
Last Verified : 2026-01-09
Weekly Installs
309
Repository
GitHub Stars
643
First Seen
Jan 20, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykWarn
Installed on
claude-code258
gemini-cli213
opencode209
cursor194
antigravity189
codex184
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
105,000 周安装