Skip to content

Add Japanese writing style rules to AI prompts for natural output#110

Merged
BoxPistols merged 2 commits into
mainfrom
claude/improve-japanese-generation-lcqAd
Mar 21, 2026
Merged

Add Japanese writing style rules to AI prompts for natural output#110
BoxPistols merged 2 commits into
mainfrom
claude/improve-japanese-generation-lcqAd

Conversation

@BoxPistols

@BoxPistols BoxPistols commented Mar 20, 2026

Copy link
Copy Markdown
Owner

Summary

This PR enhances the AI output quality by introducing comprehensive Japanese writing style rules to ensure more natural and human-like responses. Two rule sets are added: a detailed version for initial brainstorming and a concise version for refinement and deep-dive operations.

Key Changes

  • Added NATURAL_JP_RULES: A comprehensive 8-point Japanese writing style guide covering:

    • Sentence-ending variety (avoiding repetitive です/ます patterns)
    • Avoiding stiff Sino-Japanese verbs in favor of simpler expressions
    • Eliminating AI-typical phrases like "〜することが重要です"
    • Conjunction usage guidelines
    • Limiting three-point lists
    • Removing filler modifiers
    • Varying sentence length
    • Natural subject omission
  • Added NATURAL_JP_RULES_SHORT: A condensed version of the above rules for use in refinement and deep-dive prompts

  • Integrated rules into prompts:

    • Added NATURAL_JP_RULES to the main brainstorming prompt (line 323)
    • Added NATURAL_JP_RULES_SHORT to the refinement prompt (line 620)
    • Added NATURAL_JP_RULES_SHORT to the deep-dive prompt (line 844)
    • Added NATURAL_JP_RULES_SHORT to the sub-idea decomposition prompt (line 919)

Implementation Details

  • Rules are defined as constants at the top of the file for maintainability and reusability
  • The detailed ruleset includes references to external resources (Zenn article on humanization patterns)
  • The short ruleset maintains the core principles while being concise enough for inclusion in multiple prompts without excessive token usage
  • Rules are strategically placed in prompts to guide AI behavior toward more natural Japanese output across all brainstorming and refinement workflows

https://claude.ai/code/session_019MhgCZWy7pS7RrUwQx3dA4

Summary by CodeRabbit

リリースノート

  • 新機能
    • AI生成時の日本語スタイルルールを追加し、より自然で品質の高い日本語コンテンツの生成に対応しました。日本語の記述スタイル制約が強化され、読みやすさが向上しています。

blader/humanizer の25パターンを日本語に適用し、AI臭の強い表現を
抑制するルールを全プロンプト(生成・深掘り・ブラッシュアップ・
ドリルダウン)に組み込む。

主なルール:
- 文末「です/ます」の3連続禁止、体言止め等でリズムに変化
- 硬い漢語動詞(実施/活用/推進等)を和語に置換
- AI定型表現(〜が重要です/〜が求められます)の禁止
- 接続詞連打・三点羅列・水増し修飾語の抑制
- 文の長さに変化をつけ、主語を自然に省略
Copilot AI review requested due to automatic review settings March 20, 2026 19:12
@vercel

vercel Bot commented Mar 20, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
brain-brain-brain Ready Ready Preview, Comment Mar 21, 2026 1:10am

@coderabbitai

coderabbitai Bot commented Mar 20, 2026

Copy link
Copy Markdown

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

概要

src/hooks/useAI.ts に日本語執筆スタイルの制約を定義する2つの新規定数が追加され、複数のAIプロンプトテンプレートに統合されました。プロ機能のジェネレーション、リファイン、ディープダイブ、ドリルダウン機能のプロンプトに対し、自然な日本語表現を促すルールが挿入されています。

変更内容

