Deep link lessonid routing

From ai-shifu/ai-shifu · View interactive version

Deep link lessonid routing is an AI agent skill from the GitHub repository ai-shifu/ai-shifu. Use when routing Cook Web deep links to lessons consistently across learner and admin surfaces. Use lessonid, reuse table-of-contents click handling, cover login, payment, and invalid-lesson fallbacks, and diagnose debug=1 initialization and authentication recovery.

How to use this skill

Skill file

深链课节定位(`lessonid`)

核心规则

工作流

  1. 在 /c/:courseId、/shifu/:courseId 初始化时优先读取 lessonid。
  2. lessonid 变更时触发课节树重新定位,避免沿用旧缓存。
  3. 命中课节后复用目录点击同一套权限拦截。
  4. 目录点击、章节重置、课节兜底修正后都要把当前有效课节回写到 URL。
  5. 需要登录时跳登录页并保留 redirect。
  6. 付费未购时弹支付窗并带 chapterId、lessonId。
  7. 无效 lessonid 兜底到默认可学习课节。

验收清单

Learner debug console workflow

For QA or operations troubleshooting of /c/:courseId initialization, add

debug=1 to the existing URL query while preserving lessonid, mode and other

reproduction parameters. src/app/c/[[...id]]/page.tsx enables

src/components/debug/DebugConsoleOverlay.tsx only for the exact value 1;

src/lib/debug-console.ts uses the same query gate for diagnostic emission.

Removing the parameter disables the overlay and gated diagnostics.

Inspect the complete chain when changing troubleshooting behavior:

REQUEST_DEBUG_PATTERNS and shouldLogRequestDebug, plus the auth-chain

diagnostics for business codes 1001, 1004 and 1005. Follow recovery

start/skip/finish, token-change cancellation and any login redirect rather

than treating every auth response as a new logout.

initialization diagnostics through the shared debug helpers.

retains the latest 200 entries and offers clear/collapse controls. It cannot

recover console output emitted before it mounted. Do not claim it is a

complete initialization trace or a persisted log service.

Keep the URL gate, request/auth diagnostics and page instrumentation aligned;

changing only the overlay or relying only on a remote console drops part of

this reproduction workflow. Preserve existing token masking in request

summaries. The overlay also captures ordinary console output, and formatting

truncates rather than sanitizes it; inspect/redact diagnostic material before

sharing it and do not add credentials to instrumentation.

src/lib/request.test.ts covers request tracing and pre-stream business-error

handling, not the debug query/overlay or the full auth-recovery sequence. When

changing the debugging flow, verify with and without debug=1, a selected

request, an auth-recovery path and lesson-tree initialization; check that the

console capture is restored on disable/unmount and that diagnostics do not

change the underlying request behavior.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.