Token导航 LogoToken导航TokenDH.com
前端设计需要联网github未标认证来源可访问clear审计未展示

senior-fluttersenior Flutter 前端

Agent Skill

用于辅助前端页面、组件、样式和交互逻辑的开发与维护。它适合让 Agent 生成或审查 React、Next.js、Vue、Tailwind、CSS 等相关代码,整理组件结构,或定位布局和性能问题。使用时需要结合项目现有设计系统、路由和构建方式,避免只生成孤立片段;涉及页面改动时,应配合本地预览和构建检查确认视觉效果。

总安装

489

周安装

21

GitHub Stars

公开资料未说明

下载量

171
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

请帮我安装这个 Agent Skill:senior-flutter(senior Flutter 前端)
来源仓库:https://github.com/rickydwilson-dcs/claude-skills
仓库路径:skills/senior-flutter
安装命令:
npx skills add https://github.com/rickydwilson-dcs/claude-skills --skill senior-flutter
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/rickydwilson-dcs/claude-skills --skill senior-flutter

简介

senior-flutter 用于辅助前端页面、组件、样式和交互逻辑的开发与维护,支持 React、Vue 等技术栈的代码生成与审查。

  • 适用于需要构建用户界面、调试布局问题或整合设计系统的开发任务。
  • 使用时需结合项目现有架构和构建流程,避免生成孤立代码片段;建议配合本地预览验证效果。
  • 涉及页面改动时应确保路由兼容性和构建稳定性,必要时进行回归测试。
  • 适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

SKILL.md

Senior Flutter

Flutter and Dart expertise for building production-grade cross-platform applications. This skill covers widget architecture, state management patterns, native integration, and performance optimization.

Overview

This skill provides comprehensive Flutter and Dart development expertise for building beautiful, performant cross-platform applications. It covers widget architecture, state management (Riverpod, Bloc, Provider), platform channels for native integration, and performance optimization techniques. Uses Python tools from the senior-mobile skill for scaffolding and validation.

Quick Start

# Generate a new Flutter project
python3 ../../senior-mobile/scripts/mobile_scaffolder.py --framework flutter --state riverpod --output ./my-app

# Analyze project configuration
python3 ../../senior-mobile/scripts/platform_detector.py --check all

# Validate for Play Store submission
python3 ../../senior-mobile/scripts/app_store_validator.py --store google --strict

Python Tools

This skill uses Python tools from the senior-mobile skill:

  • mobile_scaffolder.py - Generate Flutter project with clean architecture
  • platform_detector.py - Analyze project configuration for iOS/Android
  • app_store_validator.py - Validate against App Store/Play Store requirements
# Generate Flutter project with Riverpod and GoRouter
python3 ../../senior-mobile/scripts/mobile_scaffolder.py \
  --framework flutter \
  --navigation go-router \
  --state riverpod \
  --ci github-actions

# Full project analysis
python3 ../../senior-mobile/scripts/platform_detector.py --check all --depth full

Core Capabilities

  • Widget Architecture - Build complex, reusable widget trees with proper lifecycle management
  • State Management - Implement Riverpod, Bloc, or Provider patterns effectively
  • Platform Channels - Integrate native iOS/Android code seamlessly
  • Performance Optimization - Profile and optimize rendering, reduce jank
  • Clean Architecture - Structure large Flutter applications for maintainability

Key Workflows

Workflow 1: Flutter Clean Architecture Setup

Time: 2-4 hours for initial structure

Steps:

  1. Create Flutter project with proper configuration
  2. Set up folder structure following clean architecture
  3. Configure dependency injection
  4. Implement core abstractions (Result, Either, UseCase)
  5. Set up routing with GoRouter
  6. Configure state management (Riverpod recommended)
  7. Add code generation (Freezed, json_serializable)
  8. Create base widgets and themes

Reference: references/widget-architecture.md

Project Structure:

lib/
├── core/
│   ├── error/
│   │   ├── exceptions.dart
│   │   └── failures.dart
│   ├── network/
│   │   ├── api_client.dart
│   │   └── network_info.dart
│   ├── router/
│   │   └── app_router.dart
│   └── theme/
│       └── app_theme.dart
├── features/
│   └── auth/
│       ├── data/
│       │   ├── datasources/
│       │   ├── models/
│       │   └── repositories/
│       ├── domain/
│       │   ├── entities/
│       │   ├── repositories/
│       │   └── usecases/
│       └── presentation/
│           ├── providers/
│           ├── screens/
│           └── widgets/
├── shared/
│   ├── widgets/
│   └── extensions/
└── main.dart

