claude-skills/

Anthropic公式スキル・プラグインの日本語ディレクトリ

last sync 22h ago
スキルOfficialdevelopment

🔧fix-bootstrap-params

プラグイン
ui5-modernization

説明

UI5 linterが検出しても自動修正できない、HTMLのbootstrapパラメータに関する問題を修正します。 次のような場合に使用: linterが以下のルールを出力した場合: - `no-deprecated-api` - bootstrapパラメータの欠落または非推奨(async、compat-version、animation、binding-syntaxなど) - `no-deprecated-theme` - `data-sap-ui-theme` における非推奨のテーマ値 - `no-deprecated-library` - `data-sap-ui-libs` における非推奨のライブラリ 以下のエラーメッセージが含まれる場合にトリガー: 「Missing bootstrap parameter」「Abandoned bootstrap parameter」「Redundant bootstrap parameter」「deprecated value」「bootstrap」 UI5のbootstrap scriptタグを含むHTMLファイルに対して、安全な修正を自動的に適用します。

原文を表示

Fix HTML bootstrap parameter issues that UI5 linter reports but cannot auto-fix. Use this skill when linter outputs these rules: - `no-deprecated-api` - For missing/deprecated bootstrap parameters (async, compat-version, animation, binding-syntax, etc.) - `no-deprecated-theme` - For deprecated theme values in data-sap-ui-theme - `no-deprecated-library` - For deprecated libraries in data-sap-ui-libs Trigger on error messages containing: "Missing bootstrap parameter", "Abandoned bootstrap parameter", "Redundant bootstrap parameter", "deprecated value", "bootstrap" Automatically applies safe fixes to HTML files containing UI5 bootstrap script tags.

ユースケース

  • UI5 linterが非推奨のbootstrapパラメータを検出したとき
  • HTMLのbootstrap scriptタグの自動修正が必要なとき
  • 非推奨のテーマ値やライブラリを更新するとき
  • bootstrap関連のエラーメッセージが出力されたとき

本文(日本語訳)

ブートストラップパラメータの修正

主要ルール

  1. ブートストラップの <script> タグのみを変更してくださいid="sap-ui-bootstrap" が指定されているか、srcsap-ui-core.js に一致するもので識別)。
    インラインスクリプト・設定ブロック・UI5 以外の script 参照を含む、それ以外のすべての <script> タグは必ずそのまま保持してください
    これらは後続フェーズで fix-csp-compliance によって処理されます。

  2. ブートストラップタグ以外の <script> ブロックは、削除・移動・書き換えをしないでください。
    ブートストラップタグの前後に <script>window.config = {...}</script> のようなブロックがある場合は、手をつけないでください。


このスキルは、UI5 リンターが検出するものの、アプリケーションの動作に影響を与える可能性があるため自動修正できない HTML ブートストラップパラメータの問題を修正します。

対応するリンタールール

ルール ID メッセージパターン このスキルのアクション
no-deprecated-api ブートストラップパラメータ data-sap-ui-async が見つかりません data-sap-ui-async="true" を追加
no-deprecated-api ブートストラップパラメータ data-sap-ui-compat-version が見つかりません data-sap-ui-compat-version="edge" を追加
no-deprecated-api ブートストラップパラメータ data-sap-ui-async に非推奨の値 false が使用されています "true" に変更
no-deprecated-api ブートストラップパラメータ data-sap-ui-compat-version に非推奨の値 ... が使用されています "edge" に変更
no-deprecated-api 廃止されたブートストラップパラメータ ... を削除してください パラメータを削除
no-deprecated-api 冗長なブートストラップパラメータ ... を削除してください パラメータを削除
no-deprecated-api ブートストラップパラメータ ...... に置き換えてください 新しいパラメータに置換
no-deprecated-theme 非推奨のテーマ ... が使用されています sap_horizon に変更
no-deprecated-library 非推奨のライブラリ ... が使用されています libs から削除

次のような場合に使用

以下のようなリンター出力が確認されたときにこのスキルを適用してください:

index.html:8:3 error Missing bootstrap parameter 'data-sap-ui-async'  no-deprecated-api
index.html:9:3 error Missing bootstrap parameter 'data-sap-ui-compat-version'  no-deprecated-api
index.html:12:3 error Abandoned bootstrap parameter 'data-sap-ui-no-duplicate-ids' should be removed  no-deprecated-api
index.html:15:3 error Use of deprecated theme 'sap_bluecrystal'  no-deprecated-theme