コホート / ファイル 概要
日本語スタイルルール定数の追加
src/hooks/useAI.ts
NATURAL_JP_RULES(長版)と NATURAL_JP_RULES_SHORT(短版)の2つの定数を新規追加。日本語の自然な記述スタイルに関する制約を含む。
複数プロンプトテンプレートへのルール統合
src/hooks/useAI.ts
プロ生成モードの「前提条件」セクションに長版ルールを挿入。リファイン、ディープダイブ、ドリルダウン機能のプロンプトに短版ルールを、既存の役割・読者制約の後に追記。

ウサギが新しいルールを見つけた🐰
日本語をもっと自然に、美しく
プロンプトに刻まれた工夫の数々
会話はより流暢に、より心地よく
モデルが笑む、日本語の響きに 🌸

推定コードレビュー時間

🎯 2 (Simple) | ⏱️ ~10 分

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PRのタイトルは、変更の主要な目的を正確に反映しており、日本語ライティングスタイルルールをAIプロンプトに追加することが明確に伝わっています。
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/improve-japanese-generation-lcqAd

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist

Copy link
Copy Markdown

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

このプルリクエストは、AIの日本語出力の品質を向上させることを目的としています。具体的には、AIが生成するテキストがより人間らしく、自然な日本語になるように、詳細な文体ルールと簡潔な文体ルールを導入し、既存の様々なAIプロンプトに適用しました。これにより、ブレインストーミングからアイデアの深掘り、ブラッシュアップに至るまで、一貫して高品質な日本語出力が期待されます。

Highlights

  • 詳細な日本語文体ルールの追加: AIの出力がより自然になるよう、8つの詳細な日本語文体ルール(NATURAL_JP_RULES)が追加されました。これには、文末の多様性、硬い漢語動詞の回避、AI定型表現の禁止などが含まれます。
  • 簡潔な日本語文体ルールの追加: 深掘りやブラッシュアップのプロンプトで使用するための、より簡潔な日本語文体ルール(NATURAL_JP_RULES_SHORT)が追加されました。
  • プロンプトへのルール統合: メインのブレインストーミングプロンプトにNATURAL_JP_RULESが組み込まれ、ブラッシュアップ、深掘り、サブアイデア分解の各プロンプトにNATURAL_JP_RULES_SHORTが組み込まれました。

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces two sets of Japanese writing style rules, NATURAL_JP_RULES and NATURAL_JP_RULES_SHORT, to improve the naturalness of AI-generated output. These rules are integrated into various prompts for brainstorming, refinement, and deep-dives. The changes are clear and well-implemented. I have one suggestion to improve code organization by moving the new prompt-related constants to a more appropriate file.

Comment thread src/hooks/useAI.ts
Comment on lines +29 to +51
/**
* 日本語の自然さを高めるための文体ルール。
* 参考: blader/humanizer の25パターン + 日本語特有のAI臭パターン排除。
* @see https://zenn.dev/m0370/articles/205c9340a418c3
*/
const NATURAL_JP_RULES = `【日本語の文体ルール(厳守)】
(1) 文末の単調さ禁止: 「〜です。」「〜ます。」を3回以上連続させない。体言止め・「〜だろう」「〜ではないか」「〜と言える」「〜にほかならない」等を織り交ぜ、文末リズムに変化をつける
(2) 硬い漢語動詞の回避: 「実施する」「活用する」「推進する」「促進する」「醸成する」「構築する」のような硬い漢語動詞を多用しない。「やる」「使う」「進める」「広げる」「つくる」等の和語や平易な表現を優先する。漢語動詞は1段落に2語以内
(3) AI定型表現の禁止: 以下の表現はAI臭が強いため使用禁止。「〜することが重要です」「〜が求められます」「〜する必要があります」→代わりに「〜がカギになる」「〜が効く」「〜しないと始まらない」等の具体的で断定的な言い回しを使う
(4) 接続詞の連打禁止: 「さらに」「また」「加えて」「それに加え」を2文連続で使わない。接続詞なしで文をつなげるか、「一方で」「ただし」「裏を返せば」等の転換系を挟む
(5) 三点羅列(ルールオブスリー)の抑制: 「A、B、Cの3つが重要」のような三点セットの羅列を多用しない。1つに絞って深く語るか、2つの対比で示す方が自然
(6) 水増し修飾語の排除: 「非常に」「極めて」「大いに」「包括的に」「効果的に」「戦略的に」を安易に使わない。修飾するなら具体的な数値や事実で裏付ける
(7) 一文の長さに変化をつける: 短い文(〜20字)と長い文(40〜60字)を混在させる。全ての文が同じ長さだと機械的に見える
(8) 主語を省略する: 日本語では主語を毎文書く必要はない。「この施策は〜」「それによって〜」の連続を避け、自然に省略する`;

