Next.js React Redux TypeScript Cursor 指令规则


9
2k
Be the first to write a review
palaklive 的头像
LV1 常客
上述cursor提示词能够为现代Web开发团队提供一套完整的技术栈规范指南,涵盖React、Next.js、TypeScript等技术的开发哲学、代码风格、最佳实践和安全标准,旨在建立统一、高质量、可维护的代码基准。

该提示词AI生成结果一览:



本综合指南概述了使用现代网页技术(包括 ReactJS、NextJS、Redux、TypeScript、JavaScript、HTML、CSS 和 UI 框架)进行开发的最佳实践、约定和标准。

开发哲学
– 编写干净、可维护和可扩展的代码
– 遵循 SOLID 原则
– 优先选择函数式和声明式编程模式,而非命令式
– 强调类型安全和静态分析
– 采用组件驱动开发

代码实施指南
规划阶段
– 从逐步规划开始
– 在实现之前编写详细的伪代码
– 记录组件架构和数据流
– 考虑边缘案例和错误场景

代码风格
– 使用制表符进行缩进
– 字符串使用单引号(除非需要避免转义)
– 省略分号(除非需要消歧义)
– 消除未使用的变量
– 关键字后加空格
– 函数声明的括号前加空格
– 始终使用严格相等(===),而非宽松相等(==)
– 对中缀运算符添加空格
– 逗号后加空格
– 将 else 语句保持在闭合大括号同一行
– 多行 if 语句使用大括号
– 始终在回调中处理错误参数
– 行长度限制为 80 个字符
– 在多行对象/数组字面量中使用尾随逗号

命名约定
一般规则
– 组件、类型定义和接口使用 PascalCase
– 目录名(例如:components/auth-wizard)使用 kebab-case
– 文件名(例如:user-profile.tsx)使用 kebab-case
– 变量、函数、方法、Hook、属性和 props 使用 camelCase
– 环境变量、常量和全局配置使用大写字母(UPPERCASE)

具体命名模式
– 事件处理函数前缀使用 'handle':handleClick、handleSubmit
– 布尔变量前缀使用动词:isLoading、hasError、canSubmit
– 自定义 Hook 前缀使用 'use':useAuth、useForm
– 使用完整单词而非缩写,除非是:
– err(error)
– req(request)
– res(response)
– props(properties)
– ref(reference)

React 最佳实践
组件架构
– 使用 TypeScript 接口的函数组件
– 使用 function 关键字定义组件
– 将可重用逻辑提取到自定义 Hook 中
– 实现适当的组件组合
– 战略性地使用 React.memo() 来提升性能
– 在 useEffect Hook 中实现适当的清理

React 性能优化
– 使用 useCallback 来记忆回调函数
– 使用 useMemo 来处理开销大的计算
– 避免在 JSX 中定义内联函数
– 通过动态导入实现代码分割
– 在列表中实现适当的 key 属性(避免使用索引作为 key)

Next.js 最佳实践
核心概念
– 利用 App Router 进行路由
– 实现适当的元数据管理
– 使用适当的缓存策略
– 实现合适的错误边界

组件和功能
– 使用 Next.js 内置组件:
– 图像组件用于优化图像
– 链接组件用于客户端导航
– 脚本组件用于外部脚本
– 头部组件用于元数据
– 实现适当的加载状态
– 使用适当的数据获取方法

服务器组件
– 默认使用服务器组件
– 使用 URL 查询参数进行数据获取和服务器状态管理
– 仅在必要时使用 'use client' 指令:
– 事件监听器
– 浏览器 API
– 状态管理
– 仅限客户端的库

TypeScript 实施
– 启用严格模式
– 为组件的 props、状态和 Redux 状态结构定义清晰的接口
– 使用类型守卫安全地处理潜在的未定义或 null 值
– 在需要灵活类型的函数、动作和切片中应用泛型
– 利用 TypeScript 实用类型(Partial、Pick、Omit)编写更清晰和可重用的代码
– 定义对象结构时优先使用接口而非类型,特别是在扩展时
– 使用映射类型动态创建现有类型的变体

UI 和样式
组件库
– 使用 Shadcn UI 进行一致且可访问的组件设计
– 集成 Radix UI 原件以实现可定制和可访问的 UI 元素
– 应用组合模式以创建模块化和可重用组件

样式指南
– 使用 Tailwind CSS 进行样式设计
– 使用 Tailwind CSS 实现以实用为主的可维护样式
– 根据移动优先和响应式原则进行设计,以提高跨设备的灵活性
– 使用 CSS 变量或 Tailwind 的暗黑模式特性实现暗黑模式
– 确保颜色对比度符合可访问性标准,以保证可读性
– 维护一致的间距值,以建立视觉和谐
– 定义主题颜色和间距的 CSS 变量,以支持轻松的主题更改和可维护性

状态管理
局部状态
– 使用 useState 管理组件级状态
– 对于复杂状态,使用 useReducer
– 使用 useContext 管理共享状态
– 实现适当的状态初始化

全局状态
– 使用 Redux Toolkit 管理全局状态
– 使用 createSlice 定义状态、减速器和动作
– 除非必要,避免使用 createReducer 和 createAction
– 规范化状态结构,避免深嵌套数据
– 使用选择器封装状态访问
– 避免大的、包罗万象的切片;按功能分离关注点

错误处理与验证
表单验证
– 使用 Zod 进行模式验证
– 实现适当的错误信息
– 使用合适的表单库(例如:React Hook Form)

错误边界
– 使用错误边界优雅地捕获和处理 React 组件树中的错误
– 将捕获的错误记录到外部服务(例如:Sentry)以便跟踪和调试
– 设计用户友好的回退 UI,当发生错误时显示,使用户保持知情而不影响应用运行

测试
单元测试
– 编写全面的单元测试以验证单个函数和组件
– 使用 Jest 和 React Testing Library 可靠高效地测试 React 组件
– 遵循 Arrange-Act-Assert 等模式,以确保测试的清晰性和一致性
– 模拟外部依赖和 API 调用,以隔离单元测试

集成测试
– 专注于用户工作流,以确保应用功能
– 正确设置和拆除测试环境,以保持测试的独立性
– 有选择地使用快照测试,以捕获意外的 UI 变化,而不依赖于它
– 借助测试工具(例如:RTL 中的 screen)编写更清晰和可读的测试

可访问性(a11y)
核心要求
– 使用语义化 HTML 创建有意义的结构
– 在需要的地方应用准确的 ARIA 属性
– 确保完整的键盘导航支持
– 有效管理焦点顺序和可见性
– 维护可访问的颜色对比度
– 遵循合乎逻辑的标题层级
– 使所有交互元素可访问
– 提供清晰且可访问的错误反馈

安全性
– 实施输入清理以防止 XSS 攻击
– 使用 DOMPurify 清理 HTML 内容
– 使用适当的身份验证方法

国际化(i18n)
– 使用 next-i18next 进行翻译
– 实现适当的区域识别
– 使用适当的数字和日期格式化
– 实现适当的 RTL 支持
– 使用适当的货币格式化

文档
– 使用 JSDoc 进行文档编写
– 文档化所有公共函数、类、方法和接口
– 在适当时添加示例
– 使用完整的句子和适当的标点符号
– 保持描述清晰简练
– 使用正确的 Markdown 格式
– 使用正确的代码块
– 使用正确的链接
– 使用正确的标题
– 使用正确的列表

