diff --git a/.agents/plugins/marketplace.json b/.agents/plugins/marketplace.json new file mode 100644 index 00000000000000..23f3b2ad72a513 --- /dev/null +++ b/.agents/plugins/marketplace.json @@ -0,0 +1,20 @@ +{ + "name": "material-ui", + "interface": { + "displayName": "Material UI" + }, + "plugins": [ + { + "name": "material-ui", + "source": { + "source": "local", + "path": "./skills" + }, + "policy": { + "installation": "AVAILABLE", + "authentication": "ON_INSTALL" + }, + "category": "Developer Tools" + } + ] +} diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json new file mode 100644 index 00000000000000..7fe450874b1322 --- /dev/null +++ b/.claude-plugin/marketplace.json @@ -0,0 +1,36 @@ +{ + "name": "material-ui", + "owner": { + "name": "MUI", + "url": "https://mui.com" + }, + "description": "Material UI agent skills", + "plugins": [ + { + "name": "material-ui", + "displayName": "Material UI", + "description": "Material UI agent skills for styling (sx, styled, theme overrides, global CSS), theming and design tokens (createTheme, colorSchemes, CSS variables), Next.js App/Pages Router integration, and Tailwind CSS v4/v3 interoperability. Use when building or customizing @mui/material UI.", + "source": "./skills", + "author": { + "name": "MUI", + "url": "https://mui.com" + }, + "homepage": "https://mui.com/material-ui/", + "repository": "https://github.com/mui/material-ui", + "license": "MIT", + "keywords": [ + "material-ui", + "mui", + "react", + "material-design", + "design-system", + "styling", + "theming", + "nextjs", + "tailwind", + "coding-agents" + ], + "category": "development" + } + ] +} diff --git a/docs/data/material/getting-started/coding-agents/coding-agents.md b/docs/data/material/getting-started/coding-agents/coding-agents.md new file mode 100644 index 00000000000000..bccc23c6528d8a --- /dev/null +++ b/docs/data/material/getting-started/coding-agents/coding-agents.md @@ -0,0 +1,27 @@ +# Coding agents + +

Install Material UI agent skills in your coding agent.

