本文へ移動
cccskills
無料GitHub で公開日本語紹介

pr-reviewer-add-rule

Gitコミットやレビューコメントから、他のコードにも適用できる規約を見つけ、重複を確認したうえでレビュー用ルールとして追加・検証します。

原文原文の説明を見る

Add a new rule to pr-reviewer/rules, derived from a Git commit or a review comment.

liferay/liferay-portalスター 2,267(GitHub 2,267 + cccskills 0)

実行スコア 未検証

インストール方法を見る

こんなときに便利

  • コミットからレビュー規約を追加したいとき
  • レビューコメントの指摘をルール化したいとき
  • 既存ルールとの重複を確認したいとき

日本語での紹介

できること

Gitコミットの差分、またはプルリクエストのレビューコメントと指摘対象のコードを調べ、今後のレビューでも機械的に判定できる規約を1つ特定します。既存ルールや STYLE.md と照らして重複を確認し、該当カテゴリの連番で pr-reviewer/rules にルールを追加します。内容は規約、理由、違反とみなす範囲、コミットやプルリクエストをもとにした例で構成します。必要なら review.sh のグループ設定や STYLE.md も更新し、違反を検出できるか、修正後のコミットを誤検出しないかを確かめてからコミットします。

こんなときに便利

レビューで繰り返し伝えているコーディング規約を、次回から適用できるルールとして残したいときに使えます。対象はJavaに限らず、Markdown、YAML、シェルなど、レビューで読むファイル全般です。ひとつの変更に複数の規約が混在する場合や、既存ルールとの重なりを判断できない場合は、内容を確認して利用者に選択を求めます。

使い方の例

  • 「このコミットから、再利用できるレビュー規約を追加して」
  • 「このレビューコメントの指摘をルールにして。対象は命名規則です」

注意点

ルールの検証には pr-reviewer/review.sh を実行できる環境が必要です。SourceFormatterがすでに修正する内容はルール化せず、処理を止めます。

この紹介文は、公開されている SKILL.md をもとに AI(OpenAI Codex)が作成しました。正確な仕様は下の原文を確認してください。

含まれるファイル(1)

  • SKILL.md3.9 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

PR Reviewer: Add Rule

Add a new rule to pr-reviewer/rules, derived from a Git commit or from a reviewer's comment on a pull request. Anyone can use this to encode a convention they spotted in a commit or were asked to follow in review. Rules can apply to any file type the reviewer reads (Java, .properties, XML, JSP, Markdown, Gradle, YAML, shell, and so on), so do not bias toward Java.

Inputs

  • A Git commit SHA, or the text of a review comment together with the commit or pull request it was made on.

  • Optional: a hint about which aspect of the commit to encode. Commits often touch multiple things, and a hint narrows the scope.

Workflow

Inspect the Source

Inspect the commit's full diff, or the comment and the code it points at. Identify a single learnable convention that a future reviewer could apply mechanically to other code. Stop and ask the user to clarify when:

  • Multiple distinct rules are present. Ask the user to pick one, or run the skill once per rule.

  • The commit mixes convention changes with logic or refactoring changes that cannot be separated.

  • The pattern is not generalizable beyond the specific file or context.

Check for Duplicates

Read the existing rules in pr-reviewer/rules and pr-reviewer/STYLE.md and compare them against the pattern. When the pattern duplicates or substantially overlaps an existing rule, flag it to the user and ask whether to skip, extend the existing rule, or proceed anyway. When the pattern is enforced by SourceFormatter already, say so and stop, since the reviewer would only repeat what the formatter fixes.

Write the Rule

Pick the category by the leading digit of the existing files (0xx convention, 1xx naming, 2xx ordering, 3xx utility methods, 4xx control flow, 5xx redundancy, 6xx tests, 7xx prose, 8xx visibility, 9xx formatting) and take the next free number in it. When no group in _GROUPS at the end of pr-reviewer/review.sh covers the new number's leading digits, add them to the group of that category, since review.sh reviews no rule outside a group. Create pr-reviewer/rules/<number>-<kebab-case-imperative-title>.md with this shape, matching the existing files:

  1. # <number>: <Title Case Imperative Title>

  2. One or two paragraphs stating the rule, with code in inline backticks.

  3. A paragraph starting **Rationale:** that explains what consistency the rule buys, not what the rule does.

  4. A paragraph starting A violation is ... that defines the boundary of the rule and names what not to flag.

  5. A paragraph starting **Example:** that cites the commit or pull request in prose. Follow it with a diff fence when a before and after reads faster than prose, using abstract identifiers (foo, Bar, methodA) rather than the commit's literal code, so the example illustrates the pattern instead of overfitting it to one case.

