From cc-mobile-flutter
Add a new screen to an existing feature — typed go_router route, BlocProvider-wired page, stateless view, and a widget test.
How this command is triggered — by the user, by Claude, or both
Slash command
/cc-mobile-flutter:add-screenThis command is limited to the following tools:
The summary Claude sees in its command listing — used to decide when to auto-load this command
# /add-screen $ARGUMENTS Add a new screen. `$ARGUMENTS` is `<feature>/<ScreenName>` (e.g. `order/OrderDetail`). ## Before writing any code Read `.claude/skills/widgets-and-screens/SKILL.md`. Check the feature's existing screens to match local conventions. ## Files to create ## Page wrapper pattern ## View pattern - Stateless. - Takes the state slice it needs as props OR uses `BlocBuilder`/`BlocSelector` locally. - Callbacks go out; events come back in from the page. ## Routing Add the typed route; update the parent route's `routes:` list if it's nested. ## Test Widget test ...
Add a new screen. $ARGUMENTS is <feature>/<ScreenName> (e.g. order/OrderDetail).
Read .claude/skills/widgets-and-screens/SKILL.md. Check the feature's existing screens to match local conventions.
lib/feature/<feature>/presentation/pages/<screen>_page.dart # BlocProvider + listeners
lib/feature/<feature>/presentation/widgets/<screen>_view.dart # stateless
lib/routing/routes/<screen>_route.dart # @TypedGoRoute
test/feature/<feature>/presentation/<screen>_view_test.dart
class <Screen>Page extends StatelessWidget {
const <Screen>Page({super.key, required this.id});
final String id;
@override
Widget build(BuildContext context) => BlocProvider<<Screen>Bloc>(
create: (_) => sl<<Screen>Bloc>()..add(<Screen>Event.load(id)),
child: BlocListener<<Screen>Bloc, <Screen>State>(
listenWhen: (p, c) => p.effect != c.effect && c.effect != null,
listener: (context, state) { /* toast, nav */ },
child: const <Screen>View(),
),
);
}
BlocBuilder/BlocSelector locally.Add the typed route; update the parent route's routes: list if it's nested.
@TypedGoRoute<<Screen>Route>(path: '/order/:id')
class <Screen>Route extends GoRouteData {
const <Screen>Route({required this.id});
final String id;
@override
Widget build(BuildContext context, GoRouterState state) => <Screen>Page(id: id);
}
Widget test pumps the <Screen>View with a fake bloc. Cover at least: loading renders spinner, success renders content, error renders the error UI.
GoRouteData subclass + @TypedGoRoute).sl<...>() inside build.const constructors wherever possible.dart run build_runner build --delete-conflicting-outputs if you added a new typed route.npx claudepluginhub dimitriremoiville/cc-mobile --plugin cc-mobile-flutter