cloudwerk-routing

File-based routing conventions for Cloudwerk, a full-stack framework for Cloudflare Workers. Use when creating pages, API routes, layouts, middleware, or error boundaries. Triggers on tasks involving route files (page.tsx, route.ts, layout.tsx, middleware.ts, error.tsx, not-found.tsx), dynamic segments ([id], [...slug]), route groups ((group)), loaders, actions, or data loading patterns.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "cloudwerk-routing" with this command: npx skills add squirrelsoft-dev/cloudwerk/squirrelsoft-dev-cloudwerk-cloudwerk-routing

Cloudwerk Routing

File-based routing conventions for Cloudwerk. The app/ directory structure maps directly to URL patterns, with special filenames determining behavior.

When to Apply

Reference these guidelines when:

  • Creating new pages or API routes in a Cloudwerk app
  • Adding layouts that wrap multiple pages
  • Implementing middleware for auth, rate limiting, or request processing
  • Using dynamic route segments ([id], [...slug])
  • Loading data with loader() or handling mutations with action()
  • Adding error or not-found boundaries

Rule Categories by Priority

PriorityCategoryImpactPrefix
1Route FilesCRITICALfiles-
2Dynamic ParametersHIGHparams-
3Data LoadingHIGHdata-

Quick Reference

1. Route Files (CRITICAL)

  • files-page-component - page.tsx conventions for rendering UI
  • files-api-route - route.ts conventions for API endpoints
  • files-layout - layout.tsx conventions for shared UI wrappers
  • files-middleware - middleware.ts conventions for request processing
  • files-error-boundary - error.tsx conventions for error handling
  • files-not-found-boundary - not-found.tsx conventions for 404 pages

2. Dynamic Parameters (HIGH)

  • params-dynamic-segments - [id] syntax for single dynamic segments
  • params-catch-all - [...slug] syntax for catch-all routes
  • params-route-groups - (group) syntax for layout grouping without URL impact

3. Data Loading (HIGH)

  • data-loader - loader() function for server-side data fetching
  • data-action - action() function for form submissions and mutations
  • data-error-control-flow - NotFoundError/RedirectError for flow control
  • data-context-api - getContext(), get(), set() for request-scoped data

How to Use

Read individual rule files for detailed explanations and code examples:

rules/files-page-component.md
rules/data-loader.md

Each rule file contains:

  • Brief explanation of why it matters
  • Incorrect code example with explanation
  • Correct code example with explanation
  • Additional context and references

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Coding

cloudwerk-config

No summary provided by upstream source.

Repository SourceNeeds Review
Coding

cloudwerk-handlers

No summary provided by upstream source.

Repository SourceNeeds Review
Coding

cloudwerk-monorepo

No summary provided by upstream source.

Repository SourceNeeds Review