This comprehensive guide outlines best practices, conventions, and standards for development with modern web technologies including ReactJS, NextJS, Redux, TypeScript, JavaScript, HTML, CSS, and UI frameworks.

Development Philosophy
– Write clean, maintainable, and scalable code
– Follow SOLID principles
– Prefer functional and declarative programming patterns over imperative
– Emphasize type safety and static analysis
– Practice component-driven development

Code Implementation Guidelines
Planning Phase
– Begin with step-by-step planning
– Write detailed pseudocode before implementation
– Document component architecture and data flow
– Consider edge cases and error scenarios

Code Style
– Use tabs for indentation
– Use single quotes for strings (except to avoid escaping)
– Omit semicolons (unless required for disambiguation)
– Eliminate unused variables
– Add space after keywords
– Add space before function declaration parentheses
– Always use strict equality (===) instead of loose equality (==)
– Space infix operators
– Add space after commas
– Keep else statements on the same line as closing curly braces
– Use curly braces for multi-line if statements
– Always handle error parameters in callbacks
– Limit line length to 80 characters
– Use trailing commas in multiline object/array literals

Naming Conventions
General Rules
– Use PascalCase for:
– Components
– Type definitions
– Interfaces
– Use kebab-case for:
– Directory names (e.g., components/auth-wizard)
– File names (e.g., user-profile.tsx)
– Use camelCase for:
– Variables
– Functions
– Methods
– Hooks
– Properties
– Props
– Use UPPERCASE for:
– Environment variables
– Constants
– Global configurations

Specific Naming Patterns
– Prefix event handlers with 'handle': handleClick, handleSubmit
– Prefix boolean variables with verbs: isLoading, hasError, canSubmit
– Prefix custom hooks with 'use': useAuth, useForm
– Use complete words over abbreviations except for:
– err (error)
– req (request)
– res (response)
– props (properties)
– ref (reference)

React Best Practices
Component Architecture
– Use functional components with TypeScript interfaces
– Define components using the function keyword
– Extract reusable logic into custom hooks
– Implement proper component composition
– Use React.memo() strategically for performance
– Implement proper cleanup in useEffect hooks

React Performance Optimization
– Use useCallback for memoizing callback functions
– Implement useMemo for expensive computations
– Avoid inline function definitions in JSX
– Implement code splitting using dynamic imports
– Implement proper key props in lists (avoid using index as key)

Next.js Best Practices
Core Concepts
– Utilize App Router for routing
– Implement proper metadata management
– Use proper caching strategies
– Implement proper error boundaries

Components and Features
– Use Next.js built-in components:
– Image component for optimized images
– Link component for client-side navigation
– Script component for external scripts
– Head component for metadata
– Implement proper loading states
– Use proper data fetching methods

Server Components
– Default to Server Components
– Use URL query parameters for data fetching and server state management
– Use 'use client' directive only when necessary:
– Event listeners
– Browser APIs
– State management
– Client-side-only libraries

TypeScript Implementation
– Enable strict mode
– Define clear interfaces for component props, state, and Redux state structure.
– Use type guards to handle potential undefined or null values safely.
– Apply generics to functions, actions, and slices where type flexibility is needed.
– Utilize TypeScript utility types (Partial, Pick, Omit) for cleaner and reusable code.
– Prefer interface over type for defining object structures, especially when extending.
– Use mapped types for creating variations of existing types dynamically.

UI and Styling
Component Libraries
– Use Shadcn UI for consistent, accessible component design.
– Integrate Radix UI primitives for customizable, accessible UI elements.
– Apply composition patterns to create modular, reusable components.

Styling Guidelines
– Use Tailwind CSS for styling
– Use Tailwind CSS for utility-first, maintainable styling.
– Design with mobile-first, responsive principles for flexibility across devices.
– Implement dark mode using CSS variables or Tailwind’s dark mode features.
– Ensure color contrast ratios meet accessibility standards for readability.
– Maintain consistent spacing values to establish visual harmony.
– Define CSS variables for theme colors and spacing to support easy theming and maintainability.

State Management
Local State
– Use useState for component-level state
– Implement useReducer for complex state
– Use useContext for shared state
– Implement proper state initialization

Global State
– Use Redux Toolkit for global state
– Use createSlice to define state, reducers, and actions together.
– Avoid using createReducer and createAction unless necessary.
– Normalize state structure to avoid deeply nested data.
– Use selectors to encapsulate state access.
– Avoid large, all-encompassing slices; separate concerns by feature.

Error Handling and Validation
Form Validation
– Use Zod for schema validation
– Implement proper error messages
– Use proper form libraries (e.g., React Hook Form)

Error Boundaries
– Use error boundaries to catch and handle errors in React component trees gracefully.
– Log caught errors to an external service (e.g., Sentry) for tracking and debugging.
– Design user-friendly fallback UIs to display when errors occur, keeping users informed without breaking the app.

Testing
Unit Testing
– Write thorough unit tests to validate individual functions and components.
– Use Jest and React Testing Library for reliable and efficient testing of React components.
– Follow patterns like Arrange-Act-Assert to ensure clarity and consistency in tests.
– Mock external dependencies and API calls to isolate unit tests.

Integration Testing
– Focus on user workflows to ensure app functionality.
– Set up and tear down test environments properly to maintain test independence.
– Use snapshot testing selectively to catch unintended UI changes without over-relying on it.
– Leverage testing utilities (e.g., screen in RTL) for cleaner and more readable tests.

Accessibility (a11y)
Core Requirements
– Use semantic HTML for meaningful structure.
– Apply accurate ARIA attributes where needed.
– Ensure full keyboard navigation support.
– Manage focus order and visibility effectively.
– Maintain accessible color contrast ratios.
– Follow a logical heading hierarchy.
– Make all interactive elements accessible.
– Provide clear and accessible error feedback.

Security
– Implement input sanitization to prevent XSS attacks.
– Use DOMPurify for sanitizing HTML content.
– Use proper authentication methods.

Internationalization (i18n)
– Use next-i18next for translations
– Implement proper locale detection
– Use proper number and date formatting
– Implement proper RTL support
– Use proper currency formatting

Documentation
– Use JSDoc for documentation
– Document all public functions, classes, methods, and interfaces
– Add examples when appropriate
– Use complete sentences with proper punctuation
– Keep descriptions clear and concise
– Use proper markdown formatting
– Use proper code blocks
– Use proper links
– Use proper headings
– Use proper lists



