AIFCC
記事一覧へ
Claude Code開発効率化ワークフローclaude-workflow

ほとんどのユーザーが知らないClaude Code の35のコマンド・テクニック・ワークフロー完全版

24747
## ほとんどのユーザーが知らないClaude Code の35のコマンド・テクニック・ワークフロー完全版 私はClaude Code を数ヶ月間毎日使い続けています。これは、Claude Code をまるでチートコードのように感じさせてくれる35のテクニックです。 ブックマークしてください :) ほとんどの開発者はClaude Code をインストールして、基本的なコード生成に使い、それで全部見たつもりになっています。 実際に見ているのはせいぜい20%です。 残りの80%——Claude Code を「便利なアシスタント」から「これまでで最も生産的な自分」に変えるテクニック——は、ドキュメントの奥深くに埋もれており、実験によって発見されるか、小さなコミュニティで共有されているかのどちらかです。 私が実際に効果を感じたすべてのテクニックをまとめました。毎日テスト済み。理論ゼロです。 ターミナルを開くたびに使うことになるでしょう。 --- ## 必須コマンド(01〜08) ### 01. Plan Mode(Shift + Tab) 実装を始める前に、Plan Mode(プランモード)に切り替えましょう。Claude Code がコードベースを分析し、コードを一切書かずにアーキテクチャプランを作成します。プランを確認し、承認してから実装モードに戻します。この習慣一つで、このリストのどのテクニックよりも多くのバグを防げます。 ### 02. Compact(/compact) 30〜45分の会話を続けると、コンテキストが膨れ上がります。`/compact` と入力すると、会話履歴全体を、重要な決定事項と現状のフォーカスされた要約に圧縮します。Claude Code が徐々に話の流れを見失わず、鋭い状態を保てます。 ### 03. Clear(/clear) 新しいタスクを始めるときは、完全にリセットしましょう。データベースリファクタリングのコンテキストをフロントエンドのリデザインに持ち込むと、混乱した矛盾するコードが生成されます。機能ごとに会話を一つ。これを徹底してください。 ### 04. Init(/init) 新しいプロジェクトの開始時に実行します。Claude Code がコードベースをスキャンし、CLAUDE.md ファイルを生成します。これは将来のセッションで毎回自動的に読み込まれる永続的なコンテキストドキュメントです。プロジェクト構造・技術スタック・コーディングパターン・主要なアーキテクチャ決定事項が含まれます。 ### 05. Cost Check(/cost) 現在のセッションのトークン使用量を表示します。長いセッション中は毎時間確認しましょう。AI支援開発にはコストがかかり、想定外の出費は困りものです。セッションごとの予算を心に決め、それと照らし合わせて確認してください。 ### 06. Memory(/memory) すべてのセッションにわたってClaude Code が記憶する永続的な指示を追加します。「TypeScriptのstrictモードを常に使用する」「publicな関数には常にJSDocコメントを付ける」「/src/core 内のファイルを変更したら常にテストを実行する」——これらのルールは、毎回繰り返さなくても将来のすべての会話で自動的に適用されます。 ### 07. Terminal Integration(! プレフィックス) メッセージの先頭に `!` を付けると、Claude に送らずターミナルコマンドとして実行されます。Claude Code インターフェースを離れずに、テストの実行・git status の確認・ディレクトリ移動を素早く行う方法です。 ### 08. Multi-Model Switching プランニングとアーキテクチャの決定にはOpus を使用。実装と実行にはSonnet に切り替えます。Opus はより深く考えますがコストが高い。Sonnet はより速く安価に実行できます。考える人でプランを作り、作る人でビルドする。 --- ## 生産性テクニック(09〜18) ### 09. 参照ファイルテクニック 欲しいコードスタイルを説明する代わりに、既存のファイルを指示します。「`src/auth/login.ts` での認証の実装方法を見てください。まったく同じパターンに従ってパスワードリセットを実装してください。」Claude Code はその参照を読み込み、パターンを正確に複製します。口頭での説明よりもはるかに一貫したコードが生成されます。 ### 10. スクリーンショットデバッグ UIで何かがおかしい?段落を書き連ねる必要はありません。スクリーンショットを撮って、Ctrl+Vで貼り付けましょう。「ボタンが入力フィールドとずれています。カード間のスペースが不均一です。両方修正してください。」視覚的なフィードバックは文章での説明よりも速く正確です。 ### 11. テストファーストワークフロー 「割引価格を計算する関数のテストを書いてください。通常割引・ゼロ割引・100%割引・マイナス価格・文字列入力をカバーしてください。それからすべてのテストをパスするように関数を実装してください。」テストがコードより先に動作を定義します。実装は事前定義されたテストをパスしなければならないため、自動的に正しいものになります。 ### 12. インクリメンタルビルド 「機能全体を作って」とは絶対に言わないでください。ステップに分解しましょう。「データベーススキーマを作成してください。」テスト。「APIエンドポイントを作ってください。」テスト。「バリデーションを追加してください。」テスト。「フロントエンドフォームを作ってください。」テスト。間にテストを挟んだ5つの小さなステップは、一つの大きな実装プロンプトよりも劇的に優れたコードを生み出します。 ### 13. コードベース質問 コードベースの不慣れな部分に何かを実装する前に。「`src/services/` を読んで、APIルートからデータベースまでデータがどのように流れるか説明してください。どんなパターンが使われていますか?ここを変更する前に何を知っておくべきですか?」作る前の理解がアーキテクチャのミスを防ぎます。 ### 14. Diffレビュー Claude Code が変更を加えた後。「変更したすべてのファイルのdiffを見せてください。各変更を1文で説明してください。」これにより意図しない変更が発見できます——Claude Code は、頼んでいないファイルを「親切に」変更することがあります。 ### 15. エラーの貼り付け 何かが壊れたとき、完全なエラーメッセージとスタックトレースをコピーしてください。要約ではなく、完全な出力を。「このエラーが出ました:[完全なエラーを貼り付け]。修正を提案する前に、根本原因をステップバイステップで診断してください。」ステップバイステップという制約が、Claudeが間違った修正に飛びつくのを防ぎます。 ### 16. アンドゥチェックポイント すべての大きな変更の前に。`git add . && git commit -m "checkpoint before [変更内容]"`。Claude Code が何かを壊した場合、以前の動作していた状態のデバッグに30分かけるのではなく、数秒で元に戻せます。 ### 17. 並行セッション 大きな機能の場合、2つのターミナルウィンドウを開きます。一方ではClaude Code でバックエンドの実装を実行し、もう一方ではClaude Code でフロントエンドを実行します。各セッションはそれぞれのドメインに対してクリーンでフォーカスされたコンテキストを持ちます。最後に各パーツを結合します。 ### 18. ドキュメント生成パス 機能を完成させた後。「この機能のために作成または変更したすべてのファイルを読んでください。包括的なドキュメントを生成してください:各関数が何をするか、それらがどのようにつながるか、期待される入出力は何か、そして明白でない設計上の決定事項は何か。」ビルド直後に生成されたドキュメントは、数日後に記憶から書かれたドキュメントよりも正確です。 --- ## アーキテクチャテクニック(19〜26) ### 19. アーキテクチャ監査 新しいプロジェクトを開始する前に。「私のプロジェクト要件を分析してください:[要件を列挙]。2つの異なるアーキテクチャアプローチを提案してください。それぞれについて:コンポーネント図・長所・短所・推定複雑さ・潜在的なリスクを示してください。明確な根拠を持つ一つを推薦してください。」AIの分析でアーキテクチャを決定することで、後の高コストな書き直しを防げます。 ### 20. 依存関係チェック 新しいパッケージを追加する前に。「[ユースケース]のために[パッケージ]を追加したいです。確認してください:これは活発にメンテナンスされていますか?既知のセキュリティ問題はありますか?バンドルサイズへの影響は?私の特定のユースケースをカバーする軽量な代替手段はありますか?」不要または危険な依存関係でプロジェクトが肥大化するのを防ぎます。 ### 21. パターン強制適用 CLAUDE.md に追記します。「新しいファイルを作成するとき、以下のパターンに従ってください:APIルートは `src/api/example-route.ts` の構造に従う。データベースクエリは `src/repositories/example-repo.ts` のリポジトリパターンを使用する。Reactコンポーネントは `src/components/ExampleComponent.tsx` の構造に従う。」Claude Code はこれを読み込み、すべての新しいファイルで自動的にあなたのパターンに合わせます。 ### 22. マイグレーションビルダー 「ユーザーテーブルのスキーマを変更する必要があります:'role'カラム(enum: admin, editor, viewer, デフォルト: viewer)を追加し、'name'を'display_name'に変更します。マイグレーションファイルを生成し、リポジトリレイヤーを更新し、古いスキーマを参照するすべてのAPIルートを更新し、TypeScriptの型を更新してください。変更を加える前に変更が必要なすべてのファイルを見せてください。」複数のレイヤーにまたがるスキーマ変更こそ、Claude Code が輝く場面です——すべての波及効果を追跡します。 ### 23. API設計レビュー 「私のAPI設計をレビューしてください:[ルート定義を貼り付け]。確認してください:一貫性のない命名・欠けているエラーレスポンス・ページネーションが必要なエンドポイント・保護されたルートで欠けている認証・REST規約違反。具体的な改善点を提案してください。」 ### 24. セキュリティスキャン 「このコードベースをセキュリティの脆弱性についてスキャンしてください:SQLインジェクション・XSS・コードや設定ファイルに露出しているシークレット・入力バリデーションの欠如・安全でない直接オブジェクト参照・レート制限の欠如。各発見事項について:深刻度・正確な場所・なぜ危険か・修正方法を示してください。」 ### 25. パフォーマンスプロファイラー 「このコードベースのパフォーマンス問題を分析してください:N+1データベースクエリ・クエリパターンに基づく欠けているインデックス・Reactコンポーネントの不要な再レンダリング・遅延ロードできる大きなバンドルインポート・キャッシュすべきAPIエンドポイント。推定インパクトの順に優先順位付けしてください。」 ### 26. リファクタリングプランナー 「`src/services/user-service.ts` を読んでください。このファイルは800行に成長し、多すぎる責任を担っています。フォーカスしたモジュールに分割するリファクタリングプランを提案してください。提案されたファイル構造・何がどこに移動するか・外部インポートが壊れないことを確認してください。まだリファクタリングを開始しないでください——プランだけ見せてください。」 --- ## ワークフロー自動化(27〜31) ### 27. Gitフックライター 「pre-commitフックを作成してください:ステージされたファイルに対してlinterを実行する・型チェックを実行する・プロダクションコードのconsole.logステートメントをチェックする・いずれかのチェックが失敗したコミットをブロックする。`.husky/pre-commit` にインストールしてください。」コミットするたびに実行される自動品質ゲートです。 ### 28. CI パイプラインビルダー 「GitHub Actionsワークフローを作成してください:すべてのPRで実行する・依存関係をインストールする・完全なテストスイートを実行する・linterを実行する・プロジェクトをビルドする・結果をPRのコメントとして投稿する。node_modulesのキャッシングを使用する。」 ### 29. 環境セットアップスクリプト 「新しい開発者が一度だけ実行して開発環境全体をセットアップする setup.sh スクリプトを作成してください:依存関係のインストール・.env.example から .env の作成・ローカルデータベースのセットアップ・マイグレーションの実行・テストデータのシード・テストスイートを実行してすべてが動作することを確認する。」 ### 30. リリースノートジェネレーター 「最後のタグからのgitログを読んでください。次の形式で整理されたリリースノートを生成してください:新機能・バグ修正・パフォーマンス改善・破壊的変更。各エントリを開発者の専門用語ではなく、ユーザーフレンドリーな言葉で書いてください。markdownのchangelogエントリとしてフォーマットしてください。」 ### 31. データベースシードビルダー 「開発データベース用の包括的なシードファイルを作成してください。含めるもの:5ユーザー(admin 1人、editor 2人、viewer 2人)・現実的なデータを持つ20のサンプルプロジェクト・エンティティ間のリレーションシップ・エッジケース(アーカイブされたプロジェクト・削除されたユーザー・メンバーのいないプロジェクト)。'test123'ではなく、現実的なデータにしてください。」 --- ## デバッグとリカバリー(32〜35) ### 32. 再現プロンプト 「このバグがユーザーから報告されました:[バグレポートを貼り付け]。最小限の再現手順を作成してください:正確なステップ・期待される動作・実際の動作。次に、このバグを捉える失敗するテストを書いてください。それからテストをパスするようにコードを修正してください。」 ### 33. Blame 調査ツール 「この関数は昨日から失敗し始めました。過去1週間のこのファイルのgitログを読んでください。どのコミットが問題を引き起こした可能性が高いかを特定し、何が変わったかを説明してください。それから修正を提案してください。」 ### 34. 依存関係競合リゾルバー 「この依存関係の競合が出ています:[エラーを貼り付け]。競合を分析してください。共有依存関係の競合するバージョンを必要とするパッケージを特定してください。最小限の変更で済む解決策を提案し、トレードオフを説明してください。」 ### 35. リカバリーモード Claude Code が壊れた実装を生成し、やり取りを繰り返しすぎた場合。「止まってください。このファイルの元の動作していたバージョンをgitから読んでください:[git showコマンドの出力を貼り付け]。今、達成しようとしていたことを確認してください:[目標をシンプルに再述]。別のアプローチで一から始めてください。前のアプローチは明らかに機能していません。」 クリーンな状態から始め直す方が、積み重なったミスを修正するよりも速い場合があります。これをいつ使うかを知っておいてください。 --- ## すべてをつなぐセットアップ 新しいプロジェクトを開始するとき、この手順を実行してください: 1. `/init` ——CLAUDE.md ファイルを生成する 2. コーディング標準とパターンを CLAUDE.md に追加する 3. `/memory` ——すべてのセッションで適用したい永続的なルールを追加する 4. Plan Mode ——コードを書く前にアーキテクチャを設計する 5. インクリメンタルにビルドを開始する——一度に一つの機能、各ステップでテスト この5分間のセットアップが、その後の開発時間すべてを変えます。 --- ## まとめ 35のテクニック。毎日テスト済み。それぞれが実際の開発上の問題を解決します。 セッション管理のための必須コマンド。より速いビルドのための生産性テクニック。より良い設計のためのアーキテクチャテクニック。一貫した品質のためのワークフロー自動化。何かが壊れたときのデバッグとリカバリー。 Claude Code は利用可能な中で最も強力な開発ツールです。これら35のテクニックがその全力を解き放ちます。 まとめるのに毎日の使用を数ヶ月かけました。時間が節約できたなら——あなたも何をすべきかわかるはずです。
原文を表示 / Show original
Khairallah AL-Awady @eng_khairallah1 35 Claude Code Commands, Tricks, and Workflows That Most Users Don't Know — The Complete List 57 255 1.5K 4.8M I have been using Claude Code daily for months. These are the 35 techniques that make it feel like a cheat code. Save this :) Most developers install Claude Code, use it for basic code generation, and think they have seen what it can do. They have seen maybe 20 percent. The other 80 percent - the techniques that turn Claude Code from "useful assistant" into "the most productive I have ever been". are buried in documentation, discovered through experimentation, or shared in small communities. I compiled every technique that moved the needle for me. Tested daily. Zero theory. Bookmark this. You will use it every time you open your terminal. Essential Commands (01 to 08) 01. Plan Mode (Shift + Tab) Before any implementation, switch to plan mode. Claude Code analyzes your codebase and creates an architecture plan WITHOUT writing any code. Review the plan. Approve it. Then switch back to implementation. This single habit prevents more bugs than any other technique on this list. 02. Compact (/compact) After 30 to 45 minutes of conversation, your context gets bloated. Type /compact to compress the entire conversation history into a focused summary of key decisions and current state. Claude Code stays sharp instead of gradually losing track of what you discussed. 03. Clear (/clear) Starting a new task? Clear the slate entirely. Carrying context from a database refactor into a frontend redesign produces confused, conflicting code. One conversation per feature. Always. 04. Init (/init) Run this at the start of any new project. Claude Code scans your codebase and generates a CLAUDE.md file. a persistent context document that it reads automatically in every future session. Includes project structure, tech stack, coding patterns, and key architecture decisions. 05. The Cost Check (/cost)Displays your token usage for the current session. Check this every hour during long sessions. AI-assisted development costs money and surprises are never fun. Set a mental budget per session and check against it. 06. Memory (/memory) Add persistent instructions that Claude Code remembers across all sessions. "Always use TypeScript strict mode." "Always add JSDoc comments to public functions." "Always run tests after modifying any file in /src/core." These rules apply automatically in every future conversation without repeating them. 07. Terminal Integration (! prefix) Prefix any message with ! to run it as a terminal command instead of sending it to Claude. Quick way to run tests, check git status, or navigate directories without leaving the Claude Code interface. 08. Multi-Model Switching Use Opus for planning and architecture decisions. Switch to Sonnet for implementation and execution. Opus thinks deeper but costs more. Sonnet executes faster and cheaper. Plan with the thinker. Build with the builder. Productivity Techniques (09 to 18) 09. The Reference File Technique Instead of describing the code style you want, point to an existing file: "Look at how authentication is implemented in src/auth/login.ts. Implement password reset following the exact same patterns." Claude Code reads the reference and replicates the patterns precisely. Produces far more consistent code than verbal descriptions. 10. The Screenshot Debug Something looks wrong in the UI? Do not write a paragraph. Screenshot it. Paste with Ctrl+V. Say: "The button is misaligned with the input field. The spacing between cards is inconsistent. Fix both." Visual feedback is faster and more accurate than written descriptions. 11. The Test-First Workflow "Write tests for a function that calculates discounted prices. Cover: normal discounts, zero discount, 100 percent discount, negative prices, and string inputs. Then implement the function to pass all tests." Tests define behavior before code exists. The implementation is automatically correct because it must pass the predefined tests. 12. The Incremental Build Never say "build the entire feature." Break it into steps: "Create the database schema." Test. "Build the API endpoint." Test. "Add validation." Test. "Build the frontend form." Test. Five small steps with testing between each one produces dramatically better code than one massive implementation prompt. 13. The Codebase Question Before implementing anything in an unfamiliar part of the codebase: "Read src/services/ and explain how data flows from the API routes to the database. What patterns are used? What should I know before modifying anything here?" Understanding before building prevents architectural mistakes. 14. The Diff Review After Claude Code makes changes: "Show me a diff of every file you modified. Explain each change in one sentence." This catches unintended modifications - Claude Code sometimes "helpfully" changes files you did not ask it to touch. 15. The Error Paste When something breaks, copy the COMPLETE error message and stack trace. Not a summary. The complete output. "I got this error: [paste full error]. Diagnose the root cause step by step before suggesting a fix." The step-by-step constraint prevents Claude from jumping to a wrong fix. 16. The Undo Checkpoint Before every major change: git add . && git commit -m "checkpoint before [change]". If Claude Code breaks something, you revert in seconds instead of spending thirty minutes debugging what used to work. 17. The Parallel Session For large features, open two terminal windows. One runs Claude Code for the backend implementation. The other runs Claude Code for the frontend. Each session has clean, focused context for its domain. Connect the pieces at the end. 18. The Documentation Pass After completing a feature: "Read every file you created or modified for this feature. Generate comprehensive documentation: what each function does, how they connect, what the expected inputs and outputs are, and any non-obvious design decisions." Documentation generated immediately after building is more accurate than documentation written days later from memory. Architecture Techniques (19 to 26) 19. The Architecture Audit Before starting a new project: "Analyze my project requirements: [list them]. Propose 2 different architectural approaches. For each: component diagram, pros, cons, estimated complexity, and what could go wrong. Recommend one with clear reasoning." Making architecture decisions with AI analysis prevents expensive rewrites later. 20. The Dependency Check Before adding any new package: "I want to add [package] to handle [use case]. Check: is this actively maintained? Are there known security issues? What is the bundle size impact? Are there lighter alternatives that cover my specific use case?" Prevents bloating your project with unnecessary or risky dependencies. 21. The Pattern Enforcer Add to your CLAUDE.md: "When creating new files, follow these patterns: API routes follow the structure in src/api/example-route.ts. Database queries use the repository pattern in src/repositories/example-repo.ts. React components follow the structure in src/components/ExampleComponent.tsx." Claude Code reads this and automatically matches your patterns in every new file. 22. The Migration Builder "I need to change the user table schema: add a 'role' column (enum: admin, editor, viewer, default: viewer) and rename 'name' to 'display_name'. Generate the migration file, update the repository layer, update all API routes that reference the old schema, and update the TypeScript types. Show me every file that needs to change before making any modifications." Schema changes that touch multiple layers are where Claude Code shines - it tracks all the ripple effects. 23. The API Design Review "Review my API design: [paste route definitions]. Check for: inconsistent naming, missing error responses, endpoints that should be paginated, missing authentication on protected routes, and any REST convention violations. Suggest specific improvements." 24. The Security Scan "Scan this codebase for security vulnerabilities: SQL injection, XSS, exposed secrets in code or config files, missing input validation, insecure direct object references, and missing rate limiting. For each finding: severity, exact location, why it is dangerous, and the fix." 25. The Performance Profiler "Analyze this codebase for performance issues: N+1 database queries, missing indexes based on query patterns, unnecessary re-renders in React components, large bundle imports that could be lazy loaded, and API endpoints that should be cached. Prioritize by estimated impact." 26. The Refactoring Planner "Read src/services/user-service.ts. This file has grown to 800 lines and handles too many responsibilities. Propose a refactoring plan that splits it into focused modules. Show the proposed file structure, what moves where, and verify that no external imports will break. Do NOT start refactoring yet - just show me the plan." Workflow Automation (27 to 31) 27. The Git Hook Writer "Create a pre-commit hook that: runs the linter on staged files, runs type checking, checks for console.log statements in production code, and blocks commits that fail any check. Install it in .husky/pre-commit." Automated quality gates that run every time you commit. 28. The CI Pipeline Builder "Create a GitHub Actions workflow that: runs on every PR, installs dependencies, runs the full test suite, runs the linter, builds the project, and posts a comment on the PR with the results. Use caching for node_modules." 29. The Environment Setup Script "Create a setup.sh script that a new developer runs once to set up the entire development environment: install dependencies, create .env from .env.example, set up the local database, run migrations, seed test data, and verify everything works by running the test suite." 30. The Release Notes Generator "Read the git log since the last tag. Generate release notes organized by: new features, bug fixes, performance improvements, and breaking changes. Write each entry in user-friendly language, not developer jargon. Format as a markdown changelog entry." 31. The Database Seed Builder "Create a comprehensive seed file for the development database. Include: 5 users (1 admin, 2 editors, 2 viewers), 20 sample projects with realistic data, relationships between entities, and edge cases (archived project, deleted user, project with no members). Make the data realistic, not 'test123'." Debug and Recovery (32 to 35) 32. The Reproduction Prompt "This bug was reported by a user: [paste bug report]. Create a minimal reproduction: the exact steps, the expected behavior, the actual behavior. Then write a failing test that captures this bug. Then fix the code to make the test pass." 33. The Blame Investigator "This function started failing yesterday. Read the git log for this file over the past week. Identify which commit likely introduced the issue and explain what changed. Then suggest the fix." 34. The Dependency Conflict Resolver "I am getting this dependency conflict: [paste error]. Analyze the conflict. Identify which packages require conflicting versions of the shared dependency. Suggest the resolution that requires the fewest changes and explain the tradeoffs." 35. The Recovery Mode When Claude Code produces a broken implementation and you have been going back and forth for too long: "Stop. Read the original working version of this file from git: [paste the git show command output]. Now look at what we have been trying to achieve: [restate the goal simply]. Start fresh with a different approach. The previous approach clearly is not working." Sometimes starting over from a clean state is faster than fixing accumulated mistakes. Know when to use this. The Setup That Ties It All Together When you start a new project, run this sequence: /init - generate the CLAUDE.md file Add your coding standards and patterns to CLAUDE.md /memory - add persistent rules you want in every session Plan mode - design the architecture before writing any code Start building incrementally - one feature at a time, tested at each step This five-minute setup transforms every subsequent hour of development. TL;DR 35 techniques. Tested daily. Each one solves a real development problem. Essential commands for session management. Productivity techniques for faster building. Architecture techniques for better design. Workflow automation for consistent quality. Debug and recovery for when things break. Claude Code is the most powerful development tool available. These 35 techniques unlock all of it. This took months of daily use to compile. If it saved you time - you know what to do. Follow me @eng_khairallah1 for more developer tools, workflows, and techniques. No fluff. Just what works. hope this was useful for you, Khairallah ❤️ Want to publish your own Article? Upgrade to Premium 6:20 PM · Apr 21, 2026 · 4.8M Views 57 255 1.5K 10K Read 57 replies

AIFCC — AI Fluent CxO Club

読み書きそろばん、AI。経営者が AI を自分で動かせるようになるコミュニティ。

ほとんどのユーザーが知らないClaude Code の35のコマンド・テクニック・ワークフロー完全版 | AIFCC