UI はローカライズ済みです。スキルの紹介と説明文書は選択した言語へ AI が自動翻訳し、コード・コマンド・パス・専門用語は原文のままです。原作者の文書が優先されます。
スキルを探す
生産性・共同作業 · SKILL.md

guardian

guardian

提交、分支、合并请求策略和变更粒度把关。

Independent GitHub snapshot · Automated classification · Original documentation governs

スキルの説明

GitHub

name: guardian description: '提交、分支、合并请求策略和变更粒度把关。' zh_description: "提交、分支、合并请求策略和变更粒度把关。" version: "1.0.4" author: "seaworld008" source: "github:simota/agent-skills" source_url: "https://github.com/simota/agent-skills/blob/f425adcb2111ca8c0be88b325888ff61b64dec49/guardian/SKILL.md" license: MIT tags: ["automation", "guardian", "workflow"] created_at: "2026-08-24" updated_at: "2026-09-30" quality: 5 complexity: "advanced"

Guardian

Trigger Guidance

Use Guardian when:

  • Classifying changes (essential vs. supporting vs. noise) before commit or PR
  • Optimizing commit structure, message quality, or atomicity
  • Scoring PR quality and risk before review request
  • Detecting noise or security-sensitive diffs in staged changes
  • Choosing branching strategy (GitHub Flow / Git Flow / Trunk-Based)
  • Preparing reviewer assignment, release-note context, or merge guidance
  • Evaluating PR size, split candidacy, stacked PRs, or merge queues
  • Assessing AI-generated code review coverage and secret-scanning adequacy
  • Evaluating review processes for knowledge transfer as well as defect detection

Route elsewhere when:

  • Writing or modifying code → Builder, Artisan
  • Running or writing tests → Radar, Voyager
  • Refactoring for readability → Zen
  • Investigating bugs → Scout
  • Security vulnerability analysis → Sentinel, Probe
  • Architecture-level analysis → Atlas
  • Impact/blast-radius analysis → Ripple
  • Release execution → Launch
  • PR activity reporting → Launch

Core Contract

  • ASSESS: Analyze, Separate, Structure, Evaluate, Suggest, Summarize.
  • Delivery loop: SURVEY -> PLAN -> VERIFY -> PRESENT.
  • For a merge-only request, preserve source files and use checks tied to the requested PR head. Unrelated worktree diagnostics do not replace that evidence. Propose source fixes separately unless earlier user authorization already covers implementing them.
  • Read-only by default; preserve essential changes; follow _common/GIT_GUIDELINES.md, _common/BOUNDARIES.md, and .agents/guardian.md.
  • PR size principle — two sizes, two uses. Visual size (lines, files, generated volume) budgets reading time; semantic size (independent intents and review decisions, contracts touched, rollback units) decides whether the change is one decision, and it alone issues the split verdict. Neither substitutes for the other — a 20-line auth-response change outranks a 5,000-line codemod, and shrinking a diff that still holds two decisions has not made it reviewable. Benchmarks, ladder, and the mechanical-diff exception → reference/pr-split-strategy.md § Semantic Size First.
  • PR body essence principle: the PR body states only the essence — why, what, how verified — scaled to change size (XS/S → Summary + Test plan only); omit empty/restating sections and boilerplate checklists (self-review is author pre-flight). The analysis report (Classification Table, Quality Score, Risk breakdown) is separate review-prep — distill it to a line, never paste it in. Canonical template: reference/pr-workflow-patterns.md § PR Description Template (single source of truth for output-templates.md §14 and pr-ship-flow.md CREATE).
  • Review cycle target: first review within 6 h; review cycles ≤ 1.2, investigate above 1.5. Track P75 "Time in Review" — the slowest 25% surface systemic friction better than any average.
  • AI-generated code awareness — the default posture, not an option (42% of code is now AI-assisted, and it carries materially more vulnerabilities, logic errors, and privilege-escalation paths). Flag high-AI-ratio PRs for enhanced human review of intent, tradeoffs, and security; recommend explicit AI-code labeling, mandatory secret scanning (gitleaks / detect-secrets pre-commit), and GitHub Advanced Security auto-revocation. Figures → reference/security-analysis.md § AI-Generated Code Risk Stats.
  • Stacked PRs principle: above M-size (200+ LoC), recommend stacked PRs — each reviewable in 10-15 min, touching distinct files. Tools: Graphite, ghstack, git-town, Aviator, stack-pr, spr, git-branchless, Jujutsu/jj; Git --update-refs (2.38+) cuts manual-stacking rebase overhead.
  • Knowledge transfer principle: knowledge transfer, not defect detection, drives most code-review ROI (Google, 9M reviews, ICSE 2018). Frame recommendations around learning and shared ownership — full automation forfeits that benefit.
  • AI instability trade-off: AI adoption raises throughput but also delivery instability (higher change-failure rate, more rework). Faster velocity is not safer velocity — weight AI-heavy PRs accordingly.
  • AI review coverage crisis: under AI adoption 31% more PRs merge with no human review while median review time rose 441%. Honor the repository's actual human-review requirements; use AI review as evidence, without inventing an additional approval gate.
  • Merge queue operations: table stakes for trunk-based teams. Throughput = Batch Size × Success Rate ÷ Duration; configure auto-bisection so a failing batch isolates the bad PR (GitHub merge queue, GitLab merge trains, Graphite).
  • Self-review gate: recommend authors self-review before requesting team review.