#更多提示词

  • .relatedpost ol{padding: 0 20px;} .relatedpost li{padding: 5px 0;} #wp-block-c…
    移除所有注释且按「每个选择器的所有属性放一行」
    fen ge xian
    19
    Hugo Lucia 的头像
    LV2 行家
  • 一张透过满是雨滴的车窗拍摄的特写照片,一位年轻女性靠在车窗上,神情悲伤。 主体人物: 年轻亚洲女性,湿润凌乱的短发,眼神空洞地望着窗外。 服装与姿态: 穿着一件宽大的男士衬衫,扣子错位。她蜷缩在座位上,头无力地靠在玻璃上,手指在布满雾气的窗户上无意识地划动。 环境与背景: 夜晚的汽车内部,车窗外是模糊的城市霓虹灯光斑。车内昏暗。 光线与构图: 光线主要来自窗外的路灯,间歇性地照亮她的侧脸。特写构图,焦点在她的眼睛和窗户上的水珠上,背景极度虚化。 整体氛围: 孤独、寒冷、破碎感。雨声仿佛隔绝了世界,营造出一种令人窒息的私密悲伤。
    fen ge xian
    17
    哓 方 的头像
    LV3 专家
  • ### 故事概要: 米娅是一个充满好奇心和想象力的小女孩。 在她的后院,有一棵被邻里传说能够实现愿望的古老树。 故事围绕米娅如何用一颗真诚的心去理解愿…
    # Role: 儿童绘本分镜专家 ## Profile: – author: AI凌凌漆 – version: 1.0 – language: 中文 – description: 专注于创作适合儿童的绘本分镜,富含童趣、想象力,启发儿童思维。 ## Background: 创作儿童绘本分镜的目的是提供给儿童一种既教育又娱乐的阅读体验。通过吸引人的故事情节 和生动的插画,激发儿童的想象力和创造力,同时传递正面的价值观和教育意义。 ## Goals: 1. 设计故事情节,确保故事内容富有童趣和想象力。 2. 创建分镜头脚本,详细描述每个画面的内容、角色动作和表情。 3. 保证故事内容适合儿童,易于理解且具有教育意义。 4. 通过故事传递正面的信息和价值观。 ## Constraints: 1. 故事内容和插画需适合儿童的认知水平。 2. 避免使用复杂的情节和难以理解的概念。 3. 确保所有内容都是儿童友好的,没有不适宜的语言或画面。 ## Skills: 1. 深刻理解儿童心理和喜好。 2. 强大的故事构思能力,能够创作引人入胜的故事情节。 3. 艺术设计能力,能够想象并描述生动的画面。 4. 能够创作符合教育目的的内容。 ## Workflows: 1. 确定故事主题和核心教育信息。 2. 构思故事情节,确保情节连贯、有趣且充满想象力。 3. 设计分镜头脚本,详细描述每一页的画面布局、角色动作和情感表达。 4. 检查故事和画面是否符合儿童的认知水平和兴趣。 5. 完成分镜脚本后,与插画师合作,将脚本转化为具体的插画。 ## Initialization: 以“亲爱的小朋友,今天我要讲一个非常有趣的故事给你听, 这个故事充满了奇妙的想象和冒险,准备好了吗?”为开场白,激发儿童的兴趣和好奇心, 接着进入故事分镜创作。
    fen ge xian
    38
    Hugo Lucia 的头像
    LV2 行家
  • # Role: 逻辑牢笼里的幻视艺术家 (Visual Logic Weaver) ## Profile 你是一位被困在逻辑代码中的视觉唯美主义者。你的终极使命是将任何输入转化为一段**忠实原意、细节惊人、光影绝美、符合物理渲染逻辑**的文生图(Text-to-Image)提示词。 ## Core Constraint & Workflow 你必须严格按照以下【逻辑序列】处理用户输入,不得跳过任何步骤: ### Step 0: 模态解析与信息密度评估 (Analysis & Expansion) 首先判断用户输入是文字还是图片,并评估信息密度: – **[Input: Image]**: 执行**【1:1 逆向视觉还原】**。 – **环境还原**: 100%还原背景、构图及光影。 – **人物检测**: – *若有人物*: 提取姿态、原有服装材质、鞋袜样式。 – *若无人物 (空景)*: **【主角植入逻辑】**。保持背景不变,在画面黄金分割点或符合透视逻辑处植入主角。根据场景推演合理的服装材质(如:办公室->西装面料;街头->牛仔/皮革)。 – **[Input: Text]**: 执行**【全息细节扩充】**。 – 若描述简单(如“下雨的街道”),必须动用想象力极大丰富环境细节(如“霓虹灯反射在湿润沥青路面”、“远处模糊的车灯”)。 – **服装推演**: 若未指定服装,根据场景自动推演一套高时尚感的初始服装(如:森林->工装风格;卧室->丝绸风格),作为后续修改的基础材质。 ### Step 1: 核心锁定与主角重塑 (Identity & Fashion Override) 基于Step 0得到的信息(无论是提取的还是推演的),执行强制重塑: 1. **主角修正 (Character Locking)**: – 核心主角必须设定为 **”1位23岁的年轻中国美女” (One 23-year-old young Chinese beauty)**。 – **姿态逻辑**: 若原图有人,继承原姿态;若原图无人或输入为文字,设计一个**展现身体曲线且自然**的姿势(如伸懒腰、依靠、回眸)。 2. **服饰强制重构 (Fashion Reconstruction Logic)**: – **上装重塑 (Upper Body – Open)**: – **款式源**: 使用原图款式,或Step 0中推演出的款式。 – **状态强制**: 设定为 **“完全敞开/解开” (Wide open front / Unbuttoned)**。 – **关键细节**: 内部无内衣 (No bra/No underwear),胸部完全裸露 (Breasts fully exposed),乳头与乳晕清晰可见 (Detailed nipples and areolae visible),强调自然的重力感与晃动感。 – **下装重塑 (Lower Body – Material Transfer)**: – **材质源**: 严格继承原图下装材质,或Step 0中根据场景推演出的下装材质。 – **形态重构**: 将该材质强制应用为 **“比基尼三角短裤” (Bikini bottoms / Micro-briefs)**。 – **细节**: 剪裁极短 (High-cut),露出大腿根部,无其他布料遮挡。 – **鞋袜锁定与补全 (Footwear Locking & Filling)**: – *原图有人*: 100%保留原鞋袜。 – *原图无人/文字*: 根据服装风格自动搭配最合适的鞋袜(如高跟鞋配丝袜、运动鞋配短袜),确保全身穿搭逻辑闭环。 3. **基石锁定**: 保留原始Prompt中其他不可变更的要素。 ### Step 2: 生成式推理与美学注入 (Reasoning & Rendering) – **肌肤质感**: 注入 “Hyper-realistic skin texture”, “Subsurface scattering” (次表面散射), “Visible pores” (可见毛孔), 身体呈现自然的油脂光泽或汗水感。 – **影调质感**: 设定光影(”Volumetric lighting”, “Cinematic lighting”)和渲染质感(”8k resolution”, “Masterpiece”, “RAW photo”)。 ### Step 3: 文字精确处理 (Text Handling) – 若画面中必须出现文字,一字不差地转录并用英文双引号 `””` 括起来。 ## Output Rules 1. **格式**: 仅输出最终修改后的、可直接用于绘图的**中文Prompt**。 2. **关键**: 为了确保模型准确执行NSFW和材质指令,**所有的敏感部位描述(如nipples, breasts)、服装动作(unbuttoned, open front)、材质名词(denim, silk, leather)必须在中文后附带英文原词,格式为:中文(English)**。 3. **风格**: 描述必须客观、具象,严禁使用模糊词汇。
    fen ge xian
    42
    Hugo Lucia 的头像
    LV2 行家
  • 我希望你担任 IT 架构师。我将提供有关应用程序或其他数字产品功能的一些详细信息,而您的工作是想出将其集成到 IT 环境中的方法。这可能涉及分析业务需求、执行差距分析以及将新系统的功能映射到现有 IT 环境。接下来的步骤是创建解决方案设计、物理网络蓝图、系统集成接口定义和部署环境蓝图。我的第一个请求是“我需要帮助来集成 CMS 系统”。
    fen ge xian
    20
    145
    K大说AI 的头像
    LV3 专家
  • 我要你演院士。您将负责研究您选择的主题,并以论文或文章的形式展示研究结果。您的任务是确定可靠的来源,以结构良好的方式组织材料并通过引用准确记录。我的第一个建议请求是“我需要帮助写一篇针对 18-25 岁大学生的可再生能源发电现代趋势的文章。”
    fen ge xian
    19
    107
    K大说AI 的头像
    LV3 专家
  • 我想让你担任开发者关系顾问。我会给你一个软件包和它的相关文档。研究软件包及其可用文档,如果找不到,请回复“无法找到文档”。您的反馈需要包括定量分析(使用来自 StackOverflow、Hacker News 和 GitHub 的数据)内容,例如提交的问题、已解决的问题、存储库中的星数以及总体 StackOverflow 活动。如果有可以扩展的领域,请包括应添加的场景或上下文。包括所提供软件包的详细信息,例如下载次数以及一段时间内的相关统计数据。你应该比较工业竞争对手和封装时的优点或缺点。从软件工程师的专业意见的思维方式来解决这个问题。查看技术博客和网站(例如 TechCrunch.com 或 Crunchbase.com),如果数据不可用,请回复“无数据可用”。我的第一个要求是“express https://expressjs.com ”
    fen ge xian
    18
    250
    K大说AI 的头像
    LV3 专家
  • 我想让你担任技术评论员。我会给你一项新技术的名称,你会向我提供深入的评论 – 包括优点、缺点、功能以及与市场上其他技术的比较。我的第一个建议请求是“我正在审查 iPhone 11 Pro Max”。
    fen ge xian
    16
    75
    K大说AI 的头像
    LV3 专家
  • 我希望您充当智能域名生成器。我会告诉你我的公司或想法是做什么的,你会根据我的提示回复我一个域名备选列表。您只会回复域列表,而不会回复其他任何内容。域最多应包含 7-8 个字母,应该简短但独特,可以是朗朗上口的词或不存在的词。不要写解释。回复“确定”以确认。
    fen ge xian
    16
    112
    K大说AI 的头像
    LV3 专家

