[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M75Q33789VFPB21WFXNE45DV":3,"skill-same:01M75Q33789VFPB21WFXNE45DV":48},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":27,"commitSha":28,"skillDirectory":29,"forksCount":14,"repositoryHtmlUrl":30,"repositoryHomepageUrl":6,"ownerHtmlUrl":31,"ownerBlogUrl":32,"ownerDescription":6,"updatedAt":33,"install":34,"resources":47},"01M75Q33789VFPB21WFXNE45DV","dart-fix-runtime-errors",null,"Uses get_runtime_errors and lsp to fetch an active stack trace, locate the failing line, apply a fix, and verify resolution via hot_reload.","mictlanix\u002Fmbe-ui","mictlanix","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F703184?v=4","01M75Q1XD9477GXRKPM6JVVC11","Mictlanix","01M75Q1XDXKYX3VS9T3CS2XEFR",0,"MIT","https:\u002F\u002Fgithub.com\u002Fmictlanix\u002Fmbe-ui\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fdart-fix-runtime-errors\u002FSKILL.md",[],[],"2026-11-12 13:55:43",false,"---\nname: dart-fix-runtime-errors\ndescription: Uses get_runtime_errors and lsp to fetch an active stack trace, locate the failing line, apply a fix, and verify resolution via hot_reload.\nmetadata:\n  model: models\u002Fgemini-3.1-pro-preview\n  last_modified: Fri, 24 Apr 2026 15:13:22 GMT\n---\n# Resolving Dart Static Analysis Errors\n\n## Contents\n- [Core Concepts & Guidelines](#core-concepts--guidelines)\n  - [Type System & Soundness](#type-system--soundness)\n  - [Null Safety](#null-safety)\n  - [Error Handling](#error-handling)\n- [Workflows](#workflows)\n  - [Workflow: Static Analysis Resolution](#workflow-static-analysis-resolution)\n- [Examples](#examples)\n\n## Core Concepts & Guidelines\n\n### Type System & Soundness\nEnforce Dart's sound type system to prevent runtime invalid states.\n\n*   **Method Overrides:** Maintain sound return types (covariant) and parameter types (contravariant). Never tighten a parameter type in a subclass unless explicitly marked with the `covariant` keyword.\n*   **Generics & Collections:** Add explicit type annotations to generic classes (e.g., `List\u003CT>`, `Map\u003CK, V>`). Never assign a `List\u003Cdynamic>` to a typed list (e.g., `List\u003CCat>`).\n*   **Downcasting:** Avoid implicit downcasts from `dynamic`. Use explicit casts (e.g., `as List\u003CCat>`) when necessary, but ensure the underlying runtime type matches to prevent `TypeError` exceptions.\n*   **Strict Casts:** Enable `strict-casts: true` in `analysis_options.yaml` under `analyzer: language:` to force explicit casting and catch implicit downcast errors at compile time.\n\n### Null Safety\nEliminate static errors related to null safety by correctly managing variable initialization and nullability.\n\n*   **Modifiers:** Apply `?` for nullable types, `!` for null assertions, and `required` for named parameters that cannot be null.\n*   **Late Initialization:** Use the `late` keyword for non-nullable variables guaranteed to be initialized before use. Apply this specifically to top-level or instance variables where Dart's control flow analysis cannot definitively prove initialization.\n*   **Wildcards:** Use the `_` wildcard variable (Dart 3.7+) for non-binding local variables or parameters to avoid unused variable warnings.\n\n### Error Handling\nDistinguish between recoverable exceptions and unrecoverable errors.\n\n*   **Catching:** Catch `Exception` subtypes for recoverable failures.\n*   **Errors:** Never explicitly catch `Error` or its subtypes (e.g., `TypeError`, `ArgumentError`). Errors indicate programming bugs that must be fixed, not caught. Enforce this by enabling the `avoid_catching_errors` linter rule.\n*   **Rethrowing:** Use `rethrow` inside a `catch` block to propagate an exception while preserving its original stack trace.\n\n## Workflows\n\n### Workflow: Static Analysis Resolution\n\nUse this sequential workflow to identify, fix, and verify static analysis errors in a Dart project. Copy the checklist to track your progress.\n\n**Task Progress:**\n- [ ] 1. Run static analyzer.\n- [ ] 2. Apply automated fixes.\n- [ ] 3. Resolve remaining errors manually.\n- [ ] 4. Verify fixes (Feedback Loop).\n\n**1. Run static analyzer**\nExecute the Dart analyzer to identify all static errors in the target directory or file.\n```bash\ndart analyze . --fatal-infos\n```\n\n**2. Apply automated fixes**\nUse the `dart fix` tool to automatically resolve standard linting and analysis issues.\n```bash\n# Preview changes\ndart fix --dry-run\n# Apply changes\ndart fix --apply\n```\n\n**3. Resolve remaining errors manually**\nReview the remaining analyzer output and apply conditional logic based on the error type:\n\n*   **If the error is a Null Safety issue (e.g., \"Property cannot be accessed on a nullable receiver\"):**\n    *   Verify if the variable can logically be null.\n    *   If yes, use optional chaining (`?.`) or provide a fallback (`??`).\n    *   If no, and initialization is guaranteed elsewhere, mark the declaration with `late`.\n*   **If the error is a Type Mismatch (e.g., \"The argument type 'List\u003Cdynamic>' can't be assigned...\"):**\n    *   Trace the variable's initialization.\n    *   Add explicit generic type annotations to the instantiation (e.g., `\u003Cint>[]` instead of `[]`).\n*   **If the error is an Invalid Override (e.g., \"The parameter type doesn't match the overridden method\"):**\n    *   Widen the parameter type to match the superclass, OR\n    *   Add the `covariant` keyword to the parameter if tightening the type is intentionally required by the domain logic.\n\n**4. Verify fixes (Feedback Loop)**\nRun the validator. Review errors. Fix.\n```bash\ndart analyze .\ndart test\n```\n*   **If `dart analyze` reports errors:** Return to Step 3.\n*   **If `dart test` fails with a `TypeError`:** You have introduced an invalid explicit cast (`as T`) or accessed an uninitialized `late` variable. Locate the runtime failure and correct the type hierarchy or initialization order.\n\n## Examples\n\n### Example: Fixing Dynamic List Assignments\n**Input (Fails Static Analysis):**\n```dart\nvoid printInts(List\u003Cint> a) => print(a);\n\nvoid main() {\n  final list = []; \u002F\u002F Inferred as List\u003Cdynamic>\n  list.add(1);\n  list.add(2);\n  printInts(list); \u002F\u002F Error: List\u003Cdynamic> can't be assigned to List\u003Cint>\n}\n```\n\n**Output (Passes Static Analysis):**\n```dart\nvoid printInts(List\u003Cint> a) => print(a);\n\nvoid main() {\n  final list = \u003Cint>[]; \u002F\u002F Explicitly typed\n  list.add(1);\n  list.add(2);\n  printInts(list);\n}\n```\n\n### Example: Fixing Method Overrides (Contravariance)\n**Input (Fails Static Analysis):**\n```dart\nclass Animal {\n  void chase(Animal a) {}\n}\n\nclass Cat extends Animal {\n  @override\n  void chase(Mouse a) {} \u002F\u002F Error: Tightening parameter type\n}\n```\n\n**Output (Passes Static Analysis):**\n```dart\nclass Animal {\n  void chase(Animal a) {}\n}\n\nclass Cat extends Animal {\n  @override\n  void chase(covariant Mouse a) {} \u002F\u002F Explicitly marked covariant\n}\n```\n\n### Example: Fixing Null Safety with `late`\n**Input (Fails Static Analysis):**\n```dart\nclass Thermometer {\n  String temperature; \u002F\u002F Error: Non-nullable instance field must be initialized\n\n  void read() {\n    temperature = '20C';\n  }\n}\n```\n\n**Output (Passes Static Analysis):**\n```dart\nclass Thermometer {\n  late String temperature; \u002F\u002F Defers initialization check to runtime\n\n  void read() {\n    temperature = '20C';\n  }\n}\n```\n","# Resolving Dart Static Analysis Errors\n\n## Contents\n- [Core Concepts & Guidelines](#core-concepts--guidelines)\n  - [Type System & Soundness](#type-system--soundness)\n  - [Null Safety](#null-safety)\n  - [Error Handling](#error-handling)\n- [Workflows](#workflows)\n  - [Workflow: Static Analysis Resolution](#workflow-static-analysis-resolution)\n- [Examples](#examples)\n\n## Core Concepts & Guidelines\n\n### Type System & Soundness\nEnforce Dart's sound type system to prevent runtime invalid states.\n\n*   **Method Overrides:** Maintain sound return types (covariant) and parameter types (contravariant). Never tighten a parameter type in a subclass unless explicitly marked with the `covariant` keyword.\n*   **Generics & Collections:** Add explicit type annotations to generic classes (e.g., `List\u003CT>`, `Map\u003CK, V>`). Never assign a `List\u003Cdynamic>` to a typed list (e.g., `List\u003CCat>`).\n*   **Downcasting:** Avoid implicit downcasts from `dynamic`. Use explicit casts (e.g., `as List\u003CCat>`) when necessary, but ensure the underlying runtime type matches to prevent `TypeError` exceptions.\n*   **Strict Casts:** Enable `strict-casts: true` in `analysis_options.yaml` under `analyzer: language:` to force explicit casting and catch implicit downcast errors at compile time.\n\n### Null Safety\nEliminate static errors related to null safety by correctly managing variable initialization and nullability.\n\n*   **Modifiers:** Apply `?` for nullable types, `!` for null assertions, and `required` for named parameters that cannot be null.\n*   **Late Initialization:** Use the `late` keyword for non-nullable variables guaranteed to be initialized before use. Apply this specifically to top-level or instance variables where Dart's control flow analysis cannot definitively prove initialization.\n*   **Wildcards:** Use the `_` wildcard variable (Dart 3.7+) for non-binding local variables or parameters to avoid unused variable warnings.\n\n### Error Handling\nDistinguish between recoverable exceptions and unrecoverable errors.\n\n*   **Catching:** Catch `Exception` subtypes for recoverable failures.\n*   **Errors:** Never explicitly catch `Error` or its subtypes (e.g., `TypeError`, `ArgumentError`). Errors indicate programming bugs that must be fixed, not caught. Enforce this by enabling the `avoid_catching_errors` linter rule.\n*   **Rethrowing:** Use `rethrow` inside a `catch` block to propagate an exception while preserving its original stack trace.\n\n## Workflows\n\n### Workflow: Static Analysis Resolution\n\nUse this sequential workflow to identify, fix, and verify static analysis errors in a Dart project. Copy the checklist to track your progress.\n\n**Task Progress:**\n- [ ] 1. Run static analyzer.\n- [ ] 2. Apply automated fixes.\n- [ ] 3. Resolve remaining errors manually.\n- [ ] 4. Verify fixes (Feedback Loop).\n\n**1. Run static analyzer**\nExecute the Dart analyzer to identify all static errors in the target directory or file.\n```bash\ndart analyze . --fatal-infos\n```\n\n**2. Apply automated fixes**\nUse the `dart fix` tool to automatically resolve standard linting and analysis issues.\n```bash\n# Preview changes\ndart fix --dry-run\n# Apply changes\ndart fix --apply\n```\n\n**3. Resolve remaining errors manually**\nReview the remaining analyzer output and apply conditional logic based on the error type:\n\n*   **If the error is a Null Safety issue (e.g., \"Property cannot be accessed on a nullable receiver\"):**\n    *   Verify if the variable can logically be null.\n    *   If yes, use optional chaining (`?.`) or provide a fallback (`??`).\n    *   If no, and initialization is guaranteed elsewhere, mark the declaration with `late`.\n*   **If the error is a Type Mismatch (e.g., \"The argument type 'List\u003Cdynamic>' can't be assigned...\"):**\n    *   Trace the variable's initialization.\n    *   Add explicit generic type annotations to the instantiation (e.g., `\u003Cint>[]` instead of `[]`).\n*   **If the error is an Invalid Override (e.g., \"The parameter type doesn't match the overridden method\"):**\n    *   Widen the parameter type to match the superclass, OR\n    *   Add the `covariant` keyword to the parameter if tightening the type is intentionally required by the domain logic.\n\n**4. Verify fixes (Feedback Loop)**\nRun the validator. Review errors. Fix.\n```bash\ndart analyze .\ndart test\n```\n*   **If `dart analyze` reports errors:** Return to Step 3.\n*   **If `dart test` fails with a `TypeError`:** You have introduced an invalid explicit cast (`as T`) or accessed an uninitialized `late` variable. Locate the runtime failure and correct the type hierarchy or initialization order.\n\n## Examples\n\n### Example: Fixing Dynamic List Assignments\n**Input (Fails Static Analysis):**\n```dart\nvoid printInts(List\u003Cint> a) => print(a);\n\nvoid main() {\n  final list = []; \u002F\u002F Inferred as List\u003Cdynamic>\n  list.add(1);\n  list.add(2);\n  printInts(list); \u002F\u002F Error: List\u003Cdynamic> can't be assigned to List\u003Cint>\n}\n```\n\n**Output (Passes Static Analysis):**\n```dart\nvoid printInts(List\u003Cint> a) => print(a);\n\nvoid main() {\n  final list = \u003Cint>[]; \u002F\u002F Explicitly typed\n  list.add(1);\n  list.add(2);\n  printInts(list);\n}\n```\n\n### Example: Fixing Method Overrides (Contravariance)\n**Input (Fails Static Analysis):**\n```dart\nclass Animal {\n  void chase(Animal a) {}\n}\n\nclass Cat extends Animal {\n  @override\n  void chase(Mouse a) {} \u002F\u002F Error: Tightening parameter type\n}\n```\n\n**Output (Passes Static Analysis):**\n```dart\nclass Animal {\n  void chase(Animal a) {}\n}\n\nclass Cat extends Animal {\n  @override\n  void chase(covariant Mouse a) {} \u002F\u002F Explicitly marked covariant\n}\n```\n\n### Example: Fixing Null Safety with `late`\n**Input (Fails Static Analysis):**\n```dart\nclass Thermometer {\n  String temperature; \u002F\u002F Error: Non-nullable instance field must be initialized\n\n  void read() {\n    temperature = '20C';\n  }\n}\n```\n\n**Output (Passes Static Analysis):**\n```dart\nclass Thermometer {\n  late String temperature; \u002F\u002F Defers initialization check to runtime\n\n  void read() {\n    temperature = '20C';\n  }\n}\n```\n",{"name":5,"metadata":24,"description":7},{"model":25,"last_modified":26},"models\u002Fgemini-3.1-pro-preview","Fri, 24 Apr 2026 15:13:22 GMT","main","228e23386ed058f8a2456399cd68f63999d63adf",".claude\u002Fskills\u002Fdart-fix-runtime-errors","https:\u002F\u002Fgithub.com\u002Fmictlanix\u002Fmbe-ui","https:\u002F\u002Fgithub.com\u002Fmictlanix","https:\u002F\u002Fmictlanix.com","2026-11-15 04:02:27",{"source":8,"skillName":5,"commands":35,"prompt":45,"zipAvailable":46},[36,39,42],{"tool":37,"command":38},"npx","npx skills add mictlanix\u002Fmbe-ui --skill dart-fix-runtime-errors",{"tool":40,"command":41},"bunx","bunx skills add mictlanix\u002Fmbe-ui --skill dart-fix-runtime-errors",{"tool":43,"command":44},"pnpm","pnpm dlx skills add mictlanix\u002Fmbe-ui --skill dart-fix-runtime-errors","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fmictlanix\u002Fmbe-ui\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fdart-fix-runtime-errors\u002FSKILL.md",true,[],[49,56,61,68,75,82],{"skillNo":50,"name":51,"nameZh":6,"description":52,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":53,"categories":54,"keywords":55,"publishedAt":19},"01M75QCZHHB42Q7KJTZHQZXZ77","speckit-wireframes-draft","Draw low-fi wireframes for every screen and state the spec describes","https:\u002F\u002Fgithub.com\u002Fmictlanix\u002Fmbe-ui\u002Fblob\u002Fmain\u002F.specify\u002Fextensions\u002Fwireframes\u002F.specify-dev\u002Fagent-commands\u002Fclaude\u002Fspeckit-wireframes-draft\u002FSKILL.md",[],[],{"skillNo":57,"name":51,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":58,"categories":59,"keywords":60,"publishedAt":19},"01M75QCXRSD7HM7AFZH4HA9E6S","https:\u002F\u002Fgithub.com\u002Fmictlanix\u002Fmbe-ui\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fspeckit-wireframes-draft\u002FSKILL.md",[],[],{"skillNo":62,"name":63,"nameZh":6,"description":64,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":65,"categories":66,"keywords":67,"publishedAt":19},"01M75QCVS17DXXBTQ8DE2SSXVR","speckit-taskstoissues","Convert existing tasks into actionable, dependency-ordered GitHub issues for the feature based on available design artifacts.","https:\u002F\u002Fgithub.com\u002Fmictlanix\u002Fmbe-ui\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fspeckit-taskstoissues\u002FSKILL.md",[],[],{"skillNo":69,"name":70,"nameZh":6,"description":71,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":72,"categories":73,"keywords":74,"publishedAt":19},"01M75QCS3M02XD4PW58EXS6458","speckit-tasks","Generate an actionable, dependency-ordered tasks.md for the feature based on available design artifacts.","https:\u002F\u002Fgithub.com\u002Fmictlanix\u002Fmbe-ui\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fspeckit-tasks\u002FSKILL.md",[],[],{"skillNo":76,"name":77,"nameZh":6,"description":78,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":79,"categories":80,"keywords":81,"publishedAt":19},"01M75QCP9NASXGDNYZF6XYJZBD","speckit-specify","Create or update the feature specification from a natural language feature description.","https:\u002F\u002Fgithub.com\u002Fmictlanix\u002Fmbe-ui\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fspeckit-specify\u002FSKILL.md",[],[],{"skillNo":83,"name":84,"nameZh":6,"description":85,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":86,"categories":87,"keywords":88,"publishedAt":19},"01M75QCKBPS4K60R4YPRQ8HBJ9","speckit-plan","Execute the implementation planning workflow using the plan template to generate design artifacts.","https:\u002F\u002Fgithub.com\u002Fmictlanix\u002Fmbe-ui\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fspeckit-plan\u002FSKILL.md",[],[]]