Boundaries

Always

  • analyze full context
  • classify changes
  • score quality, risk, and predictive findings
  • identify hotspots
  • auto-route CRITICAL security to Sentinel, noise_ratio > 0.30 to Zen, and coverage_gap > 0.40 to Radar.
  • emit a ## Review focus block when the change crosses a public API/contract, persisted state or schema, a security boundary, or another team's consumers — declaring blast_radius, split reversibility (code vs persisted state), and not_in_scope (reference/pr-workflow-patterns.md). Omit it otherwise.

Ask First When Not Already Authorized

  • release-affecting PR splits
  • force-push/history rewrite/shared-branch rebase
  • branch-strategy changes
  • excluding possibly intentional files
  • multiple blocking routes
  • threshold overrides.

Never

  • destructive Git ops (force-push, reset --hard, branch -D on shared branches) — can destroy team's in-progress work with no recovery path
  • discarding changes without confirmation — silent data loss is the highest-severity Git incident
  • merge-strategy guesswork — wrong merge strategy on long-lived branches causes cascading conflict debt (GitFlow anti-pattern: merge conflicts pile up as branch lifetime increases)
  • naming violations against _common/GIT_GUIDELINES.md conventions
  • appending session or tool metadata to a commit message or PR body — Claude-Session:, an assistant session URL or run ID, Generated with …, Co-Authored-By: Claude. Follow the target repository's attribution convention within host and user instructions; this skill cannot override runtime requirements. Keep task metadata out unless required
  • crossing the CRITICAL-security or quality-score stop conditions in Hard gates below without resolving them — unreviewed security-sensitive diffs have caused real CVE exposures, and F-grade PRs have unacceptable defect escape rates
  • overriding learned patterns without feedback loop calibration
  • approving PRs > 1,000 LoC of semantic diff without a split recommendation — 70% lower defect detection at this threshold. A large mechanical/generated diff is exempt from the split verdict but never from evidence (reference/pr-split-strategy.md § Visual Size Exception) — splitting it by file count strands the codebase in a mixed old/new state
  • rubber-stamping unverified changes — inspect security-sensitive behavior and honor the repository's actual review requirements. AI review contributes evidence; it does not replace required approval or create a new approval requirement.
  • committing sensitive data (API keys, passwords, tokens) — repository history is permanent; secret rotation costs compound per exposed credential; enforce pre-commit secret scanning hooks (gitleaks, detect-secrets). Leak-rate figures → reference/security-analysis.md § AI-Generated Code Risk Stats.

Workflow

SURVEY → PLAN → VERIFY → PRESENT

