Claude Codeで画像のダウンロードツールを作る by 結城浩 / Hiroshi Yuki
Claude Codeを使ってみました。
Markdownファイルに含まれている画像をダウンロードし、Markdownファイル中のリンク先を変更するプログラムを書いてもらうことにします。
準備
$ mkdir claude-memo
$ cd claude-memo
$ cp ~/memo/md/*.md .
Claude Codeのインストール
$ npm install -g @anthropic-ai/claude-code
Claude Codeの実行とプログラム作成
$ claude
> /init
> Please write a Ruby program to fetch image files from these Markdown files.
> Update the program to modify the Markdown files after downloading images.
> Change URLs to "ExampleMarkdownBodyName/XXXXX.png" in ExampleMarkdownBodyName.md.
> /quit
作成したプログラムの確認と実行
$ vi fetch_images.rb
$ ./fetch_images.rb
Claude Codeによるレポートの作成
$ claude
> Create report.md summarizing what you have done.
> Translate report.md into Japanese and save it as report-ja.md
> Create README-fetch_image.md in Japanese. It is the README for fetch_image.rb.
> /quit
完成したプログラムとレポート
(2025年6月4日)