Add a new project to the portfolio. Asks for project details and creates a numbered markdown or MDX file in the projects content directory. Supports embedding Claude Artifacts as interactive React components.
Add a new project to the existing portfolio site by collecting details from the user
and writing a markdown file into portfolio/src/content/projects/.
Verify that portfolio/src/content/projects/ exists. If it doesn't, tell the user
to run /build-portfolio first and stop.
List existing files in portfolio/src/content/projects/ and find the highest numeric
prefix (across both .md and .mdx files). The new file will use the next number
(e.g. if 03-foo.md is the highest, use 04). Zero-pad to two digits.
Use AskUserQuestion to ask:
What is the name of your project?
This is the only required field — collect it before proceeding.
Use AskUserQuestion (single question, multiline-friendly) to ask:
Describe this project in a sentence or two.
Use AskUserQuestion with options to ask:
Would you like to add any optional details?
Options:
This is a multiSelect question — the user can choose both optional details AND an artifact, or either one, or neither.
If the user selects "Yes — let me provide URLs, technologies, etc.", ask
follow-up questions one at a time using AskUserQuestion:
If the user selects "Embed a Claude Artifact", follow the artifact embedding steps below (Step 5a–5e). If not, skip ahead to Step 6.
Ask the user to paste their JSX code:
Paste the JSX code for your Claude Artifact below.
Check portfolio/package.json for the required dependencies. If any are missing,
install them by running:
cd portfolio && npx astro add react mdx --yes
This installs @astrojs/react, @astrojs/mdx, react, and react-dom and
automatically updates astro.config.mjs to register both integrations.
Check portfolio/src/content.config.ts. If the projects collection glob pattern
is "**/*.md", update it to "**/*.{md,mdx}" so MDX project files are loaded.
Create a React component file at:
portfolio/src/components/artifacts/{PascalCaseProjectName}.jsx
Where {PascalCaseProjectName} is the project name converted to PascalCase
(e.g. "My Cool App" → "MyCoolApp").
Write the user's pasted JSX code into this file. Ensure the component has a default export. If the pasted code is just a function component without an export, wrap it:
// If the user's code defines a component like:
// function MyComponent() { ... }
// or
// const MyComponent = () => { ... }
// Make sure it ends with:
export default MyComponent;
If the pasted code uses export default already, leave it as-is.
Mark this project to be written as .mdx instead of .md (used in Step 7).
Use AskUserQuestion to ask:
Write a short description for the project detail page (1-3 paragraphs). Or say "skip" to leave it minimal.
If the project has an embedded artifact, create an MDX file at
portfolio/src/content/projects/{NN}-{slug}.mdx. Otherwise create a .md file.
---