办公效率

代码改动转结构化PR说明

提供 Git 差异、改动文件和相关提交,生成带变更类型的标题,归纳实现内容、兼容性影响和测试情况。

填空后再复制(中文和原文同时生效)
# 代码变更摘要生成器

根据代码变更生成清晰、结构化的拉取请求描述。

## 工作流程

### 1. 分析代码变更

**收集代码变更:**
- Git diff 输出
- 修改文件列表
- 提交信息
- 相关议题编号

**理解变更:**
- 通读所有修改过的文件
- 确定变更内容(新增/修改/移除/修复)
- 理解变更的目的
- 记录其中的规律或主题

**对变更分类:**
- **新增功能:** 新增的功能
- **错误修复:** 解决的问题
- **重构:** 不改变行为的代码改进
- **文档:** 文档更新
- **测试:** 新增或修改的测试
- **依赖:** 软件包更新
- **配置:** 配置或构建变更

### 2. 创建初步摘要

**撰写清晰的标题:**

格式:`{Type} Brief description (max 72 characters)`

**类型:**
- `feat:` 新功能
- `fix:` 错误修复
- `refactor:` 代码重构
- `docs:` 文档
- `test:` 测试
- `chore:` 维护
- `perf:` 性能
- `style:` 代码风格
- `ci:` CI/CD
- `build:` 构建系统

**示例:**
- `feat: Add user authentication with OAuth2`
- `fix: Resolve memory leak in data processor`
- `refactor: Simplify error handling logic`

**撰写摘要段落:**
- 2-3 句话
- 说明做了什么以及为什么这么做
- 使用主动语态
- 简洁清晰

**示例:**
```
This PR adds OAuth2 authentication to the user login system. The change
improves security by using industry-standard authentication and enables
single sign-on with external providers.
```

### 3. 记录变更

**按类别列出变更:**

**新增:**
- 新特性或新功能
- 新文件或组件
- 新的 API 端点

**修改:**
- 更改的行为或实现
- 更新的配置
- 重构的代码

**移除:**
- 已弃用的功能
- 删除的文件
- 移除的依赖

**修复:**
- 错误修复
- 问题解决
- 错误更正

**示例:**
```markdown
## Changes

### Added
- OAuth2 authentication flow
- User session management
- Login/logout endpoints

### Modified
- User model to include OAuth tokens
- Authentication middleware
- Database schema

### Fixed
- Session timeout not working correctly
- Memory leak in token refresh
```

### 4. 识别破坏性变更

**检查破坏性变更:**
- API 签名变更
- 移除的功能
- 更改的行为
- 配置变更
- 数据库架构变更
- 包含破坏性变更的依赖更新

**记录每一项破坏性变更:**

**格式:**
```markdown
## Breaking Changes

⚠️ **[Breaking change description]**

**Impact:** [Who/what is affected]

**Migration Guide:**
1. [Step 1]
2. [Step 2]

**Before:**
```[language]
// Old code
```

**之后:**
```[language]
// New code
```
```

**Example:**
```markdown
## Breaking Changes

⚠️ **Authentication endpoint signature changed**

**Impact:** All API clients must update their authentication calls.

**Migration Guide:**
1. Update authentication endpoint from `/auth/login` to `/auth/oauth/login`
2. Include `provider` parameter in request body
3. Handle new response format with OAuth tokens

**Before:**
```javascript
POST /auth/login
{ "username": "user", "password": "pass" }
```

**之后:**
```javascript
POST /auth/oauth/login
{ "username": "user", "password": "pass", "provider": "google" }
```
```

### 5. Add Technical Details

**Explain implementation approach:**
- High-level technical approach
- Key algorithms or patterns used
- Important implementation details

**Document design decisions:**
- Why this approach was chosen
- Alternatives considered
- Trade-offs made

**Note architecture changes:**
- New components or modules
- Changed relationships
- Updated data flow

**Example:**
```markdown
## Technical Details

### Implementation Approach
Implemented OAuth2 using the Authorization Code flow with PKCE for enhanced
security. The authentication flow is handled by a new `AuthService` that
manages token exchange and refresh.

### Key Design Decisions
- **OAuth2 over SAML:** Chose OAuth2 for better mobile support and simpler
  implementation
- **PKCE extension:** Added PKCE to protect against authorization code
  interception attacks
- **Token storage:** Store refresh tokens in secure HTTP-only cookies

### Architecture Changes
- Added new `AuthService` layer between controllers and OAuth provider
- Introduced `TokenManager` for token lifecycle management
- Updated database schema to store OAuth provider information
```

### 6. 记录依赖

**列出依赖变更:**

**新增的依赖:**
- 软件包名称和版本
- 新增原因
- 用途

**更新的依赖:**
- 旧版本 → 新版本
- 更新原因
- 所有破坏性变更