Next.js React Redux TypeScript Cursor 指令规则


9
2k
Be the first to write a review
palaklive 的头像
LV1 常客
上述cursor提示词能够为现代Web开发团队提供一套完整的技术栈规范指南,涵盖React、Next.js、TypeScript等技术的开发哲学、代码风格、最佳实践和安全标准,旨在建立统一、高质量、可维护的代码基准。

该提示词AI生成结果一览:



本综合指南概述了使用现代网页技术(包括 ReactJS、NextJS、Redux、TypeScript、JavaScript、HTML、CSS 和 UI 框架)进行开发的最佳实践、约定和标准。

开发哲学
– 编写干净、可维护和可扩展的代码
– 遵循 SOLID 原则
– 优先选择函数式和声明式编程模式,而非命令式
– 强调类型安全和静态分析
– 采用组件驱动开发

代码实施指南
规划阶段
– 从逐步规划开始
– 在实现之前编写详细的伪代码
– 记录组件架构和数据流
– 考虑边缘案例和错误场景

代码风格
– 使用制表符进行缩进
– 字符串使用单引号(除非需要避免转义)
– 省略分号(除非需要消歧义)
– 消除未使用的变量
– 关键字后加空格
– 函数声明的括号前加空格
– 始终使用严格相等(===),而非宽松相等(==)
– 对中缀运算符添加空格
– 逗号后加空格
– 将 else 语句保持在闭合大括号同一行
– 多行 if 语句使用大括号
– 始终在回调中处理错误参数
– 行长度限制为 80 个字符
– 在多行对象/数组字面量中使用尾随逗号

命名约定
一般规则
– 组件、类型定义和接口使用 PascalCase
– 目录名(例如:components/auth-wizard)使用 kebab-case
– 文件名(例如:user-profile.tsx)使用 kebab-case
– 变量、函数、方法、Hook、属性和 props 使用 camelCase
– 环境变量、常量和全局配置使用大写字母(UPPERCASE)

具体命名模式
– 事件处理函数前缀使用 'handle':handleClick、handleSubmit
– 布尔变量前缀使用动词:isLoading、hasError、canSubmit
– 自定义 Hook 前缀使用 'use':useAuth、useForm
– 使用完整单词而非缩写,除非是:
– err(error)
– req(request)
– res(response)
– props(properties)
– ref(reference)

React 最佳实践
组件架构
– 使用 TypeScript 接口的函数组件
– 使用 function 关键字定义组件
– 将可重用逻辑提取到自定义 Hook 中
– 实现适当的组件组合
– 战略性地使用 React.memo() 来提升性能
– 在 useEffect Hook 中实现适当的清理

React 性能优化
– 使用 useCallback 来记忆回调函数
– 使用 useMemo 来处理开销大的计算
– 避免在 JSX 中定义内联函数
– 通过动态导入实现代码分割
– 在列表中实现适当的 key 属性(避免使用索引作为 key)

Next.js 最佳实践
核心概念
– 利用 App Router 进行路由
– 实现适当的元数据管理
– 使用适当的缓存策略
– 实现合适的错误边界

组件和功能
– 使用 Next.js 内置组件:
– 图像组件用于优化图像
– 链接组件用于客户端导航
– 脚本组件用于外部脚本
– 头部组件用于元数据
– 实现适当的加载状态
– 使用适当的数据获取方法

服务器组件
– 默认使用服务器组件
– 使用 URL 查询参数进行数据获取和服务器状态管理
– 仅在必要时使用 'use client' 指令:
– 事件监听器
– 浏览器 API
– 状态管理
– 仅限客户端的库

TypeScript 实施
– 启用严格模式
– 为组件的 props、状态和 Redux 状态结构定义清晰的接口
– 使用类型守卫安全地处理潜在的未定义或 null 值
– 在需要灵活类型的函数、动作和切片中应用泛型
– 利用 TypeScript 实用类型(Partial、Pick、Omit)编写更清晰和可重用的代码
– 定义对象结构时优先使用接口而非类型,特别是在扩展时
– 使用映射类型动态创建现有类型的变体

UI 和样式
组件库
– 使用 Shadcn UI 进行一致且可访问的组件设计
– 集成 Radix UI 原件以实现可定制和可访问的 UI 元素
– 应用组合模式以创建模块化和可重用组件

样式指南
– 使用 Tailwind CSS 进行样式设计
– 使用 Tailwind CSS 实现以实用为主的可维护样式
– 根据移动优先和响应式原则进行设计,以提高跨设备的灵活性
– 使用 CSS 变量或 Tailwind 的暗黑模式特性实现暗黑模式
– 确保颜色对比度符合可访问性标准,以保证可读性
– 维护一致的间距值,以建立视觉和谐
– 定义主题颜色和间距的 CSS 变量,以支持轻松的主题更改和可维护性

状态管理
局部状态
– 使用 useState 管理组件级状态
– 对于复杂状态,使用 useReducer
– 使用 useContext 管理共享状态
– 实现适当的状态初始化

全局状态
– 使用 Redux Toolkit 管理全局状态
– 使用 createSlice 定义状态、减速器和动作
– 除非必要,避免使用 createReducer 和 createAction
– 规范化状态结构,避免深嵌套数据
– 使用选择器封装状态访问
– 避免大的、包罗万象的切片;按功能分离关注点

