cleanup-code-inspections

作者: flutter

透過系統性地解決靜態分析警告,減少技術債並提升程式碼品質。

npx skills add https://github.com/flutter/flutter-intellij --skill cleanup-code-inspections

Skill: Code Inspection & Cleanup

You are tasked with reducing technical debt and improving code quality by systematically resolving static analysis warnings.

Objective

Reduce technical debt and improve code quality by systematically resolving static analysis warnings.

Workflow Instructions

1. Baseline

  • Run ./gradlew test and ./gradlew verifyPlugin to ensure the project is stable.

2. Run Inspection

  • Execute Analyze > Inspect Code... on the project (or a specific module) using the "Default" profile.

3. Prioritize

  • Focus first on "Probable bugs", "Performance", and "Memory" categories.

4. Refactor

  • Apply quick-fixes for obvious issues (e.g., "Result of method call ignored", "String concatenation in loop").

5. Suppress

  • Explicitly suppress false positives with a comment and reason (e.g., //noinspection [ID] - [Reason]).

6. Verify

  • Run ./gradlew testClasses to ensure safe refactoring.
  • Run ./gradlew test and ./gradlew verifyPlugin to ensure no regressions.
  • Re-run analysis to ensure the "Yellow code" count has decreased and no regressions were introduced.

7. Report & Review

  • Summarize the inspections resolved.
  • Test Location: Explicitly state where in the IDE the user should go to test the changed functionality (e.g., "Go to Preferences > Languages & Frameworks > Flutter").
  • Action: Ask the user to review the changes closely.
  • Do not commit or push.
  • Provide a suggested Git commit message (e.g., "Cleanup: Resolve static analysis warnings in [Module]").

來自 flutter 的更多技能

dart-modern-features
flutter
為了尋找現代化的候選對象:
flutter-fix-layout-issues
flutter
使用 Dart 和 Flutter MCP 工具修復 Flutter 佈局錯誤(溢出、無限制約束)。適用於處理「RenderFlex overflowed」、「Vertical…」等問題。
adding-release-notes
flutter
在 DevTools 發行說明中新增使用者面向的變更描述。用於在 NEXT_RELEASE_NOTES.md 檔案中記錄改進、修正或新功能。
reviewing-devtools-prs
flutter
DevTools 儲存庫專用的 PR 審查工作流程,強制執行 DevTools 風格指南與常見審查模式。用於審查以下專案中的拉取請求時…
dart-use-primary-constructors
flutter
協助使用者撰寫語法與語意正確的 Dart 主要建構子,並遷移/使用新的建構子語法、空主體分號語法、…
code-documentation
flutter
編寫有效程式碼文件的指南,包括 docstrings、JSDoc、dartdoc 和實作註解。在編寫新程式碼、新增…時使用此技能。
api-review
flutter
根據規範的 API 設計指南審查指定的程式碼。當使用者要求進行 API 審查或檢查程式碼是否符合 API 設計時,請使用此技能。
flutter-accessibility
flutter
在 Flutter 應用程式中實作 WCAG 2 與 EN 301 549 無障礙標準及自適應佈局。強制執行語意標註、觸控目標尺寸(最小 48x48 dp)以及文字對比度(小字 4.5:1,大字 3:1),涵蓋行動裝置、網頁與桌面平台。提供網頁語意初始化、互動元件包裝、基於螢幕尺寸的佈局切換,以及鍵盤/滑鼠輸入處理的決策邏輯。包含透過 FocusTraversalGroup 進行的焦點導覽管理,以及...