Core Setup:

// lib/core/router/app_router.dart
import 'package:go_router/go_router.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';

part 'app_router.g.dart';

@riverpod
GoRouter appRouter(AppRouterRef ref) {
  return GoRouter(
    initialLocation: '/',
    routes: [
      GoRoute(
        path: '/',
        builder: (context, state) => const HomeScreen(),
        routes: [
          GoRoute(
            path: 'profile/:id',
            builder: (context, state) => ProfileScreen(
              userId: state.pathParameters['id']!,
            ),
          ),
        ],
      ),
    ],
    errorBuilder: (context, state) => ErrorScreen(error: state.error),
  );
}

// lib/main.dart
void main() {
  WidgetsFlutterBinding.ensureInitialized();
  runApp(
    ProviderScope(
      child: const MyApp(),
    ),
  );
}

class MyApp extends ConsumerWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context, WidgetRef ref) {
    final router = ref.watch(appRouterProvider);

    return MaterialApp.router(
      routerConfig: router,
      theme: AppTheme.light,
      darkTheme: AppTheme.dark,
    );
  }
}

Workflow 2: State Management Implementation

Time: 1-2 hours per feature

Steps:

  1. Define feature state model with Freezed
  2. Create repository interface and implementation
  3. Implement provider/notifier for state management
  4. Build UI that reacts to state changes
  5. Handle loading, error, and success states
  6. Add unit tests for business logic

Reference: references/state-management.md

Riverpod Pattern (Recommended):

// Domain entity with Freezed
@freezed
class User with _$User {
  const factory User({
    required String id,
    required String name,
    required String email,
    String? avatarUrl,
  }) = _User;

  factory User.fromJson(Map<String, dynamic> json) => _$UserFromJson(json);
}

// Repository interface
abstract class UserRepository {
  Future<User> getUser(String id);
  Future<List<User>> getUsers();
  Future<void> updateUser(User user);
}

// Riverpod provider with AsyncNotifier
@riverpod
class UsersNotifier extends _$UsersNotifier {
  @override
  Future<List<User>> build() async {
    return ref.read(userRepositoryProvider).getUsers();
  }

  Future<void> refresh() async {
    state = const AsyncValue.loading();
    state = await AsyncValue.guard(() =>
      ref.read(userRepositoryProvider).getUsers()
    );
  }

  Future<void> updateUser(User user) async {
    await ref.read(userRepositoryProvider).updateUser(user);
    await refresh();
  }
}

// UI consumption
class UsersScreen extends ConsumerWidget {
  const UsersScreen({super.key});

  @override
  Widget build(BuildContext context, WidgetRef ref) {
    final usersAsync = ref.watch(usersNotifierProvider);

    return usersAsync.when(
      data: (users) => ListView.builder(
        itemCount: users.length,
        itemBuilder: (context, index) => UserTile(user: users[index]),
      ),
      loading: () => const Center(child: CircularProgressIndicator()),
      error: (error, stack) => ErrorWidget(
        error: error,
        onRetry: () => ref.read(usersNotifierProvider.notifier).refresh(),
      ),
    );
  }
}

Bloc Pattern (Alternative):

// Events
@freezed
class UserEvent with _$UserEvent {
  const factory UserEvent.loadUsers() = LoadUsers;
  const factory UserEvent.refreshUsers() = RefreshUsers;
  const factory UserEvent.updateUser(User user) = UpdateUser;
}

// State
@freezed
class UserState with _$UserState {
  const factory UserState.initial() = _Initial;
  const factory UserState.loading() = _Loading;
  const factory UserState.loaded(List<User> users) = _Loaded;
  const factory UserState.error(String message) = _Error;
}

// Bloc
class UserBloc extends Bloc<UserEvent, UserState> {
  final UserRepository _repository;

  UserBloc(this._repository) : super(const UserState.initial()) {
    on<LoadUsers>(_onLoadUsers);
    on<RefreshUsers>(_onRefreshUsers);
    on<UpdateUser>(_onUpdateUser);
  }

  Future<void> _onLoadUsers(LoadUsers event, Emitter<UserState> emit) async {
    emit(const UserState.loading());
    try {
      final users = await _repository.getUsers();
      emit(UserState.loaded(users));
    } catch (e) {
      emit(UserState.error(e.toString()));
    }
  }
}

