harden
エラー処理や多言語対応、文字溢れ対策などを強化し、想定外の事態にも強く、より安定して使える高品質なインターフェースを構築するSkill。
📜 元の英語説明(参考)
Improve interface resilience through better error handling, i18n support, text overflow handling, and edge case management. Makes interfaces robust and production-ready.
🇯🇵 日本人クリエイター向け解説
エラー処理や多言語対応、文字溢れ対策などを強化し、想定外の事態にも強く、より安定して使える高品質なインターフェースを構築するSkill。
※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o harden.zip https://jpskill.com/download/19784.zip && unzip -o harden.zip && rm harden.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/19784.zip -OutFile "$d\harden.zip"; Expand-Archive "$d\harden.zip" -DestinationPath $d -Force; ri "$d\harden.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
harden.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
hardenフォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-18
- 取得日時
- 2026-05-18
- 同梱ファイル
- 1
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
[スキル名] ハードニング 理想化されたデザインを破綻させるエッジケース、エラー、国際化の問題、および現実世界の使用シナリオに対して、インターフェースを強化します。
ハードニングの必要性を評価する
弱点とエッジケースを特定します。
-
極端な入力でテストする:
- 非常に長いテキスト(名前、説明、タイトル)
- 非常に短いテキスト(空、1文字)
- 特殊文字(絵文字、RTLテキスト、アクセント記号)
- 大きな数字(数百万、数十億)
- 多数の項目(1000以上のリスト項目、50以上のオプション)
- データなし(空の状態)
-
エラーシナリオをテストする:
- ネットワーク障害(オフライン、低速、タイムアウト)
- APIエラー(400、401、403、404、500)
- バリデーションエラー
- 権限エラー
- レート制限
- 同時操作
-
国際化をテストする:
- 長い翻訳(ドイツ語は英語より30%長くなることが多い)
- RTL言語(アラビア語、ヘブライ語)
- 文字セット(中国語、日本語、韓国語、絵文字)
- 日付/時刻形式
- 数値形式(1,000と1.000)
- 通貨記号
重要: 完璧なデータでしか機能しないデザインは、本番環境に対応していません。現実に対してハードニングしてください。
ハードニングの側面
回復力を体系的に向上させます。
テキストのオーバーフローと折り返し
長いテキストの処理:
/* 省略記号付きの単一行 */
.truncate {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
/* クランプ付きの複数行 */
.line-clamp {
display: -webkit-box;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
overflow: hidden;
}
/* 折り返しを許可 */
.wrap {
word-wrap: break-word;
overflow-wrap: break-word;
hyphens: auto;
}
Flex/Gridのオーバーフロー:
/* flexアイテムがオーバーフローするのを防ぐ */
.flex-item {
min-width: 0; /* コンテンツサイズより小さく縮小することを許可 */
overflow: hidden;
}
/* gridアイテムがオーバーフローするのを防ぐ */
.grid-item {
min-width: 0;
min-height: 0;
}
レスポンシブなテキストサイズ設定:
- 流動的なタイポグラフィには
clamp()を使用します - 最小可読サイズ(モバイルでは14px)を設定します
- テキストスケーリング(200%にズーム)をテストします
- コンテナがテキストに合わせて拡張することを確認します
国際化 (i18n)
テキストの拡張:
- 翻訳用に30〜40%のスペースを確保します
- コンテンツに適応するflexbox/gridを使用します
- 最も長い言語(通常はドイツ語)でテストします
- テキストコンテナに固定幅を使用しないようにします
// ❌ 悪い例: 短い英語テキストを想定
<button className="w-24">Submit</button>
// ✅ 良い例: コンテンツに適応
<button className="px-4 py-2">Submit</button>
RTL (右から左) のサポート:
/* 論理プロパティを使用 */
margin-inline-start: 1rem; /* margin-left ではない */
padding-inline: 1rem; /* padding-left/right ではない */
border-inline-end: 1px solid; /* border-right ではない */
/* または dir 属性を使用 */
[dir="rtl"] .arrow { transform: scaleX(-1); }
文字セットのサポート:
- すべての場所でUTF-8エンコーディングを使用します
- 中国語/日本語/韓国語 (CJK) 文字でテストします
- 絵文字でテストします(2〜4バイトになることがあります)
- 異なるスクリプト(ラテン、キリル、アラビアなど)を処理します
日付/時刻の書式設定:
// ✅ 適切な書式設定のために Intl API を使用
new Intl.DateTimeFormat('en-US').format(date); // 1/15/2024
new Intl.DateTimeFormat('de-DE').format(date); // 15.1.2024
new Intl.NumberFormat('en-US', {
style: 'currency',
currency: 'USD'
}).format(1234.56); // $1,234.56
複数形:
// ❌ 悪い例: 英語の複数形を想定
`${count} item${count !== 1 ? 's' : ''}`
// ✅ 良い例: 適切なi18nライブラリを使用
t('items', { count }) // 複雑な複数形のルールを処理
エラー処理
ネットワークエラー:
- 明確なエラーメッセージを表示します
- 再試行ボタンを提供します
- 何が起こったかを説明します
- オフラインモードを提供します(該当する場合)
- タイムアウトシナリオを処理します
// 復旧を伴うエラー状態
{error && (
<ErrorMessage>
<p>Failed to load data. {error.message}</p>
<button onClick={retry}>Try again</button>
</ErrorMessage>
)}
フォームバリデーションエラー:
- フィールドの近くにインラインエラーを表示します
- 明確で具体的なメッセージを表示します
- 修正を提案します
- 不必要に送信をブロックしないようにします
- エラー時にユーザー入力を保持します
APIエラー:
- 各ステータスコードを適切に処理します
- 400: バリデーションエラーを表示します
- 401: ログインにリダイレクトします
- 403: 権限エラーを表示します
- 404: 見つからない状態を表示します
- 429: レート制限メッセージを表示します
- 500: 一般的なエラーを表示し、サポートを提供します
段階的な機能低下 (Graceful degradation):
- コア機能はJavaScriptなしで動作します
- 画像にはaltテキストがあります
- プログレッシブエンハンスメント
- サポートされていない機能のフォールバック
エッジケースと境界条件
空の状態:
- リストに項目がない
- 検索結果がない
- 通知がない
- 表示するデータがない
- 明確な次のアクションを提供します
読み込み状態:
- 初期読み込み
- ページネーションの読み込み
- 更新
- 何が読み込まれているかを表示します(「プロジェクトを読み込み中...」)
- 長い操作の推定時間
大規模なデータセット:
- ページネーションまたは仮想スクロール
- 検索/フィルター機能
- パフォーマンス最適化
- 10,000項目すべてを一度に読み込まないようにします
同時操作:
- 二重送信を防ぎます(読み込み中はボタンを無効にします)
- 競合状態を処理します
- ロールバックを伴う楽観的更新
- 競合解決
権限の状態:
- 表示する権限がない
- 編集する権限がない
- 読み取り専用モード
- 理由を明確に説明します
ブラウザの互換性:
- 最新機能のポリフィル
- サポートされていないCSSのフォールバック
- 機能検出(ブラウザ検出ではない)
- ターゲットブラウザでテストします
入力検証とサニタイズ
クライアントサイド検証:
- 必須フィールド
- 形式検証(メール、電話、URL)
- 長さ制限
- パターンマッチング
- カスタム検証ルール
サーバーサイド検証(常に):
- クライアントサイドのみを信頼しない
- すべての入力を検証およびサニタイズします
- インジェクション攻撃から保護します
- レート制限
制約の処理:
<!-- 明確な制約を設定 -->
<input
type="text"
maxlength="100"
pattern="[A-Za-z0-9]+"
required
aria-describedby="username-hint"
/>
<small id="username-hint">
英数字のみ、最大100文字
</small>
アクセシビリティの回復力
キーボードナビゲーション:
- すべての機能
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
Strengthen interfaces against edge cases, errors, internationalization issues, and real-world usage scenarios that break idealized designs.
Assess Hardening Needs
Identify weaknesses and edge cases:
-
Test with extreme inputs:
- Very long text (names, descriptions, titles)
- Very short text (empty, single character)
- Special characters (emoji, RTL text, accents)
- Large numbers (millions, billions)
- Many items (1000+ list items, 50+ options)
- No data (empty states)
-
Test error scenarios:
- Network failures (offline, slow, timeout)
- API errors (400, 401, 403, 404, 500)
- Validation errors
- Permission errors
- Rate limiting
- Concurrent operations
-
Test internationalization:
- Long translations (German is often 30% longer than English)
- RTL languages (Arabic, Hebrew)
- Character sets (Chinese, Japanese, Korean, emoji)
- Date/time formats
- Number formats (1,000 vs 1.000)
- Currency symbols
CRITICAL: Designs that only work with perfect data aren't production-ready. Harden against reality.
Hardening Dimensions
Systematically improve resilience:
Text Overflow & Wrapping
Long text handling:
/* Single line with ellipsis */
.truncate {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
/* Multi-line with clamp */
.line-clamp {
display: -webkit-box;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
overflow: hidden;
}
/* Allow wrapping */
.wrap {
word-wrap: break-word;
overflow-wrap: break-word;
hyphens: auto;
}
Flex/Grid overflow:
/* Prevent flex items from overflowing */
.flex-item {
min-width: 0; /* Allow shrinking below content size */
overflow: hidden;
}
/* Prevent grid items from overflowing */
.grid-item {
min-width: 0;
min-height: 0;
}
Responsive text sizing:
- Use
clamp()for fluid typography - Set minimum readable sizes (14px on mobile)
- Test text scaling (zoom to 200%)
- Ensure containers expand with text
Internationalization (i18n)
Text expansion:
- Add 30-40% space budget for translations
- Use flexbox/grid that adapts to content
- Test with longest language (usually German)
- Avoid fixed widths on text containers
// ❌ Bad: Assumes short English text
<button className="w-24">Submit</button>
// ✅ Good: Adapts to content
<button className="px-4 py-2">Submit</button>
RTL (Right-to-Left) support:
/* Use logical properties */
margin-inline-start: 1rem; /* Not margin-left */
padding-inline: 1rem; /* Not padding-left/right */
border-inline-end: 1px solid; /* Not border-right */
/* Or use dir attribute */
[dir="rtl"] .arrow { transform: scaleX(-1); }
Character set support:
- Use UTF-8 encoding everywhere
- Test with Chinese/Japanese/Korean (CJK) characters
- Test with emoji (they can be 2-4 bytes)
- Handle different scripts (Latin, Cyrillic, Arabic, etc.)
Date/Time formatting:
// ✅ Use Intl API for proper formatting
new Intl.DateTimeFormat('en-US').format(date); // 1/15/2024
new Intl.DateTimeFormat('de-DE').format(date); // 15.1.2024
new Intl.NumberFormat('en-US', {
style: 'currency',
currency: 'USD'
}).format(1234.56); // $1,234.56
Pluralization:
// ❌ Bad: Assumes English pluralization
`${count} item${count !== 1 ? 's' : ''}`
// ✅ Good: Use proper i18n library
t('items', { count }) // Handles complex plural rules
Error Handling
Network errors:
- Show clear error messages
- Provide retry button
- Explain what happened
- Offer offline mode (if applicable)
- Handle timeout scenarios
// Error states with recovery
{error && (
<ErrorMessage>
<p>Failed to load data. {error.message}</p>
<button onClick={retry}>Try again</button>
</ErrorMessage>
)}
Form validation errors:
- Inline errors near fields
- Clear, specific messages
- Suggest corrections
- Don't block submission unnecessarily
- Preserve user input on error
API errors:
- Handle each status code appropriately
- 400: Show validation errors
- 401: Redirect to login
- 403: Show permission error
- 404: Show not found state
- 429: Show rate limit message
- 500: Show generic error, offer support
Graceful degradation:
- Core functionality works without JavaScript
- Images have alt text
- Progressive enhancement
- Fallbacks for unsupported features
Edge Cases & Boundary Conditions
Empty states:
- No items in list
- No search results
- No notifications
- No data to display
- Provide clear next action
Loading states:
- Initial load
- Pagination load
- Refresh
- Show what's loading ("Loading your projects...")
- Time estimates for long operations
Large datasets:
- Pagination or virtual scrolling
- Search/filter capabilities
- Performance optimization
- Don't load all 10,000 items at once
Concurrent operations:
- Prevent double-submission (disable button while loading)
- Handle race conditions
- Optimistic updates with rollback
- Conflict resolution
Permission states:
- No permission to view
- No permission to edit
- Read-only mode
- Clear explanation of why
Browser compatibility:
- Polyfills for modern features
- Fallbacks for unsupported CSS
- Feature detection (not browser detection)
- Test in target browsers
Input Validation & Sanitization
Client-side validation:
- Required fields
- Format validation (email, phone, URL)
- Length limits
- Pattern matching
- Custom validation rules
Server-side validation (always):
- Never trust client-side only
- Validate and sanitize all inputs
- Protect against injection attacks
- Rate limiting
Constraint handling:
<!-- Set clear constraints -->
<input
type="text"
maxlength="100"
pattern="[A-Za-z0-9]+"
required
aria-describedby="username-hint"
/>
<small id="username-hint">
Letters and numbers only, up to 100 characters
</small>
Accessibility Resilience
Keyboard navigation:
- All functionality accessible via keyboard
- Logical tab order
- Focus management in modals
- Skip links for long content
Screen reader support:
- Proper ARIA labels
- Announce dynamic changes (live regions)
- Descriptive alt text
- Semantic HTML
Motion sensitivity:
@media (prefers-reduced-motion: reduce) {
* {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
}
}
High contrast mode:
- Test in Windows high contrast mode
- Don't rely only on color
- Provide alternative visual cues
Performance Resilience
Slow connections:
- Progressive image loading
- Skeleton screens
- Optimistic UI updates
- Offline support (service workers)
Memory leaks:
- Clean up event listeners
- Cancel subscriptions
- Clear timers/intervals
- Abort pending requests on unmount
Throttling & Debouncing:
// Debounce search input
const debouncedSearch = debounce(handleSearch, 300);
// Throttle scroll handler
const throttledScroll = throttle(handleScroll, 100);
Testing Strategies
Manual testing:
- Test with extreme data (very long, very short, empty)
- Test in different languages
- Test offline
- Test slow connection (throttle to 3G)
- Test with screen reader
- Test keyboard-only navigation
- Test on old browsers
Automated testing:
- Unit tests for edge cases
- Integration tests for error scenarios
- E2E tests for critical paths
- Visual regression tests
- Accessibility tests (axe, WAVE)
IMPORTANT: Hardening is about expecting the unexpected. Real users will do things you never imagined.
NEVER:
- Assume perfect input (validate everything)
- Ignore internationalization (design for global)
- Leave error messages generic ("Error occurred")
- Forget offline scenarios
- Trust client-side validation alone
- Use fixed widths for text
- Assume English-length text
- Block entire interface when one component errors
Verify Hardening
Test thoroughly with edge cases:
- Long text: Try names with 100+ characters
- Emoji: Use emoji in all text fields
- RTL: Test with Arabic or Hebrew
- CJK: Test with Chinese/Japanese/Korean
- Network issues: Disable internet, throttle connection
- Large datasets: Test with 1000+ items
- Concurrent actions: Click submit 10 times rapidly
- Errors: Force API errors, test all error states
- Empty: Remove all data, test empty states
Remember: You're hardening for production reality, not demo perfection. Expect users to input weird data, lose connection mid-flow, and use your product in unexpected ways. Build resilience into every component.