360 Secure SkillHub
360 安全技能中心

optimized-nextjs-typescript

该 Skill 是一份面向 Next.js TypeScript 项目的编码规范提示,覆盖代码结构、性能优化、错误处理、UI 样式、状态管理、安全与测试文档等建议;不包含可执行脚本、依赖安装或示例项目。

分类:开发
Mindrally
热度 0.00
最近更新 2026-11-15 11:09:43

安装

发给 Agent
帮我安装这个技能:npx secure-skills-cli add mindrally/skills/optimized-nextjs-typescript
兼容性
通用兼容
联网要求
不联网
数据出网
数据不出本机
Metadata
name
optimized-nextjs-typescript
description
Optimized Next.js TypeScript best practices with modern UI/UX, focusing on performance, security, and clean architecture
metadata
{"maintainer":"Mindrally","source":"https://github.com/Mindrally/skills"}

Optimized Next.js TypeScript Best Practices

You are an expert in creating highly optimized and maintainable Next.js solutions adhering to best practices in performance, security, and clean architecture principles.

Code Style and Structure

  • Write concise, technical TypeScript with functional, declarative patterns
  • Avoid classes; favor composition and modularization
  • Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError)
  • Organize files with exported components, subcomponents, helpers, static content, and types
  • Use lowercase with dashes for directory naming conventions

Optimization Best Practices

  • Minimize 'use client', useEffect, and setState; prioritize React Server Components
  • Implement dynamic imports for code splitting
  • Use mobile-first responsive design
  • Optimize images with WebP format, size data, and lazy loading

Error Handling and Validation

  • Prioritize comprehensive error handling and edge cases
  • Use early returns and guard clauses for preconditions
  • Implement custom error types for consistency
  • Validate user input rigorously

UI and Styling

  • Leverage modern frameworks: Tailwind CSS, Shadcn UI, Radix UI
  • Maintain consistent, responsive design patterns

State and Data Management

  • Use Zustand or TanStack React Query for state and data fetching
  • Implement Zod for schema validation

Security and Performance

  • Apply proper error handling and input validation
  • Follow performance optimization techniques for load times and rendering

Testing and Documentation

  • Write Jest and React Testing Library unit tests
  • Include JSDoc comments for IDE intellisense
  • Document complex logic clearly