shoji-sws

hatena-md-skill

0
0
# Install this skill:
npx skills add shoji-sws/hatena-md-skill

Or install specific skill: npx add-skill https://github.com/shoji-sws/hatena-md-skill

# README.md

Hatena Blog Markdown Extractor

はてなブログの記事URLからコンテンツをMarkdown形式で抽出するツールです。

特徴

  • ✅ はてなブログの記事本文をMarkdown形式で抽出
  • ✅ 画像URLをフルパス(絶対パス)で保持
  • ✅ サイドバー、ヘッダー、フッター、広告などの不要な要素を自動除去
  • ✅ フロントマター付きMarkdownファイルを生成
  • ✅ Claude Code skillとして統合可能

インストール

npm install
npm run build

使用方法

コマンドライン

# デフォルトの出力先 (./hatena-posts/) に保存
node dist/index.js https://www.simple-web-system.work/entry/2024/10/17/223212

# カスタム出力先に保存
node dist/index.js https://www.simple-web-system.work/entry/2024/10/17/223212 ./my-posts

Claude Code Skillとして

Claude Code内で以下のコマンドを実行:

/hatena-md https://www.simple-web-system.work/entry/2024/10/17/223212

出力形式

抽出されたMarkdownファイルには以下のフロントマターが付きます:

---
title: "記事タイトル"
url: https://www.simple-web-system.work/entry/2024/10/17/223212
extracted: 2025-10-27T09:46:00.000Z
---

# 記事タイトル

記事本文...

![画像の説明](https://cdn-ak.f.st-hatena.com/images/fotolife/s/shojisuba/20251017/20251017002606.png)

除外される要素

以下の要素は自動的に除外されます:

  • ナビゲーション、メニュー
  • ヘッダー、フッター
  • サイドバー、ウィジェット
  • 関連記事、おすすめ記事
  • SNSシェアボタン
  • コメント欄
  • プロフィール
  • パンくずリスト
  • 検索ボックス
  • 広告
  • スクリプト、スタイル

プロジェクト構成

hatena-md-skill/
├── .claude/
│   └── skills/
│       └── hatena-md/
│           ├── skill.md       # スキル定義
│           └── run.sh         # 実行スクリプト
├── src/
│   ├── extractor.ts           # メイン抽出ロジック
│   ├── types.ts               # 型定義
│   └── index.ts               # エントリーポイント
├── dist/                      # コンパイル済みJavaScript
├── hatena-posts/              # デフォルト出力ディレクトリ
├── package.json
├── tsconfig.json
└── README.md

技術スタック

  • Node.js / TypeScript: メイン実装言語
  • axios: HTTP リクエスト
  • cheerio: HTML パースと操作
  • turndown: HTML → Markdown 変換

開発

# 依存関係のインストール
npm install

# TypeScriptのコンパイル
npm run build

# テスト実行
node dist/index.js <URL>

ライセンス

MIT

作成者

このツールは、はてなブログの記事を効率的にMarkdown形式で保存・管理するために作成されました。

# Supported AI Coding Agents

This skill is compatible with the SKILL.md standard and works with all major AI coding agents:

Learn more about the SKILL.md standard and how to use these skills with your preferred AI coding agent.