本文へスキップ
Skillpedia
デプロイとクラウド(DevOps)75k · #2938

mime-type

できること

このスキルは、サーバーが HTML、CSS、JavaScript、画像、フォントに付けるコンテンツタイプのヘッダーを確認します。ウェブサーバーを管理する人や、ページのリソースが読み込めない原因を調べる人向けです。

使う場面

  • ✓サーバーが正しいファイル種別を送っているか確認してほしいとき。
  • ✓スタイルシートやスクリプトが読み込まれず、コンテンツタイプが誤っていると疑うとき。
  • ✓新しいホスティングやフレームワークを設定し、ヘッダーが正しいか確かめたいとき。

スキルのリンク

https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/mime-type/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/mime-type/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“私のサイトでCSSが読み込まれません。サーバーが正しいコンテンツタイプを送っているか確認してもらえますか。”

毎週5つの新しいスキル。1分で読めます。

仕組み

エージェントは、主要なページとリンクされたファイルのレスポンスヘッダーを確認します。それぞれを期待される種別と比べ、一致しない場合はサーバーの変更を提案します。例えば、スタイルシートは text/css です。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

MIME Type Validation

Incorrect MIME types cause browsers to block stylesheets and scripts (MIME sniffing is disabled by X-Content-Type-Options: nosniff), breaking page rendering and signalling poor site quality to crawlers.

Quick Reference

  • The Content-Type header must match the actual file type being served
  • HTML pages must be served as text/html; charset=utf-8
  • CSS files must be served as text/css and JavaScript as text/javascript
  • Incorrect MIME types cause browsers to block or mishandle resources

Check

For key pages and their linked resources, inspect the HTTP Content-Type response header. Verify HTML responses use text/html; charset=utf-8, CSS uses text/css, JS uses text/javascript, and images use image/jpeg, image/png, etc.

Fix

Update your server configuration to serve each file type with its correct MIME type. Set X-Content-Type-Options: nosniff to prevent browsers from guessing content types. In Next.js and similar frameworks, configure headers in next.config.js.

Explain

The Content-Type header tells browsers and crawlers what kind of content is being sent. When it mismatches the actual file type, browsers either block the resource or render it incorrectly—CSS served as text/plain won't be applied, and JavaScript served as text/html may be blocked by strict MIME checking.

Code Review

For HTML, CSS, and JS assets, check the Content-Type response header. Verify HTML responses include 'charset=utf-8'. Check that X-Content-Type-Options: nosniff is set. Flag any resource returning Content-Type: text/html that is not an HTML page. Check for missing charset declarations on text responses.


For full implementation details, code examples, and framework-specific guidance, see references/rule.md.

Rule page: https://frontendchecklist.io/rules/seo/mime-type

よくある質問

コンテンツタイプが誤っているとどうなりますか?

ブラウザがファイルをブロックしたり、誤って表示したりするため、スタイルシートがまったく適用されないことがあります。

nosniff は何をしますか?

X-Content-Type-Options ヘッダーは、ブラウザに種別を推測させず、サーバーが送った値に従わせます。

Next.js ではどのように設定しますか?

next.config.js ファイルでヘッダーを設定することを提案しています。

詳細

作者による元の説明

Use when auditing server configuration or diagnosing broken resources. Applies to any web server serving HTML, CSS, JS, images, fonts, or other static assets.

repo: thedaviddias/Front-End-Checklist

人気

GitHubのスター
75k
ランキング
#2938
ライセンス
MIT
更新日
2026/10/31

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル