spa-routes

Organize SPA routes and features with thin wrappers and domain boundaries.

Updated Dec 12, 2024
One-click install
npx skills add https://github.com/kingmacth/lobe-chat --skill spa-routes-kingmacth
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: spa-routes
Source: https://github.com/kingmacth/lobe-chat/tree/main/.agents/skills/spa-routes
Command: npx skills add https://github.com/kingmacth/lobe-chat --skill spa-routes-kingmacth

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps teams organize and maintain scalable SPA architectures by separating route declarations from domain logic, ensuring thin route wrappers, and guiding where to place components in src/routes vs src/features.

Core Features & Use Cases

  • Enforces thin route wrappers that delegate to domain features, keeping routing lean and maintainable.
  • Defines clear boundaries: route-level structure in src/routes and business logic in src/features, enabling reuse across routes.
  • Provides migration guidance for moving logic from routes to features during refactors or architecture upgrades.

Quick Start

Create a new SPA route by adding a thin route wrapper under src/routes and delegate all business logic to the corresponding src/features module, then update the router configuration to register the new route.

Frequently Asked Questions about spa-routes

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I keep my SPA routing architecture thin and maintainable?

Keep SPA routing thin by using route wrappers in src/routes that delegate all business logic to domain modules in src/features. This separation keeps routing lean, maintainable, and scalable.

When should I place a component in src/routes versus src/features?

Place route-level structure and declarations in src/routes, while business logic and reusable domain components go in src/features. Use features when logic needs reuse across multiple routes.

What is the best way to migrate route logic during a frontend architecture refactor?

Migrate route logic by moving business code from src/routes to src/features, leaving thin route wrappers that delegate to domain modules. Apply structural rules to guide routing directory boundaries during the migration.

Can I apply these route separation conventions across desktop and mobile SPA contexts?

Yes. The route thin and feature boundary conventions apply to adding or refactoring routes across both desktop and mobile SPA contexts, ensuring consistent domain-driven structural boundaries.

How do I add a new route segment without bloating my frontend routing configuration?

Add a new route segment by creating a thin route wrapper under src/routes that delegates all logic to the corresponding src/features module, then register the new route in the router configuration.

Why does my SPA route structure become hard to scale as the application grows?

SPA route structure becomes hard to scale when route declarations contain heavy business logic instead of acting as thin wrappers. Separating domain logic into src/features enables reuse and maintains lean routing.