swe-programming-dart
Dart coding standards from authoritative docs/explanation/software-engineering/programming-languages/dart/ documentation
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Dart coding standards from authoritative docs/explanation/software-engineering/programming-languages/dart/ documentation
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
AI agent development standards including frontmatter structure, naming conventions, tool access patterns, model selection, and reference documentation structure
Comprehensive project planning standards for plans/ directory including folder structure (ideas/, backlog/, in-progress/, done/), stage-aware naming convention (done uses YYYY-MM-DD__identifier/; backlog and in-progress use identifier/ with no date prefix), five-document file organization (README.md, brd.md, prd.md, tech-docs.md, delivery.md for multi-file default; single README.md for trivially-small single-file exception), BRD/PRD content-placement rules, Gherkin acceptance criteria, and the mandatory structured multiple-choice grilling gates (pre-write and post-write) for resolving design decisions with the user. Essential for creating structured, executable project plans.
Trunk Based Development workflow - all development on main branch with small frequent commits, minimal branching, and continuous integration. Covers when branches are justified (exceptional cases only), commit patterns, feature flag usage for incomplete work, environment branch rules (deployment only), and AI agent default behavior (the repo-wide default delivery mode is `worktree-to-pr` -- a short-lived plan branch in a disposable worktree pushed to a draft PR; direct push to main remains available as an explicit selection). Essential for understanding repository git workflow and keeping branches short-lived
Workflow pattern standards for creating multi-agent orchestrations including YAML frontmatter (name, description, tags, status, agents, parameters), execution phases (sequential/parallel/conditional), agent coordination patterns, and Gherkin success criteria. Essential for defining reusable, validated workflow processes.
Common software development workflow patterns shared across all language developer agents
Three-stage content quality workflow pattern (Maker creates, Checker validates, Fixer remediates) with detailed execution workflows. Use when working with content quality workflows, validation processes, audit reports, or implementing maker/checker/fixer agent roles.
| name | swe-programming-dart |
| description | Dart coding standards from authoritative docs/explanation/software-engineering/programming-languages/dart/ documentation |
Progressive disclosure of Dart coding standards for agents writing Dart code.
Authoritative Source: docs/explanation/software-engineering/programming-languages/dart/README.md
Usage: Auto-loaded for agents when writing Dart code. Provides quick reference to idioms, best practices, and antipatterns.
IMPORTANT: This skill provides demo-specific style guides, not educational tutorials.
You MUST understand Dart fundamentals before using these standards. Complete the demo Dart learning path first:
What this skill covers: demo naming conventions, framework choices, repository-specific patterns.
What this skill does NOT cover: Dart syntax, language fundamentals, generic patterns (those are in crud-fs-ts-nextjs).
Files and Packages: lowercase_with_underscores
zakat_calculator.dart, murabaha_service.dartzakat_app, islamic_financeClasses and Types: UpperCamelCase
ZakatCalculator, MurabahaContract, PaymentStatusFunctions, Variables, Parameters: lowerCamelCase
calculateZakat(), totalAmount, paymentDateConstants: lowerCamelCase (not UPPER_CASE in Dart)
const defaultNisab = 5000.0;static const zakatRate = 0.025;Non-nullable by default:
// CORRECT: Non-nullable
String name = 'Ahmed';
// CORRECT: Nullable when needed
String? optionalEmail;
// CORRECT: Null-aware operators
String greeting = optionalEmail ?? 'Guest';
int? length = optionalEmail?.length;
WRONG: Null assertion without justification:
// WRONG: Unsafe null assertion
String definitelyPresent = possiblyNull!; // crashes if null
Typed exceptions:
// CORRECT: Typed exception hierarchy
class DomainException implements Exception {
final String message;
const DomainException(this.message);
}
class ZakatValidationException extends DomainException {
const ZakatValidationException(super.message);
}
// CORRECT: Catch specific types
try {
final result = await calculateZakat(wealth, nisab);
} on ZakatValidationException catch (e) {
handleValidation(e);
} on DomainException catch (e) {
handleDomain(e);
}
WRONG: Catching Object or dynamic:
// WRONG: Too broad
try {
doSomething();
} catch (e) { // Catches everything including Errors
print(e);
}
Prefer async/await:
// CORRECT: async/await
Future<ZakatResult> calculateAsync(double wealth, double nisab) async {
await Future.delayed(Duration(milliseconds: 100));
return wealth >= nisab ? ZakatResult.due(wealth * 0.025) : ZakatResult.notDue();
}
// CORRECT: Stream for multiple values
Stream<Payment> paymentsStream(String contractId) async* {
final payments = await repository.getPayments(contractId);
for (final payment in payments) {
yield payment;
}
}
Use final and const:
// CORRECT: Immutable class
class ZakatCalculation {
final double wealth;
final double nisab;
final double amount;
const ZakatCalculation({
required this.wealth,
required this.nisab,
required this.amount,
});
}
// CORRECT: const for compile-time constants
const zakatRate = 0.025;
package:test structure:
import 'package:test/test.dart';
void main() {
group('ZakatCalculator', () {
late ZakatCalculator calculator;
setUp(() {
calculator = ZakatCalculator();
});
test('returns 2.5% when wealth above nisab', () {
final result = calculator.calculate(10000, 5000);
expect(result, equals(250.0));
});
test('returns 0 when wealth below nisab', () {
final result = calculator.calculate(1000, 5000);
expect(result, equals(0.0));
});
});
}
Input Validation:
Secrets Management:
// CORRECT: Use flutter_secure_storage
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
final storage = FlutterSecureStorage();
await storage.write(key: 'api_token', value: token);
Authoritative Index: docs/explanation/software-engineering/programming-languages/dart/README.md