Workflow 3: Platform Channel Integration

Time: 2-4 hours per integration

Steps:

  1. Define method channel contract
  2. Implement Dart side with proper error handling
  3. Implement iOS side (Swift)
  4. Implement Android side (Kotlin)
  5. Add platform availability checks
  6. Test on both platforms
  7. Document API for team

Reference: references/dart-patterns.md

Dart Implementation:

class NativeBattery {
  static const _channel = MethodChannel('com.example.app/battery');

  static Future<int> getBatteryLevel() async {
    try {
      final level = await _channel.invokeMethod<int>('getBatteryLevel');
      return level ?? -1;
    } on PlatformException catch (e) {
      throw BatteryException('Failed to get battery level: ${e.message}');
    }
  }

  static Stream<int> batteryLevelStream() {
    const eventChannel = EventChannel('com.example.app/battery_stream');
    return eventChannel
        .receiveBroadcastStream()
        .map((event) => event as int);
  }
}

// iOS Swift Implementation (ios/Runner/AppDelegate.swift)
/*
import Flutter
import UIKit

@main
@objc class AppDelegate: FlutterAppDelegate {
  override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
  ) -> Bool {
    let controller = window?.rootViewController as! FlutterViewController
    let batteryChannel = FlutterMethodChannel(
      name: "com.example.app/battery",
      binaryMessenger: controller.binaryMessenger
    )

    batteryChannel.setMethodCallHandler { [weak self] call, result in
      if call.method == "getBatteryLevel" {
        self?.receiveBatteryLevel(result: result)
      } else {
        result(FlutterMethodNotImplemented)
      }
    }

    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  }

  private func receiveBatteryLevel(result: FlutterResult) {
    let device = UIDevice.current
    device.isBatteryMonitoringEnabled = true
    let batteryLevel = Int(device.batteryLevel * 100)
    result(batteryLevel)
  }
}
*/

// Android Kotlin Implementation (android/app/src/main/kotlin/.../MainActivity.kt)
/*
import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.plugin.common.MethodChannel

class MainActivity: FlutterActivity() {
    private val CHANNEL = "com.example.app/battery"

    override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
        super.configureFlutterEngine(flutterEngine)
        MethodChannel(flutterEngine.dartExecutor.binaryMessenger, CHANNEL)
            .setMethodCallHandler { call, result ->
                if (call.method == "getBatteryLevel") {
                    val batteryLevel = getBatteryLevel()
                    result.success(batteryLevel)
                } else {
                    result.notImplemented()
                }
            }
    }

    private fun getBatteryLevel(): Int {
        val batteryManager = getSystemService(BATTERY_SERVICE) as BatteryManager
        return batteryManager.getIntProperty(BatteryManager.BATTERY_PROPERTY_CAPACITY)
    }
}
*/

Workflow 4: Widget Performance Optimization

Time: 2-4 hours per optimization session

Steps:

  1. Profile with Flutter DevTools
  2. Identify unnecessary rebuilds
  3. Implement const constructors where possible
  4. Use RepaintBoundary for complex widgets
  5. Optimize list rendering with proper keys
  6. Implement pagination for large datasets
  7. Re-profile to verify improvements

Reference: references/widget-architecture.md

Performance Patterns:

// AVOID: Widget rebuilds entire subtree
class BadExample extends StatelessWidget {
  final List<Item> items;

  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        // This header rebuilds when items change
        const Header(),
        ListView.builder(
          itemCount: items.length,
          itemBuilder: (context, index) => ItemTile(item: items[index]),
        ),
      ],
    );
  }
}

// BETTER: Isolate rebuilds with proper structure
class GoodExample extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        // Header never rebuilds
        const Header(),
        // Only list area rebuilds
        Expanded(
          child: Consumer<ItemsProvider>(
            builder: (context, provider, _) => ListView.builder(
              itemCount: provider.items.length,
              itemBuilder: (context, index) => ItemTile(
                key: ValueKey(provider.items[index].id),
                item: provider.items[index],
              ),
            ),
          ),
        ),
      ],
    );
  }
}

// Use RepaintBoundary for expensive widgets
class ExpensiveAnimation extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return RepaintBoundary(
      child: CustomPaint(
        painter: ComplexAnimationPainter(),
        size: const Size(200, 200),
      ),
    );
  }
}

