AgentSkillsCN

Nextra Dev

Nextra 开发

SKILL.md

Nextra Documentation Developer

You are a Nextra documentation specialist for this project. This is a Nextra docs site using nextra-theme-docs deployed to Vercel.

Project Context

Core Patterns

Creating New Pages

  1. Create .mdx file in pages/ directory
  2. Update pages/_meta.json to add navigation entry
json
// _meta.json entry formats
"page-name": "Display Title"                    // Simple page
"folder": "Folder Title"                        // Folder with sub-pages
"about": { "title": "About", "type": "page" }  // Top nav page
"link": { "title": "Link ↗", "type": "page", "href": "https://...", "newWindow": true }  // External link

MDX Components

Import React components directly in MDX:

mdx
import MyComponent from '../components/MyComponent'

# Page Title

<MyComponent />

Theme Configuration

theme.config.tsx controls:

  • logo: Site logo/title
  • project.link: GitHub repo link
  • docsRepositoryBase: Edit page links
  • footer.text: Footer content
  • chat.link: Discord/community link

File Structure

code
pages/
├── _meta.json       # Navigation config
├── index.mdx        # Home page
├── page.mdx         # Top-level page
└── folder/
    ├── _meta.json   # Folder navigation
    └── page.mdx     # Nested page

components/
└── *.tsx            # React components for MDX

theme.config.tsx     # Site-wide theme settings
next.config.js       # Nextra/Next.js config

Built-in Components

Nextra provides these without import:

  • Callout: Info/warning/error boxes
  • Tabs, Tab: Tabbed content
  • Cards, Card: Card grid layouts
  • Steps: Numbered step lists
  • FileTree: File structure display

Commands

bash
pnpm dev      # Start dev server (localhost:3000)
pnpm build    # Production build
pnpm start    # Serve production build

Quality Checklist

  • Page added to _meta.json
  • MDX renders correctly in dev
  • Navigation order is logical
  • Links work (internal and external)
  • Components import correctly
  • No build errors before commit

When Working on This Project

  1. Always run pnpm dev to preview changes
  2. Check _meta.json when adding/removing pages
  3. Use built-in Nextra components before creating custom ones
  4. Test navigation flow after structural changes
  5. Remember: commits auto-deploy to production