agentleFS
DesquaredDesquared/agents-rules-skills/skills/flutter-feature-implementation/SKILL.md

flutter-feature-implementation

Skill4 starsChanged 3 months agoMITView on GitHub

Use when implementing a Flutter feature from scratch or completing one in progress. Covers file structure, design system compliance, state management setup, error handling, testing, and build_runner requirements.

The file

Files
SKILL.md

Feature Implementation Skill

Checklist

Code Structure

  • Files in data/domain/view (DTOs → data, Models → domain)
  • @JsonSerializable on DTOs, Equatable on Models
  • Repository interface in domain, implementation in data
  • Bloc (complex) or Cubit (simple) in view

Design System

  • ColorPalette (no hardcoded colors)
  • Spacing (no magic numbers)
  • Project's Design System Text Widgets (typography)
  • Project's Design System Assets (images/icons)
  • Core widgets (lib/core/widgets/)

State Management

  • Bloc for complex (multiple events), Cubit for simple
  • @injectable on classes (auto-registration)
  • BlocProvider at page level
  • BlocBuilder scoped to minimal subtree

Error Handling

  • Try-catch in repositories
  • Map DioException → custom exceptions (NetworkException, NotFoundException)
  • Error states in Bloc/Cubit
  • User-friendly messages

Testing

  • Unit tests for Bloc/Cubit (90%+ target)
  • Mock with mocktail
  • Test structure mirrors source
  • Use fixtures for mock data

Quality

  • flutter analyze passes (zero errors)
  • Run ./build_runner.sh after changes
  • Commit *.g.dart files

Patterns

// ✅ Clear naming
class FeatureRepository {}

// ✅ Null safety
final name = user?.name ?? 'Guest';

// ✅ const
const Text('Static');

// ✅ Async/await
try {
  final data = await repository.fetch();
  emit(LoadedState(data));
} catch (e) {
  emit(ErrorState(e.toString()));
}

// ✅ Bloc test
blocTest<MyBloc, MyState>(
  'emits [Loading, Loaded]',
  build: () {
    when(() => repository.fetch()).thenAnswer((_) async => data);
    return bloc;
  },
  act: (bloc) => bloc.add(LoadRequested()),
  expect: () => [LoadingState(), LoadedState(data)],
);

Resources

  • Extensions → lib/core/utils/extensions/
  • Helpers → lib/core/utils/helpers/
  • Validators → lib/core/utils/validators/

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.