Token导航 LogoToken导航

Agent Skill · 开发

dart-fix-static-analysis-errors(dart 修复静态分析错误)

dart-fix-static-analysis-errors 用于记录任务执行中的错误、用户纠正、经验和能力缺口,适合在 Codex、Claude、Cursor、Gemini CLI 中希望让 Agent 持续沉淀问题、修正和最佳实践时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

dart-fix-static-analysis-errors 是开发类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为只读;许可证信息还不明确,第三方扫描已通过,按安装量在开发类的 21,746 个 Skill 里排第 11,272。

总安装 1,858周安装 79GitHub Stars 63下载 651核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:dart-fix-static-analysis-errors(dart 修复静态分析错误)
来源仓库:https://github.com/dart-lang/skills
仓库路径:skills/dart-fix-static-analysis-errors
安装命令:
npx skills add https://github.com/dart-lang/skills --skill dart-fix-static-analysis-errors
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/dart-lang/skills --skill dart-fix-static-analysis-errors

这个 Skill 是做什么的

开发类 Skill 面向写代码、改代码和排查问题,一般会读写仓库文件,部分还会执行构建或测试命令。

dart-fix-static-analysis-errors 用于自动识别并修复 Dart 代码中的静态分析错误,提升代码质量和一致性。适用于需要持续改进代码质量、处理静态分析警告或进行代码审查的 Dart 项目场景。

通过运行 dart analyze 获取诊断信息,结合自动化修复建议快速定位和解决类型、空安全等问题。安装前请确认项目是否使用 Dart SDK,并检查是否需要额外权限执行分析或修改文件。注意该技能可能触发文件读写,建议在非生产分支测试后再应用到主代码库。

来源仓库内路径:skills/dart-fix-static-analysis-errors

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/dart-lang/skills --skill dart-fix-static-analy…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它标注为只读,先用只读任务试一次,确认行为符合预期再扩大使用范围。

常见问题

6 条

dart-fix-static-analysis-errors 怎么安装?

在终端执行 npx skills add https://github.com/dart-lang/skills --skill dart-fix-static-analysis-errors。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

dart-fix-static-analysis-errors 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

dart-fix-static-analysis-errors 需要什么权限?

权限级别是只读。该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

dart-fix-static-analysis-errors 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

dart-fix-static-analysis-errors 用的人多吗?

公开数据是累计安装 1,858 次,近一周安装 79 次,下载 651 次,GitHub 63 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

dart-fix-static-analysis-errors 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 第三方扫描已通过,常见的高风险行为没有命中。
  • 标注为只读权限,试用阶段不容易误改本地文件。

先想清楚的地方

  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理开发类任务、又不想每次都手写提示词的人。
  • 只想先试试效果、不希望它改动本地文件的人。

不太适合

  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

开发类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
skill-vetter

技能审查员 · OpenClaw

8,779,018986操作浏览器MIT-0通过
ontology

本体论 · OpenClaw

6,636,960576只读MIT-0通过
entra-app-registration

内部应用程序注册 · Codex、Claude

6,631,872764接触敏感数据未明确通过
entra-app-registration

内部应用程序注册 · Codex、Claude

3,757,680201接触敏感数据未明确通过
nano-banana-pro

纳米香蕉专业版 · OpenClaw

3,526,898364接触敏感数据MIT-0有提醒
dart-fix-static-analysis-errors

dart 修复静态分析错误 · 本页

1,85863只读未明确通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Resolving Dart Static Analysis Errors

Contents

Diagnostic Execution

Execute the Dart analyzer to identify static errors, warnings, and informational diagnostics across the codebase.

  • Run $ dart analyze to evaluate all Dart files in the current directory.
  • Target specific directories or files by appending the path: $ dart analyze bin or $ dart analyze lib/main.dart.
  • Enforce strictness by failing on info-level issues using the --fatal-infos flag.
  • Apply automated quick-fixes for supported diagnostics using $ dart fix --apply. Preview changes first with $ dart fix --dry-run.

Null Safety & Type Resolution