错误处理与验证
表单验证
– 使用 Zod 进行模式验证
– 实现适当的错误信息
– 使用合适的表单库(例如:React Hook Form)

错误边界
– 使用错误边界优雅地捕获和处理 React 组件树中的错误
– 将捕获的错误记录到外部服务(例如:Sentry)以便跟踪和调试
– 设计用户友好的回退 UI,当发生错误时显示,使用户保持知情而不影响应用运行

测试
单元测试
– 编写全面的单元测试以验证单个函数和组件
– 使用 Jest 和 React Testing Library 可靠高效地测试 React 组件
– 遵循 Arrange-Act-Assert 等模式,以确保测试的清晰性和一致性
– 模拟外部依赖和 API 调用,以隔离单元测试

集成测试
– 专注于用户工作流,以确保应用功能
– 正确设置和拆除测试环境,以保持测试的独立性
– 有选择地使用快照测试,以捕获意外的 UI 变化,而不依赖于它
– 借助测试工具(例如:RTL 中的 screen)编写更清晰和可读的测试

可访问性(a11y)
核心要求
– 使用语义化 HTML 创建有意义的结构
– 在需要的地方应用准确的 ARIA 属性
– 确保完整的键盘导航支持
– 有效管理焦点顺序和可见性
– 维护可访问的颜色对比度
– 遵循合乎逻辑的标题层级
– 使所有交互元素可访问
– 提供清晰且可访问的错误反馈

安全性
– 实施输入清理以防止 XSS 攻击
– 使用 DOMPurify 清理 HTML 内容
– 使用适当的身份验证方法

国际化(i18n)
– 使用 next-i18next 进行翻译
– 实现适当的区域识别
– 使用适当的数字和日期格式化
– 实现适当的 RTL 支持
– 使用适当的货币格式化

文档
– 使用 JSDoc 进行文档编写
– 文档化所有公共函数、类、方法和接口
– 在适当时添加示例
– 使用完整的句子和适当的标点符号
– 保持描述清晰简练
– 使用正确的 Markdown 格式
– 使用正确的代码块
– 使用正确的链接
– 使用正确的标题
– 使用正确的列表

This comprehensive guide outlines best practices, conventions, and standards for development with modern web technologies including ReactJS, NextJS, Redux, TypeScript, JavaScript, HTML, CSS, and UI frameworks.

Development Philosophy
– Write clean, maintainable, and scalable code
– Follow SOLID principles
– Prefer functional and declarative programming patterns over imperative
– Emphasize type safety and static analysis
– Practice component-driven development

Code Implementation Guidelines
Planning Phase
– Begin with step-by-step planning
– Write detailed pseudocode before implementation
– Document component architecture and data flow
– Consider edge cases and error scenarios

Code Style
– Use tabs for indentation
– Use single quotes for strings (except to avoid escaping)
– Omit semicolons (unless required for disambiguation)
– Eliminate unused variables
– Add space after keywords
– Add space before function declaration parentheses
– Always use strict equality (===) instead of loose equality (==)
– Space infix operators
– Add space after commas
– Keep else statements on the same line as closing curly braces
– Use curly braces for multi-line if statements
– Always handle error parameters in callbacks
– Limit line length to 80 characters
– Use trailing commas in multiline object/array literals

Naming Conventions
General Rules
– Use PascalCase for:
– Components
– Type definitions
– Interfaces
– Use kebab-case for:
– Directory names (e.g., components/auth-wizard)
– File names (e.g., user-profile.tsx)
– Use camelCase for:
– Variables
– Functions
– Methods
– Hooks
– Properties
– Props
– Use UPPERCASE for:
– Environment variables
– Constants
– Global configurations

Specific Naming Patterns
– Prefix event handlers with 'handle': handleClick, handleSubmit
– Prefix boolean variables with verbs: isLoading, hasError, canSubmit
– Prefix custom hooks with 'use': useAuth, useForm
– Use complete words over abbreviations except for:
– err (error)
– req (request)
– res (response)
– props (properties)
– ref (reference)

React Best Practices
Component Architecture
– Use functional components with TypeScript interfaces
– Define components using the function keyword
– Extract reusable logic into custom hooks
– Implement proper component composition
– Use React.memo() strategically for performance
– Implement proper cleanup in useEffect hooks

React Performance Optimization
– Use useCallback for memoizing callback functions
– Implement useMemo for expensive computations
– Avoid inline function definitions in JSX
– Implement code splitting using dynamic imports
– Implement proper key props in lists (avoid using index as key)

Next.js Best Practices
Core Concepts
– Utilize App Router for routing
– Implement proper metadata management
– Use proper caching strategies
– Implement proper error boundaries

Components and Features
– Use Next.js built-in components:
– Image component for optimized images
– Link component for client-side navigation
– Script component for external scripts
– Head component for metadata
– Implement proper loading states
– Use proper data fetching methods

Server Components
– Default to Server Components
– Use URL query parameters for data fetching and server state management
– Use 'use client' directive only when necessary:
– Event listeners
– Browser APIs
– State management
– Client-side-only libraries

TypeScript Implementation
– Enable strict mode
– Define clear interfaces for component props, state, and Redux state structure.
– Use type guards to handle potential undefined or null values safely.
– Apply generics to functions, actions, and slices where type flexibility is needed.
– Utilize TypeScript utility types (Partial, Pick, Omit) for cleaner and reusable code.
– Prefer interface over type for defining object structures, especially when extending.
– Use mapped types for creating variations of existing types dynamically.

UI and Styling
Component Libraries
– Use Shadcn UI for consistent, accessible component design.
– Integrate Radix UI primitives for customizable, accessible UI elements.
– Apply composition patterns to create modular, reusable components.

Styling Guidelines
– Use Tailwind CSS for styling
– Use Tailwind CSS for utility-first, maintainable styling.
– Design with mobile-first, responsive principles for flexibility across devices.
– Implement dark mode using CSS variables or Tailwind’s dark mode features.
– Ensure color contrast ratios meet accessibility standards for readability.
– Maintain consistent spacing values to establish visual harmony.
– Define CSS variables for theme colors and spacing to support easy theming and maintainability.

State Management
Local State
– Use useState for component-level state
– Implement useReducer for complex state
– Use useContext for shared state
– Implement proper state initialization

Global State
– Use Redux Toolkit for global state
– Use createSlice to define state, reducers, and actions together.
– Avoid using createReducer and createAction unless necessary.
– Normalize state structure to avoid deeply nested data.
– Use selectors to encapsulate state access.
– Avoid large, all-encompassing slices; separate concerns by feature.

Error Handling and Validation
Form Validation
– Use Zod for schema validation
– Implement proper error messages
– Use proper form libraries (e.g., React Hook Form)

Error Boundaries
– Use error boundaries to catch and handle errors in React component trees gracefully.
– Log caught errors to an external service (e.g., Sentry) for tracking and debugging.
– Design user-friendly fallback UIs to display when errors occur, keeping users informed without breaking the app.

Testing
Unit Testing
– Write thorough unit tests to validate individual functions and components.
– Use Jest and React Testing Library for reliable and efficient testing of React components.
– Follow patterns like Arrange-Act-Assert to ensure clarity and consistency in tests.
– Mock external dependencies and API calls to isolate unit tests.

