|
1 | | -/** |
2 | | - * Prompts implementation for the Model Context Protocol (MCP) server. |
3 | | - * |
4 | | - * This file defines prompts that guide the AI model's responses. |
5 | | - * Prompts help to direct the model on how to process user requests. |
6 | | - */ |
7 | | - |
8 | | -import{getFramework}from"./utils/framework.js" |
| 1 | +import{getFramework}from"../utils/framework.js" |
| 2 | +import{ |
| 3 | +getOptimizationInstructions, |
| 4 | +getPageTypeSpecificInstructions, |
| 5 | +}from"./helpers.js" |
9 | 6 |
|
10 | 7 | /** |
11 | 8 | * List of prompts metadata available in this MCP server |
@@ -499,133 +496,3 @@ Provide complete ${framework} data table implementation with proper TypeScript t |
499 | 496 | } |
500 | 497 | }, |
501 | 498 | } |
502 | | - |
503 | | -/** |
504 | | - * Helper function to get page type specific instructions |
505 | | - */ |
506 | | -functiongetPageTypeSpecificInstructions(pageType:string):string{ |
507 | | -constinstructions={ |
508 | | -dashboard:` |
509 | | - - Use dashboard blocks as foundation (dashboard-01) |
510 | | - - Include metrics cards, charts, and data tables |
511 | | - - Implement sidebar navigation with proper menu structure |
512 | | - - Add header with user profile and notifications |
513 | | - - Create responsive grid layout for widgets`, |
514 | | - |
515 | | -login:` |
516 | | - - Use login blocks as reference (login-01 through login-05) |
517 | | - - Implement form validation with clear error messages |
518 | | - - Add social authentication options if specified |
519 | | - - Include forgot password and sign-up links |
520 | | - - Ensure mobile-responsive design`, |
521 | | - |
522 | | -calendar:` |
523 | | - - Use calendar blocks (calendar-01 through calendar-32) |
524 | | - - Implement different calendar views (month, week, day) |
525 | | - - Add event creation and management |
526 | | - - Include date navigation and filtering |
527 | | - - Support event categories and colors`, |
528 | | - |
529 | | -sidebar:` |
530 | | - - Use sidebar blocks as foundation (sidebar-01 through sidebar-16) |
531 | | - - Implement collapsible navigation |
532 | | - - Add proper menu hierarchy |
533 | | - - Include search functionality |
534 | | - - Support both light and dark themes`, |
535 | | - |
536 | | -products:` |
537 | | - - Use products blocks as reference (products-01) |
538 | | - - Create product grid/list views |
539 | | - - Implement filtering and sorting |
540 | | - - Add product details modal or page |
541 | | - - Include shopping cart functionality if needed`, |
542 | | - |
543 | | -custom:` |
544 | | - - Analyze requirements and choose appropriate blocks |
545 | | - - Combine multiple block patterns as needed |
546 | | - - Focus on component reusability |
547 | | - - Ensure consistent design patterns`, |
548 | | -} |
549 | | - |
550 | | -return( |
551 | | -instructions[pageTypeaskeyoftypeofinstructions]||instructions.custom |
552 | | -) |
553 | | -} |
554 | | - |
555 | | -/** |
556 | | - * Helper function to get optimization specific instructions |
557 | | - */ |
558 | | -functiongetOptimizationInstructions( |
559 | | -optimization:string, |
560 | | -framework:string |
561 | | -):string{ |
562 | | -constgetPerformanceInstructions=(framework:string)=>{ |
563 | | -switch(framework){ |
564 | | -case"svelte": |
565 | | -return` |
566 | | - - Use Svelte's built-in reactivity with runes for fine-grained updates |
567 | | - - Minimize the use of reactive statements that cause unnecessary updates |
568 | | - - Use derived state with $derived for computed values |
569 | | - - Consider using $effect only when necessary for side effects |
570 | | - - Implement lazy loading for heavy components |
571 | | - - Use $state.raw for non-reactive data to avoid unnecessary reactivity overhead |
572 | | - - Leverage Svelte's compile-time optimizations` |
573 | | - |
574 | | -case"vue": |
575 | | -return` |
576 | | - - Use Vue 3's Composition API with reactive refs and computed properties |
577 | | - - Use defineAsyncComponent for code splitting and lazy loading |
578 | | - - Minimize watchers and use computed properties when possible |
579 | | - - Leverage Vue's built-in reactivity system efficiently |
580 | | - - Use shallowRef and shallowReactive for performance-critical scenarios |
581 | | - - Implement virtual scrolling for large lists using Vue Virtual Scroller` |
582 | | - |
583 | | -case"react": |
584 | | -default: |
585 | | -return` |
586 | | - - Implement React.memo for preventing unnecessary re-renders |
587 | | - - Use useMemo and useCallback hooks appropriately |
588 | | - - Optimize bundle size by code splitting with React.lazy |
589 | | - - Implement virtual scrolling for large lists |
590 | | - - Minimize DOM manipulations and use refs efficiently |
591 | | - - Use lazy loading for heavy components |
592 | | - - Consider using React.startTransition for non-urgent updates` |
593 | | -} |
594 | | -} |
595 | | - |
596 | | -constinstructions={ |
597 | | -performance:getPerformanceInstructions(framework), |
598 | | - |
599 | | -accessibility:` |
600 | | - - Add proper ARIA labels and roles |
601 | | - - Ensure keyboard navigation support |
602 | | - - Implement focus management |
603 | | - - Add screen reader compatibility |
604 | | - - Ensure color contrast compliance |
605 | | - - Support high contrast mode |
606 | | - - Use semantic HTML elements`, |
607 | | - |
608 | | -responsive:` |
609 | | - - Implement mobile-first design approach |
610 | | - - Use CSS Grid and Flexbox effectively |
611 | | - - Add proper breakpoints for all screen sizes |
612 | | - - Optimize touch interactions for mobile |
613 | | - - Ensure readable text sizes on all devices |
614 | | - - Implement responsive navigation patterns |
615 | | - - Use container queries where appropriate`, |
616 | | - |
617 | | -animations:` |
618 | | - - Add smooth transitions between states |
619 | | - - Implement loading animations and skeletons |
620 | | - - Use CSS transforms for better performance |
621 | | - - Add hover and focus animations |
622 | | - - Implement page transition animations |
623 | | - - Ensure animations respect reduced motion preferences |
624 | | - - Use hardware acceleration with transform3d when needed`, |
625 | | -} |
626 | | - |
627 | | -return( |
628 | | -instructions[optimizationaskeyoftypeofinstructions]|| |
629 | | -`Focus on general code quality improvements and${framework}-specific best practices implementation.` |
630 | | -) |
631 | | -} |