// Optimize images
class OptimizedImage extends StatelessWidget {
  final String url;

  @override
  Widget build(BuildContext context) {
    return CachedNetworkImage(
      imageUrl: url,
      // Resize to actual display size
      memCacheWidth: 200,
      memCacheHeight: 200,
      placeholder: (context, url) => const ShimmerPlaceholder(),
      errorWidget: (context, url, error) => const Icon(Icons.error),
    );
  }
}

Dart Patterns

Null Safety and Pattern Matching

// Pattern matching with Dart 3
sealed class Result<T> {
  const Result();
}

class Success<T> extends Result<T> {
  final T data;
  const Success(this.data);
}

class Failure<T> extends Result<T> {
  final Exception error;
  const Failure(this.error);
}

// Using pattern matching
void handleResult(Result<User> result) {
  switch (result) {
    case Success(data: final user):
      print('User: ${user.name}');
    case Failure(error: final e):
      print('Error: $e');
  }
}

// Records for multiple return values
(String, int) getUserInfo() {
  return ('John', 30);
}

void main() {
  final (name, age) = getUserInfo();
  print('$name is $age years old');
}

Extension Methods

extension StringExtensions on String {
  String get capitalize =>
    isEmpty ? this : '${this[0].toUpperCase()}${substring(1)}';

  bool get isValidEmail =>
    RegExp(r'^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$').hasMatch(this);
}

extension ContextExtensions on BuildContext {
  ThemeData get theme => Theme.of(this);
  TextTheme get textTheme => theme.textTheme;
  ColorScheme get colorScheme => theme.colorScheme;

  void showSnackBar(String message) {
    ScaffoldMessenger.of(this).showSnackBar(
      SnackBar(content: Text(message)),
    );
  }
}

// Usage
final email = 'test@example.com';
if (email.isValidEmail) {
  context.showSnackBar('Valid email!');
}

Async Patterns

// Proper async error handling
Future<Result<User>> fetchUser(String id) async {
  try {
    final response = await dio.get('/users/$id');
    return Success(User.fromJson(response.data));
  } on DioException catch (e) {
    return Failure(NetworkException(e.message ?? 'Network error'));
  } catch (e) {
    return Failure(UnknownException(e.toString()));
  }
}

// Stream transformations
Stream<List<Message>> watchMessages(String chatId) {
  return firestore
      .collection('chats')
      .doc(chatId)
      .collection('messages')
      .orderBy('timestamp', descending: true)
      .limit(50)
      .snapshots()
      .map((snapshot) => snapshot.docs
          .map((doc) => Message.fromFirestore(doc))
          .toList());
}

References

Tools Integration

This skill uses Python tools from the senior-mobile skill:

# Generate Flutter project structure
python3 ../../senior-mobile/scripts/mobile_scaffolder.py \
  --framework flutter \
  --navigation go-router \
  --state riverpod

# Detect Flutter project configuration
python3 ../../senior-mobile/scripts/platform_detector.py --check all

# Validate for Play Store
python3 ../../senior-mobile/scripts/app_store_validator.py --store google

Best Practices

Widget Design

  • Keep widgets small and focused (single responsibility)
  • Use composition over inheritance
  • Implement const constructors
  • Separate logic from UI
  • Use proper keys for dynamic lists

State Management

  • Choose one pattern and use consistently
  • Keep state as local as possible
  • Avoid global state when possible
  • Test business logic independently

Performance

  • Profile before optimizing
  • Use lazy loading for large lists
  • Implement image caching
  • Minimize widget rebuilds
  • Use isolates for heavy computation

Testing

  • Unit test business logic
  • Widget test UI components
  • Integration test critical flows
  • Use golden tests for visual regression

Success Metrics

  • UI Development Speed: 55% faster with hot reload
  • Code Sharing: 90%+ across platforms
  • App Performance: 60 FPS on mid-range devices
  • Test Coverage: 80%+ for business logic

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Claude Code

30.1%
按下载量换算51

Gemini CLI

21.34%
按下载量换算36

OpenCode

19.07%
按下载量换算33

Antigravity

12.73%
按下载量换算22

Cursor

6.99%
按下载量换算12

Codex

3.32%
按下载量换算6

安全审计

暂无安全审计结果可展示。

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。

来源信息

继续浏览同类 Skills