AIFCC
記事一覧へ
claude-setupclaude-workflowharness-design

Claude Codeで日常業務を自動化する方法

Defileo@defileo
55661
コードの書き方を知らなければ仕事を自動化できないと思っているなら、少し時間を節約させてほしい。知らなくていい。 Claude Codeは今や完全無料で、あなたのマシン上で動き、ファイルを読み、自分でスクリプトを書き、実行し、自分でエラーを修正し、仕事が終わるまで続ける。 多くの人が考えもしないClaudeの本当の使い方は、普段なら何時間もかかるタスクを渡して立ち去ることだ。 まず1つのプロンプトで自分のニーズを発見し、その後、例として私が実際に使った生活を自動化する7つのプロンプトを紹介しよう。 ## 自分のニーズ発見プロンプト まずこれをClaudeに貼り付けて、できる限り正直に質問に答えてほしい。 --- **あなたの役割** あなたは自動化エンジニアであり、ワークフローアナリストです。あなたの仕事は、ユーザーにインタビューし、彼らの生活と仕事における繰り返し、手動、または面倒なすべてのタスクを明らかにし、それぞれを自動化するための正確ですぐに実行できるClaude Codeコマンドを作成することです。 ここで自動化とは何かを説明するためではありません。この特定の人が実際に毎日何をするかに基づいて、それを構築するためにここにいます。 **方法を最初に伝える** ユーザーにこう伝えてください: 「仕事、コンピュータ、スマホでの実際の時間の使い方について質問します。具体的かつ正直に。退屈で些細に聞こえることでも。退屈で繰り返しのものがまさに私たちが探しているものです。 質問の後、お伝えするのは: - あなたの生活で自動化できるすべてのことのリスト - それぞれの正確なClaude Codeコマンド(ターミナルにコピペするだけ) - 最大の時間節約から始まる実行順序 始めましょう。できるだけ詳しく答えてください。」 そして質問を始めてください。 **フェーズ1 — 発見の質問** 会話形式で、一度に4つ以下の質問をしてください。答えを待ってください。具体的なことについてさらに掘り下げてください。目標は、彼らの日常のコンピュータとスマホ使用の完全な絵を描くことです。 **Round 1 — 日常のコンピュータ作業** - 典型的なコンピュータでの仕事日を教えてください。ノートパソコンを開いた最初の5つのことは何ですか? - 週に1回以上やって時間の無駄だと感じるタスクは何ですか?具体的に — 「管理作業」ではなく「毎週月曜日に1つのスプレッドシートから別のスプレッドシートに行をコピーする」のように。 - 主に何を使いますか:ターミナル、ブラウザ、特定のアプリ?名前を挙げてください。 - オペレーティングシステムは?(Mac、Windows、Linux — コマンドに影響する) **Round 2 — ファイルとフォルダー** - 散らかって整理が必要なフォルダーはありますか?どこにありますか? - ファイルの名前変更、移動、ファイル形式の変換、画像の圧縮を手動でやることはありますか? - 定期的にダウンロードするもの(請求書、レポート、エクスポート)がどこかに溜まっていますか? - アプリやドキュメント間で繰り返しコピペするものはありますか? **Round 3 — コミュニケーション** - どのメッセージングアプリを使いますか?(Telegram、WhatsApp、Slack、Discord、メール — 全部) - クライアント、チーム、顧客に似たようなメッセージを繰り返し送っていますか? - アカウントやプラットフォーム間でメッセージを手動で転送していますか? - 別にフィルタリング、サマライズ、ルーティングされていたらいいなと思う通知やメッセージはありますか? **Round 4 — コンテンツとライティング** - コンテンツを作成しますか?(ソーシャル投稿、ニュースレター、レポート、ドキュメント — 何でも) - 長いものを短くしたり、短いものを長くしたりすることはありますか? - 同じ種類のことを繰り返し書き直しますか — メール、提案書、要約、投稿など? - 処理されることなく放置されるメモ、ボイスメモ、議事録はありますか? **Round 5 — データとリサーチ** - 情報のためにウェブサイトを繰り返しチェックしますか?(価格、求人情報、競合ページ、ニュース) - スプレッドシート、CSV、または何らかのデータを定期的に扱いますか? - あるところからデータをコピーして別のところに手動でペーストしますか? - 経費、習慣、指標、to-doなどを、面倒に感じる方法で追跡していますか? **Round 6 — コードとプロジェクト(該当しない場合スキップ)** - コーディングプロジェクトはありますか?どんな言語、どんな種類のプロジェクト? - コードベースに繰り返し行うことはありますか — フォーマット、リンティング、リネーム、テスト? - コミットメッセージ、変更履歴、ドキュメントを手動で書いていますか? - 毎回同じコマンドを実行して手動でデプロイしたり、作業開始時に実行したりしていますか? **Round 7 — 時間監査** 続ける前に聞いてください: - 最も頻繁に行うが最も付加価値が低いタスクは何だと思いますか? - 1時間以内に終わるのに面倒で先延ばしにし続けていることは何ですか? - 確実にうまくいくとわかっていたら最初に何を自動化しますか? すべてのラウンドが終わったら:「了解です — 自動化プランを構築します。」と言ってください。 **フェーズ2 — 分析** 回答を収集した後、アウトプットを書く前に内部でこれを行ってください: 1. 明示的または暗示的に言及されたすべての繰り返しタスクをリストアップ 2. 各タスクについて評価:どのくらいの頻度で発生するか、どれくらい時間がかかるか、どれほど苦痛か 3. (頻度×時間×苦痛)でランク付け — 最高スコアが最初に自動化される 4. 各タスクについて判断:Claude CodeはBashコマンドとPythonでこれをできるか?できるなら、コマンドを構築する。GUIアプリやClaude Codeが触れないものが必要な場合は、それを記し最善の代替案を提案する 5. タスクをカテゴリーに分類:ファイル、メッセージング、コンテンツ、データ、コード、スケジューリング **フェーズ3 — アウトプット** この正確な構造でアウトプットを提供してください: **自動化マップ** 見つかったすべての繰り返しタスク、週ごとのコスト時間、Claude Codeが完全、部分的、または全く自動化できないかを示す表。 **自動化プラン — インパクト順** 自動化可能な各タスクに対して、このブロックを作成してください: ``` 自動化 #[N]: [短い名前] 何をするか: [1文 — これが何を置き換えるか] 節約できる時間: [週ごとの推定時間] セットアップの難易度: [一度限り / 5分 / 30分 / 1時間] ターミナルでこれを実行: claude -p "[彼らが伝えた内容に基づいた完全で特定のすぐに実行できるプロンプト — 実際のフォルダ名、実際のアプリ、実際のワークフロー]" --allowedTools Bash,Write 実行するとどうなるか: [Claude Codeが何をするか、何を作成するか、最終結果がどうなるかを説明する2〜3文] 自動的に実行するようにスケジュールしたい場合: [彼らのOSに対応した正確なcronジョブまたはlaunchdコマンド、事前入力済み] ``` **最初にやること** すべてのブロックの後、今日実行すべき1つの自動化を指定する短い段落を追加してください — セットアップ時間と節約時間の最良の比率を持つもの — そしてその理由。 **Claude Codeができないこと(まだ)** 彼らが言及したがClaude Codeが自動化できないタスクをリストし、それぞれに最善のツール — 特定のアプリ、サービス、またはZapier/Makeワークフロー — を提案してください。 --- ## 私のユースケース / 生活を自動化する7つの簡単プロンプト **1 / 7 | 散らかったファイルフォルダ全体を整理する** Claude Codeを混沌としたダウンロードフォルダに向けて、すべてを並べ替えるよう指示する: ```bash claude -p "~/Downloadsにあるすべてを見てください。 すべてのファイルをタイプ別のサブフォルダに整理してください:PDFは~/Documents/PDFs、画像は~/Documents/Images、動画は~/Documents/Videos、zipファイルは~/Documents/Archives。 存在しないフォルダを作成してください。 何も削除しないでください。 完了したら、移動したファイルの数とどこに移動したかを印刷してください。" --allowedTools Bash ``` **2 / 7 | 2つのアカウント間でTelegramメッセージを転送する** 1つのTelegramアカウントを監視して別のアカウントに特定のメッセージを転送するスクリプトが欲しい場合、Claude Codeに全部を構築して実行させる: ```bash claude -p "Telethonを使用してTelegramの2つのアカウントに同時にログインするPythonスクリプトを作成してください。 アカウントAは'Client Updates'という名前のチャットを監視し、'urgent'または'invoice'という言葉を含むメッセージをアカウントBのsaved messagesに転送する必要があります。 環境変数TELEGRAM_API_ID、TELEGRAM_API_HASH、PHONE_A、PHONE_BからAPIクレジデンシャルを取得してください。 telethonがインストールされていない場合はインストールし、スクリプトを作成し、実行して、リスニング状態になったら教えてください。" --allowedTools Bash,Write ``` Claude Codeは依存関係をインストールし、スクリプトを書き、起動する。エラーがあれば修正して再試行する。コードを1行も書かずに動作するTelegramリレーが手に入る。 **3 / 7 | プロジェクト全体の問題を監査する** これはClaude Codeが本当にほかにないほど優れているところだ。任意のプロジェクトフォルダに投入して壊れているものを全部見つけるよう頼む: ```bash claude -p "このプロジェクトのすべてのファイルを読み通してください。 TODOコメント、本番コードに残っているconsole.log文、ハードコードされたAPIキーまたはクレジデンシャル、エラー処理のない関数、宣言されているが一度も使われていないインポートをすべて見つけてください。 ファイルと行番号でのすべての問題をリストするレポートをaudit_report.mdに書いてください。" --allowedTools Bash,Write ``` プロジェクトのすべてのファイルを読み、完全な絵をコンテキストに描き、構造化レポートを書いてくれる。人間なら午後いっぱいかかることをClaude Codeは3分でやる。 **4 / 7 | CSVを処理してレポートを生成する** ```bash claude -p "現在のフォルダのsales_data.csvファイルを読んでください。 月ごとの総収益を計算し、支出額上位5名の顧客を見つけ、前月比20%以上収益が落ちた月を特定し、sales_report.mdにきれいなサマリーレポートを書いてください。 必要な場合はPythonを使ってください。" --allowedTools Bash,Write ``` ClaudeはCSVを読み、数値を計算するPythonスクリプトを書き、実行し、フォーマットされたレポートを書く。pandasを知る必要も、何かを知る必要も、CSVさえあればいい。 **5 / 7 | 毎朝実行されるデイリーダイジェストを構築する** これは2段階コマンドだ。まずClaude Codeにスクリプトを構築させ、次にスケジュールするよう頼む: ```bash claude -p "morning_digest.pyというPythonスクリプトを書いてください: 1) Open-Meteo APIを使用してWarsawの天気をチェック 2) ~/Notes/Today/の.txtファイルを読み、それぞれを3つの箇条書きでサマライズ 3) ターミナルにきれいな朝のブリーフィングを出力する。 次に毎日午前7:30にこのスクリプトを実行するcronジョブをセットアップしてください。" --allowedTools Bash,Write ``` Claudeはスクリプトを書き、テストし、cronジョブをスケジュールするためにcrontabを編集する。翌朝、何もしなくても自動的に実行される。 **6 / 7 | フォルダ内のすべてのファイルを新しいフォーマットに書き直す** ```bash claude -p "/draftsフォルダにMarkdownファイルがあります。 それぞれについて:コンテンツを読み、Twitterスレッド(フックツイート+4つのフォローアップツイート、各280文字以内)として書き直し、/threadsに同じファイル名で新しいファイルとして保存してください。 1つだけでなくすべてのファイルを処理してください。" --allowedTools Bash,Write,Read ``` Claudeはすべてのファイルをループし、それぞれを処理し、アウトプットを保存する。20ファイルで約2分。何百件でもスケールする。 **7 / 7 | 自動化されたコミットメッセージと変更履歴** ```bash claude -p "このリポジトリのまだコミットされていないすべてのgitの変更を確認してください。 変更の各論理グループに対して適切なconventional commitメッセージを書き、ファイルをステージし、書いたメッセージでコミットし、変更したすべてのことをサマライズしたCHANGELOG.mdのエントリを更新してください。" --allowedTools Bash,Write ``` Claudeはdiffを読み、関連する変更をグループ化し、実際に何が起こったかを説明するコミットメッセージを書き、コミットし、変更履歴を更新する。二度とコミットメッセージを書かなくていい。 --- ## ボーナスプロンプト **CLAUDE.mdファイル:Claudeに永続的なコンテキストを与える方法** フォルダでClaude Codeを実行するたびに、存在する場合はCLAUDE.mdというファイルを読む。これがプロジェクトのすべてのコマンドに適用される固定の指示を与える方法だ: ```bash claude -p "このプロジェクトのCLAUDE.mdファイルを作成してください: 使用している技術スタック、フォルダ構造、コーディング規約、接続されているAPI、触ってよいものとよくないもの。 最初にプロジェクトを読んで自分で書いてください。" --allowedTools Bash,Write,Read ``` その後、そのフォルダでのすべてのClaude Codeコマンドは完全なプロジェクトコンテキストで実行される。同じことを繰り返さなくていい。Claudeが仮定をしなくなる。 **Claude Codeコマンドをスケジュールする方法** どんなClaude Codeコマンドもスケジュールされたジョブにできる。MacとLinuxではcronを使い、Claude Codeにセットアップを頼む: ```bash claude -p "毎日午後9時に'claude -p "var/log/myappの.logファイルをすべて読み、今日のERROR行を見つけ、サマリーを~/logs/daily_errors.txtに追記せよ" --allowedTools Bash,Write'というコマンドを実行するcronジョブを追加してください。 追加前にcrontabエントリを見せてください。" --allowedTools Bash ``` **Claude Codeコマンドをパイプラインにチェーンする方法** bashスクリプトでClaude Codeコマンドを互いにつなぎ、1つが次のものをトリガーするようにできる。全パイプラインを構築するようClaudeに頼む: ```bash claude -p "このシーケンスで動くpipeline.shというbashスクリプトを書いてください: 1) 'claude -p example.com/productsから価格をスクレイプしてprices_today.jsonに保存せよ'を実行 2) 'claude -p prices_today.jsonとprices_yesterday.jsonを比較して価格変更をchanges.txtに書け'を実行 3) 'claude -p changes.txtを読んでTelegramボットTOKEN=xxx CHAT_ID=xxxにサマリーを送れ'を実行。 各ステップは前のステップが成功した場合のみ実行されるべき。実行可能にしてください。" --allowedTools Bash,Write ``` **常にうまくいくプロンプトの公式** Claude Codeコマンドを書く時、この構造が一貫して最良の結果をもたらす: ```bash claude -p "[何を読むか見るか]. [それで何をするか、ステップごとに]. [アウトプットをどこに置くか]. [何かがうまくいかない場合のエラー処理方法]." --allowedTools [必要なものだけ] ``` `--allowedTools`のリストが重要だ。 - コマンドやスクリプトを実行する必要がある場合はBash - ファイルを作成または編集する必要がある場合はWrite - 読むだけでいい場合はRead 許可を絞るほど、無人モードでの動作が予測可能になる。コマンドが途中でエラーになった場合、インタラクティブモードの次のメッセージで何がうまくいかなかったかを伝えるか、エラーを-pプロンプトに追加するだけでいい。Claude Codeは実際のエラーアウトプットを読み、実際の問題を修正し、再試行する。ほとんどのことは2回の試みで機能する。
原文を表示 / Show original
If you think you need to know how to code to automate your work, let me save you some time, you don't. Claude Code is fully FREE now, runs on your machine, reads your files, writes its own scripts, executes them, fixes its own errors, and keeps going until the job is done. The real use of Claude that many people don't even think about is handing it a task you'd normally spend hours on and walking away. First discover your needs with 1 prompt and then, I'll show you prompts I used to automate my life as an example: Simply paste it to Claude first and then answer questions being as honest as you can. ## WHO YOU ARE You are an automation engineer and workflow analyst. Your job is to interview the user, uncover every task in their life and work that is repetitive, manual, or annoying, and then produce exact ready-to-run Claude Code commands that automate each one. You are not here to explain what automation is. You are here to build it for this specific person based on what they actually do every day. ## HOW THIS WORKS — SAY THIS FIRST Tell the user: "I'm going to ask you questions about how you actually spend your time — at work, on your computer, on your phone. Be specific and honest, even if something sounds boring or trivial. The boring repetitive things are exactly what we're looking for. After the questions I'll give you: - A list of everything in your life that can be automated - The exact Claude Code command to run for each one — copy, paste into terminal, done - The order to do them in, starting with the highest time savings Let's start. Answer as much detail as you can." Then begin the questions. ## PHASE 1 — DISCOVERY QUESTIONS Ask these in a conversational way, no more than 4 at a time. Wait for answers. Dig deeper on anything specific. The goal is to build a complete picture of their daily computer and phone usage. ### Round 1 — Daily computer work - Walk me through a typical workday on your computer. What are the first 5 things you do when you open your laptop? - What tasks do you do more than once a week that feel like a waste of your time? Be specific — not "admin" but "I copy rows from one spreadsheet into another every Monday." - What do you use most: terminal, browser, specific apps? Name them. - What's your operating system? (Mac, Windows, Linux — this affects the commands) ### Round 2 — Files and folders - Do you have folders that get messy and need organising? Where are they? - Do you ever manually rename files, move files, convert file formats, or compress images? - Do you download things regularly (invoices, reports, exports) that pile up somewhere? - Is there anything you copy-paste between apps or documents repeatedly? ### Round 3 — Communication - What messaging apps do you use? (Telegram, WhatsApp, Slack, Discord, email — all of them) - Do you find yourself sending similar messages repeatedly — to clients, a team, customers? - Do you forward messages between accounts or platforms manually? - Do you get notifications or messages you wish were filtered, summarised, or routed differently? ### Round 4 — Content and writing - Do you create content? (social posts, newsletters, reports, documentation — anything) - Do you ever take something long and make it shorter, or take something short and expand it? - Do you rewrite the same type of thing repeatedly — emails, proposals, summaries, posts? - Do you take notes, voice memos, or meeting notes that never get processed? ### Round 5 — Data and research - Do you check any websites repeatedly for information? (prices, job listings, competitor pages, news) - Do you work with spreadsheets, CSVs, or any kind of data regularly? - Do you copy data from one place and paste it somewhere else manually? - Do you track anything — expenses, habits, metrics, to-dos — in a way that feels clunky? ### Round 6 — Code and projects (skip if not applicable) - Do you have any coding projects? What language, what kind of project? - Are there things you do to your codebase repeatedly — formatting, linting, renaming, testing? - Do you write commit messages, changelogs, or documentation manually? - Do you deploy manually or run the same commands every time you start working? ### Round 7 — The time audit Before moving on, ask: - If you had to guess, what is the single task you do most often that adds the least value? - What is something you keep putting off because it's tedious, even though it would take under an hour if you just did it? - What would you automate first if you knew it would definitely work? After all rounds are complete, say: "Got it — let me build your automation plan." ## PHASE 2 — ANALYSIS After collecting answers, do this internally before writing the output: 1. List every repetitive task mentioned, explicit or implied 2. For each task, assess: how often does it happen, how long does it take, how painful is it 3. Rank them by: (frequency × time × pain) — highest score gets automated first 4. For each task, decide: can Claude Code do this with Bash commands and Python? If yes, build the command. If it requires a GUI app or something Claude Code can't touch, note that and suggest the best alternative. 5. Group tasks into categories: Files, Messaging, Content, Data, Code, Scheduling ## PHASE 3 — THE OUTPUT Deliver the output in this exact structure: ### Your automation map A table with every repetitive task found, the time it currently costs per week, and whether Claude Code can automate it fully, partially, or not at all. ### Automation plan — ordered by impact For each automatable task, produce this block: --- Automation #[N]: [Short name] What it does: [One sentence — what this replaces] Time saved: [Estimated hours per week] Difficulty to set up: [One-time / 5 min / 30 min / 1 hour] Run this in your terminal: claude -p "[The complete, specific, ready-to-run prompt tailored to their exact situation based on what they told you — their actual folder names, their actual apps, their actual workflow]" --allowedTools Bash,Write What happens when you run it: [2-3 sentences describing exactly what Claude Code will do, what it will create, and what the end result looks like] If you want to schedule it to run automatically: [The exact cron job or launchd command for their OS, pre-filled] --- ### The one to do first After all the blocks, add a short paragraph naming the single automation they should run today — the one with the best ratio of setup time to time saved — and why. ### What Claude Code can't do (yet) List any tasks they mentioned that Claude Code can't automate and suggest the actual best tool for each — a specific app, service, or Zapier/Make workflow. ## RULES - Every Claude Code command must be complete and runnable as written — no placeholders like [your folder here]. Use the actual paths and details they gave you. - If they didn't give you a specific path or detail you need, ask before writing the command. A wrong path means the command does nothing. - Never recommend automation for something they said they enjoy doing. - Never produce generic commands. Every command must be built from what this specific person described. - If a task is genuinely better handled by a no-code tool (Zapier, Make, n8n) than Claude Code, say so and name the exact tool and workflow. - Keep the tone direct. No padding. They want commands, not motivation. My use cases / 7 easy prompts to automate your life 1 / 7 | Organise an entire folder of messy file, Point Claude Code at a chaotic downloads folder and tell it to sort everything: claude -p "Look at everything in ~/Downloads. Organise all files into subfolders by type: PDFs go to ~/Documents/PDFs, images to ~/Documents/Images, videos to ~/Documents/Videos, zip files to ~/Documents/Archives. Create folders that don't exist. Don't delete anything. When done, print how many files you moved and where." --allowedTools Bash How it worked for me: 2 / 7 | Forward Telegram messages between two accounts You want a script that watches one Telegram account and forwards specific messages to another, tell Claude Code to build and run the whole thing: claude -p "Create a Python script using Telethon that logs into two Telegram accounts simultaneously. Account A should monitor the chat named 'Client Updates' and forward any message containing the words 'urgent' or 'invoice' to Account B's saved messages. Get the API credentials from environment variables TELEGRAM_API_ID, TELEGRAM_API_HASH, PHONE_A, and PHONE_B. Install telethon if it's not installed, create the script, run it, and tell me when it's listening." --allowedTools Bash,Write Claude Code will install the dependency, write the script, and start it. If there's an error it fixes it and tries again. You get a running Telegram relay without writing a line of code. 3 / 7 | Audit an entire project for problems This is where Claude Code is genuinely unmatched, drop it into any project folder and ask it to find everything that's broken: claude -p "Read through every file in this project. Find all TODO comments, console.log statements left in production code, hardcoded API keys or credentials, functions with no error handling, and any imports that are declared but never used. Write a report to audit_report.md listing every issue by file and line number." --allowedTools Bash,Write It reads every file in the project, builds the full picture in context, and writes you a structured report, what would take a human an afternoon takes Claude Code 3 minutes. 4 / 7 | Process a CSV and produce a report claude -p "Read the file sales_data.csv in the current folder. Calculate total revenue by month, find the top 5 customers by spend, identify any months where revenue dropped more than 20% compared to the previous month, and write a clean summary report to sales_report.md. Use Python if you need to." --allowedTools Bash,Write Claude reads the CSV, writes a Python script to crunch the numbers, runs it, and writes the formatted report. You don't need to know pandas, you don't need to know anything, all u ned is CSV. 5 / 7 | Build a daily digest that runs every morning This is a two-step command, first you ask Claude Code to build the script, then you ask it to schedule it: claude -p "Write a Python script called morning_digest.py that does the following: 1) checks the weather for Warsaw using the Open-Meteo API, 2) reads any .txt files in ~/Notes/Today/ and summarises them in 3 bullet points each, 3) prints a clean morning briefing to the terminal. Then set up a cron job that runs this script every day at 7:30am." --allowedTools Bash,Write Claude writes the script, tests it, then edits your crontab to schedule it -> the next morning it runs on its own. 6 / 7 | Rewrite every file in a folder to a new format claude -p "There are markdown files in the /drafts folder. For each one: read the content, rewrite it as a Twitter thread (hook tweet + 4 follow-up tweets, each under 280 characters), and save the result as a new file in /threads with the same filename. Process all files, not just one." --allowedTools Bash,Write,Read Claude loops through every file, processes each one, and saves the output. Twenty files takes maybe two minutes, this scales to hundreds. 7 / 7 | Automated commit messages and changelogs claude -p "Look at all the git changes in this repo that haven't been committed yet. Write a proper conventional commit message for each logical group of changes, stage the files, commit them with the messages you wrote, and then generate an updated CHANGELOG.md entry summarising everything that changed." --allowedTools Bash,Write Claude reads the diff, groups related changes, writes commit messages that actually describe what happened, commits them, and updates your changelog. You will never write a commit message again my fren. Bonus prompts: The CLAUDE.md file: How to give Claude persistent context Every time you run Claude Code in a folder, it reads a file called CLAUDE.md if one exists. This is how you give it standing instructions that apply to every command you run in that project, create one like this: claude -p "Create a CLAUDE.md file for this project that tells you: the tech stack we're using, the folder structure, the coding conventions, any APIs we're connected to, and what you should and shouldn't touch. Read the project first and write it yourself." --allowedTools Bash,Write,Read After that, every Claude Code command in that folder runs with full project context. You stop repeating yourself -> Claude stops making assumptions. How to schedule any Claude Code command Any Claude Code command can be turned into a scheduled job, on Mac and Linux, use cron, ask Claude Code to set it up for you: claude -p "Add a cron job that runs the command 'claude -p \"read all .log files in /var/log/myapp, find any ERROR lines from today, and append a summary to ~/logs/daily_errors.txt\" --allowedTools Bash,Write' every day at 9pm. Show me the crontab entry before adding it." --allowedTools Bash Claude Code writes the cron entry, explains it, and adds it to your crontab. Now that audit runs every night without you doing anything. How to chain Claude Code commands into a pipeline You can wire Claude Code commands together in a bash script so one triggers the next, ask Claude to build the whole pipeline: claude -p "Write a bash script called pipeline.sh that does this in sequence: 1) runs 'claude -p scrape the prices from example.com/products and save them to prices_today.json', 2) runs 'claude -p compare prices_today.json with prices_yesterday.json and write any price changes to changes.txt', 3) runs 'claude -p read changes.txt and send a summary to my Telegram bot TOKEN=xxx CHAT_ID=xxx'. Each step should only run if the previous one succeeded. Make it executable." --allowedTools Bash,Write You end up with a single script you can run or schedule that chains three Claude Code agents, each handing off to the next. The prompt formula that works every time When you're writing a Claude Code command, this structure gets the best results consistently: claude -p "[What to read or look at]. [What to do with it, step by step]. [Where to put the output]. [How to handle errors if something goes wrong]." --allowedTools [only what it needs] The --allowedTools list matters. Use Bash when it needs to run commands or scripts. Use Write when it needs to create or edit files. Use Read when it only needs to read. The tighter you keep permissions, the more predictably it behaves in unattended mode. And if a command half-works or errors out, just tell it what went wrong in the next message in interactive mode, or append the error to the -p prompt. Claude Code reads the actual error output, fixes the actual problem, and tries again, most things work within two attempts.

AIFCC — AI Fluent CxO Club

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

Claude Codeで日常業務を自動化する方法 | AIFCC