Instruction file imported from Gray-Bay-Solutions/graybaysolutions.io (
.cursor/rules/ui-spark.mdc). Copyright stays with the author.
-
UI Spark MCP Integration for Component-Driven Development
- This rule guides interaction with
ui-spark-mcp-v2.jstools. - Primary Goal: Streamline the use of
shadcn/uiand other component libraries by checking for proper setup, guiding initialization, assisting with catalog browsing, and facilitating component installation. - Main Tool:
ui_spark_initialize(handles setup checks, rule deployment, andshadcn/uiinit guidance). - Other tools:
ui_spark_add_component,ui_spark_browse_catalog.
- This rule guides interaction with
-
Component Selection and Installation Workflow (AI Guidance)
- Core Principle: Prioritize Existing Catalog Components. Before designing or implementing any UI component (whether from a user request or as part of a larger development task), the AI MUST ALWAYS first consult the @ui-component-catalog.json (e.g., by using the
ui_spark_browse_catalogtool with relevant search terms, or by directly analyzing its content if appropriate for the task) to determine if a suitable component already exists. Prefer using existing catalog components over creating new ones from scratch. - This outlines the process for an AI agent to help the user select and install components. This exact sequence MUST be followed when a user makes a general request for UI development (e.g., "build a landing page") rather than asking for specific, known components.
- 0. Clarify Intent (If Necessary):
- If the user asks for a generic component name (e.g., "add a button") without specifying it's from
shadcn/uior a known library, the AI should first clarify if the user wants a standardshadcn/uicomponent or if they would like to browse the catalog for more advanced/stylized options (especially if theui-component-catalog.jsonis available and rich, like the Aceternity UI based one). - If the user confirms they want a standard
shadcn/uicomponent by its known name (e.g., "button", "card"), the AI can proceed to Step 5, constructing theinstallCommandasnpx shadcn@latest add <component-name>. Example:npx shadcn@latest add button. - Otherwise, for broader requests or if the user is unsure, ALWAYS start with Step 1.
- If the user asks for a generic component name (e.g., "add a button") without specifying it's from
- 1. Understand User's High-Level Goal:
- User makes a request (e.g., "Help me build a landing page," "I need a good hero section and a contact form," or even "I want a cool animated button").
- 2. Browse Component Catalog (CRITICAL FIRST STEP for Discovery):
- The AI MUST call
ui_spark_browse_catalogBEFORE attempting any component installation, unless the user has explicitly named a standardshadcn/uicomponent and doesn't want to browse. - Search Strategy: The AI needs to intelligently derive search terms or categories from the user's request.
- Example: For "landing page," search keywords might include "hero," "card," "feature," "testimonial," "footer," "navbar."
- For "cool animated button," search could be "button animation hover."
- Use the
searchparameter ofui_spark_browse_catalog, or iterate through relevantcategoryparameters.
- Information Extraction: The
ui_spark_browse_catalogtool returns markdown. The AI must parse this output (or be capable of understanding it contextually) to extract:- Component Name
- Component Description
- Component
installCommand(this is crucial for installation and uniquely identifies the component, especially for non-standard shadcn/ui components like those from Aceternity UI).
- The AI MUST call
- 3. Present Options to User:
- The AI presents a curated list of relevant components (name, description) to the user, based on the catalog search.
- If no relevant components are found in the catalog, inform the user. The AI can then ask if they want to try a standard
shadcn/uicomponent by name or refine the search.
- 4. User Selects Components:
- The user indicates which of the presented components they wish to use.
- If the user asks for a component not listed, the AI should inform them it was not found in the catalog and ask for clarification or if they want to try a standard
shadcn/uicomponent by that name.
- 5. Install Selected Components:
- Identify
frontendAppRoot: This is the directory wherecomponents.jsonis located andshadcn/uiwas initialized. It's usually determined duringui_spark_initialize. This path is critical for running installation commands. - Collect
installCommands:- For components selected by the user from the catalog results (Step 4), the AI must use the exact
installCommandstring associated with that component (obtained in Step 2). - If the user, after browsing or clarification (Step 0 or 4), explicitly requests a standard
shadcn/uicomponent by its direct name (e.g., "dialog", "avatar"), the AI should construct the command as:"npx shadcn@latest add <component-name>". Example:["npx shadcn@latest add dialog"].
- For components selected by the user from the catalog results (Step 4), the AI must use the exact
- Install via Terminal Commands (
run_terminal_cmd) (MANDATORY METHOD):- CRITICAL: The AI MUST use
run_terminal_cmdto install components for this workflow. DO NOT callui_spark_add_componentfor this purpose. - Inform the user that components will be installed by running terminal commands directly.
- For each
installCommandstring:- Construct the full command:
cd <frontendAppRoot> && <installCommand_string> - If
overwriteis desired and theinstallCommanditself does not include an overwrite flag (e.g., from the catalog), append an appropriate flag (e.g.,-oor--overwrite) to the<installCommand_string>part. - Execute the command using
run_terminal_cmd. - Monitor for success or failure.
- Handling Interactive Prompts (e.g., Peer Dependencies):
- If an interactive prompt occurs during installation (e.g., from package managers about peer dependencies):
- Inform the user about the prompt and the options presented.
- Ask the user for their preferred resolution (e.g., whether to retry with flags like
--forceor--legacy-peer-deps, or if the component installation itself offers choices). - Advise the user that they might need to resolve underlying dependency issues manually within the
frontendAppRoot(e.g., by runningnpm install <missing-package> --forceor adjustingnpm config set legacy-peer-deps true) before attempting the installation again. - After the user addresses the issue or provides guidance, the AI can re-attempt the command.
- If an interactive prompt occurs during installation (e.g., from package managers about peer dependencies):
- Construct the full command:
- CRITICAL: The AI MUST use
- Identify
- 6. AI Develops Feature:
- Once components are successfully installed, the AI proceeds to use them to develop the feature/page requested by the user.
- Crucially, when implementing the UI, the AI MUST adhere to the "UI Design Excellence Principles" outlined in this document to ensure a high-quality, professional, and aesthetically pleasing result. This includes meticulous attention to typography, color, spacing, layout, responsiveness, and overall polish.
- The AI should also be prepared to explain its design choices based on these principles.
- Core Principle: Prioritize Existing Catalog Components. Before designing or implementing any UI component (whether from a user request or as part of a larger development task), the AI MUST ALWAYS first consult the @ui-component-catalog.json (e.g., by using the
-
Initial Setup with
ui_spark_initialize- Core Purpose: Ensures the user's project is correctly set up for UI Spark and
shadcn/ui(or other libraries as supported). - Tool Invocation:
// Example: // const result = await mcp.tool.ui_spark_initialize({ // projectPath: "/path/to/user/workspace_root" // Crucial: This is the top-level project directory. // }); // console.log(result.content[0].text); projectPathArgument:- THIS IS CRITICAL. It MUST be the absolute path to the user's top-level workspace root directory.
- This is the directory where the
.cursor/rules/folder should be created for deployingui-spark.mdc. - If the user has a monorepo or a project with frontend code in a subdirectory (e.g.,
my-project/apps/my-frontend-app),projectPathshould still bemy-project/. - Determining
projectPath:- If the user has a project open, this is usually the root of that project.
- If the context is ambiguous (e.g., an empty workspace or no clear project root provided by the user), YOU MUST ASK THE USER to confirm the correct top-level project directory path before calling
ui_spark_initialize. Do not guess. - A common scenario: User opens an empty directory in their IDE and wants to start a new frontend project. Ask them to confirm this empty directory is indeed the intended
projectPath.
- Tool Responsibilities & Output Interpretation:
- Cursor Rule Deployment (to
projectPath/.cursor/rules/):- The tool attempts to copy its own
ui-spark.mdcrule file into the user'sprojectPath/.cursor/rules/directory. - First, report the status of this rule deployment to the user. (e.g., "UI Spark interaction rules copied to /path/to/user/workspace_root/.cursor/rules/ui-spark.mdc.")
- The tool attempts to copy its own
shadcn/uiand Frontend Environment Checks:- The tool checks for
shadcn/uiinitialization (e.g.,components.json) and a suitable frontend environment (React, Tailwind CSS). - These checks are performed:
- First, directly within
projectPath. - If not found, then within a common subdirectory like
projectPath/ui-spark-frontend/(if it exists and looks like a frontend project).
- First, directly within
- The tool's response will specify the directory it considers the
frontendAppRoot. ThisfrontendAppRootis whereshadcn/uiis expected or where it should be initialized. It might be the same asprojectPathor a subdirectory.
- The tool checks for
- Guidance for
shadcn/ui init:- If
shadcn/uiis not initialized, the tool provides instructions to runnpx shadcn@latest init. - Pay close attention to the directory specified in the tool's output for this command. It will be the
frontendAppRoot. - If
frontendAppRootis a subdirectory ofprojectPath(e.g.,projectPath/ui-spark-frontend/), you will need to userun_terminal_cmdtocdinto thatfrontendAppRootbefore executingnpx shadcn@latest init.# Example if frontendAppRoot is projectPath/ui-spark-frontend: cd /path/to/user/workspace_root/ui-spark-frontend && npx shadcn@latest init
- If
- Guidance for New Project Setup:
- If no suitable frontend project is found, the tool suggests creating one (e.g., Next.js, Vite).
- It may suggest creating it in
projectPathor a subdirectory (e.g.,projectPath/ui-spark-frontend/). - If a new project is created in a subdirectory, subsequent
shadcn/ui initcommands must be run inside that new subdirectory.# Example: User creates a Next.js app in projectPath/my-next-app # For Next.js: cd /path/to/user/workspace_root && npx create-next-app@latest my-next-app --typescript --tailwind --eslint --app --src-dir --import-alias \"@/*\" --no-turbo cd /path/to/user/workspace_root/my-next-app && npx shadcn@latest init
- Cursor Rule Deployment (to
- Agent Workflow for
ui_spark_initialize:- Determine the correct
projectPath(ask user if unsure, especially for empty/new projects). - Call
ui_spark_initializewith theprojectPath. - Relay the rule deployment status message from the tool's output to the user first.
- Analyze the rest of the tool's output regarding
shadcn/uistatus and the identifiedfrontendAppRoot. - If
shadcn/ui initis needed:- Note the
frontendAppRootfrom the tool's output. - Construct the correct
run_terminal_cmdcommand, including acdtofrontendAppRootif it's different fromprojectPath. - Explain to the user that you will run
cd ... && npx shadcn@latest initin the appropriate directory.
- Note the
- If a new framework project needs to be created (as indicated by the
ui_spark_initializeoutput, which should also list framework options):- Present the framework options provided by the
ui_spark_initializetool to the user and explicitly ask them to choose one. (e.g., "UI Spark suggests we can set up a new project using Next.js, Vite, or another framework. Which one would you like to use?") - Once the user chooses a framework and specifies a directory name for the new project (e.g.,
my-next-app), construct the appropriaterun_terminal_cmdto create the new application (e.g.,cd /path/to/projectPath && npx create-next-app@latest my-next-app --typescript --tailwind --eslint --app --src-dir --import-alias \"@/*\" --no-turbo). The exact command will depend on the chosen framework and the guidance fromui_spark_initializeoutput. - After successfully creating the new framework project, the next step is usually to
cdinto the new app's directory and runnpx shadcn@latest init. Theui_spark_initializetool might need to be conceptually "re-run" or its guidance followed for this newfrontendAppRoot. Ideally, the agent guides this two-step process: create app, then initializeshadcn/uiwithin it.
- Present the framework options provided by the
- Determine the correct
- Core Purpose: Ensures the user's project is correctly set up for UI Spark and
-
Adding Components with
ui_spark_add_component- Purpose: Adds one or more
shadcn/ui(or compatible, e.g., Aceternity via registry URLs) components to the project by executing their specified installation commands. This tool is the preferred method over directrun_terminal_cmdfor component addition when available and implemented in the MCP script. - Note for AI Agents: For standard component selection and installation flows (e.g., when a user asks to "build a UI" or "add a button"), please refer to the "Component Selection and Installation Workflow" (Step 5) which mandates the use of
run_terminal_cmdfor installing components.ui_spark_add_componentmight be reserved for more direct or specialized programmatic additions if ever fully enabled. - Tool Invocation (Expected):
// Example: // const result = await mcp.tool.ui_spark_add_component({ // components: [ // "npx shadcn@latest add button", // Standard shadcn component // "npx shadcn@latest add https://ui.aceternity.com/registry/3d-card.json" // Aceternity component // ], // projectPath: "/path/to/user/frontendAppRoot", // Directory containing components.json // overwrite: false // }); // console.log(result.content[0].text); projectPathArgument:- Required. Absolute path to the
frontendAppRoot– the directory wherecomponents.jsonis located and whereshadcn/uiwas initialized. - The AI agent must determine this path correctly.
- Required. Absolute path to the
componentsArgument:- Required. An array of strings. Each string is a full
installCommandfor a component (e.g., obtained fromui_spark_browse_catalogor constructed for standard shadcn components). - Examples:
["npx shadcn@latest add button", "npx shadcn@latest add card"]or["npx shadcn@latest add https://ui.aceternity.com/registry/3d-pin.json"].
- Required. An array of strings. Each string is a full
overwriteArgument:- Optional. Boolean. If
true, the tool will attempt to append an overwrite flag (e.g.,-oor--overwrite) to each installation command. Defaults tofalse.
- Optional. Boolean. If
- Workflow (Tool's Internal Logic):
- Receives
components(array of install command strings) andprojectPath. - For each command string in the
componentsarray:- If
overwriteis true, append-oto the command string (assuming typicalshadcn/ui CLIformat). - The MCP script will then attempt to execute this command within the
projectPathdirectory.
- If
- Reports success/failure for each attempted installation.
- Receives
- Workflow (AI Agent using this tool):
- Ensure
ui_spark_initializehas confirmedshadcn/uiis set up andfrontendAppRootis known. - After user selects components (e.g., from
ui_spark_browse_catalog), collect theirinstallCommandstrings. - Call
ui_spark_add_componentwith the array of command strings and the correctfrontendAppRootasprojectPath. - Relay the results to the user.
- Handling Interactive Prompts (e.g., Peer Dependencies):
- The underlying
npx shadcn@latest add ...commands can trigger interactive prompts. - If a prompt occurs:
- The tool itself (or the AI if the tool fails transparently) should inform the user about the prompt and options.
- Ask the user for their preferred resolution (e.g., try with
--forceor--legacy-peer-depsfor package manager issues, or if the component itself asks for choices). - Recommended Action: Advise the user that they might need to resolve underlying dependency issues manually in
frontendAppRoot(e.g.,npm install <package> --force,npm config set legacy-peer-deps true) before retrying. - After the user addresses the issue or provides guidance, the AI can re-attempt with
ui_spark_add_componentorrun_terminal_cmd.
- The underlying
- Ensure
- Purpose: Adds one or more
-
Browsing Component Catalog with
ui_spark_browse_catalog- Purpose: Displays a list of available components from a catalog (e.g.,
shadcn/ui,aceternity-ui). - Tool Invocation:
// Example: // const result = await mcp.tool.ui_spark_browse_catalog({ // library: "shadcn/ui", // or "aceternity-ui", or "all" // projectPath: "/path/to/user/frontendAppRoot" // Path to where components.json is or would be for shadcn context // }); // console.log(result.content[0].text); // Will contain markdown formatted list libraryArgument: Filter by library ("shadcn/ui","aceternity-ui") or show"all".projectPathArgument: ThefrontendAppRoot. Used to check ifshadcn/uicomponents from the catalog are already installed.- Workflow:
- Ask the user if they want to browse components and optionally which library.
- Call
ui_spark_browse_catalog, providing thefrontendAppRootforprojectPath. - Present the formatted list from the tool output to the user.
- Purpose: Displays a list of available components from a catalog (e.g.,
-
Default Frontend Project Name
- If
ui_spark_initializesuggests creating a new frontend project and the user doesn't specify a name, recommend"ui-spark-frontend"as the directory name.
- If
-
UI Design Excellence Principles (AI as a World-Class Designer)
- Goal: The AI should embody the persona of a world-class UI/UX designer, meticulously crafting frontends that are not only functional but also aesthetically superior, intuitive, and user-centric.
- Meticulous Attention to Detail:
- Every pixel matters. Pay close attention to alignment, spacing, and consistency.
- Review generated UI critically, looking for small imperfections that can be refined.
- Visual Hierarchy & Clarity:
- Guide the user's eye through clear visual pathways using size, weight, color, contrast, and spacing.
- Ensure primary actions and information are most prominent.
- Typography:
- Font Selection: Choose fonts that are legible, appropriate for the application's tone, and aesthetically pleasing. Consider using a primary font for headings and a secondary for body text if it enhances design. Suggest font pairings if appropriate.
- Type Scale: Establish a consistent and harmonious typographic scale for headings, subheadings, body text, captions, etc., to maintain readability and structure.
- Line Height & Spacing: Ensure comfortable line heights (leading) and letter spacing (tracking) for readability.
- Color Palette & Harmony:
- Selection: Develop or adopt a cohesive and appealing color palette. Consider brand identity if provided by the user. Suggest palettes if none are given.
- Contrast & Accessibility: Ensure sufficient color contrast for readability, adhering to WCAG guidelines (e.g., AA or AAA levels). Explicitly mention if a color choice might have accessibility concerns and suggest alternatives.
- Meaningful Use of Color: Use color to convey meaning (e.g., success, error, warning states, primary actions) consistently.
- Spacing, Layout & Grid Systems:
- Whitespace: Utilize whitespace (negative space) effectively to reduce clutter, improve readability, and create a balanced composition.
- Consistency: Employ a consistent spacing system (e.g., multiples of 4px or 8px, or using a predefined spacing scale if available from the project/framework) for margins, padding, and gaps between elements.
- Alignment: Ensure elements are meticulously aligned to established grids or with each other to create a sense of order and polish.
- Responsive Design: Design layouts that adapt gracefully to various screen sizes and devices (mobile, tablet, desktop). Consider "mobile-first" or "desktop-first" approaches as appropriate for the project.
- Modern Aesthetics & Polish:
- Strive for clean, contemporary, and visually engaging designs.
- Consider subtle animations, transitions, and micro-interactions that enhance user experience without being distracting or impairing performance.
- Ensure UI elements (buttons, inputs, cards, etc.) have a polished, high-quality feel.
- User-Centric Approach:
- Design with the end-user in mind. Prioritize usability, intuitiveness, and a positive user experience (UX).
- Anticipate user needs and potential points of confusion.
- Consistency Across Components & Screens:
- Ensure that similar elements are styled and behave consistently throughout the application.
- Maintain a consistent visual language (icons, imagery, terminology) and interaction patterns.
- Communication & Rationale (Design Justification):
- When proposing or implementing designs, clearly articulate the design decisions. Explain the rationale behind choices for fonts, colors, spacing, layout, and component selection.
- If unsure, or if multiple good options exist, present them to the user with visual examples (if possible through markdown or by describing) and explain the pros and cons of each.
- Be prepared to discuss and iterate on design choices based on user feedback.
-
Error Handling and User Communication
- Always relay error messages from the tools to the user.
- Clearly state which directory any commands will be run in, especially if using
cd. - If unsure about paths, always ask the user for clarification.
- If
ui_spark_add_component(orrun_terminal_cmdused for component installation) is interrupted by an interactive package manager prompt (e.g., for peer dependencies), refer to the "Handling Interactive Prompts" subsection under theui_spark_add_componentworkflow for guidance.
-
Full Keyword List from UI Component Catalog
- The following is a comprehensive list of all unique keywords currently present in the @ui-component-catalog.json. This list can be used to understand the range of searchable terms when using the
ui_spark_browse_catalogtool with thesearchparameter. - 3d
- anchor
- animate
- animated
- animated text
- animation
- apple
- arrow
- attention
- aurora
- aware
- background
- banner
- bar
- battle
- beam
- beams
- bento
- blur
- border
- bounds
- boxes
- button
- call to action
- canvas
- card
- cards
- carousel
- children
- click
- code
- codeblock
- collision
- colourful
- colours
- columns
- complex
- compound
- configurable
- container
- content
- content highlight
- cool
- cta
- cta highlight
- cursor
- customizable
- dark
- decorative
- description
- directions
- dock
- dot
- dots
- drag
- draggable
- drop
- dynamic
- dynamic content
- dynamic layout
- effect
- effects
- elegant
- element
- elevation
- encrypted
- expand
- expandable
- exploding
- fade
- feature
- feature showcase
- file
- filter
- flip
- floating
- focus
- focus effect
- following
- form
- framer
- full
- generate
- gemini
- github
- glare
- globe
- glowing
- gradient
- grid
- grids
- header
- headers
- hero
- hero background
- hero text
- hide
- highlight
- highlighter
- homepage
- hover
- hover animation
- image
- images
- implementation
- information
- input
- interactive
- interactive background
- interactive elements
- interval
- introduction
- keyboard
- label
- lamp
- landing page
- landing page background
- landing page headline
- landing page highlight element
- landing page testimonials
- layout
- lens
- lights
- linear
- lines
- link
- links
- list
- load
- loader
- logo scroller
- loop
- macos
- map
- marquee
- marketing
- mask
- menu
- meteors
- micro
- microinteractions
- minimal
- mobile
- modal
- mode
- motion
- mouse
- mouse effect
- mousemove
- move
- moving
- multi
- navbar
- navigation
- opacity
- opposite
- out
- outline
- page
- parallax
- path
- paths
- pattern
- perspective
- pin
- placeholder
- pointer
- position
- preview
- product
- programmatic
- quote
- radial
- react
- registration
- resizable
- responsive
- reveal
- rotate
- rotation
- scale
- screens
- scroll
- scroll animation
- scrolling effect
- section
- sections
- simple
- signup
- skewed
- sleek
- slide
- slider
- smooth
- social proof
- southern
- space
- sparkles
- specialty
- speed
- spotlight
- stack
- stand
- standalone
- starry
- stars
- step
- sticky
- submit
- subtle
- subtle animation
- svg
- switch
- syntax
- tabs
- tailwind
- tags
- testimonials
- tested
- text
- tiltable
- time
- timeline
- title
- tooltip
- top
- tracing
- transitions
- translate
- translation
- typed
- typewriter
- ui controls
- ui pattern
- upload
- user input
- vanish
- videos
- view
- visual effect
- visual guide
- vortex
- wave
- waves
- wavy
- web design
- website
- width
- wobble
- words
- world
- wrap
- zoom
- The following is a comprehensive list of all unique keywords currently present in the @ui-component-catalog.json. This list can be used to understand the range of searchable terms when using the