‹ 首页

pr-threshold

@wellapp-ai · 收录于 5 天前 · 上游提交 1 个月前

Track commit accumulation and trigger PR when thresholds crossed

适合你,如果希望自动管理PR创建时机

/ 通过 npx 安装 校验哈希
npx oh-my-skill add wellapp-ai/well/pr-threshold
/ 通过 bash 安装
curl -fsSL https://oh-my-skill.com/install.sh | bash -s -- wellapp-ai/well/pr-threshold
/ 已经装过?验证本机副本,不用重装
npx oh-my-skill verify wellapp-ai/well/pr-threshold
安装目标可用 --agent / --scope 或 --to 明确指定;省略时只会在唯一已存在的 agent 目录上自动选择,零命中或多命中会停止并提示。content_hash 缺失或不一致均拒装。
340GitHub stars
~927上下文体积 · 单文件
索引托管

怎么用

商店整理自技能原文 · 版本 782601c · 表述以原文为准
它做什么

安装后,当代码行数、修改文件数或提交次数超过设定阈值时,Claude 会自动提醒你推送 Pull Request(PR)进行人工审查,避免 PR 变得太大或太复杂。

什么时候触发

每次成功执行 git 提交后自动触发,或者在代理模式(Agent Mode)的提交工作流中触发。你也可以手动输入“use pr-threshold skill”来激活。

装好后可以这样说
Claude 会显示各指标是否超过阈值,并给出建议。
仅当阈值被超越且你想手动决定时使用。
Claude 会报告累积数值与阈值对比。
技能原文 SKILL.md作者撰写 · MIT · 782601c

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
git diff origin/develop --stat | tail -1

Extract: insertions + deletions

1.2 Files Changed
git diff origin/develop --name-only | wc -l
1.3 Commit Count
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
## 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)
## 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)
## 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:

## 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:

**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
## 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".

按 MIT 许可原样转载,未经改动 · 在 GitHub 查看 →

评论

登录即可评论;带「已验证安装」的,是发布者名下有本店的安装或持有记录。