Write the file the way the rules themselves demand: no hyphens in prose (rule 701), each paragraph on one line (rule 708), complete sentences, and no trailing newline at the end of the file (rule 908).

When the rule belongs to a section of pr-reviewer/STYLE.md, add a bracketed reference to it there.

Self Test the Rule

Validate that the reviewer catches the violation with the new rule in place. Review the reverse of the commit, which reintroduces the violation:

pr-reviewer/review.sh --json <sha>..<sha>~1

The output must include a violation whose rule is the new number, on the file and line the commit changed. When it does not, revise the rule and repeat. Then review the commit itself, <sha>~1..<sha>, and confirm the new rule reports nothing, so the rule does not flag the fix it describes.

Commit the Rule

After the self test passes, stage the new rule file and any STYLE.md change and commit with this message:

<ticket> Add rule <number> derived from <sha>

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

コメント

ログインなしで書き込めます。使ってみた感想、質問、動かなかった環境などを気軽にどうぞ。

まだコメントはありません。最初のコメントを書いてみませんか。

送信するとすぐに公開されます。メールアドレスや電話番号などの個人情報は書かないでください。URL は 2 つまでです。

0 / 1000 文字

このフォームは reCAPTCHA で保護されており、Google のプライバシーポリシーと利用規約が適用されます。

同じリポジトリのスキル

format-source

無料概要あり

Liferayのソースコードを対象に、対応する整形ツールとルールを使って形式をそろえ、生成ファイルを避けながら修正対象を確認できます。

  • モジュールのソースを整形したいとき
  • コミット済み変更の書式を確認したいとき
  • Goやシェルの整形ルールを適用したいとき
liferay/liferay-portal2,2672026年10月29日 更新

jira-bug

無料概要あり

不具合の説明や修正コミットから必要事項を整理し、再現手順や期待・実際の動作を含むバグチケットをLPDプロジェクトのJiraに登録できます。

  • LPDの不具合をJiraに登録したいとき
  • 修正コミットからバグを起票したいとき
  • 再現手順と期待動作を整理したいとき
liferay/liferay-portal2,2672026年10月29日 更新

jira-task

無料概要あり

説明やコミット内容をもとに、必要な情報を整えてLPDプロジェクトのJiraにタスクを登録し、チケット番号と閲覧URLを受け取れます。

  • LPDの作業タスクを起票したいとき
  • コミットからタスクを整理したいとき
  • 受け入れ条件付きで課題を登録したいとき
liferay/liferay-portal2,2672026年10月29日 更新

markdown-format

無料概要あり

Liferay向けのMarkdown文書を、前付けの順序や見出しの表記、シェル記法、文章の調子まで整え、リポジトリの規約に沿った読みやすい形に仕上げます。

  • Liferay向けMarkdownを整えたいとき
  • 見出しや前付けを規約に合わせたいとき
  • シェル例と文章を校正したいとき
liferay/liferay-portal2,2672026年10月29日 更新

poshi-migrate

無料概要あり

LiferayのPoshi `.testcase` を内容に応じてPlaywright、Jest、JUnit、Java統合テストへ移行し、既存テストとの重複や移行を妨げる条件も整理します。

  • Poshiテストを新しいテスト層へ移したいとき
  • 既存Playwrightテストとの重複を調べたいとき
  • 移行先と実装手順を計画したいとき
liferay/liferay-portal2,2672026年10月29日 更新

poshi-shrink

無料概要あり

LiferayコンポーネントのPoshiテストを調べ、重複するテストを統合・整理する計画を立ててから、確認しやすい単位でテスト数を減らします。

  • コンポーネントのPoshiテストを減らしたいとき
  • Playwright移行前にテストを整理したいとき
  • 重複テストの統合計画を確認したいとき
liferay/liferay-portal2,2672026年10月29日 更新

liferay のスキルをすべて見る

このスキルの問題を報告する