修正方針

1. ブートストラップ script タグを特定する

以下のいずれかに該当する <script> タグを探してください:

  • id="sap-ui-bootstrap"
  • src 属性が sap-ui-core.jssap-ui-custom.jssap-ui-boot.js 等のパターンに一致する

2. ルールとメッセージに基づいて修正を適用する

no-deprecated-api — パラメータの欠落

data-sap-ui-async が欠落している場合: data-sap-ui-async="true" を追加
data-sap-ui-compat-version が欠落している場合: data-sap-ui-compat-version="edge" を追加

<!-- 修正前 -->
<script id="sap-ui-bootstrap"
    src="resources/sap-ui-core.js"
    data-sap-ui-theme="sap_horizon">
</script>

<!-- 修正後 -->
<script id="sap-ui-bootstrap"
    src="resources/sap-ui-core.js"
    data-sap-ui-async="true"
    data-sap-ui-compat-version="edge"
    data-sap-ui-theme="sap_horizon">
</script>

no-deprecated-api — 非推奨の値

data-sap-ui-async="false": "true" に変更
data-sap-ui-compat-versionedge 以外の値が設定されている場合: "edge" に変更

no-deprecated-api — 廃止済みパラメータ(完全に削除)

以下のパラメータは完全に削除してください:

  • data-sap-ui-no-duplicate-ids — モダン UI5 では強制適用済み
  • data-sap-ui-auto-aria-body-role — モダン UI5 で廃止
  • data-sap-ui-manifest-first — 代わりに Component.create の manifest オプションを使用
  • data-sap-ui-origin-info — サポート終了
  • data-sap-ui-areas — 代わりに Control.placeAt を使用
  • data-sap-ui-trace — サポート終了
  • data-sap-ui-xx-no-less — サポート終了

no-deprecated-api — 冗長なパラメータ

  • data-sap-ui-binding-syntax="simple" — 削除(モダン UI5 では complex 構文が強制適用)
  • data-sap-ui-binding-syntax="complex"compat-version="edge" が設定されている場合は削除
  • data-sap-ui-preload に無効な値が指定されている場合 — 削除

