Skill站外收录 @skilllib/skill-2117939930272414420
pr-threshold
监控代码提交的累积规模与风险,在超出审阅承受阈值时自动建议或阻断流程,推动及时发起评审,确保变更可维护性与协作效率。
开发运维 AI 技能
Skills.MD
# PR Threshold Skill
Monitor accumulated commits and metrics to determine when a PR should be pushed for human review. Prevents PRs from becoming too large or complex for effective review.
## When to Use
- After each successful git commit
- During Agent Mode commit-level workflow
- Manually with "use pr-threshold skill"
## Thresholds
| Metric | Trigger Value | Rationale |
|--------|---------------|-----------|
| Lines of Code | > 300 | Human cognitive limit |
| Files Changed | > 10 | Context switching cost |
| Commits | > 5 | Review complexity |
| Risk Score | HIGH | Needs careful review |
| Scope Completion | 100% | Feature complete |
## Phase 1: Gather Metrics
### 1.1 Lines of Code
```bash
git diff origin/develop --stat | tail -1
```
Extract: insertions + deletions
### 1.2 Files Changed
```bash
git diff origin/develop --name-only | wc -l
```
### 1.3 Commit Count
```bash
git rev-list origin/develop..HEAD --count
```
### 1.4 Risk Score
Sum of risk from pr-review across all commits:
- LOW = 1
- MEDIUM = 2
- HIGH = 3
### 1.5 Scope Completion
From Commit Plan:
- Total commits planned: N
- Commits completed: M
- Completion: M/N * 100%
## Phase 2: Evaluate Thresholds
```markdown
## PR Threshold Check
| Metric | Current | Threshold | Status |
|--------|---------|-----------|--------|
| Lines of Code | [N] | 300 | OK/CROSSED |
| Files Changed | [N] | 10 | OK/CROSSED |
| Commits | [N] | 5 | OK/CROSSED |
| Risk Score | [N] | HIGH | OK/CROSSED |
| Scope Completion | [N]% | 100% | OK/CROSSED |
```
## Phase 3: Determine Action
### CONTINUE (No threshold crossed)
```markdown
## Verdict: CONTINUE
No thresholds crossed. Proceeding to next commit.
### Current Accumulation:
- LOC: [N]/300
- Files: [N]/10
- Commits: [N]/5
- Scope: [N]%
### Next Commit:
[Name of next commit from plan]
```
### TRIGGER_PR (Threshold crossed)
```markdown
## Verdict: TRIGGER_PR
**Threshold crossed:** [Which metric(s)]
### Recommendation:
Push PR now for human review before continuing.
### PR Scope:
- Commits: [List of commit names]
- Total LOC: [N]
- Files: [N]
- Risk: [LOW/MEDIUM/HIGH]
### Remaining Work:
- Commits left: [N]
- Features incomplete: [List]
**Proceed to push-pr mode?** (Yes / Continue anyway)
```
### BLOCK (Threshold crossed, no override)
If threshold crossed and user has NOT provided explicit override:
```markdown
## Verdict: BLOCK
**Threshold crossed:** [Which metric(s)]
IMPLEMENTATION PAUSED - User decision required.
| Option | Action |
|--------|--------|
| A | Push PR now (recommended) |
| B | Continue anyway (override logged) |
Reply with A or B to proceed.
```
Do NOT continue until user responds. This is a hard stop per `00-hard-rules.mdc`.
## Phase 4: Handle Decision
### If TRIGGER_PR
1. Present metrics summary
2. Recommend push-pr mode
3. If user approves: Switch to push-pr mode
4. If user continues: Log override, proceed
### If CONTINUE
1. Proceed to next commit in plan
2. Update accumulated metrics
## Threshold Overrides
User can override thresholds with explicit confirmation:
```markdown
**Warning:** LOC threshold exceeded (350/300).
Continuing without PR may make review harder.
**Override and continue?** (Yes / Push PR now)
```
Log overrides for later review.
## Integration
This skill is invoked by:
- `agent.mdc` - After each successful commit
- `commit.mdc` - After commit completes
## Metrics Storage
Track across commits:
```
Accumulated Metrics:
- Total LOC: [running sum]
- Total Files: [unique count]
- Commit Count: [N]
- Highest Risk: [LOW/MEDIUM/HIGH]
- Started: [timestamp]
```
Reset after successful PR push.
## Output Format
```markdown
## PR Threshold Status
**Verdict:** [CONTINUE / TRIGGER_PR]
| Metric | Value | Threshold | % |
|--------|-------|-----------|---|
| LOC | [N] | 300 | [N]% |
| Files | [N] | 10 | [N]% |
| Commits | [N] | 5 | [N]% |
| Scope | [N]% | 100% | [N]% |
[Action recommendation]
```
## Invocation
Invoked automatically after each commit, or manually with "use pr-threshold skill".
评论 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
举报「pr-threshold」
举报信息仅审核团队可见,同一资产 24 小时内仅可举报一次