magic-starter
Skill3 starsChanged 17 days agoMITView on GitHub
Build with magic_starter: opt-in Magic screens for sign-in, settings, teams, billing and support, plus the view registry.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- anilcancakir/aiword for word, first seen Nov 16, 2026
Other versions1 project uses a version of this.
Word for word · 1
- anilcancakir/ai★ 3100% same
Edited · 0
None found.
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository19 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- crumbsSkill
- dowelSkill
- flutter-reviewSkill
- magic-analyticsSkill
- magic-deeplinkSkill
- magic-deviceSkill
- magic-devtoolsSkill
- magic-encryptionSkill
- magic-frameworkSkill
- magic-local-storageSkill
- magic-notificationsSkill
- magic-paymentsSkill
- magic-pickerSkill
- magic-sentrySkill
- magic-social-authSkill
- magic-socketSkill
- tapirSkill
- wind-uiSkill
The file
We split this skill into the rules it gives an agent
8 rules. About 0 are common, 1 is distinctive, and 7 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 28
Call MagicStarter.bootstrap(userFactory:, onLogout:, locales:) from AppServiceProvider.boot().
- Very specific: line 47
Call registerMagicStarterAuthRoutes() and registerMagicStarterProfileRoutes() always, and the team, notification and support functions …
- Very specific: line 50
Put a host page inside the starter's shell with layout: (child) => MagicStarter.view.makeLayout('layout.app', child: child) and layoutId: …
- Very specific: line 61
Every key with its condition and widget: references/views-and-layouts.md.
- Very specific: line 66
Every use*Theme() assigns the whole struct: a field you leave out goes back to its default.
- Very specific: line 77
Read a refusal by its code, never its message (step_up_required, password_already_set, last_login_method, owns_shared_teams, ...).
- Very specific: line 79
Call MagicStarterAuthController.instance.doSocialSignIn(provider) straight from the tap, with no await before it, or a web popup is blocked.
- Distinctive: line 226
Run a gated action with step-up proof from a view of your own:
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 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.
Files
magic_starter
Ready-made screens for a Magic app: login, registration, password reset, email verification, two-factor, social and phone sign-in, guest sessions and handoff; a settings hub with profile, security and preference pages; teams; the magic_notifications screens in the app shell; billing over magic_payments; a support desk. Each feature is a toggle in lib/config/magic_starter.dart that defaults to false. MagicStarterServiceProvider wires it, MagicStarter is the facade (bootstrap, view, theme setters), MagicStarterConfig reads the toggles and routes, and every screen, layout and modal resolves through a string-keyed registry the host can override. The controllers call magic-starter-laravel's api/v1 routes one to one.
This skill covers magic_starter only. The Magic framework itself (container, facades, routing, Auth, Http, controllers) is the magic-framework skill; the className syntax and the W-widgets are wind-ui; the notification API (Notify) is magic-notifications, the billing contract is magic-payments, the social login bridge is magic-social-auth.
Install
flutter pub add magic_starter
dart run magic:dowel plugin:install magic_starter --no-bootstrap
dart run magic:dowel starter:install --features=registration,teams,notifications
dart run magic:dowel starter:doctorRequires Dart >=3.13, Flutter >=3.47 and magic ^1.0.0, in an app already scaffolded with dart run magic:dowel magic:install. plugin:install registers MagicStarterDowelProvider and injects MagicStarterServiceProvider into lib/config/app.dart; pass --no-bootstrap, because the chained starter:install always gets --non-interactive, writes every feature false, and a later starter:install --features=... finds the config that exists by then, leaves it alone and exits 1 naming the features it would have changed (recover with starter:configure, a hand edit, or --force). Run starter:install yourself: without --features it asks one question per feature, every answer defaulting to no; with it, an unlisted key is written false. It writes lib/config/magic_starter.dart, the middleware, User (and Team), a dashboard, lib/routes/app.dart, the MagicStarter.bootstrap(...) call in AppServiceProvider, the auth and guest aliases in lib/app/kernel.dart, the route registrations and the English strings in assets/lang/en.json. The package has no executable: every command is dart run magic:dowel starter:<command>. Import only package:magic_starter/magic_starter.dart (or package:magic_starter/cli.dart from a pure Dart dispatcher).
Boot rules
- Register
MagicStarterServiceProviderinproviders, afterAuthServiceProvider(and afterNotificationServiceProviderwhennotificationsis on): itsboot()reads the session the auth provider restored and the push driver the notification provider attached. It is not auto-registered; without itMagicStarter.managerfalls back to a default manager, prints one debug warning, and no auth listener, push identity orstarter.*Gate ability exists. - Call
MagicStarter.bootstrap(userFactory:, onLogout:, locales:)fromAppServiceProvider.boot(). Pass the host's ownuserFactory: without one every screen readsMagicStarterAuthUser, and nothing fails to say so. - The team callbacks
currentTeam,allTeams,onSwitchcome as all three or none. A partial set throwsArgumentErrorbefore any setter runs;teamson without them throwsStateError. RouteonSwitchthroughMagicStarter.switchTeam('$teamId'): it switches on the backend, applies the answer's user and re-identifies the store billing rail, which a directMagicStarterTeamController.instance.switchTeamcall skips. onLoginruns after a fresh sign-in (not a restore);onGuestClaimedgets theGuestClaimOutcomeof a guest claim. Both are optional and also have setters (useLogin,useGuestClaimed).MagicStarter.manager.onAnalyticsPreferenceChangedgets the new value after the user changes theanalyticsswitch (never on the boot or sign-in apply); re-applymagic_analyticsidentity there. The starter imports no analytics package: withanalyticson,applyAnalyticsOptOutis how the account's choice reaches the host's own (boot, sign-in, the switch, sign-out), andboot()throws aStateErrorwhile it is unset. Pass it tobootstrap()(applyAnalyticsOptOut: (optedOut) => Analytics.setOptOut(optedOut), withmagic_analyticsinstalled in the host throughflutter pub addandplugin:install) and combine a host-level consent there. The starter calls the hook one change at a time, in order, so a hook that awaits is safe; it must not callMagicStarterAnalyticsPreferenceController.updateAnalyticsPreferenceorapplyOnDevice,applyCachedOnDeviceorforgetOnDevice, which would wait on the call it runs inside (a sign-out is fine).- Register work that needs the token at sign-out with
MagicStarter.beforeLogout(hook), before this provider boots: its own hooks release the push device and revoke the token withPOST /auth/logout, and a hook registered after them runs on a dead token. Each hook is bounded to five seconds and a throw is logged. Sign a user out withMagicStarter.signOut(): it runs the hooks once, then theonLogoutcallback, which replaces the built-in sign-out, or the built-in one when none is set. A customonLogoutmust awaitAuth.logout()itself and must not callMagicStarterAuthController.instance.logout()(that runs the hooks a second time). Read the guest flag withMagicStarter.isGuest(), neverAuth.user()?.get<bool>('is_guest')inline.
Feature rules
- A toggle is read when the manager is first resolved: a feature that is off registers no route and no view key, so
MagicStarter.view.make(key)throwsStateError. Guard links and builds withMagicStarterConfig.has<Feature>Features(), never an inlineConfig.get. social_loginneeds a bridge:MagicStarter.useSocialAuth(MagicStarterSocialAuth). Without it the provider buttons and the Connected accounts hub row never render.magic_social_authpublishes the bridge; the starter never calls itssignOut(), so the bridge signs its SDK out itself.billingneedsbilling.web_origin, an absolute URL with no trailing slash. Unset or empty, the billing screen hides the web checkout button; a relative value makes Stripe refuse the return URL and the error is only logged, so the button does nothing.billing.billableis'user'or'team', must equal the backend's, and any other value throwsStateError.billingregisters theteams.billingview key and no route. The host registers a page atMagicStarterConfig.billingRoute()(routes.billing, default/teams/billing) and puts aMagicStarterBillingControllerin the container first (Recipes), since the view resolves its controller and cannot construct one.notificationsmakes the provider declare<notifications.external_id_prefix><user id>as the push identity on everyAuth.stateNotifierchange and release it on any sign-out, account deletion included. The prefix defaults touser_and must equal the backend'sMAGIC_STARTER_EXTERNAL_ID_PREFIX: a mismatch is accepted by OneSignal and delivered to nobody. A blank value resolves touser_.supportneedsregisterMagicStarterSupportRoutes()in the route provider;starter:installadds it only whensupportwas chosen at install. Everysupport_*option needssupport.guest_authadds no route: it shows "Continue as guest" on login, records the guest token and claims the guest's data at the next sign-in.RedirectIfAuthenticatedlets a guest session through to the auth pages.- Stored and unread:
MagicStarterConfig.requestTimeoutSeconds()andmaxRetries(), anduseGuestAuthEntry(). Do not build on them.useNewsletterLabel()is read by the register view alone (the checkbox label whennewsletteris on), not by the profile newsletter page.
Route and middleware rules
- The route groups name the middleware
authandguest. Register them withKernel.registerAll({'auth': () => EnsureAuthenticated(), 'guest': () => RedirectIfAuthenticated()});starter:installwrites this intolib/app/kernel.dart. - Call
registerMagicStarterAuthRoutes()andregisterMagicStarterProfileRoutes()always, and the team, notification and support functions freely: each returns early while its toggle is off. None takes an argument. - Paths come from config:
routes.auth_prefix(/auth),routes.profile_prefix(/settings),routes.teams_prefix(/teams),routes.notifications_prefix,routes.login,routes.home. Build links withMagicStarterConfig.*Route(), never a literal path. EnsureAuthenticatedsends a signed-out visitor toroutes.loginand records the location withMagicRouter.setIntendedUrl; every sign-in lands there, or onroutes.home. The login and register screens also honour?next=<in-app path>.starter:installregisters its ownlib/app/middleware/copies instead, which record no intended URL and do not let a guest through; register the package classes for this behaviour.- Put a host page inside the starter's shell with
layout: (child) => MagicStarter.view.makeLayout('layout.app', child: child)andlayoutId: MagicStarterLayoutIds.app. A differentlayoutIdis a separate shell, which rebuilds the layout on every move between them.
View registry rules
- Override with
MagicStarter.view.register(key, builder),registerLayout('layout.app' | 'layout.guest', builder)orregisterModal('modal.confirm' | 'modal.password_confirm' | 'modal.two_factor', builder), from any provider'sboot(). Defaults register only when a key is free, so provider order does not matter. - The settings surface is
settings.hubplus drill-down keys:profile.profile,settings.appearance,settings.security.password(always),settings.language,settings.timezone,settings.newsletter,settings.changelog,settings.security.two_factor,settings.security.sessions,settings.security.connected_accounts(behind their toggles).profile.settingsis not a registered default key. notifications.listandnotifications.preferenceslive onmagic_notifications'Notify.view. Registering them onMagicStarter.viewmounts nothing.- A slot adds a widget inside a shipped view:
MagicStarter.view.slot(viewKey, slotName, builder), registered before the view builds. Only the names a view reads work (headerandfooteron the auth views, the hub,profile.profileand the team views;formFooteron login and register;afterSection:membersonteams.settings); any other name is inert. makeLayouthands your layout the child unchanged; under a route group it is go_router's shell navigator. Render it once inside the layout and never key it on the route path: under go_router 18 a path key freezes a page that readsGoRouterState.ofinbuildwhen it is left.dart run magic:dowel starter:publish --tag=views:<key>copies a view intolib/resources/views/starter/, rewrites its relative imports topackage:magic_starter/magic_starter.dart, and registers it inAppServiceProviderunder anas publishedimport (the barrel exports the original under the same class name). The copy does not follow later releases;starter:doctorflags a published view nothing registers.
Every key with its condition and widget: references/views-and-layouts.md.
Theming rules
MagicStarter.useWindTheme(windTheme)keeps, field by field, what a single setter called before it set. A setter called after it assigns its whole struct, so build that struct from the active theme (MagicStarter.useLayoutTheme(MagicStarter.layoutTheme.copyWith(...))) or every field it omits, the Wind-derived colours included, goes back to its stock default. A field set to exactly its stock default, or to exactly what the previoususeWindTheme()derived for it, reads as unset, and the nextuseWindTheme()replaces it; to keep such a value, set a different one, or set it again afteruseWindTheme()withcopyWith.useTheme(MagicStarterTheme)replaces every sub-theme, souseButtonTheme()anduseFieldTheme()come after it or the host's standard is lost without an error.- Every
use*Theme()assigns the whole struct: a field you leave out goes back to its default. Change one string withMagicStarter.formTheme.copyWith(...),MagicStarter.modalTheme.copyWith(...)or thecopyWithof any other sub-theme. - Page geometry is the host's: set
MagicStarter.manager.pageContainerClassNameonce from the string your own pages use (default'max-w-7xl px-4 lg:px-8 pt-6 sm:pt-8 pb-16'), and never put amax-w-*or pagepx-*on a starter page or component. - Style with the semantic aliases (
bg-surface,text-fg,bg-primary,border-color-border, ...) fromMagicStarterTokens.defaultAliases, passed asWindThemeData(aliases: ...). Wind drops an alias the theme lacks silently, so the class paints nothing. - A
classNamepassed to anMScomponent is appended after the theme and wins on every family it names.
Sub-themes, the button and field arithmetic and the modal presentation: references/theming.md.
Sign-in and identity rules
- Every shipped sign-in (password, social, two-factor challenge, OTP, guest, handoff) concludes in one internal step that reads a two-factor answer at the top level or under
data, shows a cancelled deletion, logs in and lands on the intended URL. Drive a sign-in through the controllers (doLogin,doSocialSignIn,doTwoFactorChallenge, ...) rather than callingAuth.loginwith a token yourself, or those steps are skipped. - Gated profile calls take
proof:(Map<String, String>):doEnableTwoFactor,doDisableTwoFactor,getRecoveryCodes,doRegenerateRecoveryCodes,doRevokeSession,doRevokeOtherSessions,doDeleteAccount,doSetPassword. A password account gives{'password': ...}, a password-less one{'code': ...}or{'confirmation_token': ...}, a guest{}. Get it withconfirmIdentity(context)or run the action insideconfirmAndRun(context, controller, action: ...). - Read a refusal by its
code, never its message (step_up_required,password_already_set,last_login_method,owns_shared_teams, ...). doDeleteAccount(proof:)schedules the deletion by default (a sign-in within the grace period cancels it);immediately: trueskips the grace period. Either way the user is signed out without the before-logout hooks.- Call
MagicStarterAuthController.instance.doSocialSignIn(provider)straight from the tap, with noawaitbefore it, or a web popup is blocked. - A controller of yours that caches one user's or one team's data implements magic's
SessionScoped; the provider declares the session identity as user plus team, and the host callsSessionScope.attach()last in its own provider.
Recipes
Bootstrap a team app. User and Team are the host's models. With teams on, starter:install writes a Team that ships toMagicStarterTeam() and a User with the currentTeam and allTeams getters. Write the conversion yourself (an extension returning MagicStarterTeam(id:, name:, photoUrl:, isPersonalTeam:)) only when a team.dart or user.dart already existed and starter:install skipped it because --force was not passed:
import 'package:magic/magic.dart';
import 'package:magic_starter/magic_starter.dart';
class AppServiceProvider extends ServiceProvider {
AppServiceProvider(super.app);
@override
void register() {}
@override
Future<void> boot() async {
MagicStarter.bootstrap(
userFactory: (data) => User.fromMap(data),
onLogout: () async {
await Auth.logout();
MagicRoute.to(MagicStarterConfig.loginRoute());
},
locales: {
'en': 'English',
'tr': 'Türkçe',
},
currentTeam: () => User.current.currentTeam?.toMagicStarterTeam(),
allTeams: () => User.current.allTeams
.map((team) => team.toMagicStarterTeam())
.toList(),
onSwitch: (teamId) => MagicStarter.switchTeam('$teamId'),
);
}
}Register the routes and the middleware aliases:
import 'package:magic/magic.dart';
import 'package:magic_starter/magic_starter.dart';
void registerStarterRoutes() {
Kernel.registerAll({
'auth': () => EnsureAuthenticated(),
'guest': () => RedirectIfAuthenticated(),
});
registerMagicStarterAuthRoutes();
registerMagicStarterProfileRoutes();
registerMagicStarterTeamRoutes();
registerMagicStarterNotificationRoutes();
registerMagicStarterSupportRoutes();
}Mount the billing view (UsageStat comes from magic_payments, a direct dependency once you name it):
import 'package:magic/magic.dart';
import 'package:magic_payments/magic_payments.dart';
import 'package:magic_starter/magic_starter.dart';
void registerBilling() {
Magic.put(
MagicStarterBillingController(
usageCopy: (stats) => [
for (final stat in stats)
UsageStat(
key: stat.key,
used: stat.used,
limit: stat.limit,
label: trans('usage.${stat.key}'),
),
],
formatNumber: (value) => '$value',
),
);
if (!MagicStarterConfig.hasBillingFeatures()) return;
MagicRoute.group(
middleware: ['auth'],
layoutId: MagicStarterLayoutIds.app,
layout: (child) => MagicStarter.view.makeLayout('layout.app', child: child),
routes: () {
MagicRoute.page(
MagicStarterConfig.billingRoute(),
() => MagicStarter.view.make('teams.billing'),
);
},
);
}Replace a screen and add a slot:
import 'package:flutter/widgets.dart';
import 'package:magic/magic.dart';
import 'package:magic_starter/magic_starter.dart';
class BrandedLoginView extends StatelessWidget {
const BrandedLoginView({super.key});
@override
Widget build(BuildContext context) => WText('Sign in', className: 'text-fg');
}
void customiseStarter() {
MagicStarter.view.register('auth.login', () => const BrandedLoginView());
MagicStarter.view.slot('settings.hub', 'footer', (context) {
return WText('v1', className: 'text-sm text-fg-muted');
});
}Theme from the host palette, then the button and field standards:
import 'package:magic/magic.dart';
import 'package:magic_starter/magic_starter.dart';
void themeStarter(WindThemeData windTheme) {
const String standard = 'px-5 py-[11px] text-[17px] leading-[22px]';
MagicStarter.useWindTheme(windTheme);
MagicStarter.useButtonTheme(
const MagicStarterButtonTheme(
shapeClassName: 'rounded-full',
smClassName: standard,
mdClassName: standard,
lgClassName: standard,
),
);
MagicStarter.useFormTheme(
MagicStarter.formTheme.copyWith(
inputClassName: 'w-full py-[10px] min-h-11 text-[17px] leading-[22px]',
),
);
}Run a gated action with step-up proof from a view of your own:
import 'package:flutter/widgets.dart';
import 'package:magic/magic.dart';
import 'package:magic_starter/magic_starter.dart';
Future<void> deleteAccount(BuildContext context) async {
final MagicStarterProfileController controller =
MagicStarterProfileController.instance;
await confirmAndRun(
context,
controller,
variant: ConfirmDialogVariant.danger,
action: (proof) => controller.doDeleteAccount(proof: proof),
);
}Turn a plan-gated 403 into the upgrade prompt:
import 'package:magic/magic.dart';
import 'package:magic_starter/magic_starter.dart';
Future<void> analyse(String id) async {
final MagicResponse response = await Http.post('/monitors/$id/analyze');
if (response.successful) return;
final PlanUpgradeRequirement? requirement =
PlanUpgradeRequirement.fromResponse(response);
if (requirement != null) {
UpgradePrompt.show(requirement);
}
}Testing
No mocking library. In setUp() call MagicApp.reset() and Magic.flush(), then setUpMagicStarterForTests() (or pass a configured MagicStarterManager), bind a contract fake for the network (Magic.singleton('network', () => FakeDriver()), a class that implements NetworkDriver and records the method, URL and payload) and set toggles with Config.set('magic_starter.features.<key>', true) before the manager is first resolved. Assert the request a controller sends and its state (controller.isSuccess, hasErrors), never a faked sign-in. MagicStarter.resetFallbackManagerForTests() clears the unbound fallback between tests. Dispose a controller's ValueNotifiers in tearDown().
References
references/views-and-layouts.md: every view, layout and modal key with its condition, the slots, the shell hooks (navigation, header, sidebar footer, page chrome, bottom nav), publishing.references/controllers-and-routes.md: the controllers and what each owns, every route with its path and middleware, sign-in completion and session scope.references/theming.md: the sub-themes,useWindTheme, the button and field standards, modal presentation.references/backend-contract.md: theapi/v1endpoints each controller calls, the backend keys that must match, the refusal codes.
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
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.

