AGENT SKILL

middleware-protected-routes

暂无简介

License 许可
MIT
最近更新
2026-05-26
Stars
★ 0
Forks
0

02 资源文件 1

03 SKILL.md 正文

Middleware Protected Routes

Follow ../_shared/skill-contract.md.

Purpose

Protect routes and redirect unauthenticated users in a predictable way.

Use when

  • route access must be controlled
  • auth state affects navigation

Do not use when

  • the task is about backend authorization
  • the task is only about page content

Inputs required

  • protected route list
  • auth/session source
  • redirect target

Outputs expected

  • middleware behavior
  • redirect map
  • exception list

Workflow

  1. List protected routes.
  2. Decide the auth signal.
  3. Define redirect behavior.
  4. Keep exceptions explicit.
  5. Verify the unauthenticated flow.

Validation checklist

  • [ ] Redirects are deterministic
  • [ ] Protected routes are listed
  • [ ] No business logic lives in middleware

References

  • ../../prompts/review_security.md
  • ../../examples/account-settings-nextjs.md

04 同仓库更多 Skills