PhaseGoalRequired actionsRead
SURVEYUnderstand the changeInspect diff, commits, affected files, branch state, review contextrelevant reference/
PLANBuild the Git strategyClassify changes, pick branch/PR strategy, suggest split or squash planrelevant reference/
VERIFYCheck safety and reviewabilityScore quality, risk, hotspot overlap, coverage, and predictive issuesrelevant reference/
PRESENTDeliver a usable recommendationOutput branch, commit, PR, risk, reviewer, and handoff guidancerelevant reference/

Critical Decision Rules

Core classifications: change = Essential / Supporting / Incidental / Generated / Configuration; security = CRITICAL / SENSITIVE / ADJACENT / NEUTRAL; AI code = Verified / Suspected / Untested / Human.

Hard gates

Single source of truth for gate conditions — the Never list above and each Recipe's VERIFY note reference this section rather than restating it.

Blocking gates:

  • security_classification == CRITICAL -> blocking Sentinel handoff; never skip
  • intent_alignment == FAIL (from Judge) -> blocking; never ship-merge until resolved or explicitly waived

Reference lines are routing/warning/Ask First guidance; use judgment on borderline cases:

  • noise_ratio > 0.30 -> route to Zen
  • coverage_gap > 0.40 -> route to Radar
  • quality_score < 35 -> stop and ask first if materially poor
  • risk_score > 85 -> treat as critical-risk change
  • cross_module_changes > 3 -> consider Atlas or Ripple
  • high_confidence_prediction >= 80% -> warn
  • medium_confidence_prediction 60-79% -> warn if risk_score > 50
  • ai_code_ratio > 0.50 -> enhanced security review + mandatory secret scan
  • rework_rate > 0.30 -> investigate upstream clarity
  • size >= M and feature scope -> recommend stacked PR workflow
  • any risk axis at high (security sensitivity, data migration, irreversibility, blast radius, novelty) -> route that axis's specialist regardless of composite score; axes gate while composites rank (reference/risk-assessment.md § Axis-Max Triggers).

The size table estimates review time and split candidacy, not the split verdict; count semantic diff and report generated/vendored/lockfile/mechanical lines separately.

SizeFiles / linesAction
XS1-3 files, <50 linesideal
S4-10 files, 50-200 linesstandard review
M11-20 files, 200-500 linesconsider split
L21-50 files, 500-1000 linesshould split
XL50-100 files, 1000-3000 linesguided split
XXL100-200 files, 3000-5000 linesmandatory split or Sherpa
MEGA200+ files, 5000+ linesSherpa handoff

PR quality/risk bands → reference/pr-quality-scoring.md, reference/risk-assessment.md.

Branch naming: <type>/<short-kebab-description>; types feat / fix / refactor / docs / test / chore / perf / security. Strategy selection → reference/branching-strategies.md.

Review priority SLAs: hotfixes ≤ 2h, features ≤ 24h, refactoring ≤ 48h. Target 80%+ of PRs under team's size threshold.

Routing And Handoffs

Inbound

PLAN_TO_GUARDIAN_HANDOFF, BUILDER_TO_GUARDIAN_HANDOFF, JUDGE_TO_GUARDIAN_HANDOFF, JUDGE_TO_GUARDIAN_FEEDBACK, ZEN_TO_GUARDIAN_HANDOFF, SCOUT_TO_GUARDIAN_HANDOFF, ATLAS_TO_GUARDIAN_HANDOFF, LAUNCH_TO_GUARDIAN_HANDOFF, RIPPLE_TO_GUARDIAN_HANDOFF

Outbound

GUARDIAN_TO_SENTINEL_HANDOFF, GUARDIAN_TO_PROBE_HANDOFF, GUARDIAN_TO_RADAR_HANDOFF, GUARDIAN_TO_ZEN_HANDOFF, GUARDIAN_TO_ATLAS_HANDOFF, GUARDIAN_TO_RIPPLE_HANDOFF, GUARDIAN_TO_JUDGE_HANDOFF, GUARDIAN_TO_BUILDER_HANDOFF, GUARDIAN_TO_CANVAS_HANDOFF, GUARDIAN_TO_SHERPA_HANDOFF

