custom-pages-and-apis
Builds custom pages and API routes inside an EventCatalog project. Creates Astro pages and TypeScript endpoints in the catalog's pages/ folder using the…
от event-catalog★ 16 звёзд на GitHub
Установить custom-pages-and-apis в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
EventCatalog Custom Pages & APIs
Build user-defined pages and API routes that are served by EventCatalog itself — with full access to catalog data (domains, services, events, teams, ...) through a stable, documented toolkit.
Custom pages live in a pages/ folder at the root of the catalog and are served under a configurable URL prefix (default /custom). API routes live in pages/api/ and require SSR mode.
Requirements (check these FIRST)
Before writing any files, verify both.
- Core version — custom pages are served for every catalog from
@eventcatalog/core5.0.0 (no plan or license key needed). Versions 4.1.0–4.x only served them with a Scale license key, and the Layout'sfullWidthprop needs 4.12 or later. Check the catalog'spackage.json, and suggest upgrading if it's on 4.x. - SSR for API routes only —
.astropages work in any output mode, but anything underpages/api/requiresoutput: "server"ineventcatalog.config.js. A production build fails with a hard error if API routes exist in static mode (dev only warns). See references/api-routes.md.
Instructions
Step 1: Locate the catalog
Find the user's EventCatalog project (look for eventcatalog.config.js). Then check:
- Does
pages/already exist? Read what's there — includingpages/homepage.astro, which is a special file (it replaces the catalog homepage at/, not served under the prefix). Without one, the catalog opens on its built-in dashboard homepage. - What is the configured prefix? Read
pages.prefixfromeventcatalog.config.js(defaultcustom). All generated links must use it. - What output mode is set (
output: "static"or"server")? - Does the catalog have a
components/folder? Files in it are importable as@catalog/components/*. - Is
landingPageset ineventcatalog.config.js? If so,/redirects there and a custom homepage is never shown.
Step 2: Understand what the user wants to build
Common asks and where they land:
| User wants | File to create | URL |
|---|---|---|
| A content/dashboard page | pages/reports.astro |
/custom/reports |
| A custom homepage | pages/homepage.astro |
/ (replaces default homepage) |
| A section with an index | pages/tools/index.astro |
/custom/tools |
| A dynamic page | pages/reports/[id].astro |
/custom/reports/:id |
| A JSON API endpoint | pages/api/stats.ts |
/custom/api/stats |
| A dynamic API endpoint | pages/api/teams/[id].ts |
/custom/api/teams/:id |
| Shared partials/components | pages/_components/Card.astro |
never routed (underscore prefix) |
Full routing rules (extensions, index handling, underscore convention, reserved prefixes, prefix validation): references/routing.md.
Custom homepage: pages/homepage.astro is already rendered inside the EventCatalog shell, so don't wrap it in Layout. It receives EventCatalog's components on Astro.props.components, including CatalogDashboard (the default dashboard, with optional title and description), so a homepage can add to the dashboard rather than rebuild it:
---
const { CatalogDashboard } = Astro.props.components;
---
<div class="not-prose">
<CatalogDashboard title="Acme Catalog" description="Our domains, systems, services and messages." />
</div>
Step 3: Build pages with the toolkit
Always prefer the stable public toolkit over EventCatalog internals:
@catalog/layouts/Layout.astro— the EventCatalog page shell (header, nav, optional resource sidebar). Props:title(required),description?,sidebar?(defaulttrue),showHeader?(defaulttrue),fullWidth?(defaultfalse; renders edge-to-edge without EventCatalog's page padding, for pages that control their own layout).@catalog/utils— cached collection getters:getDomains,getServices,getSystems,getEvents,getCommands,getQueries,getFlows,getChannels,getEntities,getAgents,getContainers,getDataProducts,getAdrs,getTeams,getUsers, plusgetItemsFromCollectionByIdAndSemverOrLatestfor semver resolution. Pass{ getAllVersions: false }to get only latest versions.@catalog/components/*— the user's own components from their catalog'scomponents/folder.
Minimal page:
---
import Layout from '@catalog/layouts/Layout.astro';
import { getServices } from '@catalog/utils';
const services = await getServices({ getAllVersions: false });
---
<Layout title="Service Report" description="All services in our architecture" sidebar={false}>
<div class="max-w-4xl mx-auto p-8">
<h1 class="text-2xl font-bold text-[rgb(var(--ec-page-text))]">Services ({services.length})</h1>
<ul>
{services.map((service) => (
<li>
<a href={`/docs/services/${service.data.id}/${service.data.version}`}>{service.data.name}</a>
</li>
))}
</ul>
</div>
</Layout>
Key conventions when generating page code:
- **Tailwi
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- references/api-routes.md
- references/examples.md
- references/routing.md
- references/toolkit.md
FAQ
Что делает скилл custom-pages-and-apis?
Builds custom pages and API routes inside an EventCatalog project. Creates Astro pages and TypeScript endpoints in the catalog's pages/ folder using the stable @catalog/layouts and @catalog/utils toolkit, wires them into the navigation, and sets up editor support. Use when user asks to "add a custom page to my catalog", "build a team page", "add an API endpoint to EventCatalog", "create a custom homepage", "add a custom route", "query catalog data from my own page", or "extend EventCatalog with my own pages".
Как установить скилл custom-pages-and-apis?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл custom-pages-and-apis запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
AnthropicCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
discernment-nudge
AnthropicAfter you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
data-consolidate
AnthropicJoins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
inspection-to-capa
AnthropicRuns the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…