2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Claude:記事レビューをClaude Code Actionにやらせてみよう!

Posted at

まえがき

皆さんどうもこんにちは、ECN技術部所属、Fuseです。
以前、Gemini CLI GitHub Actionsを使った無料のAI記事レビューで開発効率を上げるにて、Geminiで記事をレビューするワークフローを作成しました。しかし、無料枠で動かしているため動作が不安定です…
弊社ではClaude Codeをエンジニアが使えるようにしているのでそっちに乗り換えてみようと思います。

Claude Code Actionとは?

Claude Code Actionとは、GitHub Actionsワークフロー内でClaude Codeを実行するためのGitHub Actionです。
これにより、Claude Codeの上にカスタムワークフローを構築できます。

手順

公式のドキュメントに従いセットアップします。
リポジトリのルートディレクトリにて、まずClaude Codeに入り、

claude code

/install-github-appを実行。

 Tips for getting started:

  Run /init to create a CLAUDE.md file with instructions for Claude
  Use Claude to help with file analysis, editing, bash commands and git
  Be as specific as you would with another engineer for the best results

> /install-github-app 

リポジトリを選択したら、リンクが表示されるのでそこからリポジトリにClaudeをインストール。
連携手順1.png
連携手順2.png
その後Enterを押したら使用するワークフローを問われます。
ここはClaude Code Reviewを選択します。
連携手順3.png
次に使うトークンを問われます。今回は有料サブスクリプションプランであるMaxプランに入会しているのでCreate a long-lived token with your Claude subscriptionを選択します。
入会していない場合はEnter a new API keyを選べばAPIキーを入力して認証することもできます。
連携手順4.png
その後はリンクからClaudeの画面に移動し認証コードをコピー&ペースト。これで認証は完了です。
連携手順5.png
この文面が出ればセットアップは終了です。お疲れさまでした。

プロンプトを書き換える

セットアップ後はブランチが自動で生成されます。そのままマージしてもいいですが、ここはプロンプトを記事レビュー用に書き換えてみましょう。
プロンプトは.github/workflows/claude-code-review.ymlの40行目以降に書いてあります。
デフォルトのプロンプトはこのようになっています。

Please review this pull request and provide feedback on:
- Code quality and best practices
- Potential bugs or issues
- Performance considerations
- Security concerns
- Test coverage
            
Use the repository's CLAUDE.md for guidance on style and conventions. Be constructive and helpful in your feedback.

Use `gh pr comment` with your Bash tool to leave your review as a comment on the PR.

Geminiのときに使ったプロンプトを参考にプロンプトをこんな形に書き換えました。

Please review changed technical articles in this pull request and provide feedback on:
- Are there any typos or missing characters?
- Is there any unnatural Japanese?
- Are there any compliance violations or risks of controversy?
- Is there anything written that could damage the company's image?
- **Clarity and Searchability of Titles**
  - Does the title allow readers to understand the content of the article at a glance?
  - Does it include search keywords (SEO)?
- **Clear Purpose of the Introduction**
  - Why is this article being written? Who is the target audience?
  - Are the issues being addressed and the benefits clearly stated?
- **Logical Structure**
  - Is the flow organized as “background → problem → solution → results → summary”?
  - Are the headings (h2/h3) used appropriately?
- **Accuracy and reproducibility of code**
  - Does the code actually work?
  - Are the environment, version, and dependencies clearly stated?
- **Use of images and charts**
  - Are diagrams and screenshots used as needed?
  - Are captions or explanations provided?
- **Definition of Terms and Consideration for Beginners**
  - Are there explanations for technical terms and abbreviations?
  - Are there explanations for points that beginners might find difficult?
- **Reliability of Information and Sources**
  - Are links or sources for external information clearly indicated?
  - Is there a clear distinction between subjective and objective information?
- **Writing Style and Readability**
  - Are sentences too long?  
  - Are line breaks, bullet points, and emphasis (bold text, quotes) used appropriately?
- **Does it align with Qiita's style?**
  - Is Qiita's Markdown syntax used correctly?
  - Are tags and categories set appropriately?
- **Overall reading impression and explicit learning outcomes**
  - Does the content leave readers feeling that they have learned something or want to try it out?
  - Are the key points concisely summarized at the end?

Use the repository's CLAUDE.md for guidance on style and conventions. Be constructive and helpful in your feedback.

Use `gh pr comment` with your Bash tool to leave your review as a comment on the PR.

変更が終わったらブランチをマージ、これでレビューが動くようになります。

早速レビューしてもらう

試しにこの記事を書きかけの状態で提出し、レビューしてもらいましょう。
レビュー結果.png
無事、いい点や改善点、総評などをまとめたレビューを行ってくれました!
誤字や表記ゆれの指摘や企業イメージ的に問題が無いかの確認、タグやタイトルのSEO観点からの改善案の提案などといった様々な内容を確認してくれます!

あとがき

今回はClaude Code Actionを使って記事の自動レビュー機構を作り直してみました。
無料枠で無理やり動かしていたGeminiのころと違い、大きく安定性が向上しました。
今後の展望としては、これをほかのプロジェクトに生かしてレビューの効率化を行いたいです。
皆さんもぜひ試してみてはいかがでしょうか?


株式会社ECN
株式会社ECNはPHP、JavaScriptを中心にお客様のご要望に合わせたwebサービス、システム開発を承っております。 ビジネスの最初から最後までをサポートを行い お客様のイメージに合わせたWebサービス、システム開発、デザインを行います。

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?