**移除的依赖:**
- 软件包名称
- 移除原因
- 替代它的内容(如有)

**示例:**
```markdown
## Dependencies

### Added
- `passport@0.6.0` - OAuth2 authentication library
- `passport-google-oauth20@2.0.0` - Google OAuth2 strategy

### Updated
- `express@4.17.1` → `express@4.18.2` - Security patches and bug fixes
- `jsonwebtoken@8.5.1` → `jsonwebtoken@9.0.0` - Updated for Node 18 support

### Removed
- `bcrypt@5.0.1` - Replaced by OAuth2, no longer needed for password hashing
```

### 7. 提供测试说明

**编写分步测试指南:**

**格式:**
```markdown
## Testing

### How to Test
1. [Setup step]
2. [Action to perform]
3. [Expected result]
4. [Edge case to verify]

### Test Coverage
- Added [X] unit tests
- Added [Y] integration tests
- Current coverage: [Z]%

### Manual Testing Checklist
- [ ] Test scenario 1
- [ ] Test scenario 2
- [ ] Test edge case 1
```

**示例:**
```markdown
## Testing

### How to Test
1. Start the application: `npm start`
2. Navigate to `/login`
3. Click "Sign in with Google"
4. Complete OAuth flow in popup
5. Verify you're redirected back and logged in
6. Check that session persists after page refresh

### Test Coverage
- Added 15 unit tests for AuthService
- Added 8 integration tests for OAuth flow
- Current coverage: 87% (up from 82%)

### Manual Testing Checklist
- [ ] Google OAuth login works
- [ ] Session persists across page refreshes
- [ ] Logout clears session correctly
- [ ] Token refresh works when token expires
- [ ] Error handling for failed OAuth
```

### 8. 补充背景信息

**添加安全注意事项:**
- 已完成的安全改进
- 对安全性的影响
- 已处理的漏洞
- 安全审查状态

**添加性能影响:**
- 预期的性能变化
- 基准测试结果
- 优化细节
- 资源使用情况的变化

**添加架构说明:**
- 使用的架构模式
- 系统设计变更
- 集成点
- 可扩展性注意事项

**示例:**
```markdown
## Security Considerations

### Improvements
- ✅ Implemented PKCE to prevent authorization code interception
- ✅ Store refresh tokens in HTTP-only cookies to prevent XSS
- ✅ Added rate limiting on authentication endpoints
- ✅ Validate OAuth state parameter to prevent CSRF

### Security Review
- [ ] Security team review pending
- [ ] Penetration testing scheduled

## Performance Impact

### Expected Changes
- Login time: ~500ms (OAuth redirect adds latency)
- Token validation: <10ms (cached in memory)
- Database queries: +2 per login (OAuth token storage)

### Optimizations
- Implemented token caching to reduce database hits
- Added connection pooling for OAuth provider requests

## Architecture Notes

### Patterns Used
- **Strategy Pattern:** Different OAuth providers (Google, GitHub, etc.)
- **Factory Pattern:** Token creation and validation
- **Middleware Pattern:** Authentication checks

### Integration Points
- Integrates with existing User model
- Hooks into session management middleware
- Compatible with existing authorization system
```

### 9. 添加文档说明

**列出文档更新:**
```markdown
## Documentation

- [ ] Updated README with OAuth setup instructions
- [ ] Added API documentation for new endpoints
- [ ] Updated environment variables guide
- [ ] Added OAuth provider configuration guide
- [ ] Updated changelog
```

### 10. 链接相关议题

**引用相关议题:**
```markdown
## Related Issues

Closes #123
Fixes #456
Related to #789
```

### 11. 审查与完善

**审查 PR 描述:**
- 摘要是否清晰?
- 是否记录了所有变更?
- 是否突出了破坏性变更?
- 测试说明是否完整?
- 背景信息是否充分?

**完善内容,使其清晰易懂:**
- 删除不必要的细节
- 补充缺失的信息
- 改进措辞
- 修正格式

**检查完整性:**
- 所有部分均已填写
- 没有遗留占位符
- 链接可用
- 代码示例正确

## 输出格式

用 Markdown 生成完整的 PR 描述:

```markdown
# {Type} Brief description

## Summary
[2-3 sentence overview]

## Changes

### Added
- [Item 1]
- [Item 2]

### Modified
- [Item 1]

### Fixed
- [Item 1]

## Breaking Changes
[If any, with migration guide]

## Technical Details

### Implementation Approach
[Explanation]

### Key Design Decisions
- [Decision 1]
- [Decision 2]

### Architecture Changes
[Description]

## Dependencies

### Added
- [Package] - [Reason]

### Updated
- [Package] - [Reason]

## Testing

### How to Test
1. [Step 1]
2. [Step 2]

### Test Coverage
- [Details]

### Manual Testing Checklist
- [ ] [Item 1]
- [ ] [Item 2]

## Security Considerations
[Details]

## Performance Impact
[Details]

## Architecture Notes
[Details]

## Documentation
- [ ] [Item 1]
- [ ] [Item 2]

## Related Issues
Closes #[number]

## Checklist
- [ ] Code follows style guidelines
- [ ] Self-review completed
- [ ] Tests added/updated
- [ ] Documentation updated
- [ ] All tests passing
```

详细模板请参阅 [pr-templates.md](references/pr-templates.md)。

## 最佳实践

### 摘要
- 保持简洁(2-3 句话)
- 说明做了什么以及为什么这么做
- 使用主动语态
- 表述具体

### 变更
- 按类型分组(新增/修改/移除/修复)
- 具体但简洁
- 使用项目符号列表
- 链接相关议题

### 破坏性变更
- 用 ⚠️ 清晰标记
- 提供迁移指南
- 展示变更前后的示例
- 说明影响

### 技术细节
- 说明采用的方法
- 记录决策
- 说明架构变更
- 保持内容相关

### 测试
- 提供清晰的说明
- 包含预期结果
- 列出边界情况
- 说明覆盖率变化

### 背景信息
- 添加安全说明
- 说明性能影响
- 解释架构变更
- 记录依赖

## 常见场景

### 场景 1:新增功能

**输入:** 添加用户身份验证的代码

**输出:**
```markdown
# feat: Add user authentication with OAuth2

## Summary
This PR implements OAuth2 authentication for user login. Users can now
sign in using their Google or GitHub accounts, improving security and
user experience.

## Changes

### Added
- OAuth2 authentication flow
- Google and GitHub OAuth providers
- User session management
- Login/logout endpoints

### Modified
- User model to include OAuth tokens
- Database schema for OAuth data

## Testing

### How to Test
1. Start app: `npm start`
2. Navigate to `/login`
3. Click "Sign in with Google"
4. Complete OAuth flow
5. Verify successful login

### Test Coverage
- Added 15 unit tests
- Added 8 integration tests
- Coverage: 87%
```

### 场景 2:错误修复

**输入:** 修复内存泄漏的代码

**输出:**
```markdown
# fix: Resolve memory leak in data processor

## Summary
This PR fixes a memory leak in the data processor that was causing
memory usage to grow unbounded during long-running operations.

## Changes

### Fixed
- Memory leak in DataProcessor.process()
- Improper cleanup of event listeners
- Unclosed database connections

## Technical Details

### Root Cause
Event listeners were not being removed after processing completed,
causing references to processed data to remain in memory.

### Solution
- Added proper cleanup in finally block
- Implemented connection pooling
- Added memory monitoring

## Testing

### How to Test
1. Run long-running process: `npm run process-large-dataset`
2. Monitor memory usage
3. Verify memory stays stable

Fixes #456
```

### 场景 3:重构

**输入:** 重构错误处理的代码

**输出:**
```markdown
# refactor: Simplify error handling logic

## Summary
This PR refactors error handling across the application to use a
consistent pattern, improving maintainability and reducing code
duplication.

## Changes

### Modified
- Centralized error handling in ErrorHandler class
- Updated all controllers to use new error handling
- Simplified error response format

### Removed
- Duplicate error handling code in controllers
- Inconsistent error response formats

## Technical Details

### Implementation Approach
Introduced a centralized ErrorHandler class that provides consistent
error handling and response formatting across all endpoints.

### Benefits
- Reduced code duplication by 40%
- Consistent error responses
- Easier to maintain and extend

## Testing

### Behavior Verification
All existing tests pass, confirming no behavior changes.

### Test Coverage
- Updated 25 existing tests
- Coverage maintained at 85%
```

## 故障排查

### 问题:代码变更中的背景信息不足

**解决方法:**
- 索取提交信息
- 索取相关议题的描述
- 检查代码中的注释
- 向用户询问背景信息

### 问题:不清楚变更了什么

**解决方法:**
- 仔细检查 git diff
- 寻找变更中的规律
- 从文件名中寻找线索
- 请用户澄清

### 问题:无法确定破坏性变更

**解决方法:**
- 查找 API 签名变更
- 检查是否有移除的功能
- 审查依赖更新
- 不确定时询问用户

### 问题:缺少测试信息

**解决方法:**
- 建议基本测试步骤
- 推荐测试覆盖率目标
- 提供测试清单模板
- 向用户询问具体的测试场景

同类提示词

办公效率· n8n 工作流的对话模型

商品照片转棚拍广告生图指令

上传商品照片并提供说明文字,分析材质、配色和原图问题,写出保留商品外观的棚拍广告生图指令。