/** 深掘り・ブラッシュアップ用の簡易版日本語文体ルール */
const NATURAL_JP_RULES_SHORT = `【日本語の文体ルール】
- 「〜です。」「〜ます。」を3回以上連続させない。体言止めや「〜だろう」「〜と言える」等で文末リズムに変化をつける
- 「実施する」「活用する」「推進する」等の硬い漢語動詞を多用せず「やる」「使う」「進める」等の平易な表現を優先する
- 「〜することが重要です」「〜が求められます」はAI臭が強いため禁止。「〜がカギになる」「〜が効く」等の具体的な言い回しを使う
- 「さらに」「また」「加えて」を2文連続で使わない
- 「非常に」「極めて」「包括的に」「戦略的に」を安易に使わず、具体的事実で裏付ける
- 短い文と長い文を混在させ、主語は自然に省略する`;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

These new constants for Japanese writing style rules are a great addition. For better code organization, consider moving them to src/constants/prompts.ts. This file already contains other prompt-related constants, and moving these would help keep the useAI.ts hook focused on logic rather than prompt definitions. You can then export them from prompts.ts and import them here.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves the naturalness of Japanese AI outputs by adding reusable “Japanese writing style rules” and injecting them into the main brainstorm and follow-up (refine/deep-dive/drill-down) prompts in useAI.

Changes:

  • Added NATURAL_JP_RULES (detailed) and NATURAL_JP_RULES_SHORT (condensed) prompt constants to guide more natural Japanese writing.
  • Integrated the detailed rules into the primary brainstorming prompt and the short rules into refine/deep-dive/drill-down prompts.
Comments suppressed due to low confidence (1)

src/hooks/useAI.ts:327

  • commonConditions is built by joining items with join('。') and then embedded as a single paragraph under 【前提条件】. Injecting the multi-line NATURAL_JP_RULES block into that sentence-joined list results in punctuation directly before the header (e.g. ...特定する。【日本語の文体ルール...】) and mixes structured, newline-heavy content into a -delimited paragraph, which can reduce prompt clarity. Consider appending NATURAL_JP_RULES as a separate section after 【前提条件】 (or change the join strategy for this element) so the rules remain a clearly delimited block.
      '各アイデアの description には抽象的な方針だけでなく「例: 」で始まる具体的な行動例を1つ以上含める。IT専門用語やカタカナ業界用語は避け、現場担当者が「明日の朝一でこれをやる」とイメージできる粒度で書く。「最適化」「差別化」「戦略的」等の抽象語を使った場合は必ず直後に「(例: ○○を△△に変える)」と補足する',
      '各アイデアには「なぜそれが有効か」のメカニズム(因果関係)を1文含める。「○○をすると→△△が変わり→結果として□□が改善する」の形式',
      '【多様性】毎回異なる切り口で分析すること。前回と同じ結論に至りそうな場合は、あえて別の分析フレームワーク・別の優先課題・別の業界事例を起点にする。keyIssue と understanding は入力課題の組み合わせによって異なる根本原因を特定する',
      NATURAL_JP_RULES,
      compInstructions,
    ]
      .filter(Boolean)
      .join('。');

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@BoxPistols BoxPistols merged commit c91d7af into main Mar 21, 2026
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants