본문으로 건너뛰기
cccskills
무료GitHub에 공개

route-discovery-system

Filesystem auto-discovery of App Router pages into navigable index pages. Use when creating an index/listing page, adding route directories, converting hard-coded route configs to auto-discovery, or adding a route-listing display variant.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

설치 방법 보기

포함된 파일(1)

  • SKILL.md6.1 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Route Discovery System

Filesystem-based route auto-discovery that replaces hard-coded config.ts route arrays. Server Components scan directories for page.tsx files and render grouped navigation UIs with switchable display variants.

Architecture

Server Component (RouteIndexPage)
  └─ scanRoutes() reads filesystem (server-only)
  └─ Serializes RouteDisplayData
  └─ Passes to RouteDisplaySwitcher (client)
       └─ next/dynamic loads active variant (ssr: false)
       └─ Dropdown switches between variants

Key boundary: utils/route-discovery/index.ts is server-only (filesystem access). utils/route-discovery/shared.ts has pure functions safe for client imports.

File Map

FileRole
utils/route-discovery/index.tsServer-only: scanRoutes, scanRoutesShallow
utils/route-discovery/shared.tsClient-safe: groupRoutes, getRouteLabel, toModulePages, sortGroupKeys
components/ssr/RouteIndexPage.tsxServer Component: scans filesystem, renders page shell, passes data to switcher
components/ssr/RouteHeaderData.tsxServer Component: auto-feeds ModuleHeader nav from filesystem
components/ssr/route-display/types.tsRouteDisplayData, RouteDisplayVariant, RouteDisplayProps
components/ssr/route-display/RouteDisplaySwitcher.tsxClient wrapper: variant dropdown + next/dynamic imports
components/ssr/route-display/GroupedCardsDisplay.tsxVariant: grouped folder cards (default)
components/ssr/route-display/DataTableDisplay.tsxVariant: searchable keyboard-navigable grid
components/ssr/route-display/ExpandableSectionsDisplay.tsxVariant: collapsible accordion sections
components/ssr/route-display/FlatListDisplay.tsxVariant: minimal filterable list

Usage: Index Page

Replace any hard-coded route listing with:

import { join } from "path";
import { RouteIndexPage } from "@/components/ssr/RouteIndexPage";

export default async function MyPage() {
  return (
    <RouteIndexPage
      directory={join(process.cwd(), "app", "(authenticated)", "my-feature")}
      basePath="/my-feature"
      title="My Feature"
    />
  );
}

Props

PropTypeDefaultDescription
directorystringrequiredAbsolute path to scan
basePathstringrequiredURL prefix for links
titlestring—Page heading
descriptionstringauto-generatedSubtitle text
iconComponentTypeLayoutGridLucide icon for heading
shallowbooleanfalseScan one level only
defaultVariantRouteDisplayVariant"grouped-cards"Initial display variant
childrenReactNode—Custom content above the grid

Usage: Layout with Auto-Header

Replace config.ts + ModuleHeader patterns:

import { join } from "path";
import { RouteHeaderData } from "@/components/ssr/RouteHeaderData";

export default function Layout({ children }: { children: React.ReactNode }) {
  return (
    <RouteHeaderData
      directory={join(process.cwd(), "app", "(authenticated)", "tests", "forms")}
      moduleHome="/tests/forms"
      moduleName="Forms"
    >
      {children}
    </RouteHeaderData>
  );
}

Adding a New Display Variant

  1. Create components/ssr/route-display/MyNewDisplay.tsx:
"use client";
import type { RouteDisplayProps } from "./types";

export default function MyNewDisplay({ data }: RouteDisplayProps) {
  const { routes, groups, sortedGroupKeys, basePath, hasGroups } = data;
  // Render using data — import from shared.ts, NOT from index.ts
  // Use Link from "next/link" for navigation
}
  1. Add the variant key to types.ts:
export type RouteDisplayVariant =
  | "grouped-cards"
  | "data-table"
  | "expandable-sections"
  | "flat-list"
  | "my-new-variant";
  1. Add the label to VARIANT_LABELS in types.ts.

  2. Register in RouteDisplaySwitcher.tsx:

