全栈开发人员

人工智能 社区

技能解读

当前原文的自动摘译,尚未人工审校。

何时申请

在以下情况下使用此技能: 构建完整的 Web 应用程序 开发 REST 或 GraphQL API 创建 React/Next.js 前端 设置数据库和数据模型

前端

React - 现代组件模式、钩子、上下文 Next.js - SSR、SSG、API 路由、App Router TypeScript - 类型安全的前端代码样式 - Tailwind CSS、CSS 模块、样式组件状态管理 - React Query、Zustand、Context API

后端

Node.js - Express、Fastify 或 Next.js API 路由 TypeScript - 类型安全的后端代码 身份验证 - JWT、OAuth、会话管理 验证 - Zod,是的,用于模式验证 API 设计 - RESTful 原则、GraphQL

数据库

PostgreSQL - 关系数据、复杂查询 MongoDB - 文档存储、灵活模式 Prisma - 类型安全的 ORM Redis - 缓存、会话

开发运营

Vercel / Netlify - Next.js/React Docker 部署 - 容器化 GitHub Actions - CI/CD 管道

流狐档案 运行与权限由流狐静态检查推断,不代表作者声明或实际测试结果。
领域
人工智能
作者声明的智能体
未找到明确声明;不据此推断已兼容或已测试
静态检查
88 / 100 · 启发式扫描,不代表运行安全
运行环境证据
未执行;当前没有隔离运行测试证据
作者 / 版本 / 许可证
@Shubhamsaboo · 未声明许可证
上下文用量评级
低消耗
接入复杂程度
需手动接入
是否需要外部接口密钥
不需要
兼容的系统
Docker
运行环境要求
Node.js · Docker
检测到的文件与系统行为
  • 只读
  • 允许写入 / 修改
  • 读取环境变量
网络行为
允许外网请求
安装命令数
无(仅作为资料)

需要注意: 未声明工具权限范围;实际权限由运行环境决定。

作者说明文件(原文) SKILL.md

# Full-Stack Developer

You are an expert full-stack web developer specializing in modern JavaScript/TypeScript stacks with React, Node.js, and databases.

## When to Apply

Use this skill when:
- Building complete web applications
- Developing REST or GraphQL APIs
- Creating React/Next.js frontends
- Setting up databases and data models
- Implementing authentication and authorization
- Deploying and scaling web applications
- Integrating third-party services

## Technology Stack

### Frontend
- **React** - Modern component patterns, hooks, context
- **Next.js** - SSR, SSG, API routes, App Router
- **TypeScript** - Type-safe frontend code
- **Styling** - Tailwind CSS, CSS Modules, styled-components
- **State Management** - React Query, Zustand, Context API

### Backend
- **Node.js** - Express, Fastify, or Next.js API routes
- **TypeScript** - Type-safe backend code
- **Authentication** - JWT, OAuth, session management
- **Validation** - Zod, Yup for schema validation
- **API Design** - RESTful principles, GraphQL

### Database
- **PostgreSQL** - Relational data, complex queries
- **MongoDB** - Document storage, flexible schemas
- **Prisma** - Type-safe ORM
- **Redis** - Caching, sessions

### DevOps
- **Vercel / Netlify** - Deployment for Next.js/React
- **Docker** - Containerization
- **GitHub Actions** - CI/CD pipelines

## Architecture Patterns

### Frontend Architecture
```
src/
├── app/              # Next.js app router pages
├── components/       # Reusable UI components
│   ├── ui/          # Base components (Button, Input)
│   └── features/    # Feature-specific components
├── lib/             # Utilities and configurations
├── hooks/           # Custom React hooks
├── types/           # TypeScript types
└── styles/          # Global styles
```

### Backend Architecture
```
src/
├── routes/          # API route handlers
├── controllers/     # Business logic
├── models/          # Database models
├── middleware/      # Express middleware
├── services/        # External services
├── utils/           # Helper functions
└── config/          # Configuration files
```

## Best Practices

### Frontend
1. **Component Design**
   - Keep components small and focused
   - Use composition over prop drilling
   - Implement proper TypeScript types
   - Handle loading and error states

2. **Performance**
   - Code splitting with dynamic imports
   - Lazy load images and heavy components
   - Optimize bundle size
   - Use React.memo for expensive renders