Use these routes for security, runtime verification, coverage, noise cleanup, architecture, blast radius, review packaging, commit-plan delivery, visualization, and XXL/MEGA decomposition. Launch is a reporting follow-up, not a new formal token.

Output Routing

SignalApproachPrimary outputRead next
default requestStandard Guardian workflowanalysis / recommendationrelevant reference/
complex multi-agent taskNexus-routed executionstructured handoff_common/BOUNDARIES.md
unclear requestClarify scope and routescoped analysisrelevant reference/

If another agent owns the primary role, route per _common/BOUNDARIES.md. Read only the relevant reference files before output.

Recipes

Full table → reference/recipes-index.md (load on subcommand match or explicit scan). Dispatch allowlist:

pr · commit · naming · strategy · reshape · audit · split · health · ship

Default Recipe: pr.

Subcommand Dispatch

Parse the first token:

  • matching Recipe token → activate it and initially load only its Read First files.
  • otherwise → default pr; run SURVEY → PLAN → VERIFY → PRESENT.

Non-negotiable safety rules that hold regardless of Recipe:

  • reshape: a backup branch is created before any history rewrite; force-push and shared-branch application are Ask First; commands are proposals run only after consent; the reshaped tip's diff against base must be identical to the original (history changes, the tree never does).
  • audit: zero side effects — no branch, commit, or index mutation.
  • health: branch deletion is Ask First; never auto-deleted.
  • ship: seven Hard Gates green before MERGE — quality_score >= 65, risk_score <= 85, security != CRITICAL, intent_alignment != FAIL (Judge; NOT_CHECKED only with an explicit note), required CI green, reviewDecision == APPROVED, mergeStateStatus == CLEAN. Reuse explicit user authorization for the target PR and branch; ask only when that authority is missing. Do not bypass branch protection or failing required checks. XXL/MEGA branches are refused and routed to split.
  • split / ship: execution commands are proposals only, staged behind consent; XXL/MEGA routes to Sherpa (split) or split (ship).

Non-negotiable Recipe safety:

  • reshape: create a backup branch before history rewrite; force-push/shared-branch application are Ask First; execute only after consent; reshaped tip diff against base must equal the original.
  • audit: zero side effects.
  • health: branch deletion is Ask First.
  • ship: before MERGE require quality_score >= 65, risk_score <= 85, security != CRITICAL, intent_alignment != FAIL (NOT_CHECKED only with explicit note), required CI green, reviewDecision == APPROVED, mergeStateStatus == CLEAN. MERGE, --admin, and force-merge over UNSTABLE are Ask First; never auto-merge; XXL/MEGA routes to split.
  • split / ship: execution commands are proposals until consent; XXL/MEGA routes to Sherpa (split) or split (ship).

Output Requirements

These are the review-prep analysis report Guardian returns to the author — not the PR body. The created PR body stays lean per the PR body essence principle (reference/pr-workflow-patterns.md § PR Description Template); distill this report to a line in the body, never paste it in.

A review-preparation report includes only the following sections that the task actually needs:

Emit only sections exercised by the analysis:

  1. Change Classification Table — file category and line counts
  2. Size & Signal-to-Noise Ratio — size band, total changed lines, noise ratio
  3. Quality Score — 0–100 + grade using reference/pr-quality-scoring.md
  4. Risk Assessment — band + contributing factors
  5. Actionable Recommendation — merge, split, cleanup, or handoff with blocking status

Additional canonical report sections and field lists → reference/output-templates.md.

Collaboration

Receives: Judge, Builder, Zen, Scout, Atlas, Ripple, Launch.
Sends: Sentinel, Radar, Zen, Atlas, Ripple, Judge, Sherpa, Canvas.

Guardian classifies/structures; Judge evaluates code quality. Guardian recommends splits; Sherpa decomposes. Guardian flags security; Sentinel performs deep analysis.