+ +Material UI ships agent skills for common integration topics—`material-ui-nextjs`, `material-ui-styling`, `material-ui-tailwind`, and `material-ui-theming`—in the repository's `skills/` folder. + +## Installation + +Install the skills with your coding agent: + + + +```bash Claude +claude plugin marketplace add mui/material-ui +claude plugin install material-ui@material-ui +``` + +```bash Codex +codex plugin marketplace add mui/material-ui +codex plugin add material-ui@material-ui +``` + +```bash Other +npx skills add mui/material-ui +``` + + diff --git a/docs/data/material/pages.ts b/docs/data/material/pages.ts index f3cf3c49b15347..88d6df3812974b 100644 --- a/docs/data/material/pages.ts +++ b/docs/data/material/pages.ts @@ -9,6 +9,11 @@ const pages: MuiPage[] = [ children: [ { pathname: '/material-ui/getting-started', title: 'Overview' }, { pathname: '/material-ui/getting-started/installation' }, + { + pathname: '/material-ui/getting-started/coding-agents', + newFeature: true, + title: 'Coding agents', + }, { pathname: '/material-ui/getting-started/usage' }, { pathname: '/material-ui/getting-started/mcp', newFeature: true, title: 'MCP' }, { pathname: '/material-ui/llms.txt', newFeature: true, title: 'llms.txt' }, diff --git a/docs/pages/material-ui/getting-started/coding-agents.js b/docs/pages/material-ui/getting-started/coding-agents.js new file mode 100644 index 00000000000000..9adbdb8d88f384 --- /dev/null +++ b/docs/pages/material-ui/getting-started/coding-agents.js @@ -0,0 +1,6 @@ +import { MarkdownDocs } from '@mui/internal-core-docs/MarkdownDocs'; +import * as pageProps from 'docs/data/material/getting-started/coding-agents/coding-agents.md?muiMarkdown'; + +export default function Page() { + return ; +} diff --git a/docs/translations/translations.json b/docs/translations/translations.json index dfb1ecccbbaeba..3d086145f762e6 100644 --- a/docs/translations/translations.json +++ b/docs/translations/translations.json @@ -40,6 +40,7 @@ "/material-ui/getting-started-group": "Getting started", "/material-ui/getting-started": "Overview", "/material-ui/getting-started/installation": "Installation", + "/material-ui/getting-started/coding-agents": "Coding agents", "/material-ui/getting-started/usage": "Usage", "/material-ui/getting-started/mcp": "MCP", "/material-ui/llms.txt": "llms.txt", diff --git a/packages-internal/markdown/parseMarkdown.mjs b/packages-internal/markdown/parseMarkdown.mjs index cfe84b33bafc52..e91c5746b02601 100644 --- a/packages-internal/markdown/parseMarkdown.mjs +++ b/packages-internal/markdown/parseMarkdown.mjs @@ -205,6 +205,58 @@ function getDescription(markdown) { return matches[1].trim().replace(/`/g, ''); } +/** + * Parse the tab title from a `` fence header. + * Accepts a single unquoted word (`npm`) or a quoted multi-word title (`"Claude Code"`). + * @param {string} language + * @param {string} meta - Remainder of the fence line after the language. + * @returns {string} + */ +function parseCodeblockTabTitle(language, meta) { + const trimmed = meta.trim(); + const fencePreview = `\`\`\`${language}${meta}`; + + if (!trimmed) { + throw new Error( + [ + 'docs-infra: Missing codeblock tab title.', + `The fence ${fencePreview} is missing a tab title.`, + 'Add a single-word title (e.g. ```bash npm) or a quoted multi-word title (e.g. ```bash "Claude Code").', + '', + ].join('\n'), + ); + } + + const quotedMatch = trimmed.match(/^(["'])([\s\S]*?)\1$/); + if (quotedMatch) { + const title = quotedMatch[2]; + if (title.length === 0) { + throw new Error( + [ + 'docs-infra: Empty codeblock tab title.', + `The fence ${fencePreview} has an empty quoted tab title.`, + 'Provide a non-empty title (e.g. ```bash "Claude Code").', + '', + ].join('\n'), + ); + } + return title; + } + + if (/^\S+$/.test(trimmed)) { + return trimmed; + } + + throw new Error( + [ + 'docs-infra: Invalid codeblock tab title.', + `The fence ${fencePreview} has a tab title that could not be parsed.`, + 'Use a single word (e.g. ```bash Claude) or quote multi-word titles (e.g. ```bash "Claude Code").', + '', + ].join('\n'), + ); +} + function getCodeblock(content) { if (!content.startsWith(']*storageKey=["|'](?!storageKey=["|'])(\S*)["|'].*>/m, )?.[1]; - const blocks = [...content.matchAll(/^```(\S*) (\S*)\n(.*?)\n```/gmsu)].map( - ([, language, tab, code]) => ({ language, tab, code }), - ); - - const blocksData = blocks.filter( - (block) => block.tab !== undefined && !emptyRegExp.test(block.code), - ); + const blocksData = [...content.matchAll(/^```(\S*)([^\n]*)\n(.*?)\n```/gmsu)] + .map(([, language, meta, code]) => ({ + language, + tab: parseCodeblockTabTitle(language, meta), + code, + })) + .filter((block) => !emptyRegExp.test(block.code)); return { type: 'codeblock', diff --git a/packages-internal/markdown/parseMarkdown.test.mjs b/packages-internal/markdown/parseMarkdown.test.mjs index 32392a70a7f4b0..11fb776fb9174d 100644 --- a/packages-internal/markdown/parseMarkdown.test.mjs +++ b/packages-internal/markdown/parseMarkdown.test.mjs @@ -243,6 +243,97 @@ title: "Our docs just got a major upgrade—here's what that means for you" ], }); }); + + it('should accept quoted multi-word tab titles', () => { + const codeblock = getCodeblock( + [ + '', + '', + '```bash "Claude Code"', + 'claude plugin marketplace add mui/material-ui', + '```', + '', + "```bash 'OpenAI Codex'", + 'codex plugin add material-ui@material-ui', + '```', + '', + '', + ].join('\n'), + ); + expect(codeblock).to.deep.equal({ + type: 'codeblock', + storageKey: 'coding-agent', + data: [ + { + language: 'bash', + tab: 'Claude Code', + code: 'claude plugin marketplace add mui/material-ui', + }, + { + language: 'bash', + tab: 'OpenAI Codex', + code: 'codex plugin add material-ui@material-ui', + }, + ], + }); + }); + + it('should throw on unquoted multi-word tab titles', () => { + expect(() => { + getCodeblock( + [ + '', + '', + '```bash Claude Code', + 'claude plugin marketplace add mui/material-ui', + '```', + '', + '', + ].join('\n'), + ); + }).to.throw(`docs-infra: Invalid codeblock tab title. +The fence \`\`\`bash Claude Code has a tab title that could not be parsed. +Use a single word (e.g. \`\`\`bash Claude) or quote multi-word titles (e.g. \`\`\`bash "Claude Code"). +`); + }); + + it('should throw when the tab title is missing', () => { + expect(() => { + getCodeblock( + [ + '', + '', + '```bash', + 'npm install @mui/material', + '```', + '', + '', + ].join('\n'), + ); + }).to.throw(`docs-infra: Missing codeblock tab title. +The fence \`\`\`bash is missing a tab title. +Add a single-word title (e.g. \`\`\`bash npm) or a quoted multi-word title (e.g. \`\`\`bash "Claude Code"). +`); + }); + + it('should throw on empty quoted tab titles', () => { + expect(() => { + getCodeblock( + [ + '', + '', + '```bash ""', + 'npm install @mui/material', + '```', + '', + '', + ].join('\n'), + ); + }).to.throw(`docs-infra: Empty codeblock tab title. +The fence \`\`\`bash "" has an empty quoted tab title. +Provide a non-empty title (e.g. \`\`\`bash "Claude Code"). +`); + }); }); describe('renderMarkdown', () => { diff --git a/skills/.claude-plugin/plugin.json b/skills/.claude-plugin/plugin.json new file mode 100644 index 00000000000000..ec73b200430e0d --- /dev/null +++ b/skills/.claude-plugin/plugin.json @@ -0,0 +1,17 @@ +{ + "name": "material-ui", + "description": "Material UI agent skills for styling, theming, Next.js, and Tailwind CSS integration.", + "author": { + "name": "MUI", + "url": "https://mui.com" + }, + "homepage": "https://mui.com/material-ui/", + "repository": "https://github.com/mui/material-ui", + "license": "MIT", + "skills": [ + "./material-ui-nextjs", + "./material-ui-styling", + "./material-ui-tailwind", + "./material-ui-theming" + ] +} diff --git a/skills/.codex-plugin/plugin.json b/skills/.codex-plugin/plugin.json new file mode 100644 index 00000000000000..ada9f74c080e49 --- /dev/null +++ b/skills/.codex-plugin/plugin.json @@ -0,0 +1,50 @@ +{ + "name": "material-ui", + "description": "Material UI agent skills for styling, theming, Next.js, and Tailwind CSS integration.", + "author": { + "name": "MUI", + "url": "https://mui.com" + }, + "homepage": "https://mui.com/material-ui/", + "repository": "https://github.com/mui/material-ui", + "license": "MIT", + "keywords": [ + "material-ui", + "mui", + "react", + "material-design", + "design-system", + "styling", + "theming", + "nextjs", + "tailwind" + ], + "skills": [ + "./material-ui-nextjs", + "./material-ui-styling", + "./material-ui-tailwind", + "./material-ui-theming" + ], + "interface": { + "displayName": "Material UI", + "shortDescription": "Build UI with Material UI styling, theming, Next.js, and Tailwind", + "longDescription": "Material UI is a React component library that implements Material Design. This plugin packages the repository's agent skills so coding agents can follow official guidance when working with @mui/material.\n\nUse it when choosing among sx, styled(), theme overrides, and global CSS; building or extending themes with createTheme, colorSchemes, and CSS variables; wiring Material UI into Next.js App or Pages Router with @mui/material-nextjs; or combining Material UI with Tailwind CSS v4 layers (and v3 interoperability).\n\nThe skills point agents at the documented decision order and APIs — not at reading package source. Each skill's SKILL.md is the entry point; AGENTS.md is the full guide.", + "developerName": "MUI", + "category": "Developer Tools", + "capabilities": [ + "Styling guidance (sx, styled, theme overrides)", + "Theming and design tokens", + "Next.js integration", + "Tailwind CSS interoperability" + ], + "websiteURL": "https://mui.com/material-ui/", + "defaultPrompt": [ + "Style a Material UI Card with the right sx vs styled approach", + "Add light and dark color schemes to my Material UI theme", + "Set up Material UI with Next.js App Router and Emotion cache" + ], + "brandColor": "#007FFF", + "composerIcon": "./assets/logo.svg", + "logo": "./assets/logo.svg" + } +} diff --git a/skills/assets/logo.svg b/skills/assets/logo.svg new file mode 100644 index 00000000000000..d4127aa2d1a51f --- /dev/null +++ b/skills/assets/logo.svg @@ -0,0 +1 @@ +