docusaurus-config
Use when working with docusaurus.config.js/ts files to validate or modify Docusaurus configuration
When & Why to Use This Skill
The docusaurus-config skill is a specialized utility designed to automate the validation and modification of Docusaurus configuration files (docusaurus.config.js/ts). It ensures that documentation projects adhere to essential structural requirements, such as mandatory fields and specific URL formatting, while helping developers seamlessly integrate plugins and themes without manual syntax errors.
Use Cases
- Initial Setup & Validation: Automatically verify that mandatory fields like 'title', 'url', and 'baseUrl' are present and correctly formatted before deploying a new documentation site.
- Configuration Maintenance: Safely modify existing configuration files while preserving the original coding style, whether using TypeScript, JavaScript, ESM, or CommonJS.
- Plugin & Theme Management: Correctly implement and configure Docusaurus plugins and themes using the proper string or array-based syntax to avoid runtime errors.
- Deployment Readiness: Ensure the 'url' and 'baseUrl' parameters follow strict formatting rules (e.g., no trailing slashes on URLs) to prevent broken assets and navigation after deployment.
| name | docusaurus-config |
|---|---|
| # IMPORTANT | Keep description on ONE line for Claude Code compatibility |
| description | Use when working with docusaurus.config.js/ts files to validate or modify Docusaurus configuration |
Docusaurus Config
Quick Start
Configuration lives in docusaurus.config.js or docusaurus.config.ts at project root.
import { Config } from "@docusaurus/types";
const config: Config = {
title: "My Site", // Required
url: "https://example.com", // Required, no trailing /
baseUrl: "/", // Required, must start and end with /
favicon: "img/favicon.ico",
organizationName: "my-org",
projectName: "my-project",
presets: [
[
"@docusaurus/preset-classic",
{
/* options */
},
],
],
themeConfig: {
/* theme config */
},
customFields: {
/* unknown fields go here */
},
};
export default config;
Core Principles
- Required:
title,url,baseUrlare mandatory - Custom fields: Unknown fields must use
customFieldsobject - Validation:
urlno trailing slash,baseUrlmust be/path/ - Plugins/themes: Use string or
[name, options]array format
Common Tasks
Before editing: Read current config to preserve format (JS/TS, ESM/CommonJS)
After editing: Verify required fields, URL formats, and restart dev server
Reference Files
See references/detailed-guide.md for comprehensive examples