agentleFS
gspencergooggspencergoog/skills/skills/dart-concurrency/SKILL.md

dart-concurrency

Skill2 starsChanged 30 days agoApache-2.0View on GitHub

Prevents, diagnoses, and fixes asynchronous problems in Dart and Flutter: UI freezes and jank, event loop starvation, race conditions, shared-state corruption, isolate deadlocks, and test timeouts, using the Dart MCP analysis, test, and runtime tools. Use when the UI hangs or stutters, when a test times out around Futures, Streams, FakeAsync, or pumpAndSettle, or when the analyzer reports unawaited_futures, discarded_futures, or use_build_context_synchronously. Don't use for moving CPU-bound work such as JSON parsing into an isolate in an otherwise healthy app (use flutter-concurrency).

2 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

11 rules. About 0 are common, 7 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈7

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Before debugging runtime issues, enforce structural correctness.

    line 33
  2. Very specific:

    Scan: Use analyze_files to check analysis_options.yaml.

    line 35
  3. Very specific:

    Enforce: Ensure unawaited_futures, discarded_futures, and use_build_context_synchronously are enabled.

    line 36
  4. Distinctive:

    Remediate: If violations are found, apply the strategies defined in references/static-analysis.md.

    line 37
  5. Distinctive:

    If a defect is reported via CI/CD or local testing:

    line 41
  6. Very specific:

    Execute: Run run_tests with the --log-file argument.

    line 43
  7. Distinctive:

    If the application is unresponsive but compiles:

    line 49
  8. Very specific:

    Check Errors: Use get_runtime_errors to identify unhandled exceptions.

    line 52
  9. Distinctive:

    Profile: Use VM Service lookups to differentiate between Event Loop Starvation and Deadlocks.

    line 53
  10. Distinctive:

    If CPU is high and stack traces show recursion: See references/event-loops.md.

    line 54
  11. Distinctive:

    If CPU is low and execution halts: See references/race-conditions.md or references/isolate-management.md.

    line 55

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Dart Concurrency Anomalies Workflow

MCP Toolchain Dependencies

This skill requires access to the dart and dart_analysis_server MCP toolsets:

  • analyze_files: For static analysis and AST parsing.
  • run_tests: To reproduce hangs and capture timeout logs (--log-file).
  • dtd: To bridge into the runtime environment (Dart Tooling Daemon).
  • get_runtime_errors: To fetch current runtime errors and stack traces.
  • widget_inspector: To detect infinite rendering loops.
  • hot_reload: To inject fixes without losing state.
  • pub_dev_search: To find pub packages (e.g., synchronized).

Operational Workflows

Phase 1: Proactive Static Analysis

Before debugging runtime issues, enforce structural correctness.

  • Scan: Use analyze_files to check analysis_options.yaml.
  • Enforce: Ensure unawaited_futures, discarded_futures, and use_build_context_synchronously are enabled.
  • Remediate: If violations are found, apply the strategies defined in references/static-analysis.md.

Phase 2: Test Suite Reproduction

If a defect is reported via CI/CD or local testing:

  • Execute: Run run_tests with the --log-file argument.
  • Parse: Scan logs for pumpAndSettle timed out or FakeAsync discrepancies.
  • Resolve: Apply heuristics from references/test-suite-anomalies.md.

Phase 3: Runtime Introspection (The "Hang" Protocol)

If the application is unresponsive but compiles:

  • Connect: Invoke dtd.
  • Check Errors: Use get_runtime_errors to identify unhandled exceptions.
  • Profile: Use VM Service lookups to differentiate between Event Loop Starvation and Deadlocks.
    • If CPU is high and stack traces show recursion: See references/event-loops.md.
    • If CPU is low and execution halts: See references/race-conditions.md or references/isolate-management.md.

Decision Trees

Is the UI Frozen?

  • Yes -> Check Event Loop Starvation (High CPU) or Deadlock (Low CPU).
  • No (stale data) -> Check Race Conditions.

Is it a Test Timeout?

  • pumpAndSettle -> Infinite Animation.
  • Silent Hang -> FakeAsync vs. Real I/O conflict.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.