Skills.MD
# Generate Testing Plan for PR
Generate a comprehensive testing plan based on the current branch changes or a specific PR.
## Arguments
`$ARGUMENTS` can be:
- Empty: Uses current branch diff against `production`
- PR number: `2732` - fetches that PR's diff
## Steps
1. **Get the diff:**
- If `$ARGUMENTS` is empty: `git diff production...HEAD`
- If `$ARGUMENTS` is a PR number: `gh pr diff {PR_NUMBER}`
2. **Read `docs/COMMON_MISTAKES.md`** for patterns that have caused production bugs
3. **Analyze the changes:**
- Identify files changed and their types (components, hooks, utils, styles, pages)
- Categorize the change (new feature, bug fix, refactor, styling)
- Assess risk level based on scope and what's touched
4. **Generate the testing plan** using the criteria below and output format
## Testing Criteria
### Critical Checks
- **Security**: No hardcoded secrets, input validation, no unsanitized `dangerouslySetInnerHTML`
- **Error Handling**: API failures have fallbacks, validate API response shape before accessing
- **Rendering Strategy**: SSG for static+SEO, ISR for periodic+SEO, SSR for user-specific+SEO, CSR
for private/no-SEO
- **Correctness**: Code matches requirements, UI matches designs, safely revertible
### Standard Checks
- **TypeScript**: No unjustified `any`, interfaces for objects, enums for categoricals
- **React**: No unnecessary `useEffect`, use `useSWR` cache directly, skeleton loaders, optimistic
updates
- **i18n/RTL**: All text via `t()`, CSS logical properties only (`margin-inline-start` not
`margin-left`)
- **Performance**: Lazy load non-critical components, new packages <10kb gzipped
- **A11y**: Semantic elements (`button`/`a` not `div onClick`), images have `alt`, inputs have
`label`
### Regression Checks
- Modified components still work as before
- Shared hooks/utils don't break other consumers
- Style changes don't affect other components
- No race conditions, memory leaks, or unhandled promise rejections
### Visual Verification
- **Themes**: Light, dark, sepia
- **RTL**: Arabic layout mirrors correctly
- **Responsive**: Mobile, tablet, desktop breakpoints
## Output Format
Generate a testing plan with sections proportional to the change. Skip sections that don't apply.
```markdown
## Testing Plan
### Change Summary
- **Type:** [New Feature | Bug Fix | Refactor | Styling | Config]
- **Risk Level:** [Low | Medium | High]
- **Files Changed:** X files
- **What it does:** Brief description
---
### Critical Path Tests
<!-- Primary functionality that MUST work -->
- [ ] [Specific test based on what the PR does]
- [ ] [Another specific test]
### State Verification
<!-- Only include states relevant to the change -->
- [ ] Loading state displays correctly
- [ ] Error state displays correctly (simulate: disconnect network / return 500)
- [ ] Empty state displays correctly (no data scenario)
- [ ] Success state displays correctly
### Visual & Theme Tests
<!-- Only if UI changes -->
| Theme | Verified |
| ----- | -------- |
| Light | |
| Dark | |
| Sepia | |
| Breakpoint | Verified |
| --------------- | -------- |
| Mobile (<768px) | |
| Tablet | |
| Desktop | |
| Direction | Verified |
| --------- | -------- |
| LTR | |
| RTL (AR) | |
### Regression Tests
<!-- Based on what files were modified, what else might break -->
- [ ] [Component X that imports this file still works]
- [ ] [Feature Y that uses this hook still works]
### Edge Cases
<!-- Specific to this change type -->
- [ ] [Relevant edge case 1]
- [ ] [Relevant edge case 2]
### Accessibility
<!-- Only if interactive elements changed -->
- [ ] Keyboard navigation (Tab, Enter, Escape)
- [ ] Focus states visible
- [ ] Screen reader compatible
---
### Pre-Merge Checks
- [ ] `yarn lint` passes
- [ ] `yarn test` passes
- [ ] `yarn build` succeeds
- [ ] No console.log statements
- [ ] No hardcoded strings (using `t()`)
```
## Guidelines
### Be Specific, Not Generic
```markdown
// Bad - too generic
- [ ] Component works correctly
// Good - specific and actionable
- [ ] Clicking "Add Bookmark" shows success toast and updates bookmark icon
- [ ] Removing bookmark while offline shows error message
```
### Scale to Change Size
| Change Size | Testing Depth |
| ----------------- | ----------------------------------- |
| Tiny (1-2 LOC) | Critical path only, 2-3 tests |
| Small (<50 LOC) | Critical + states, 5-8 tests |
| Medium | Full plan minus irrelevant sections |
| Large (>15 files) | Full plan + flag for splitting |
### Derive from Common Mistakes
Apply patterns from `docs/COMMON_MISTAKES.md`:
- Fetches data → verify loading/error/empty states
- Uses arrays → verify empty, single item, many items
- User input → verify validation, empty submit, error handling
- Touches styles → verify RTL, themes, responsive
- Modifies shared code → verify all consumers still work
## Final Output
After generating the plan:
1. Display the testing plan in markdown format
2. Tell the user they can copy/paste it into their PR description
3. Offer to help test any specific scenarios they're unsure about
评论 0
还没有评论,来抢沙发。
相关内容
同类或同场景的收录内容
building-with-kafka-strimzi
在 Kubernetes 上构建基于 Apache Kafka 的事件驱动系统,支持高可靠的消息传递、事务性处理与精确一次语义,结合 Strimzi 运营商实现集群自动化管理,利用 Schema Registry 保障事件模式演进,适用于微服务间解耦通信与实时数据流处理场景。
站外数据与分析
609 0.0
personal-tool-builder
专注于从个人真实痛点出发快速构建实用工具,涵盖命令行程序、本地优先应用和自动化脚本的开发与演进,强调先满足自身需求再逐步扩展,通过持续自用打磨功能,避免过度设计,确保工具简洁有效且长期可维护。
站外商业与营销
196 0.0
threejs-lighting
实现三维场景中的光照与阴影控制,支持多种光源类型及环境光照明,提供从基础布光到高级阴影优化的完整方案,适用于需要真实感渲染或性能平衡的可视化项目。
站外效率工具
442 0.0
aggregation-helper
提供数据聚合场景的自动化辅助能力,涵盖 SQL 查询编写、统计分析建模、可视化方案设计及商业智能配置,支持从需求理解到生产级代码生成的全流程指导。
站外效率工具数据与分析
217 0.0
举报「test-plan」
举报信息仅审核团队可见,同一资产 24 小时内仅可举报一次