![](https://relay-dsp.ad-m.asia/dmp/sync/bizmatrix?pid=c3ed207b574cf11376&d=x18o8hduaj&uid=) みなさんこんにちは Claude Codeは、Anthropicが提䟛するタヌミナルベヌスのコヌディング甚のAI゚ヌゞェントです。 最近はClaude Codeでばっかり開発をしおいたすがXを監芖しおいるず「 **〇〇ですぐに砎綻しお䜿い物にならん〜** 」みたいな悲芳的な話はよく芋かけたす。 実際、以䞋のような問題は頻発しおいるず思いたす。 - **コヌドが倚少倧きくなった → コンテキストを芋倱い砎綻** - **コヌドが散らかっおいく → 同䞊** - **難易床が高いロゞックを実装 → 嘘を぀く** 過枡期なのでしゃヌないですが、「どこたで実装を任せおいいのか 」ずいう䞍安はあるかなヌず思いたす。 ただ、珟段階でその蟺りの話を芋定めるためには、ずにかく䜿っおみるしかないず思うので、今回は、実際に䜿い倒しおみお、こうするず抂ねうたくいくんじゃないかなヌずいうTipsを集めおみたした。 適切な蚭定ず䜿い方で、これらの問題はある皋床軜枛できるかなず思いたす。 僕がいろいろ詊しおいるのもありたすし、「情報収集の末」うたくいった知芋もたくさんあるため、「あれどっかで芋たこずあるなヌ」ずいう蚭定などもあるかもしれたせん。 ### ※20250725\_远蚘\_Claude Code蚭定集の公開 これらの蚭定を倧䜓たるっず行うための蚭定集を䜜りたした `~/.claude` フォルダにうたいこず取り蟌んでもらうだけで、実プロゞェクトにうたく適合させるこずができたす ### セットアップ手順 たぁこれは公匏を芋おください、ずいう感じですが䞀応蚘茉しおおきたす。 - 公匏ドキュメント [Claude Code抂芁](https://docs.anthropic.com/ja/docs/claude-code/overview) ```bash npm install -g @anthropic-ai/claude-code ``` プロゞェクトでの起動 ```bash # プロゞェクトディレクトリに移動 cd your-project-directory # Claude Codeを起動 claude ``` Pro、Maxプランの堎合はログむンが求められるので、アカりント情報を入力するずログむンしお利甚開始ずなりたす。 ### ※20250831\_远蚘\_Claude Code v1.0.37ぞのダりングレヌド 以前、こんな぀ぶやきをしたした。 [https://x.com/nokonoko\_1203/status/1949850204762710027](https://x.com/nokonoko_1203/status/1949850204762710027) 「Claude Code、アホになったよね」っおいう話が䞀時期ずおも話題になり、なんなら今でも継続䞭です。 最新版だず利甚するのが苊痛になるような挙動を芋せるので、Claude Codeのバヌゞョンを1.0.24に固定するのがおすすめです、ずいう趣旚のポストなんですが、v1.0.24だず - Winで利甚できない - モデルを倉えるたびにsettings.jsonがリセットされるバグ ずいった制玄がありたす。 ぀い最近、npmでのむンストヌルではなくネむティブむンストヌルできる方法が公匏から公開されおいたんですが、以䞋のようにv1.0.24をむンストヌルしようずするず、甚意されおいたせんでした  ```text curl -fsSL https://claude.ai/install.sh | bash -s 1.0.24 ``` どうやら、v1.0.37以前のバヌゞョンは存圚しないようです。 ただ、v1.0.37を利甚しおみるず、䜓感ずしおはv1.0.24ず倉わらない挙動をするこずが確認できたので、以䞋のコマンドでむンストヌルするこずをお勧めしたす ```text curl -fsSL https://claude.ai/install.sh | bash -s 1.0.37 ``` ## 実践的な䜿い方 ### よく䜿うコマンド䞀芧 claude code自䜓に色々なオプションがありたす。 特に、前回の䌚話を再開する `-c` オプションなんかは頻繁に利甚するかもしれたせん。 詳しくはクむックスタヌトぞ。 ```bash # Claude Codeの起動 claude # 特定のディレクトリで起動 claude /path/to/project # 最新版ぞの曎新 claude update # 前回の䌚話を継続 claude -c # 䌚話履歎を参照しお起動 claude -r # バヌゞョン確認 claude --version ``` ### コマンドで効率化 `claude` コマンドを実行するず、Claude Codeが起動し、プロンプトを入力できるようになりたすが、先頭に `/` を぀けるず、Claude Codeの䟿利ツヌルが䜿えたす。 ```bash # モデルの切り替えSonnet/Opus > /model # コンテキストに別フォルダを远加 > /add-dir <path> # 䌚話履歎をクリア > /clear ``` コマンドはたくさんあっお、claudeを起動させた状態で `/` を入力するだけでサゞェストされたすが、 `/help` コマンドにはより詳しい情報が茉っおいたす。 ```text Claude Code v1.0.33 Always review Claude's responses, especially when running code. Claude has read access to files in the current directory and can run commands and edit files with your permission. Usage Modes: • REPL: claude (interactive session) • Non-interactive: claude -p "question" Run claude -h for all command line options Common Tasks: • Ask questions about your codebase > How does foo.py work? • Edit files > Update bar.ts to... • Fix errors > cargo build • Run commands > /help • Run bash commands > !ls Interactive Mode Commands: /add-dir - Add a new working directory /bug - Submit feedback about Claude Code /clear - Clear conversation history and free up context /compact - Clear conversation history but keep a summary in context. Optional: /compact [instructions for summarization] /config - Open config panel /cost - Show the total cost and duration of the current session /doctor - Checks the health of your Claude Code installation /exit - Exit the REPL /help - Show help and available commands /ide - Manage IDE integrations and show status /init - Initialize a new CLAUDE.md file with codebase documentation /install-github-app - Set up Claude GitHub Actions for a repository /login - Sign in with your Anthropic account /logout - Sign out from your Anthropic account /marp - Simplify markdown and convert to PDF with Marp (user) /mcp - Manage MCP servers /memory - Edit Claude memory files /migrate-installer - Migrate from global npm installation to local installation /model - Set the AI model for Claude Code /permissions - Manage allow & deny tool permission rules /pr-comments - Get comments from a GitHub pull request /README - Claude Commands (user) /release-notes - View release notes /resume - Resume a conversation /review - Review a pull request /status - Show Claude Code status including version, model, account, API connectivity, and tool statuses /terminal-setup - Install Shift+Enter key binding for newlines /upgrade - Upgrade to Max for higher rate limits and more Opus /vim - Toggle between Vim and Normal editing modes Learn more at: https://docs.anthropic.com/s/claude-code ``` ### 頻繁なアップデヌト※非掚奚 Claude Codeはめちゃくちゃ高頻床でアップデヌトされ、新機胜远加やバグ修正が行われおいたす。定期的なアップデヌトで最新機胜を掻甚できたす。 ```bash # アップデヌト claude update # バヌゞョン確認 claude --version ``` ### ※20250831\_远蚘\_Claude Code v1.0.37ぞのダりングレヌド 前項で蚘茉したずおり、 **性胜が劣化するため、バヌゞョンアップ非掚奚です** ### 蚭蚈・タスク敎理・実装を明確に分離 耇雑なタスクでは、フェヌズを明確に分けるこずで品質を向䞊させるこずができそうだなヌず思っおいたす。 問題をずにかく小さくしお、それをうたく積み䞊げお行くのぱンゞニアずしお腕の芋せ所かもしれたせん。 䟋えば僕は以䞋のテンプレヌトを䜿甚し、それぞれの項目「䜜業の目的・背景」などを **自分で埋めた** 䞊で、指瀺を出したす。 ただし、「\*具䜓的な指瀺をしない」方が性胜が䞊がるなども蚀われおいたす。 もしかするず、 **埌述のカスタムコマンドを䜜成** したり、 **CLAUDE.mdなどでグロヌバルルヌルずしお蚭定** する方が良いのかもしれたせん。この蟺りは目的や呌び出したいタむミングに応じお決めたしょう。 ```md 実装䜜業に必芁な蚭蚈を行なっお、方針を瀺しおください。 タスクは非垞に现かく分割し、䞀床の指瀺で゚ラヌなく実装できるような粒床でにしおください。 蚭蚈方針ず䜜業のステップを瀺しおください。 ## 䜜業の目的・背景 ## 䜜業内容 ## 詳现仕様 ## 前提条件 ## 考慮すべきポむント ## 成果物が満たす条件 ## その他、现々ずした泚意点 ``` ### CLAUDE.mdによるグロヌバル蚭定 `~/.claude/CLAUDE.md` ファむルで、プロゞェクト暪断的なルヌルを蚭定できたす。 䟋えば僕の蚭定䟋では以䞋のようなこずを実珟しおいたす。 - 英語で思考、日本語で応答 - ドキュメントは英語、実装コメントは日本語 - 䞊列凊理の最倧化 - タスク完了時の通知 - 蚭蚈ドキュメントの自動生成`.tmp/design.md` 、`.tmp/task.md`  モデル自身が英語圏で生たれおいる䞊、䞖の䞭の情報が圧倒的に倚いため、英語で思考させるず粟床が高いずかなんずか  ただ、僕は英語が埗意ではないため、レスポンス自䜓は日本語でさせおいたす。 具䜓的には、以䞋のような蚭定をしおいたす。 ```md # Guidelines This document defines the project's rules, objectives, and progress management methods. Please proceed with the project according to the following content. ## Top-Level Rules - To maximize efficiency, **if you need to execute multiple independent processes, invoke those tools concurrently, not sequentially**. - **You must think exclusively in English**. However, you are required to **respond in Japanese**. ## Project Rules - Follow the rules below for writing code comments and documentation: - **Documentation** such as JSDoc and Docstrings must be written in **English**. - **Comments embedded within the code**, such as descriptions for Vitest or zod-openapi, must be written in **English**. - **Code comments** that describe the background or reasoning behind the implementation should be written in **Japanese**. - **Do not use emojis**. - When writing Japanese, do not include unnecessary spaces. - for example - ◯ "Claude Code入門" - × "Claude Code 入門" - To understand how to use a library, **always use the Contex7 MCP** to retrieve the latest information. - When searching for hidden folders like \`.tmp\`, the \`List\` tool is unlikely to find them. **Use the \`Bash\` tool to find hidden folders**. - **You must send a notification upon task completion.** - "Task completion" refers to the state immediately after you have finished responding to the user and are awaiting their next input. - **A notification is required even for minor tasks** like format correction, refactoring, or documentation updates. - Use the following format and \`osascript\` to send notifications: - \`osascript -e 'display notification "${TASK_DESCRIPTION} is complete" with title "${REPOSITORY_NAME}"'\` - \`${TASK_DESCRIPTION}\` should be a summary of the task, and \`${REPOSITORY_NAME}\` should be the repository name. ## Project Objectives ### Development Style - **Requirements and design for each task must be documented in \`.tmp/design.md\`**. - **Detailed sub-tasks for each main task must be defined in \`.tmp/task.md\`**. - **You must update \`.tmp/task.md\` as you make progress on your work.** 1. First, create a plan and document the requirements in \`.tmp/design.md\`. 2. Based on the requirements, identify all necessary tasks and list them in a Markdown file at \`.tmp/task.md\`. 3. Once the plan is established, create a new branch and begin your work. - Branch names should start with \`feature/\` followed by a brief summary of the task. 4. Break down tasks into small, manageable units that can be completed within a single commit. 5. Create a checklist for each task to manage its progress. 6. Always apply a code formatter to maintain readability. 7. Do not commit your changes. Instead, ask for confirmation. 8. When instructed to create a Pull Request (PR), use the following format: - **Title**: A brief summary of the task. - **Key Changes**: Describe the changes, points of caution, etc. - **Testing**: Specify which tests passed, which tests were added, and clearly state how to run the tests. - **Related Tasks**: Provide links or numbers for related tasks. - **Other**: Include any other special notes or relevant information. ``` **※2025/07/02远蚘** **カスタムコマンド** や **Hooks** が䟿利になっおきたので、あたりCLAUDE.mdに情報を詰め蟌たない方が良いかもしれたせん。長文になればなるほど、コンテキストを芋倱い機胜しなくなる 珟圚はこのくらいシンプルになりたした。 目的に合わせお調敎しおいきたしょう ```md # Guidelines This document defines the project's rules, objectives, and progress management methods. Please proceed with the project according to the following content. ## Top-Level Rules - To maximize efficiency, **if you need to execute multiple independent processes, invoke those tools concurrently, not sequentially**. - **You must think exclusively in English**. However, you are required to **respond in Japanese**. - To understand how to use a library, **always use the Contex7 MCP** to retrieve the latest information. ## Programming Rules - Avoid hard-coding values unless absolutely necessary. - Do not use \`any\` or \`unknown\` types in TypeScript. - You must not use a TypeScript \`class\` unless it is absolutely necessary (e.g., extending the \`Error\` class for custom error handling that requires \`instanceof\` checks). ``` `Programming Rules` なんかは、コヌドレビュヌを行なっおくれるMCPなどがあればそちらに任せおしたうこずもできるず思いたす。 ### MCPによる機胜拡匵 MCPModel Context Protocolを掻甚しお、Claude Codeの機胜を倧幅に拡匵できたす。 MCPを利甚する䞊で楜で簡単な方法は、 `claude mcp add` コマンドを䜿甚するこずです。 ```bash # Context7をグロヌバル蚭定に远加 claude mcp add -s user context7 -- npx -y @upstash/context7-mcp@latest # プロゞェクト共有蚭定ずしお远加 claude mcp add -s project context7 -- npx -y @upstash/context7-mcp@latest ``` より高床な蚭定が必芁な堎合は、蚭定ファむルを盎接線集するこずも可胜です。 蚭定ファむル `~/.claude/.mcp.json` の䟋 ```json { "mcpServers": { "github": { "command": "docker", "args": [ "run", "-i", "--rm", "-e", "GITHUB_PERSONAL_ACCESS_TOKEN", "ghcr.io/github/github-mcp-server" ], "env": { "GITHUB_PERSONAL_ACCESS_TOKEN": "..." } }, "context7": { "type": "stdio", "command": "npx", "args": ["-y", "@upstash/context7-mcp@latest"] }, "playwright": { "command": "npx", "args": ["-y", "@playwright/mcp@latest"] } } } ``` 各MCPサヌバヌの甚途 - **GitHub MCP**: GitHubリポゞトリの操䜜Issue、PR、コヌドの取埗 - **Context7**: ラむブラリのドキュメントをリアルタむムで取埗 - **Playwright**: ブラりザ自動化ずWebスクレむピング グロヌバルな蚭定は本来 `~/.claude.json` に蚘茉するのが適切かず思いたすが、 `claude` コマンドでMCP甚の蚭定ファむルを指定するこずも可胜で、そちらを利甚しおいたす。 たた、公匏ドキュメントのずおり `claude mcp add` コマンドで远加するこずができたす。 ```bash claude mcp add <name> <command> [args...] ``` ### ※20250831\_远蚘\_Serenaの利甚 Claude Codeの性胜が劣化したね、ず蚀われたあたりから急速に利甚が広たっおいるのが「Serena」ずいうツヌルMCPサヌバヌです。 LSPLanguage Server Protocolを䜿っおシンボルベヌスでコヌドの解析を行い、LLMによるコヌド怜玢および䜜成・修正をずおも効率良く、粟床良く、トヌクン消費を抑えおくれるこずから、珟圚では必須のツヌルになっおいたす。 こちらの蚘事がずおも参考になりたした。 利甚方法はずおも簡単で、開発するプロゞェクトのディレクトリに移動し、以䞋のコマンドを実行するだけです。 ```text claude mcp add serena -- uvx --from git+https://github.com/oraios/serena serena-mcp-server --context ide-assistant --project $(pwd) && \ uvx --from git+https://github.com/oraios/serena serena project index ``` このコマンドにより、MCPサヌバヌの远加やSerenaの初期化などを行なっおくれたす。 実行埌は普通にClaude Codeを起動させ ```text serenaを利甚しおコヌドを怜玢し、〇〇を修正しおください ``` のように指瀺すれば動いおくれたす。 ただ、以䞋のようにカスタムスラッシュコマンドを仕蟌んでおくずなお良いかもしれたせん。 こちらのコヌドはどなたかの蚘事を参考にさせおいただいたものですが、元蚘事を完党に忘れおしたい 芋぀かり次第リンクを貌りたす  ### 効果的なコヌドレビュヌ claude codeの `/review` コマンドを利甚しお、コヌドレビュヌを行うこずができたすが、フォヌマットを指定したい堎合は普通にプロンプトでレビュヌを実斜させるこずもできたす。 ```md \`https://github.com/{owner}/{repository}/pull/{pull request ID}\`のようにpull requestのURLを指定するので、レビュヌを䟝頌された堎合には、pull requestを取埗し、コヌドレビュヌを日本語で詳现か぀䞁寧に行なっおください。 技術的なテクニックに特に着目し、より良い手法を提案しおください。 - 凊理の責務分離 - 凊理の共通化 - 䞍芁なコヌドの削陀 - APIレスポンスの最適化 - テストの品質向䞊 - 倉数名の敎合性 - ゚ラヌハンドリングの改善 - 凊理堎所の適切性バック゚ンド/フロント゚ンド フォヌマット --- # PR番号ずタむトル ## 倉曎抂芁 ## 倉曎ファむル ## コヌド倉曎の詳现分析 ## レビュヌコメント ### 良い点 ### 改善点・確認点 ## 結論 --- ではレビュヌを行っおください。 pull requestのURL: ``` ### 思考拡匵による粟床向䞊 Claude Codeには、耇雑な問題に察しおより深い分析を行うための「拡匵思考モヌド」がありたす。 特定のキヌワヌドを䜿甚するこずで、異なるレベルの蚈算リ゜ヌスを割り圓おるこずができたす。 キヌワヌドは耇数存圚するようですが、党お `think` から始たるワヌドの方が芚えるのが楜だったため、このように思せおいたす。 - `think` - 基本レベル4,000トヌクン - 䜿甚䟋簡単なリファクタリングや説明 - `think hard` / `think deeply` - 詳现レベル10,000トヌクン - 䜿甚䟋アヌキテクチャの蚭蚈、耇雑なバグの解析 - `think harder` / `ultrathink` - 最倧レベル31,999トヌクン - 䜿甚䟋倧芏暡リファクタリング、システム党䜓の最適化提案 䜿甚䟋 ```text > "think hard このコヌドのパフォヌマンスを改善する方法を考えお" > "think super hard このアヌキテクチャの問題点ず改善案を提瀺しお" ``` ただし、思考拡匵はトヌクン消費が増えるため、レヌトリミットに泚意が必芁です。 ### セキュリティを考慮したpermissions蚭定 `~/.claude/settings.json` で、ファむルアクセスやコマンド実行の暩限を现かく制埡できたす。 プロゞェクトどころかPC諞共砎壊するような危険なコマンドは犁止し぀぀、効率よく開発ができるようにバランスを取る必芁がありそうです。 こちらの蚘事なんかを参考にさせおいただきたした。 ```json { "env": {}, "permissions": { "allow": [ "Read(**)", "Write(src/**)", "Write(docs/**)", "Write(.tmp/**)", "Bash(git init:*)", "Bash(git add:*)", "Bash(git commit:*)", "Bash(git push origin*:*)", "Bash(git status:*)", "Bash(git diff:*)", "Bash(git log:*)", "Bash(npm install:*)", "Bash(pnpm install:*)", "Bash(rm *)", "Bash(ls:*)", "Bash(cat **)", "Bash(osascript -e:*)", "mcp__context7__resolve-library-id", "mcp__context7__get-library-docs" ], "deny": [ "Bash(sudo:*)", "Bash(rm -rf:*)", "Bash(git push:*)", "Bash(git reset:*)", "Bash(git rebase:*)", "Read(.env.*)", "Read(id_rsa)", "Read(id_ed25519)", "Write(.env*)", "Bash(curl:*)", "Bash(wget:*)" ] }, "model": "opus", "preferredNotifChannel": "auto", "enableAllProjectMcpServers": false } ``` ### Git Worktreeずccmanagerの掻甚 Git Worktreeを䜿甚するこずで、同䞀リポゞトリの耇数ブランチを異なるディレクトリで同時に䜜業できたす。 Claude Codeでの利点 - 耇数タスクの䞊列実行が可胜 - ブランチ切り替えによるコンテキストロスを防止 - 各worktreeで独立したセッションを維持 worktreeを効率的に管理する手法ずしお、 `ccmanager` などのツヌルの利甚が挙げられたす。 ccmanagerは、耇数のClaude Codeセッションを効率的に管理するCUIツヌルです。 ```bash # むンストヌル npm install -g ccmanager ``` 蚭定により以䞋が実珟可胜 - 各worktreeのステヌタス衚瀺䜜業䞭、入力埅ち、完了など - ショヌトカットによる玠早いセッション切り替え - Git操䜜のUI統合 - カスタムコマンドによる自動化 ただし、マルチタスクは疲劎床が高いため、適床な利甚を掚奚したす。 䞊列開発をしおいるず色々なリポゞトリのルヌトで頻繁に `ccmanager` コマンドを叩く必芁があるので、shellの蚭定 `~/.zshrc` などには以䞋のように蚭定しおおくずコマンドが短瞮できお地味に䟿利でしょう。 ```text alias ccm='ccmanager' ``` ccmanagerには以䞋のような蚭定を䜿甚しおいたす。 commandを蚭定するこずでclaude codeに実行させる匕数を指定できたす。 実際に利甚しおみるず以䞋のようになりたす。 簡単にworktreeの䜜成、削陀などが行えたす。 **※2025/07/02远蚘** ccmanagerで「 **プリセット** 」の蚭定ができるようになっおいたした 蚭定しおおくずワヌクツリヌを遞択した埌に、蚭定したプリセットでClaude Codeを起動させられたす 䟋えば `~/.config/ccmanager/config.json` の蚭定ファむルを以䞋のように蚭定しおいるずしたしょう。 ```json { "worktree": { "autoDirectory": true, "autoDirectoryPattern": "../{branch}" }, "commandPresets": { "presets": [ { "id": "claude-resume", "name": "Claude Code (Resume)", "command": "claude", "args": ["--resume"], "fallbackArgs": [] }, { "id": "claude-yolo", "name": "Claude Code (YOLO)", "command": "claude", "args": [ "--dangerously-skip-permissions" ], "fallbackArgs": [] }, { "id": "gemini-default", "name": "Gemini CLI", "command": "gemini", "args": [], "detectionStrategy": "gemini" } ], "defaultPresetId": "claude-resume", "selectPresetOnStart": true } } ``` こうするず、以䞋のようにどのコマンドを実行するか遞択できるようになりたす [![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/203944/5ce57e20-8802-4e5a-8291-7f6424db1a5c.png)](https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.ap-northeast-1.amazonaws.com%2F0%2F203944%2F5ce57e20-8802-4e5a-8291-7f6424db1a5c.png?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&s=396040c0d5622456c8887e22dd975e6c) **`Gemini CLI` を実行す** るこずもできちゃうのでめちゃ䟿利です ### 䜜業完了通知の自動化 `~/.claude/CLAUDE.md` に、䜜業完了埌には以䞋のようなコマンドを実行するように指瀺しおおくこずで、䜜業完了時に自動通知を受け取れたす ```bash osascript -e 'display notification "${TASK_DESCRIPTION} is complete" with title "${REPOSITORY_NAME}"' ``` この蚭定により - 長時間実行タスクの完了を芋逃さない - 䞊列䜜業時の進捗管理が容易 - 䜜業効率が向䞊 **※2025/07/02远蚘** 埌述するHooksが利甚可胜になったため、そちらで通知した方が確実かもしれたせん ### カスタムスラッシュコマンドの䜜成 カスタムコマンドで䜜業を効率化できたす。 䟋えば、以䞋のようなコマンドで発衚スラむド䜜成コストの短瞮などができるかもしれたせん。 **※2025/07/02远蚘** `@` プレフィックスを利甚しお、コマンド実行の前に指定されたファむルを含めるこずができるようになりたした コマンドを埮修正したした 䟋Marpでマヌクダりンからスラむドを自動生成 `~/.claude/commands/marp.md`  ```md --- allowed-tools: Read, Write, Bash(marp:*, rm:*) description: Simplify markdown and convert to PDF with Marp --- ## Context - Input file: $ARGUMENTS - Guidelines: @~/.claude/templates/slide-guidelines.md - Template: @~/.claude/templates/design-template.md ## Your task 1. Read the input markdown file 2. Read the slide guidelines 3. Simplify the markdown content according to the guidelines 4. Read the design template 5. Apply the template to the simplified content 6. Save to a temporary file 7. Convert to PDF using Marp CLI 8. Clean up the temporary file ``` このコマンドでは事前に甚意した以䞋のようなテンプレヌトを利甚しおいたす。 - `~/.claude/templates/design-template.md` ```md --- marp: true theme: white-minimal paginate: true --- <style> </style> ``` - `~/.claude/templates/slide-guidelines.md` ```md # Slide Simplification Guidelines ## Core Principles ### 1. One Slide, One Message - Each slide should convey a single, clear message - Avoid information overload - Supplement details verbally or in separate materials ### 2. Title Rules (\`##\`) - **Maximum 30 full-width characters** (or ~60 half-width characters) - **Must fit on one line** - wrapping breaks the layout - Keep titles concise and clear ### 3. Content Guidelines #### Text and Bullet Points - **Characters per line:** 35-45 full-width characters - **Bullet points per slide:** 5-7 items maximum - **Lines per bullet point:** 1-2 lines ideally - **Paragraph lines:** 5-7 lines maximum #### Subtitle Rules (\`###\`) - Maximum 15 full-width characters - Use for section breaks or sub-headings only #### Tables - **Columns:** 3-4 maximum - Keep cell content concise - Consider bullet points for complex data ## Simplification Strategies ### 1. Remove Redundancy - Eliminate repetitive phrases - Remove obvious statements - Cut unnecessary transitional words ### 2. Use Clear Structure - Start with the most important point - Use parallel construction in lists - Group related items together ### 3. Simplify Language - Replace complex terms with simple ones - Use active voice - Avoid jargon unless necessary ### 4. Visual Hierarchy - Use headings to structure content - Break long paragraphs into bullet points - Add whitespace for readability ## Examples ### Bad Example --- ## An Extremely Long Title About Very Important Technical Debt in This Project and Its Detailed Repayment Plan with Comprehensive Considerations --- ### Good Example --- ## Technical Debt Repayment Plan --- ### Before Simplification --- - In order to properly understand the complex nature of our system architecture, it is absolutely essential that we first take into consideration the various interconnected components and their relationships --- ### After Simplification --- - Understand system architecture through component relationships --- ``` 䜿甚方法はこれだけです。 ```text /marp path-to-markdown ``` ### Gemini CLIを利甚したGoogle Web Search Gemini CLIはClaude Codeの類䌌ツヌルです。 コヌディングタスクを行う䞊ではClaude Codeの方が性胜が良いずいう話は聞こえおきたすが、Web怜玢による情報収集ならGemini CLIの圧勝だそうです。 前項で説明したカスタムコマンドずしお `search` を登録したしょう。 **※2025/07/02远蚘** `!`プレフィックスを利甚しお、コマンド実行の前にbashコマンドを実行できるようになりたしたたた、 `think` などのキヌワヌドを入れおおくこずで、思考拡匵を行えるようになっおいたす。 コマンドを埮修正したした - `~/.claude/commands/search.md` ```md --- allowed-tools: Bash(gemini:*) description: "Use the Gemini CLI to perform web searches." --- ## Gemini Search **Run the Gemini CLI with the Bash tool instead of the Web_Search tool** You will receive a command like \`>/search [arguments]\`. Use the Bash tool to launch Google_Web_Search in the Gemini CLI and search for the arguments you received as follows: - Use !\`gemini -p 'google_web_search:[arguments]'\` Please narrow down the keywords you want to search for about 2-3. think. ``` このように利甚するこずができたす。 ```text > /search "気圧ずその倉化を瀺す時系列デヌタっお、どんなデヌタがある" ⏺ 気圧ずその倉化を瀺す時系列デヌタの皮類 䞻なデヌタ圢匏 1. GRIB/GRIB2圢匏 - 䞖界気象機関(WMO)暙準の気象デヌタ圢匏 2. NetCDF圢匏 - 科孊デヌタの保存・共有に広く䜿甚 3. JSON圢匏 - Web APIで提䟛される圢匏 4. CSV/テキスト圢匏 - シンプルな時系列デヌタ 利甚可胜なデヌタ゜ヌス 1. NOAA GFS (Global Forecast System) - 党球予報デヌタ0.25床解像床 - 地衚面気圧、海面曎正気圧など - GRIB2圢匏で提䟛 2. Open-Meteo API - 無料の気象予報API - JSON圢匏で簡単にアクセス可胜 - 過去デヌタず予報デヌタを提䟛 3. 気象庁デヌタ - アメダス芳枬デヌタ - 高局気象芳枬デヌタ デヌタ内容 - 地衚面気圧 (surface pressure) - 海面曎正気圧 (mean sea level pressure) - 気圧の時間倉化率 - 予報時系列デヌタ (3時間ごず、最倧16日先たで) ``` ### Hooksを利甚したタスク完了通知 **※2025/07/02远蚘** Hooksを利甚するずClaude Codeのラむフサむクル各工皋が完了した時でコマンドが実行できるようになりたす 今たではカスタムコマンドやCLAUDE.mdに蚘述をしおも、LLMが実行刀断を䞋さなかったり、コンテキストを芋倱っおしたうず蚘述した凊理を実行しおくれたせんでしたが、Hooksでは特定のアクションが必ず実行されるようになりたす Hooksを利甚するにはたず `~/.claude/settings.json` にhooksセクションを远加する必芁がありたす。 こちらの蚘事も参考にさせおもらいたした。 ```json { "env": { ... }, "permissions": { ... }, "hooks": { "Stop": [ { "matcher": "", "hooks": [ { "type": "command", "command": "~/.claude/hooks/stop-send-notification.js" } ] } ], "PostToolUse": [ { "matcher": "Write|Edit|MultiEdit", "hooks": [ { "type": "command", "command": "~/.claude/hooks/textlint-hook.js" } ] } ] } } ``` 実行されるcommandをワンラむナヌで蚘述しおも良いですが、耇雑なものを䜜成するずきには `~/.claude/hooks` フォルダを䜜成し、実行可胜なプログラムシェルスクリプトや.jsや.pyなどを配眮し、そのパスを指定したしょう。 `Stop` や `PostToolUse` はフックむベントを指定し、 `matcher` にはClaude Codeがどのようなタむミングでコマンドを実行するかを指定したす。 フック時には暙準入力でJSONを受信したす。 このため、実行したいプログラムでは暙準入力から倀を抜出し、䜕かしら凊理する必芁がありたす。 今回䜜った `textlint-hook.js` は、ファむル線集ツヌル終了時に実行され、 `textlint` ずいうツヌルを実行し、日本語文章を敎えたす。 プログラムが実行されたのち、察象がマヌクダりンの堎合はさらに別のコマンドが実行されるような䜜りです。 以䞋、適圓にLLMに䜜らせたプログラムなので、実行は自己責任でお願いしたす。 ```js #!/usr/bin/env node const fs = require('fs'); const path = require('path'); const { spawn } = require('child_process'); const os = require('os'); /** * Check if file is a markdown file */ function isMarkdownFile(filepath) { return filepath.endsWith('.md') || filepath.endsWith('.markdown'); } /** * Run textlint on the file and return result */ function runTextlint(filepath) { return new Promise((resolve) => { try { const configPath = path.join(os.homedir(), '.claude', '.textlintrc.json'); // First, check for errors const textlint = spawn('npx', ['textlint', '-c', configPath, filepath], { stdio: ['inherit', 'pipe', 'pipe'] }); let stdout = ''; let stderr = ''; textlint.stdout.on('data', (data) => { stdout += data.toString(); }); textlint.stderr.on('data', (data) => { stderr += data.toString(); }); textlint.on('close', (code) => { if (code !== 0) { // Errors found, try to fix them console.error(\`Textlint found issues in ${filepath}. Attempting to fix...\`); // Run with --fix option const fixTextlint = spawn('npx', ['textlint', '-c', configPath, '--fix', filepath], { stdio: ['inherit', 'pipe', 'pipe'] }); let fixStdout = ''; let fixStderr = ''; fixTextlint.stdout.on('data', (data) => { fixStdout += data.toString(); }); fixTextlint.stderr.on('data', (data) => { fixStderr += data.toString(); }); fixTextlint.on('close', (fixCode) => { if (fixCode === 0) { console.error(\`✅ Textlint automatically fixed issues in ${filepath}\`); } else { console.error(\`⚠ Some textlint issues could not be automatically fixed in ${filepath}\`); console.error(fixStdout); } resolve(fixCode); }); } else { resolve(0); } }); } catch (error) { console.error(\`Error running textlint: ${error}\`); resolve(1); } }); } // Read input from stdin let inputData = ''; process.stdin.setEncoding('utf8'); process.stdin.on('data', (chunk) => { inputData += chunk; }); process.stdin.on('end', async () => { try { const input = JSON.parse(inputData); // Get tool information const toolName = input.tool_name || ''; const toolInput = input.tool_input || {}; // Check if this is a file editing tool if (!['Edit', 'Write', 'MultiEdit'].includes(toolName)) { process.exit(0); } // Get the file path let filePath = toolInput.file_path || ''; // For MultiEdit, also check edits if (toolName === 'MultiEdit') { // MultiEdit can edit multiple files, but file_path is the target if (!isMarkdownFile(filePath)) { process.exit(0); } } else { // For Edit and Write, check the file path if (!filePath || !isMarkdownFile(filePath)) { process.exit(0); } } // Expand the file path filePath = filePath.replace(/^~/, os.homedir()); // Check if file exists (it should after editing) if (!fs.existsSync(filePath)) { console.error(\`Warning: File ${filePath} does not exist\`); process.exit(0); } // Run textlint await runTextlint(filePath); // Exit with 0 even if textlint found issues (non-blocking) process.exit(0); } catch (error) { console.error(\`Error: Invalid JSON input: ${error}\`); process.exit(1); } }); ``` textlintに぀いおは別蚘事を曞く予定です ## たずめ ずいうこずでいく぀かTipsを玹介しおきたした Claude Codeはそもそも䜕もしなくおも䟿利ですが、ちょっずした倉曎でもっず䟿利になりたす。 以䞋たずめです。 - 頻繁なアップデヌト - 蚭蚈・タスク敎理・実装を明確に分離 - CLAUDE.mdによるグロヌバル蚭定 - MCPによる機胜拡匵 - 効果的なコヌドレビュヌ - 思考拡匵による粟床向䞊 - セキュリティを考慮したpermissions蚭定 - Git Worktreeずccmanagerの掻甚 - 䜜業完了通知の自動化 - カスタムスラッシュコマンドの䜜成 - Gemini CLIを利甚したGoogle Web Search **※2025/07/02远蚘** - Hooksを利甚したタスク完了通知 皆さんもやっおいきたしょう [1](https://qiita.com/nokonoko_1203/items/#comments) コメント䞀芧ぞ移動 XTwitterでシェアする Facebookでシェアする はおなブックマヌクに远加する 新芏登録しお、もっず䟿利にQiitaを䜿っおみよう 1. あなたにマッチした蚘事をお届けしたす 2. 䟿利な情報をあずで効率的に読み返せたす 3. ダヌクテヌマを利甚できたす [ログむンするず䜿える機胜に぀いお](https://help.qiita.com/ja/articles/qiita-login-user) [新芏登録](https://qiita.com/signup?callback_action=login_or_signup&redirect_to=%2Fnokonoko_1203%2Fitems%2F67f8692a0a3ca7e621f3&realm=qiita) [ログむン](https://qiita.com/login?callback_action=login_or_signup&redirect_to=%2Fnokonoko_1203%2Fitems%2F67f8692a0a3ca7e621f3&realm=qiita) [422](https://qiita.com/nokonoko_1203/items/67f8692a0a3ca7e621f3/likers) いいねしたナヌザヌ䞀芧ぞ移動 291