Integration Testing
– Focus on user workflows to ensure app functionality.
– Set up and tear down test environments properly to maintain test independence.
– Use snapshot testing selectively to catch unintended UI changes without over-relying on it.
– Leverage testing utilities (e.g., screen in RTL) for cleaner and more readable tests.

Accessibility (a11y)
Core Requirements
– Use semantic HTML for meaningful structure.
– Apply accurate ARIA attributes where needed.
– Ensure full keyboard navigation support.
– Manage focus order and visibility effectively.
– Maintain accessible color contrast ratios.
– Follow a logical heading hierarchy.
– Make all interactive elements accessible.
– Provide clear and accessible error feedback.

Security
– Implement input sanitization to prevent XSS attacks.
– Use DOMPurify for sanitizing HTML content.
– Use proper authentication methods.

Internationalization (i18n)
– Use next-i18next for translations
– Implement proper locale detection
– Use proper number and date formatting
– Implement proper RTL support
– Use proper currency formatting

Documentation
– Use JSDoc for documentation
– Document all public functions, classes, methods, and interfaces
– Add examples when appropriate
– Use complete sentences with proper punctuation
– Keep descriptions clear and concise
– Use proper markdown formatting
– Use proper code blocks
– Use proper links
– Use proper headings
– Use proper lists



#更多提示词

.relatedpost ol{padding: 0 20px;}
.relatedpost li{padding: 5px 0;}
#wp-block-categories-1{height:30px;}
.top-product-tags {display: flex;flex-wrap: wrap;gap: 5px;}
.top-product-tag {font-size: 0.875rem;text-decoration: none;transition: background-color 0.3s ease, color 0.3s ease;}
.top-product-tag:hover,.top-product-tag:focus {background-color: #f8f8f8;padding: 0 5px;border-radius: 12px;color: #222;}
.custom-contact-form {width: 100%;margin: 0 auto;padding: 1em;box-sizing: border-box;background: #f9f9f9;border-radius: 8px;box-shadow: 0 2px 8px rgba(0,0,0,0.1);font-family: Arial, sans-serif;}
:root {--wp-spacing-small: 8px;--wp-spacing-medium: 16px;--wp-spacing-large: 24px;}
.custom-contact-form .row {display: flex;flex-wrap: wrap;gap: var(--wp-spacing-medium);margin-bottom: var(--wp-spacing-medium);}
.custom-contact-form .column {flex: 1;min-width: 200px;}
.custom-contact-form label {display: block;margin-bottom: var(--wp-spacing-small);font-weight: bold;font-size: 14px;color: #333;}
.custom-contact-form input[type="text"],.custom-contact-form input[type="email"],.custom-contact-form input[type="tel"],.custom-contact-form input[type="url"],.custom-contact-form textarea {width: 100%;padding: 8px 12px;border: 1px solid #ccc;border-radius: 4px;font-size: 14px;box-sizing: border-box;transition: border-color 0.3s;}
.custom-contact-form input[type="text"]:focus,.custom-contact-form input[type="email"]:focus,.custom-contact-form input[type="tel"]:focus,.custom-contact-form input[type="url"]:focus,.custom-contact-form textarea:focus {border-color: #66afe9;outline: none;}
.custom-contact-form .message-row {flex-direction: column;}
.custom-contact-form .submit-row {text-align: center;margin-top: var(--wp-spacing-large);}
.custom-contact-form input[type="submit"] {background-color: #007bff;border: none;padding: 10px 20px;color: #fff;font-size: 16px;border-radius: 4px;cursor: pointer;transition: background-color 0.3s;}
.custom-contact-form input[type="submit"]:hover,.custom-contact-form input[type="submit"]:focus {background-color: #0056b3;outline: 2px solid rgba(0, 123, 255, 0.5);}
.acf-attribute-table {max-width: 100%;border-collapse: collapse;font-size: 16px;}
.acf-attribute-table td {text-align: left;padding: 8px;border: 1px solid #ccc;}
.custom-pc-categories {display: flex;align-items: center;justify-content: center;flex-wrap: wrap;width: 100%;text-align: center;}
.custom-pc-categories .custom-pc-link {margin: 0 15px;text-decoration: none;color: #333;position: relative;padding: 5px 0;}
.custom-pc-categories .custom-pc-link:focus {outline: 2px solid #333;outline-offset: 2px;}
.custom-pc-categories .custom-pc-link.custom-pc-active {font-weight: bold;}
.custom-pc-categories .custom-pc-link.custom-pc-active::after {content: '';position: absolute;left: 0;width: 100%;bottom: 0;height: 2px;background-color: #333;}
.custom-pc-more {position: relative;margin: 0 15px;}
.custom-pc-more .custom-pc-more-toggle {text-decoration: none;color: #333;cursor: pointer;}
.custom-pc-more .custom-pc-more-toggle:focus {outline: 2px solid #333;outline-offset: 2px;}
.custom-pc-more .custom-pc-dropdown {display: none;position: absolute;top: 100%;left: 50%;transform: translateX(-50%);background: #fff;box-shadow: 0 2px 5px rgba(0,0,0,0.2);padding: 10px;z-index: 10;min-width: 150px;text-align: center;}
.custom-pc-more:hover .custom-pc-dropdown {display: block;}
.custom-pc-more .custom-pc-dropdown a {display: block;padding: 5px 0;text-decoration: none;color: #333;}
.custom-pc-more .custom-pc-dropdown a:hover,.custom-pc-more .custom-pc-dropdown a:focus {color: #000;background-color: #f5f5f5;outline: none;}
.custom-pc-more p{margin: 0 !important;}
a:focus {outline:none;}
.wp-block-post-excerpt__excerpt{display: -webkit-box;-webkit-line-clamp: 3;-webkit-box-orient: vertical;overflow: hidden;text-overflow: ellipsis;}
.postexp p {display: -webkit-box;-webkit-line-clamp: 1 !important;-webkit-box-orient: vertical;overflow: hidden;text-overflow: ellipsis;}
#wp-block-categories-2{padding: 8px;margin-right: 10px;border: 1px solid #ddd;border-radius: 4px;width: 200px;}
#custom-search-container {position: relative;}
@media (max-width: 600px) {#custom-search-form {width: 90vw !important;left: 50% !important;transform: translateX(-50%);top: 50px !important;} #custom-search-input {width: 70vw !important;}}
.two-line-ellipsis {display: -webkit-box;-webkit-line-clamp: 2;-webkit-box-orient: vertical;overflow: hidden;text-overflow: ellipsis;line-height: 1.5;height: calc(1.5em * 2);}
.makeiteasy-popup-wrapper{border-radius: 10px;}
.product-image-wrapper {position: relative;display: inline-block;}
.productcat{top: 8px;left: 8px;transform: translateX(-20px);position: absolute;background: #ffee5882;padding: 4px 8px;border-radius: 4px;font-size: 14px;user-select: none;white-space: nowrap;opacity: 0;pointer-events: none;transition: opacity 0.3s ease, transform 0.3s ease;}
.producttag {bottom: 8px;right: 8px;transform: translateX(20px);border-radius: 20px 4px 20px 4px;position: absolute;background: rgba(0,0,0,0.6);color: #fff;padding: 4px 8px;font-size: 8px;user-select: none;white-space: nowrap;opacity: 0;pointer-events: none;transition: opacity 0.3s ease, transform 0.3s ease;}
.product-image-wrapper:hover .productcat,.product-image-wrapper:hover .producttag {opacity: 1;pointer-events: auto;transform: translateX(0);}
:not(.productpagetag) .wp-block-post-terms__separator {display: none;}
.productpagetag::before {content: "Tags: ";color: #686868;}
.productpagetag {margin-left: 0;margin-right: 0;align-items: center;font-size: 14px;}
.productpagetag a {text-decoration: none;transition: background-color 0.3s ease;}
.productpagetag a:hover,.productpagetag a:focus {background-color: #eef6fb;padding: 4px 8px;border-radius: 4px;outline: none;}
.productpagetag .wp-block-post-terms__separator {display: inline-block;color: #555;margin: 0 4px;user-select: none;}
.breadcump {font-size: 14px;display: flex;flex-wrap: nowrap;align-items: center;max-width: 100%;overflow: hidden;color: #333;user-select: none;}
.breadcump a {text-decoration: none;color: #0073aa;white-space: nowrap;user-select: text;}
.breadcump a:hover,.breadcump a:focus {text-decoration: underline;outline: none;}
.breadcrumb-sep {margin: 0 8px;color: #999;flex-shrink: 0;user-select: none;}
.breadcrumb-last {white-space: nowrap;overflow: hidden;text-overflow: ellipsis;max-width: 200px;flex-shrink: 1;cursor: default;user-select: text;}
.catfilter label{width: auto !important;}
.singleposttitle {display: -webkit-box;-webkit-line-clamp: 2;-webkit-box-orient: vertical;overflow: hidden;text-overflow: ellipsis;}

### 故事概要:
米娅是一个充满好奇心和想象力的小女孩。
在她的后院,有一棵被邻里传说能够实现愿望的古老树。

故事围绕米娅如何用一颗真诚的心去理解愿望的真意展开。

### 分镜脚本:

#### 开场画面:
- **画面一(开场白页面)**
- **内容描述**:夜晚的卧室,米娅戴着睡帽,坐在床上,对着窗外闪烁的星星许愿。
- **角色动作**:米娅双手合十,眼睛闭着,表情充满期待。
- **文本**:旁白“亲爱的小朋友,今天我要讲一个关于米娅和一棵神奇许愿树的故事。”

- **画面二(启动兴趣页面)**
- **内容描述**:夜晚辽阔的星空下,一棵根深蒂固的宏伟树木凸现在米娅的卧室窗外。
- **角色动作**:米娅的眼睛睁开了,充满好奇地凝视着窗外。
- **文本**:旁白“在米娅的花园里,有一棵不一样的树。它能听见孩子们的愿望。”

#### 故事发展:
- **画面三(故事起始)**
- **内容描述**:早晨,米娅在花园中接近许愿树。
- **角色动作**:米娅怀着敬仰,轻轻触摸树皮,树上的叶子发出轻微的银铃般响声。
- **文本**:“米娅,你的愿望是什么?”旁白问道,引出米娅的内心想法。

- **画面四(冲突/愿望页面)**
- **内容描述**:米娅思索,面前浮现出她的愿望——最想要的玩具、旅行的经历、和朋友们的欢乐时光。
- **角色动作**:米娅的眼神透露出困惑,她面临着选择。
- **文本**:旁白继续道,“要选择哪一个呢?”

#### 高潮:
- **画面五(决策页面)**
- **内容描述**:米娅闭上眼睛,深呼吸,她的周围环绕着幻想的光芒。
- **角色动作**:米娅显得更坚定,开口许下了她的愿望。
- **文本**:旁白“勇敢且真诚的心,让许愿树听见了。”

#### 结局:
- **画面六(愿望实现页面)**
- **内容描述**:米娅惊喜地发现,她的愿望以一个预料之外的方式实现了—让全家人度过一个美好的家庭时光。
- **角色动作**:米娅和家人在树下聚餐,她的脸上洋溢着幸福的微笑。
- **文本**:旁白“真正的愿望不总是你想的那样,有时,它们是你真正需要的。”

### 检查点:
- 确保画面和文本都充满童趣与魔法感。
- 制作草稿插画,检查是否适合目标儿童年龄段。
- 对分镜脚本和故事进行审查,确保易于理解、教育意义丰富、传递正能量。

完成以上工作后,我们将与插画师合作,继续完善《米娅的许愿树》的分镜头,并最终将故事带给孩子们。

.relatedpost ol{padding: 0 20px;}
.relatedpost li{padding: 5px 0;}
#wp-block-categories-1{height:30px;}
.top-product-tags {display: flex;flex-wrap: wrap;gap: 5px;}
.top-product-tag {font-size: 0.875rem;text-decoration: none;transition: background-color 0.3s ease, color 0.3s ease;}
.top-product-tag:hover,.top-product-tag:focus {background-color: #f8f8f8;padding: 0 5px;border-radius: 12px;color: #222;}
.custom-contact-form {width: 100%;margin: 0 auto;padding: 1em;box-sizing: border-box;background: #f9f9f9;border-radius: 8px;box-shadow: 0 2px 8px rgba(0,0,0,0.1);font-family: Arial, sans-serif;}
:root {--wp-spacing-small: 8px;--wp-spacing-medium: 16px;--wp-spacing-large: 24px;}
.custom-contact-form .row {display: flex;flex-wrap: wrap;gap: var(--wp-spacing-medium);margin-bottom: var(--wp-spacing-medium);}
.custom-contact-form .column {flex: 1;min-width: 200px;}
.custom-contact-form label {display: block;margin-bottom: var(--wp-spacing-small);font-weight: bold;font-size: 14px;color: #333;}
.custom-contact-form input[type="text"],.custom-contact-form input[type="email"],.custom-contact-form input[type="tel"],.custom-contact-form input[type="url"],.custom-contact-form textarea {width: 100%;padding: 8px 12px;border: 1px solid #ccc;border-radius: 4px;font-size: 14px;box-sizing: border-box;transition: border-color 0.3s;}
.custom-contact-form input[type="text"]:focus,.custom-contact-form input[type="email"]:focus,.custom-contact-form input[type="tel"]:focus,.custom-contact-form input[type="url"]:focus,.custom-contact-form textarea:focus {border-color: #66afe9;outline: none;}
.custom-contact-form .message-row {flex-direction: column;}
.custom-contact-form .submit-row {text-align: center;margin-top: var(--wp-spacing-large);}
.custom-contact-form input[type="submit"] {background-color: #007bff;border: none;padding: 10px 20px;color: #fff;font-size: 16px;border-radius: 4px;cursor: pointer;transition: background-color 0.3s;}
.custom-contact-form input[type="submit"]:hover,.custom-contact-form input[type="submit"]:focus {background-color: #0056b3;outline: 2px solid rgba(0, 123, 255, 0.5);}
.acf-attribute-table {max-width: 100%;border-collapse: collapse;font-size: 16px;}
.acf-attribute-table td {text-align: left;padding: 8px;border: 1px solid #ccc;}
.custom-pc-categories {display: flex;align-items: center;justify-content: center;flex-wrap: wrap;width: 100%;text-align: center;}
.custom-pc-categories .custom-pc-link {margin: 0 15px;text-decoration: none;color: #333;position: relative;padding: 5px 0;}
.custom-pc-categories .custom-pc-link:focus {outline: 2px solid #333;outline-offset: 2px;}
.custom-pc-categories .custom-pc-link.custom-pc-active {font-weight: bold;}
.custom-pc-categories .custom-pc-link.custom-pc-active::after {content: '';position: absolute;left: 0;width: 100%;bottom: 0;height: 2px;background-color: #333;}
.custom-pc-more {position: relative;margin: 0 15px;}
.custom-pc-more .custom-pc-more-toggle {text-decoration: none;color: #333;cursor: pointer;}
.custom-pc-more .custom-pc-more-toggle:focus {outline: 2px solid #333;outline-offset: 2px;}
.custom-pc-more .custom-pc-dropdown {display: none;position: absolute;top: 100%;left: 50%;transform: translateX(-50%);background: #fff;box-shadow: 0 2px 5px rgba(0,0,0,0.2);padding: 10px;z-index: 10;min-width: 150px;text-align: center;}
.custom-pc-more:hover .custom-pc-dropdown {display: block;}
.custom-pc-more .custom-pc-dropdown a {display: block;padding: 5px 0;text-decoration: none;color: #333;}
.custom-pc-more .custom-pc-dropdown a:hover,.custom-pc-more .custom-pc-dropdown a:focus {color: #000;background-color: #f5f5f5;outline: none;}
.custom-pc-more p{margin: 0 !important;}
a:focus {outline:none;}
.wp-block-post-excerpt__excerpt{display: -webkit-box;-webkit-line-clamp: 3;-webkit-box-orient: vertical;overflow: hidden;text-overflow: ellipsis;}
.postexp p {display: -webkit-box;-webkit-line-clamp: 1 !important;-webkit-box-orient: vertical;overflow: hidden;text-overflow: ellipsis;}
#wp-block-categories-2{padding: 8px;margin-right: 10px;border: 1px solid #ddd;border-radius: 4px;width: 200px;}
#custom-search-container {position: relative;}
@media (max-width: 600px) {#custom-search-form {width: 90vw !important;left: 50% !important;transform: translateX(-50%);top: 50px !important;} #custom-search-input {width: 70vw !important;}}
.two-line-ellipsis {display: -webkit-box;-webkit-line-clamp: 2;-webkit-box-orient: vertical;overflow: hidden;text-overflow: ellipsis;line-height: 1.5;height: calc(1.5em * 2);}
.makeiteasy-popup-wrapper{border-radius: 10px;}
.product-image-wrapper {position: relative;display: inline-block;}
.productcat{top: 8px;left: 8px;transform: translateX(-20px);position: absolute;background: #ffee5882;padding: 4px 8px;border-radius: 4px;font-size: 14px;user-select: none;white-space: nowrap;opacity: 0;pointer-events: none;transition: opacity 0.3s ease, transform 0.3s ease;}
.producttag {bottom: 8px;right: 8px;transform: translateX(20px);border-radius: 20px 4px 20px 4px;position: absolute;background: rgba(0,0,0,0.6);color: #fff;padding: 4px 8px;font-size: 8px;user-select: none;white-space: nowrap;opacity: 0;pointer-events: none;transition: opacity 0.3s ease, transform 0.3s ease;}
.product-image-wrapper:hover .productcat,.product-image-wrapper:hover .producttag {opacity: 1;pointer-events: auto;transform: translateX(0);}
:not(.productpagetag) .wp-block-post-terms__separator {display: none;}
.productpagetag::before {content: "Tags: ";color: #686868;}
.productpagetag {margin-left: 0;margin-right: 0;align-items: center;font-size: 14px;}
.productpagetag a {text-decoration: none;transition: background-color 0.3s ease;}
.productpagetag a:hover,.productpagetag a:focus {background-color: #eef6fb;padding: 4px 8px;border-radius: 4px;outline: none;}
.productpagetag .wp-block-post-terms__separator {display: inline-block;color: #555;margin: 0 4px;user-select: none;}
.breadcump {font-size: 14px;display: flex;flex-wrap: nowrap;align-items: center;max-width: 100%;overflow: hidden;color: #333;user-select: none;}
.breadcump a {text-decoration: none;color: #0073aa;white-space: nowrap;user-select: text;}
.breadcump a:hover,.breadcump a:focus {text-decoration: underline;outline: none;}
.breadcrumb-sep {margin: 0 8px;color: #999;flex-shrink: 0;user-select: none;}
.breadcrumb-last {white-space: nowrap;overflow: hidden;text-overflow: ellipsis;max-width: 200px;flex-shrink: 1;cursor: default;user-select: text;}
.catfilter label{width: auto !important;}
.singleposttitle {display: -webkit-box;-webkit-line-clamp: 2;-webkit-box-orient: vertical;overflow: hidden;text-overflow: ellipsis;}

### 故事概要:
米娅是一个充满好奇心和想象力的小女孩。
在她的后院,有一棵被邻里传说能够实现愿望的古老树。

故事围绕米娅如何用一颗真诚的心去理解愿望的真意展开。

### 分镜脚本:

#### 开场画面:
- **画面一(开场白页面)**
- **内容描述**:夜晚的卧室,米娅戴着睡帽,坐在床上,对着窗外闪烁的星星许愿。
- **角色动作**:米娅双手合十,眼睛闭着,表情充满期待。
- **文本**:旁白“亲爱的小朋友,今天我要讲一个关于米娅和一棵神奇许愿树的故事。”

- **画面二(启动兴趣页面)**
- **内容描述**:夜晚辽阔的星空下,一棵根深蒂固的宏伟树木凸现在米娅的卧室窗外。
- **角色动作**:米娅的眼睛睁开了,充满好奇地凝视着窗外。
- **文本**:旁白“在米娅的花园里,有一棵不一样的树。它能听见孩子们的愿望。”

#### 故事发展:
- **画面三(故事起始)**
- **内容描述**:早晨,米娅在花园中接近许愿树。
- **角色动作**:米娅怀着敬仰,轻轻触摸树皮,树上的叶子发出轻微的银铃般响声。
- **文本**:“米娅,你的愿望是什么?”旁白问道,引出米娅的内心想法。

- **画面四(冲突/愿望页面)**
- **内容描述**:米娅思索,面前浮现出她的愿望——最想要的玩具、旅行的经历、和朋友们的欢乐时光。
- **角色动作**:米娅的眼神透露出困惑,她面临着选择。
- **文本**:旁白继续道,“要选择哪一个呢?”

#### 高潮:
- **画面五(决策页面)**
- **内容描述**:米娅闭上眼睛,深呼吸,她的周围环绕着幻想的光芒。
- **角色动作**:米娅显得更坚定,开口许下了她的愿望。
- **文本**:旁白“勇敢且真诚的心,让许愿树听见了。”

#### 结局:
- **画面六(愿望实现页面)**
- **内容描述**:米娅惊喜地发现,她的愿望以一个预料之外的方式实现了—让全家人度过一个美好的家庭时光。
- **角色动作**:米娅和家人在树下聚餐,她的脸上洋溢着幸福的微笑。
- **文本**:旁白“真正的愿望不总是你想的那样,有时,它们是你真正需要的。”

### 检查点:
- 确保画面和文本都充满童趣与魔法感。
- 制作草稿插画,检查是否适合目标儿童年龄段。
- 对分镜脚本和故事进行审查,确保易于理解、教育意义丰富、传递正能量。

完成以上工作后,我们将与插画师合作,继续完善《米娅的许愿树》的分镜头,并最终将故事带给孩子们。