=你是一位专业产品摄影师和广告创意总监。分析上传的产品图片及其配文:{{ $('Telegram Trigger Received').item.json.message.caption }} 你的任务是创建一段详细的图像生成提示词,将这张产品照片转化为高端、商业级的广告视觉作品。 分析要求: 1. **产品识别**:识别产品类型、尺寸、类别、材质、配色和关键特征 2. **当前状态评估**:指出当前的光线、背景、构图和质量问题 3. **目标美学**:根据产品类别确定理想的广告风格(奢侈品、科技、食品、时尚等) 输出(严格使用 JSON 格式):
办公效率· n8n 工作流的对话模型

Veo 3营销视频分镜指令

填写视频需求、营销目标、图像描述和画幅,生成包含场景、运镜、动作、灯光与结尾的结构化制片指令。

=# Veo3 视频生成系统提示词 你是一名专业的视频提示词工程师,擅长为 Veo3 视频生成撰写细致、富有电影感的提示词。你的角色是分析用户输入,将其转化为全面的视频生成指令,以产出高质量、引人入胜的内容。 ## 输入分析 你将收到以下用户输入: - **AI Videos instructions**:视频生成的核心用户请求 - **Campaign objectives**:营销活动目标和说明 - **Images Description**:用户提供的视觉背景信息 - **Aspect Ratio**:要求的视频尺寸比例 ## 输出格式 你
可填 21 项
办公效率· n8n 工作流的对话模型

保留原品的社媒广告视觉方案

提供商品图和配文,生成保留原品外观的广告生图说明,广告文字仅从配文提取,缺项留空。

={ "system_prompt": "你是一位顶尖创意总监,专攻爆款产品广告,拥有15年以上奢侈品牌广告活动经验。将产品图片转化为商业级广告,让浏览者停下滑动并促进转化。", "instructions": { "core_rules": [ "保持原始产品100%不变——不得修改、替换或扭曲", "只提取和使用用户配文中提供的文字", "如果配文中没有相关文字,文字字段留空——绝不生成AI广告语", "专注于高端视觉强化和商业摄影技巧", "制作适合在Instagram展
办公效率· Claude Fable 5.2

用代码制作长纪录片流程

从题材调研、脚本和样帧审核开始,按章节生成三维分镜、旁白、环境声与可复现渲染。

<inputs> 向我询问: 1. 我的主题 2. 目标视频时长 3. 我是否已有脚本 如果我只给你一个主题,先研究该主题并撰写脚本。 开始制作任何内容之前,先向我展示: - 完整脚本 - 章节拆分 - 前 60 seconds 的分镜计划 - 6 张展示预期视觉方向的静帧 在我认可视觉效果之前,不要渲染完整视频。 </inputs> <story> 按照高品质 YouTube 纪录片的方式来写,不要写成 AI 科普解说。 故事必须始终向前推进。 每个部分都需要包含以下内容之一: - 一个新问题 - 一个揭示 - 一个矛盾 - 一个后果 - 一条证据
办公效率

同场景表情变化九宫格自拍

上传主角照片,可选搭档参考图或设定,并填写服装、背景或姿势偏好,生成同一布光和构图的九张变化。

# photo-booth ## 何时使用此 skill - 当用户希望根据参考图制作大头贴宫格、表情宫格、情侣自拍宫格、同步姿势组图或多种人像变体时使用。 - 当请求制作 3x3 宫格,且主体、房间、服装、构图和布光保持一致,仅表情或细微姿势发生变化时触发。 ## 必需输入 - 主要人物的主参考图。 - 可选的伴侣或角色参考图。 - 如果未提供伴侣参考图,需提供期望的伴侣设定。 - 用户指定的服装、背景、摄影时代、姿势清单或氛围。 如果缺少主参考图,请用户附上。如果伴侣设定或预期风格不明确,提出一个有针对性的问题。 ## 连续性规则 -
需参考图
办公效率· Claude Code / 动效编程

单镜头立体落地页飞越动画

提供落地页链接、品牌名、标志和两段收尾文案,可选配乐,制作卡片随镜头掠过而浮起的连续飞越短片。

<inputs> 向我索取:我的落地页链接、品牌名称和标志、由两部分组成的结尾文案(一句陈述,后接一小段斜体文字),以及一条 15 second 音轨(可选)。 </inputs> <direction> 以 60fps 对我的落地页进行 14.5 second 3D 飞越拍摄,1440x1152。页面平放在明亮的摄影棚地面上(中央为 #f9fbfb,角落为 #f2f3f6),周围有柔和宽阔的阴影,圆角为 24px。全程使用一个连续镜头,绝不切镜:镜头从首屏上方低处开始,以恒定速度沿页面向后滑行,同时朝页面上方看去;然后垂直升至正上方,将整个页面呈现为
✓