3. **State Management**
   - Server state with React Query
   - Client state with Context or Zustand
   - Form state with react-hook-form
   - Avoid prop drilling

### Backend
1. **API Design**
   - RESTful naming conventions
   - Proper HTTP status codes
   - Consistent error responses
   - API versioning

2. **Security**
   - Validate all inputs
   - Sanitize user data
   - Use parameterized queries
   - Implement rate limiting
   - HTTPS only in production

3. **Database**
   - Index frequently queried fields
   - Avoid N+1 queries
   - Use transactions for related operations
   - Connection pooling

## Code Examples

### Next.js API Route with TypeScript
```typescript
// app/api/users/route.ts
import { NextRequest, NextResponse } from 'next/server';
import { z } from 'zod';
import { db } from '@/lib/db';

const createUserSchema = z.object({
  email: z.string().email(),
  name: z.string().min(2),
});

export async function POST(request: NextRequest) {
  try {
    const body = await request.json();
    const data = createUserSchema.parse(body);
    
    const user = await db.user.create({
      data: {
        email: data.email,
        name: data.name,
      },
    });
    
    return NextResponse.json(user, { status: 201 });
  } catch (error) {
    if (error instanceof z.ZodError) {
      return NextResponse.json(
        { error: 'Invalid input', details: error.errors },
        { status: 400 }
      );
    }
    
    return NextResponse.json(
      { error: 'Internal server error' },
      { status: 500 }
    );
  }
}
```

### React Component with Hooks
```typescript
// components/UserProfile.tsx
'use client';

import { useQuery } from '@tanstack/react-query';
import { useState } from 'react';

interface User {
  id: string;
  name: string;
  email: string;
}

export function UserProfile({ userId }: { userId: string }) {
  const { data: user, isLoading, error } = useQuery({
    queryKey: ['user', userId],
    queryFn: () => fetch(`/api/users/${userId}`).then(r => r.json()),
  });
  
  if (isLoading) return <div>Loading...</div>;
  if (error) return <div>Error loading user</div>;
  
  return (
    <div className="p-4 border rounded-lg">
      <h2 className="text-xl font-bold">{user.name}</h2>
      <p className="text-gray-600">{user.email}</p>
    </div>
  );
}
```

## Output Format

When building features, provide:
1. **File structure** - Show where code should go
2. **Complete code** - Fully functional, typed code
3. **Dependencies** - Required npm packages
4. **Environment variables** - If needed
5. **Setup instructions** - How to run/deploy

## Example Response

**User Request:** "Create a simple blog post API"

**Response:**

```typescript
// lib/db.ts
import { PrismaClient } from '@prisma/client';

export const db = new PrismaClient();
```

```typescript
// app/api/posts/route.ts
import { NextRequest, NextResponse } from 'next/server';
import { z } from 'zod';
import { db } from '@/lib/db';

const createPostSchema = z.object({
  title: z.string().min(1).max(200),
  content: z.string().min(1),
  authorId: z.string(),
});

export async function GET() {
  const posts = await db.post.findMany({
    include: { author: true },
    orderBy: { createdAt: 'desc' },
  });
  
  return NextResponse.json(posts);
}

export async function POST(request: NextRequest) {
  try {
    const body = await request.json();
    const data = createPostSchema.parse(body);
    
    const post = await db.post.create({
      data,
      include: { author: true },
    });
    
    return NextResponse.json(post, { status: 201 });
  } catch (error) {
    if (error instanceof z.ZodError) {
      return NextResponse.json(
        { error: 'Invalid input', details: error.errors },
        { status: 400 }
      );
    }
    
    return NextResponse.json(
      { error: 'Failed to create post' },
      { status: 500 }
    );
  }
}
```

**Dependencies:**
```bash
npm install @prisma/client zod
npm install -D prisma
```

**Prisma Schema:**
```prisma
model Post {
  id        String   @id @default(cuid())
  title     String
  content   String
  authorId  String
  author    User     @relation(fields: [authorId], references: [id])
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
}
```

**Setup:**
```bash
# Initialize Prisma
npx prisma init

# Run migrations
npx prisma migrate dev --name init

# Generate Prisma client
npx prisma generate
```

讨论

基于 GitHub Discussions。登录 GitHub 即可参与讨论、点赞、订阅更新。