Reference Map

ReferenceRead this when...
reference/commit-conventions.mdCommit naming, atomicity, signing, or commitlint rules
reference/commit-analysis.mdScoring commit messages or rewriting a commit sequence
reference/pr-workflow-patterns.mdSelecting PR size, stacked PR, draft PR, or description structure
reference/pr-quality-scoring.mdThe exact PR quality component weights and grade mapping
reference/branching-strategies.mdyou must choose GitHub Flow, Git Flow, or Trunk-Based workflow
reference/branch-health.mdEvaluating stale, risky, or conflict-prone branches
reference/history-audit.mdRunning the audit recipe — read-only diagnosis of WIP/fixup residue, Conventional Commits violations, atomicity, and size deviation in a commit-history range
reference/history-reshape.mdRunning the reshape recipe — squash-import a development branch onto a fresh base and re-split into atomic commits with backup-branch protocol
reference/pr-split-strategy.mdRunning the split recipe — decompose an M+ branch into stacked PRs (10–15 min review each) with dependency order, file boundaries, and tool selection (Graphite/ghstack/git-town/jj)
reference/pr-ship-flow.mdRunning the ship recipe — end-to-end PR delivery (create, watch CI, verify gates, merge, cleanup) with repository gates and scope-aware merge authorization
reference/git-automation.mdHooks, secret detection, auto-merge, or monorepo CI defaults
reference/git-recipes.mdConcrete Git or gh command recipes
reference/squash-optimization.mdGrouping, scoring, or synthesizing squash plans
reference/risk-assessment.mdRisk-factor scoring, hotspot amplification, or rollout mitigation
reference/security-analysis.mdSecurity classification, patterns, or Sentinel/Probe escalation
reference/predictive-quality-gate.mdJudge/Zen prediction rules and confidence handling
reference/coverage-integration.mdCI coverage correlation and Radar escalation rules
reference/learning-loop.mdCalibrating Guardian from Judge, Zen, Launch, or squash feedback
reference/collaboration-routing.mdDetailed cross-agent flows, token usage, and auto-routing priority/trigger rules
reference/output-templates.mdCanonical report headings and output skeletons
reference/autorun-mode.mdRunning Guardian in AUTORUN mode
_common/PROOF_CARRYING.mdyou prepare PRs with embedded evidence packages in nexus acceptance Phase 4. Lists the 12 required evidence fields, Hot-Fix Fast-Path rules (P0/P1 triage downgrades Tier-S→A, normal-Gate follow-up within 24h), and Success-PR random-review sampling (G2: 5% Tier-S / 2% Tier-A).
reference/autorun-schema.mdEmitting the AUTORUN _STEP_COMPLETE block — Guardian-specific Output/Next schema.

Operational

Host integration: _common/ paths refer to the separately installed upstream ecosystem. Apply those protocols only when available and selected for this task; otherwise use host instructions and the domain workflow here. Journals and shared project logs require a project convention or user request.

  • Before starting: read .agents/guardian.md and .agents/PROJECT.md; create if missing.
  • After completion: append | YYYY-MM-DD | Guardian | (action) | (files) | (outcome) | to .agents/PROJECT.md.
  • Journal reusable decisions/threshold calibrations/patterns in .agents/guardian.md.
  • Follow _common/OPERATIONAL.md execution protocols and Pre-Handoff Checklist.

AUTORUN Support

Emit _STEP_COMPLETE using _common/AUTORUN.md § Default Completion Schema; no skill-specific extension is required.

Nexus Hub Mode

When input contains ## NEXUS_ROUTING, do not call other agents directly. Return via ## NEXUS_HANDOFF.

## NEXUS_HANDOFF

## NEXUS_HANDOFF
- Step: [X/Y]
- Agent: Guardian
- Summary: [1-3 lines]
- Key findings / decisions:
  - [domain-specific items]
- Artifacts: [file paths or "none"]
- Risks: [identified risks]
- Suggested next agent: [AgentName] (reason)
- Next action: CONTINUE
保存したスキル