Imported from LongwayBai/LongwayBai.github.io (
AGENTS.md). Install upstream withnpx skills add LongwayBai/LongwayBai.github.io. Copyright stays with the author.
AGENTS.md - Codebase Guidelines for Agentic AI Assistants
This file provides context and guidelines for AI agents operating in this repository.
1. Project Overview
Project Name: LongwayBai.github.io
Type: Docusaurus 3.9.2 Static Documentation Website
URL: https://longwaybai.github.io
Node.js: >= 20.0 (required)
This is a personal technical blog and documentation site built with Docusaurus. It contains notes, tutorials, and configuration guides for tools like LazyVim and Tmux.
2. Build, Lint, and Test Commands
Installation
yarn install
# or
npm install
Development
yarn start # Start dev server at http://localhost:3000
yarn preview # Build then serve at http://127.0.0.1:3000
Build & Deploy
yarn build # Generate static site to ./build/
yarn serve # Serve production build locally
yarn deploy # Deploy to GitHub Pages
Type Checking
yarn typecheck # Run TypeScript compiler (tsc --noEmit)
Utilities
yarn clear # Clear Docusaurus cache
yarn swizzle # Eject Docusaurus components
yarn write-translations # Generate i18n files
yarn write-heading-ids # Add heading IDs to docs
CI/CD
- GitHub Actions workflow:
.github/workflows/deploy-pages.yml - Deploys on push to
mainbranch - Build artifact:
./build/directory
3. TypeScript Configuration
- Config file:
tsconfig.json - Extends:
@docusaurus/tsconfig - Compiler options:
baseUrl: "." - Excluded:
[".docusaurus", "build"]
TypeScript is used for:
docusaurus.config.tssidebars.tssrc/pages/*.tsxsrc/components/**/*.tsx
4. Code Style Guidelines
TypeScript / TSX Conventions
-
Imports
import type {SomeType} from 'package'; // Type-only imports import clsx from 'clsx'; // Default imports for utilities import Layout from '@theme/Layout'; // Docusaurus theme components import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; -
Type Annotations
- Use
typekeyword for type aliases - Prefer explicit return types for exported functions
- Use
ReactNodefor React children props
type FeatureItem = { title: string; description: ReactNode; }; export default function Home(): ReactNode { ... } - Use
-
Function Components
- Use function declarations for page components
- Use default exports for page-level components
- Named exports for reusable components
-
Server vs Client Code
// docusaurus.config.ts, sidebars.ts - Server-side only // "This runs in Node.js - Don't use client-side code here"
CSS Modules
- Component styles use CSS modules:
*.module.css - Global styles in
src/css/custom.css - Docusaurus uses Infima CSS framework
- Dark mode via
[data-theme='dark']selector
Markdown / MDX Conventions
-
Frontmatter
--- slug: url-slug title: Page Title sidebar_position: 1 authors: [username] tags: [tag1, tag2] --- -
Blog Posts
- Filename format:
YYYY-MM-DD-title.md - Use
<!-- truncate -->for excerpt
- Filename format:
-
Special Admonitions (Callouts) Use the
:::syntax for highlighted callouts. Always include empty lines around content to work with Prettier.:::note Some **content** with _Markdown_ `syntax`. ::: :::tip A helpful tip. ::: :::info Additional information. ::: :::warning Something to be careful about. ::: :::danger Critical warning - potential data loss or security risk. :::With custom title:
:::note[Your Custom Title] Content goes here. :::Nested admonitions:
:::::info[Parent] Parent content ::::tip[Child] Child content ::::::: -
Code Blocks
- Specify language:
```typescriptfor TypeScript - Docusaurus supports syntax highlighting via Prism
- Specify language:
-
Admonitions in JSX/TSX Outside Markdown, use the
@theme/Admonitioncomponent:import Admonition from '@theme/Admonition'; export default function MyPage() { return ( <Admonition type="tip" icon="π‘" title="Did you know..."> <p>Use plugins for shorter syntax.</p> </Admonition> ); }Accepted types:
note,tip,danger,info,warningOptional props:icon(JSX element or string),title
5. Directory Structure
/
βββ docs/ # Documentation files
β βββ intro.md
β βββ lazyvim/
β β βββ index.md
β β βββ installation.md
β β βββ keymaps.md
β β βββ plugins.md
β βββ tmux/
β βββ index.md
β βββ installation.md
β βββ keymaps.md
βββ blog/ # Blog posts (YYYY-MM-DD-title.md)
βββ src/
β βββ pages/ # Custom React pages
β β βββ index.tsx # Homepage
β β βββ index.module.css
β βββ components/ # Custom React components
β β βββ HomepageFeatures/
β βββ css/
β βββ custom.css # Global styles
βββ static/ # Static assets (img/, etc.)
βββ docusaurus.config.ts # Site configuration
βββ sidebars.ts # Docs sidebar config
βββ package.json
βββ tsconfig.json
6. Docusaurus Configuration
Key settings in docusaurus.config.ts:
| Setting | Value |
|---|---|
| URL | https://longwaybai.github.io |
| baseUrl | / |
| onBrokenLinks | throw |
| i18n | English only |
Important: Do not use browser APIs (window, document) or JSX syntax in:
docusaurus.config.tssidebars.ts
7. Content Guidelines
Documentation
- Language: Chinese (δΈζ)
- Write like work notes - process and thinking over conclusions
- Keep experiments and iterations visible
- Focus on practical, reusable workflows
Blog Posts
- MDX supported for interactive content
- Use
slugin frontmatter for custom URLs - RSS/Atom feeds enabled
Images
- Place in
static/img/directory - Reference with
/img/filename.png
8. Git Workflow
Branch Strategy
main- production branch, auto-deploys to GitHub Pages
Commit Messages
git add -A
git commit -m "type: description"
# Types: docs, fix, feat, refactor, style
Push
git push # Triggers CI/CD automatically
9. Troubleshooting
Build fails
- Verify Node.js >= 20
- Run
yarn clearthenyarn build
Links 404
- Check
baseUrlindocusaurus.config.ts - Should be
/for user pages (username.github.io)
Type errors
- Run
yarn typecheckto see all errors - Docusaurus config files run in Node.js context
10. Key Dependencies
| Package | Version | Purpose |
|---|---|---|
| @docusaurus/core | 3.9.2 | Core framework |
| @docusaurus/preset-classic | 3.9.2 | Standard features |
| react | ^19.0.0 | UI library |
| typescript | ~5.6.2 | Type checking |
| clsx | ^2.0.0 | Class name utility |
| prism-react-renderer | ^2.3.0 | Syntax highlighting |
Last updated: 2026-03-23 (Admonitions expanded)