"my-new-variant": dynamic(() => import("./MyNewDisplay"), { ssr: false }),

Scanner Behavior

  • Recursively walks directories looking for page.tsx files
  • Skips: _prefixed directories, [dynamic] route segments
  • Groups routes by top-level directory segment
  • scanRoutesShallow only checks immediate children (no recursion)

Converting Existing Routes

When converting a directory from hard-coded config.ts to auto-discovery:

  1. Replace page.tsx with RouteIndexPage usage
  2. Replace layout.tsx with RouteHeaderData (if it imported from config.ts)
  3. Delete config.ts
  4. Keep EntityPack wrappers and export const dynamic = 'force-dynamic' if present
  5. Never touch functional leaf pages — only replace listing/index pages

Favicon Integration

RouteIndexPage automatically resolves the favicon for the basePath and threads it into the display:

  • The favicon badge renders next to the page <h1> title (replaces the Lucide icon when a favicon exists)
  • GroupedCardsDisplay uses the favicon color as a left-border accent on each group card
  • Flat list entries show the favicon badge instead of a plain dot

No extra code needed — just pass the correct basePath and the system picks up the config from navigation-links.tsx or the system-route overrides (/demo, /tests, /administration).

To understand how favicons are registered and what colors/letters are already in use, see .claude/skills/route-metadata-favicons/SKILL.md.


Pages NOT Using This System

These have custom logic and intentionally remain hand-maintained:

  • administration/page.tsx — curated category dashboard (has /administration/all-routes companion)
  • dashboard/page.tsx — iOS-style icon grid
  • tests/links/ and tests/windows/ — master cross-directory index lists
  • demos/local-tools/page.tsx, demos/scraper/page.tsx — custom functional UIs

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Admin debug system wiring for the floating AdminIndicator's live debug data and Copy Full Context. Use when adding debug visibility to a route or feature, wiring useDebugContext or the debug panel, capturing console errors, or enabling the copy-context workflow for a page.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

armanisadeghi/ai-matrx32026년 10월 22일 업데이트

Compact two-icon Copy / Copy-for-AI controls (components/agent-copy). Use when adding copy buttons to a row, card, list, or record; merging duplicate Copy/JSON/AI controls; continuing the copy rollout; or writing a Copy-for-AI payload. NOT for markdown content actions (use rich-document-actions).

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

armanisadeghi/ai-matrx32026년 10월 22일 업데이트

Disclosing a surface's existing fixed AI jobs in the shell's top Agents menu. Use when a page, panel, overlay, or window already runs a mandate behind a button, assist, automatic action, or mode; when the agent-disclosure guard names a file; or during a surface check.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

armanisadeghi/ai-matrx32026년 10월 22일 업데이트

The watch-fix-rerun method for making an existing platform agent or automated process efficient and correct: baseline its ledger, run one unit yourself, fix the class behind every wasted call, rerun, record. Use when asked to improve, optimize, watch, or 'make efficient' an agent, a sandbox session, a sync job, or any recurring automated process.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

armanisadeghi/ai-matrx32026년 10월 22일 업데이트

Redux state for agent execution and firing agent shortcuts. Use when editing features/agents/redux/, building agent UI, creating a conversation, touching assembleRequest or NDJSON stream state, wiring agent-state selectors, adding a per-conversation capability, or triggering a shortcut from a button, menu, or code (useShortcutTrigger, launchAgentExecution).

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

armanisadeghi/ai-matrx32026년 10월 22일 업데이트

The provision for a call site: the exhaustive menu of values that place in the code can realistically produce. Use before creating or fixing a mandate or agent that reasons about more than its own input, when deciding whether an agent can answer at all with what it is sent, or when its output 'looks right' but nobody checked it could be. NOT for building the agent (use create-agent).

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

armanisadeghi/ai-matrx32026년 10월 22일 업데이트

armanisadeghi의 스킬 모두 보기

이 스킬의 문제 신고