Address static errors related to Dart's sound null safety and strict type system.

  • Nullability: Append ? to types to explicitly allow null (e.g., String?).
  • Assertion: Use the postfix bang operator ! to cast a nullable expression to its underlying non-nullable type when you can guarantee it is not null.
  • Delayed Initialization: Apply the late modifier to non-nullable top-level or instance variables that are guaranteed to be initialized before their first read, bypassing the analyzer's definite assignment checks.
  • Named Parameters: Use the required modifier for named parameters that do not have a default value and cannot be null.
  • Explicit Downcasts: If static analysis disallows an implicit downcast (e.g., assigning List<Animal> to List<Cat>), use an explicit cast: as List<Cat>.
  • Generic Types: Always provide explicit type annotations to generic classes (e.g., List<String>, Map<String, dynamic>). Avoid using a raw List or Map which defaults to dynamic.

Flow Analysis & Type Promotion

Leverage Dart's control flow analysis to safely promote nullable types to non-nullable types without manual casting.

  • Null Checks: Check a local variable against null (e.g., if (value!= null)) to automatically promote it to a non-nullable type within that block.
  • Type Tests: Use the is operator (e.g., if (value is String)) to promote a variable to a specific subclass or type.
  • Early Returns: Use early returns, break, or throw to exit a control flow path if a variable is null or the wrong type. The analyzer will promote the variable for the remainder of the scope.
  • Reachability: Use the Never type for functions that unconditionally throw exceptions or terminate the process. The analyzer uses this to determine unreachable code paths.

Analyzer Configuration

Configure the analysis_options.yaml file at the package root to enforce stricter type checks and customize linter rules.

  • Enable strict-casts: true to prevent implicit downcasts from dynamic.
  • Enable strict-inference: true to prevent the analyzer from falling back to dynamic when it cannot infer a type.
  • Enable strict-raw-types: true to require explicit type arguments on generic types.
  • Suppress specific diagnostics in a file using // ignore_for_file: <diagnostic_name>.
  • Suppress a diagnostic on a specific line using // ignore: <diagnostic_name>.

Workflow: Static Analysis Remediation

Follow this sequential workflow to resolve static analysis errors in a Dart project.

Task Progress Checklist

Copy this checklist to track your progress:

  • Run $ dart analyze to establish a baseline of errors.
  • Run $ dart fix --apply to resolve automatically fixable issues.
  • Address remaining Null Safety errors (?, !, late, required).
  • Address remaining Type System errors (explicit as casts, generic type annotations).
  • Run $ dart analyze to verify all errors are resolved.
  • Execute tests or run the application to ensure fixes did not introduce runtime exceptions (e.g., failed as casts or uninitialized late variables).

Conditional Logic

  • If working with mixed-version code (legacy Dart 2.9): Disable sound null safety temporarily by passing --no-sound-null-safety to dart run or flutter run, or by adding // @dart=2.9 to the top of the entrypoint file.
  • If a field is private and final: Rely on flow analysis for type promotion.
  • If a field is public or non-final: Flow analysis cannot promote it. Copy the field to a local variable first, check the local variable for null, and use the local variable.

Feedback Loop

  1. Run Validator: $ dart analyze
  2. Review Errors: Identify the file, line number, and diagnostic code.
  3. Fix: Apply the appropriate null safety or type resolution fix.
  4. Repeat: Continue until $ dart analyze returns "No issues found!".

Examples

Type Promotion via Local Variable Assignment

When dealing with nullable instance fields, copy to a local variable to enable flow analysis.

Incorrect (Fails Analysis):

class Coffee {
  String? _temperature;

  void checkTemp() {
    if (_temperature != null) {
      // ERROR: Property cannot be promoted because it is not a local variable.
      print(_temperature.length);
    }
  }
}

Correct:

class Coffee {
  String? _temperature;

  void checkTemp() {
    final temp = _temperature; // Copy to local variable
    if (temp != null) {
      // SUCCESS: 'temp' is promoted to non-nullable String.
      print(temp.length);
    }
  }
}

Strict Analyzer Configuration

Implement the following analysis_options.yaml to enforce strict type safety.

include: package:lints/recommended.yaml

analyzer:
  language:
    strict-casts: true
    strict-inference: true
    strict-raw-types: true
  errors:
    invalid_assignment: error
    missing_return: error
    dead_code: info

平台分布

Codex

33.73%
按下载量换算220

Claude

29.11%
按下载量换算190

Cursor

18.03%
按下载量换算117

Gemini CLI

10.14%
按下载量换算66

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

只读

该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills