1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

GitHub Copilot CLI から Qiita に記事を投稿する方法

1
Last updated at Posted at 2026-03-27

はじめに

GitHub Copilot CLI から、会話しながら Qiita の記事を書いて投稿するまでの手順をまとめます。

実際にこの記事自体も Copilot CLI から投稿しています。

全体の流れ

  1. Copilot CLI に記事を書いてもらう(Markdown ファイル生成)
  2. Qiita CLI でログイン&投稿
  3. 修正があれば Copilot CLI で編集 → 再投稿

前提

  • GitHub Copilot CLI が使える状態であること

手順 (人間がやること)

初回のみ

1. Qiita API トークンの発行

https://qiita.com/settings/tokens/new にアクセスして、以下の2つにチェックを入れて発行します。

  • read_qiita
  • write_qiita

read_qiita_team / write_qiita_team は Qiita Team 用なので不要です。

2. Copilot CLI に初期設定を頼む

「Qiita CLIをインストールして。ログイン設定は環境変数 QIITA_TOKEN を参照するコマンドを生成して。」


入力データが学習されない(オプトアウト)環境を使いましょう。
https://github.com/orgs/community/discussions/188488

Our agreements with Business and Enterprise customers prohibit using their Copilot interaction data for model training, and we honor those commitments. 
Individual users on Free, Pro, and Pro+ plans have control over their data and can opt out at any time.
ビジネスおよびエンタープライズのお客様との契約では、お客様のCopilotのインタラクションデータをモデルのトレーニングに使用することを禁じており、当社はその約束を遵守しています。
無料、プロ、プロプラスプランの個​​人ユーザーは、自身のデータを管理でき、いつでもオプトアウトできます。

毎回の記事投稿

日々 Copilot CLI でものづくりをしていると、良いノウハウが溜まっていきます。メモとして残したくなったら:

  1. ここまでの〇〇をまとめて Qiita の記事に書いて。限定共有で投稿して
  2. (サイトで確認して)「ここ直して」「この段落いらない」など
  3. 再投稿して
  4. 問題なければ Qiita のサイトで手動で公開に切り替え

人間がやるのは記事の内容を指示することと、最後の公開ボタンを押すことだけです。

手順 (Copilot CLI が裏でやっていること)

上の指示を受けて、Copilot CLI は裏で以下を実行しています。

1. Qiita CLI のインストールと初期化

npm install @qiita/qiita-cli --save-dev
npx qiita init

2. ログイン

人間から受け取ったトークンを使って、インタラクティブにログインします。

npx qiita login
発行したトークンを入力: xxxxxxxxxxxxxxxx
Hi yourname!
ログインが完了しました 🎉

3. 記事ファイルの作成と執筆

npx qiita new 記事名

public/記事名.md が生成されるので、Front Matter(メタデータ)と本文を書き込みます。

---
title: 記事のタイトル
tags:
  - タグ1
  - タグ2
private: false  # true: 限定共有 / false: 公開
updated_at: ""
id: null        # 初回投稿時に自動で記事IDが入る
organization_url_name: null
slide: false
ignorePublish: false
---

4. 投稿

npx qiita publish 記事名
Posted: 記事名 -> 5b93d13814e50fce7daf
Successful!

初回投稿すると、Front Matter の id に Qiita の記事 ID が自動で書き込まれます。

5. 修正・再投稿

人間から「ここ直して」と言われたら、Markdown ファイルを編集して同じコマンドで再投稿します。

npx qiita publish 記事名
Updated: 記事名 -> 5b93d13814e50fce7daf
Successful!

id を見て同じ記事を上書き更新します。

Copilot CLI との組み合わせが便利なポイント

  • 「〇〇の記事書いて」で Markdown 生成 — 構成・本文・コードブロックまで一気に作ってくれます
  • 「ここ修正して」で即編集 → 再投稿 — ファイル編集と npx qiita publish を Copilot CLI がやってくれるので、ブラウザを触る必要がありません
  • 実際のコマンド出力をそのまま記事に使える — 今まさに動かしている環境の ls 結果やコマンド出力を、リアルタイムで記事に反映できます

実例

実際にこの記事自体も Copilot CLI から投稿しています。手動記載量 0行 です!

以下の記事もまさにこの方法で Copilot CLI から書いて投稿しました。

GitHub Copilot CLI の設定ファイルを Ubuntu⇔Mac で共有する(Google Drive + symlink)

記事の Markdown ファイル冒頭:

---
title: GitHub Copilot CLI の設定ファイルを Ubuntu⇔Mac で共有する(Google Drive + symlink)
tags:
  - Mac
  - Linux
  - GitHub
  - GoogleDrive
  - copilot
private: true
updated_at: '2026-03-27T22:05:43+09:00'
id: 5b93d13814e50fce7daf
organization_url_name: null
slide: false
ignorePublish: false
---

# はじめに

GitHub Copilot CLI を Ubuntu と Mac の両方で使ってます。
...

id: 5b93d13814e50fce7daf は初回投稿時に自動で書き込まれたものです。

まとめ

人間がやること

  1. Copilot CLI に「ここまでの〇〇をまとめて Qiita の記事に書いて。限定共有で投稿して」と伝える
  2. 出来上がった記事を Qiita のプレビューで確認する
  3. 問題なければ Qiita のサイトで公開に切り替える

これだけです。 コマンドを覚える必要はありません。

Copilot CLI が裏でやること

ステップ コマンド
インストール npm install @qiita/qiita-cli --save-dev
初期化 npx qiita init
ログイン npx qiita login
記事作成 npx qiita new 記事名
投稿 npx qiita publish 記事名
更新 npx qiita publish 記事名(同じコマンド)

Copilot CLI が全部やってくれるので、人間はコマンドを意識する必要がありません。会話しながら記事を書いて、そのまま投稿まで完結できるのは快適です。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?