no-deprecated-api — 置き換えが必要なパラメータ

  • data-sap-ui-animationdata-sap-ui-animation-mode(値の変換: truefullfalseminimal

no-deprecated-theme — 非推奨テーマ

以下のテーマをモダンなテーマに置き換えてください:

  • sap_bluecrystalsap_horizon
  • sap_belizesap_horizon
  • sap_belize_plussap_horizon
  • sap_belize_hcbsap_horizon_hcb
  • sap_belize_hcwsap_horizon_hcw
  • sap_hcbsap_horizon_hcb
  • sap_uxsap_horizon
  • sap_platinumsap_horizon
  • sap_goldreflectionsap_horizon

no-deprecated-library — 非推奨ライブラリ

以下の非推奨ライブラリを data-sap-ui-libs から削除してください:

  • sap.ui.commons
  • sap.ui.ux3
  • sap.makit
  • sap.me
  • sap.ca.ui
  • sap.sac.grid
  • sap.ui.suite
  • sap.zen.commons
  • sap.zen.crosstab
  • sap.zen.dsh

実装手順

  1. HTML ファイルを読み込む
  2. ブートストラップ script タグを解析して特定する
  3. 各リンターエラー(ルール ID とメッセージで識別)に対して以下を実行:
    • パラメータが欠落している場合: 推奨値でパラメータを追加
    • 非推奨の値が使用されている場合: 推奨値に更新
    • 廃止済み・冗長な場合: パラメータを削除
    • 非推奨テーマの場合: モダンなテーマに置換
    • 非推奨ライブラリの場合: libs リストから削除
  4. インデントや改行などの書式をできる限り保持する
  5. 更新したファイルを書き出す

修正例

リンター出力:

index.html:8:3 error Missing bootstrap parameter 'data-sap-ui-async'  no-deprecated-api
index.html:8:3 error Missing bootstrap parameter 'data-sap-ui-compat-version'  no-deprecated-api
index.html:12:3 error Abandoned bootstrap parameter 'data-sap-ui-no-duplicate-ids' should be removed  no-deprecated-api
index.html:10:3 error Use of deprecated theme 'sap_bluecrystal'  no-deprecated-theme

変換内容:

<!-- 修正前 -->
<script id="sap-ui-bootstrap"
    src="resources/sap-ui-core.js"
    data-sap-ui-theme="sap_bluecrystal"
    data-sap-ui-no-duplicate-ids="true"
    data-sap-ui-resource-roots='{"my.app": "./"}'>
</script>

<!-- 修正後 -->
<script id="sap-ui-bootstrap"
    src="resources/sap-ui-core.js"
    data-sap-ui-async="true"
    data-sap-ui-compat-version="edge"
    data-sap-ui-theme="sap_horizon"
    data-sap-ui-resource-roots='{"my.app": "./"}'>
</script>

注意事項

  • 一貫性のため、data-sap-ui-async="true" は常に他の data 属性より前に追加してください
  • compat-version="edge" を設定すると complex バインディング構文が自動的に有効になるため、binding-syntax は冗長になります
  • 削除したパラメータの箇所に余分な空白や空行を残さないようにしてください
  • ファイルに複数の script タグが含まれている場合は、ブートストラップタグのみを変更し、その他(フェーズ 5 の CSP コンプライアンス処理で対応するインライン <script> ブロックを含む)はすべてそのまま残してください
原文(English)を表示

Fix Bootstrap Parameters

Key Rules

  1. ONLY modify the bootstrap <script> tag (identified by id="sap-ui-bootstrap" or src matching sap-ui-core.js). All other <script> tags — including inline scripts, config blocks, and non-UI5 script references — MUST be preserved exactly as-is. They will be handled by fix-csp-compliance in a later phase.
  2. Do not delete, move, or rewrite any <script> block that is not the bootstrap tag. If the file has <script>window.config = {...}</script> before or after the bootstrap tag, leave it untouched.

This skill fixes HTML bootstrap parameter issues that the UI5 linter detects but cannot auto-fix because the changes may affect application behavior.

Linter Rules Handled

Rule ID Message Pattern This Skill's Action
no-deprecated-api Missing bootstrap parameter 'data-sap-ui-async' Add data-sap-ui-async="true"
no-deprecated-api Missing bootstrap parameter 'data-sap-ui-compat-version' Add data-sap-ui-compat-version="edge"
no-deprecated-api Use of deprecated value 'false' for bootstrap parameter 'data-sap-ui-async' Change to "true"
no-deprecated-api Use of deprecated value '...' for bootstrap parameter 'data-sap-ui-compat-version' Change to "edge"
no-deprecated-api Abandoned bootstrap parameter '...' should be removed Remove the parameter
no-deprecated-api Redundant bootstrap parameter '...' should be removed Remove the parameter
no-deprecated-api Bootstrap parameter '...' should be replaced with '...' Replace with new parameter
no-deprecated-theme Use of deprecated theme '...' Change to sap_horizon
no-deprecated-library Use of deprecated library '...' Remove from libs

When to Use

Apply this skill when you see linter output like:

index.html:8:3 error Missing bootstrap parameter 'data-sap-ui-async'  no-deprecated-api
index.html:9:3 error Missing bootstrap parameter 'data-sap-ui-compat-version'  no-deprecated-api
index.html:12:3 error Abandoned bootstrap parameter 'data-sap-ui-no-duplicate-ids' should be removed  no-deprecated-api
index.html:15:3 error Use of deprecated theme 'sap_bluecrystal'  no-deprecated-theme

Fix Strategy

1. Locate the Bootstrap Script Tag

Find the <script> tag with either:

  • id="sap-ui-bootstrap"
  • src attribute matching pattern: sap-ui-core.js, sap-ui-custom.js, sap-ui-boot.js, etc.

2. Apply Fixes Based on Rule and Message

no-deprecated-api - Missing Parameters

Missing data-sap-ui-async: Add data-sap-ui-async="true" Missing data-sap-ui-compat-version: Add data-sap-ui-compat-version="edge"

<!-- Before -->
<script id="sap-ui-bootstrap"
    src="resources/sap-ui-core.js"
    data-sap-ui-theme="sap_horizon">
</script>

<!-- After -->
<script id="sap-ui-bootstrap"
    src="resources/sap-ui-core.js"
    data-sap-ui-async="true"
    data-sap-ui-compat-version="edge"
    data-sap-ui-theme="sap_horizon">
</script>

no-deprecated-api - Deprecated Values

data-sap-ui-async="false": Change to "true" data-sap-ui-compat-version with non-edge value: Change to "edge"

no-deprecated-api - Abandoned Parameters (remove completely)

Remove these parameters entirely:

  • data-sap-ui-no-duplicate-ids - Enforced in modern UI5
  • data-sap-ui-auto-aria-body-role - Removed in modern UI5
  • data-sap-ui-manifest-first - Use Component.create manifest option instead
  • data-sap-ui-origin-info - No longer supported
  • data-sap-ui-areas - Use Control.placeAt instead
  • data-sap-ui-trace - No longer supported
  • data-sap-ui-xx-no-less - No longer supported

no-deprecated-api - Redundant Parameters

  • data-sap-ui-binding-syntax="simple" - Remove; complex syntax is enforced in modern UI5
  • data-sap-ui-binding-syntax="complex" - Remove if compat-version="edge" is set
  • data-sap-ui-preload with invalid values - Remove

no-deprecated-api - Replaced Parameters

  • data-sap-ui-animationdata-sap-ui-animation-mode (convert truefull, falseminimal)

no-deprecated-theme - Deprecated Themes

Replace with modern theme:

  • sap_bluecrystalsap_horizon
  • sap_belizesap_horizon
  • sap_belize_plussap_horizon
  • sap_belize_hcbsap_horizon_hcb
  • sap_belize_hcwsap_horizon_hcw
  • sap_hcbsap_horizon_hcb
  • sap_uxsap_horizon
  • sap_platinumsap_horizon
  • sap_goldreflectionsap_horizon

no-deprecated-library - Deprecated Libraries

Remove deprecated libraries from data-sap-ui-libs:

  • sap.ui.commons
  • sap.ui.ux3
  • sap.makit
  • sap.me
  • sap.ca.ui
  • sap.sac.grid
  • sap.ui.suite
  • sap.zen.commons
  • sap.zen.crosstab
  • sap.zen.dsh

Implementation Steps

  1. Read the HTML file
  2. Parse to find the bootstrap script tag
  3. For each linter error (identified by rule ID and message):
    • If missing parameter: Add the parameter with recommended value
    • If deprecated value: Update to recommended value
    • If abandoned/redundant: Remove the parameter
    • If deprecated theme: Replace with modern theme
    • If deprecated library: Remove from libs list
  4. Preserve formatting (indentation, line breaks) as much as possible
  5. Write the updated file

Example Fix

Given linter output:

index.html:8:3 error Missing bootstrap parameter 'data-sap-ui-async'  no-deprecated-api
index.html:8:3 error Missing bootstrap parameter 'data-sap-ui-compat-version'  no-deprecated-api
index.html:12:3 error Abandoned bootstrap parameter 'data-sap-ui-no-duplicate-ids' should be removed  no-deprecated-api
index.html:10:3 error Use of deprecated theme 'sap_bluecrystal'  no-deprecated-theme

Transform:

<!-- Before -->
<script id="sap-ui-bootstrap"
    src="resources/sap-ui-core.js"
    data-sap-ui-theme="sap_bluecrystal"
    data-sap-ui-no-duplicate-ids="true"
    data-sap-ui-resource-roots='{"my.app": "./"}'>
</script>

<!-- After -->
<script id="sap-ui-bootstrap"
    src="resources/sap-ui-core.js"
    data-sap-ui-async="true"
    data-sap-ui-compat-version="edge"
    data-sap-ui-theme="sap_horizon"
    data-sap-ui-resource-roots='{"my.app": "./"}'>
</script>

Notes

  • Always add data-sap-ui-async="true" before other data attributes for consistency
  • Setting compat-version="edge" enables complex binding syntax automatically, so binding-syntax becomes redundant
  • Removed parameters should not leave trailing whitespace or empty lines
  • If the file has multiple script tags, only modify the bootstrap tag — leave all others intact (including inline <script> blocks that will be handled by CSP compliance in Phase 5)

原文・著作権は Anthropic および各プラグイン作者に帰属します。日本語訳は Claude API による自動翻訳です。