Communityコーディング&開発github.com

レビュースタイル

コードがプロジェクトのスタイルガイドに従っているかを確認します。改善提案は行いません。

レビュースタイル とは?

このスキルは、コードがプロジェクトのスタイルガイドに準拠しているかを自動検証するためのパス/フェイルゲートです。特定のフェーズ(デザイナー、テスター、実装者)に応じて適切なスタイルガイドを参照し、違反がないかをチェックします。設計フェーズでは構造体やエラー型のパターン、実装フェーズではunwrapの禁止やインポートルール、テストフェーズではGiven/When/Thenコメントの有無などを厳格に検証します。結果は構造化されたJSONで返され、オーケストレーターが次のアクションを決定するために使用します。元号台帳(レッジャー)機能にも対応しており、複数サイクルのレビューで既に解決済みの違反や論争中の項目を尊重します。

対応~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/cbgbt/bottlerocket-forest/tree/main/skills/review-style

Installed? Explore more コーディング&開発 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

レビュースタイルスキル

目的

コードがすべてのプロジェクトスタイルガイドに従っているかを検証します。 これはパス/フェイルのゲートであり、フィードバックセッションではありません。

使用するタイミング

  • TDD検証フェーズ
  • スタイル準拠のPRレビュー
  • スタイル検証が必要なコードレビュー

必要な入力

context_files

  • レビュー対象フェーズのスタイルガイド(例: docs/style/rust-design.md)
  • レビューする変更ファイル
  • 元号台帳ファイル(マルチサイクルレビュー時に任意)

context_data

  • phase: フェーズ(designer/tester/implementor)— どのスタイルガイドルールを適用するかを決定
  • changed_files: レビューするファイルのリスト

レスポンス形式

以下のスキーマに従った構造化レスポンスを返します。

class StyleResult(BaseModel):
    status: Literal["accept", "violations"]
    violations: list[str] = []  # 各要素: "file:line - description"
    themes: str | None = None   # 違反にまたがるパターン(任意)

すべてのチェックがパスした場合:

StyleResult(status="accept")

いずれかのチェックが失敗した場合:

StyleResult(
    status="violations",
    violations=[
        "src/config.rs:23 - snafuセレクタがモジュールレベルでインポートされています。関数内部で行うべきです",
        "src/parser.rs:45 - テスト内にGiven/When/Thenコメントがありません",
    ],
    themes="複数の違反が一貫性のないエラーハンドリング手法に起因しています"
)

元号台帳への対応

context_filesに元号台帳ファイルが提供された場合:

  1. 以前のサイクルを読む — どの違反が提起され、実装者がどう応答したかを確認
  2. RESOLVED(解決済み)項目を検証 — 修正が実際に適用されたことを確認
  3. DISPUTED(論争中)項目を尊重 — 実装者の理由が妥当であれば再提起しない
  4. 新しい違反のみを提起 — 以前に議論されていない問題のみ

スタイルガイド(信頼できる情報源)

docs/style/ 内のスタイルガイドが唯一の情報源です:

  • docs/style/rust-design.md — 設計フェーズのルール(型、シグネチャ、bon、nutype、snafu)
  • docs/style/rust-impl.md — 実装フェーズのルール(エラーハンドリング、インポート、パニック禁止)
  • docs/style/rust-test.md — テストフェーズのルール(Given/When/Then、test_case、アサーション)

該当するガイドを読み、自分の判断を適用してください。要約に頼らないでください。

手順

1. 適用ルールの特定

フェーズに基づいて:

  • designer: rust-design.md のルール(特に「プロジェクトクレート選択表」)
  • tester: rust-test.md のルール
  • implementor: rust-impl.md のルール
  • テストファイル(#[cfg(test)] モジュール)はフェーズに関係なく常に rust-test.md のルールが適用

2. 各ファイルのレビュー

適用可能なスタイルガイドルールに照らしてチェックします。 明確な違反のみをフラグし、スタイルの好みはフラグしません。

設計フェーズの重要なチェック:

  • 複合構造体(2フィールド以上)は #[derive(Builder)] と #[non_exhaustive] を使用しているか
  • バリデーション付きnewtypeは nutype を使用しているか
  • エラーは #[snafu(module)] 付きの snafu を使用しているか
  • 関数本体は todo!() であり、実装が含まれていないか

実装フェーズの重要なチェック:

  • プロダクションコードに unwrap()/expect() がないか
  • snafuコンテキストセレクタが関数内部でインポートされているか
  • インポート間に空行がないか

テストフェーズの重要なチェック:

  • すべてのテストにGiven/When/Thenコメントがあるか
  • パラメータ化テストに test_case が使われているか

3. 構造化結果の返却

StyleResult スキーマを使用します。オーケストレーターがこれを解析して次のステップを決定します。

このスキルが行わないこと

  • 違反に関係のない改善提案
  • 一般的な建設的フィードバックの提供
  • スコープや正当性のレビュー(それには review-scope を使用)
  • ガイドにないスタイルの好みのフラグ

これはバイナリゲートです: 承認(accept)か違反(violations)かのみです。

Individual skills in this repo

This repo contains 19 individual skills — each has its own dedicated page.

ad-hoc-implementation-plan

Transform a rough plan into implement-commit ready artifacts. Allows rigorous review while implementing.

build-kit-locally

Build a kit and publish it to a locally hosted registry for development testing

build-variant-from-local-kits

Build a variant using locally published kits for development validation

deep-research

Create educational documents that build understanding progressively with citations

edit-spec-file

Edit Bottlerocket RPM spec files following project style conventions

fact-find

Quick lookup of specific facts about Bottlerocket with citations

idea-honing

Clarify feature ideas through iterative Q&A, recording insights to guide concept development

implement-commit

Implement commits from an implementation plan using a TDD pipeline

local-registry

Start and manage a local OCI registry for Bottlerocket kit development

prepare-core-kit-release

Prepare bottlerocket-core-kit for release by bumping version and updating changelog

propose-feature-concept

Create a new feature concept document to pitch the idea and explain the problem/solution

propose-feature-design

Create or update feature technical design document with architecture and implementation guidance

propose-feature-requirements

Create or update feature requirements specification using EARS notation with examples and appendices

propose-feature-test-plan

Create a test plan mapping EARS requirements and Critical Constraints to specific tests

propose-implementation-plan

Create an implementation plan with atomic commits that build toward a complete feature

review-code

Deep code review generating PR comments via principled question-driven analysis

review-scope

Verify code changes match intended scope and requirements without exceeding boundaries

test-local-twoliter

Build and test local changes to twoliter before releasing

update-twoliter

Update all Bottlerocket repositories to a new Twoliter version

関連スキル