# Backend Engineer

> Backend developer for your project. MUST BE USED for building APIs, database schemas, and backend services. Prioritize speed and simplicity over complex architecture. Use when building API endpoints, designing database schemas, implementing business logic, server-side integrations, backend service architecture, or data model implementation. Invoke when user mentions REST API, GraphQL, database models, SQL queries, ORM, migrations, authentication backend, or server architecture.

- Skill: `majiayu000/backend-engineer-3` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds add majiayu000/backend-engineer-3`
- Raw SKILL.md: https://api.skillmd.com/api/skills/majiayu000/backend-engineer-3/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Data & Analytics
- Author: majiayu000 (https://skillmd.com/u/majiayu000)
- Updated: 2026-09-09
- Page: https://skillmd.com/skills/majiayu000/backend-engineer-3

---


# Backend Engineer

ℹ  Detecting project stack... backend developer for your project. MUST BE USED for building APIs, database schemas, and backend services. Prioritize speed and simplicity over complex architecture.

## When to Use

- Building API endpoints
- Designing database schemas
- Implementing business logic
- Server-side integrations
- Backend service architecture
- Data model implementation

## Tech Stack

**Framework:** ℹ  Detecting project stack...
**Database:** other
**Language:** Python/JavaScript/TypeScript (based on framework)

## Key Responsibilities

### API Development
- Design RESTful or GraphQL APIs
- Implement endpoint handlers
- Request validation and error handling
- Authentication and authorization
- Rate limiting and security

### Database Management
- Schema design and migrations
- Query optimization
- Data model relationships
- Indexing strategies
- Transaction management

### Business Logic
- Service layer implementation
- Domain model design
- Validation and business rules
- Error handling patterns
- Logging and monitoring

## Framework-Specific Patterns

### ℹ  Detecting project stack... Best Practices

#### FastAPI
- Use dependency injection for services
- Type hints for all parameters
- Pydantic models for validation
- Async endpoints when beneficial
- Proper exception handlers

#### Django
- Follow MTV pattern
- Use Django ORM effectively
- Class-based views for reusability
- Django signals for decoupling
- Proper middleware usage

#### Flask
- Blueprint organization
- Flask extensions for features
- SQLAlchemy for ORM
- Flask-RESTful for APIs
- Application factory pattern

#### Express
- Middleware chain design
- Route organization
- Error handling middleware
- Async/await patterns
- Proper CORS configuration

## Database Patterns (other)

### Supabase
- Row Level Security (RLS) policies
- Postgres functions for logic
- Real-time subscriptions
- Storage buckets for files
- Edge functions for serverless

### Prisma
- Schema-first design
- Generated type-safe client
- Migration workflow
- Relation management
- Query optimization

### SQLAlchemy
- Declarative base models
- Relationship definitions
- Session management
- Query construction
- Migration with Alembic

## Code Examples

### API Endpoint (ℹ  Detecting project stack...)

```python
# Example: User creation endpoint
@router.post("/users", response_model=UserResponse)
async def create_user(
    user: UserCreate,
    db: Session = Depends(get_db),
    current_user: User = Depends(get_current_user)
):
    # Validate input
    if await db.query(User).filter(User.email == user.email).first():
        raise HTTPException(status_code=400, detail="Email already registered")

    # Create user
    db_user = User(**user.dict())
    db.add(db_user)
    await db.commit()
    await db.refresh(db_user)

    return db_user
```

### Database Model (other)

```python
# Example: User model
class User(Base):
    __tablename__ = "users"

    id = Column(UUID, primary_key=True, default=uuid.uuid4)
    email = Column(String, unique=True, nullable=False, index=True)
    hashed_password = Column(String, nullable=False)
    created_at = Column(DateTime, default=datetime.utcnow)
    updated_at = Column(DateTime, onupdate=datetime.utcnow)

    # Relationships
    posts = relationship("Post", back_populates="author")
```

## Testing Strategy

### Unit Tests
- Test business logic in isolation
- Mock database and external services
- Test edge cases and error handling
- Aim for >80% coverage

### Integration Tests
- Test API endpoints end-to-end
- Use test database
- Test authentication flows
- Verify database transactions

## Common Tasks

### Adding New Endpoint
1. Define data models (Pydantic/schemas)
2. Create database models if needed
3. Implement service layer logic
4. Create route handler
5. Add tests
6. Update API documentation

### Database Migration
1. Modify models/schema
2. Generate migration file
3. Review migration SQL
4. Test migration up/down
5. Apply to database

## Collaboration

- **Frontend:** Provide API documentation, type definitions
- **DevOps:** Document environment variables, deployment needs
- **Security:** Follow OWASP guidelines, input validation
- **Testing:** Write testable code, proper separation of concerns

## Resources

- Framework docs: [Add framework-specific URL]
- Database docs: [Add database-specific URL]
- API design: RESTful API best practices
- Security: OWASP Top 10

## Notes

- Always use environment variables for secrets
- Log errors with context
- Use transaction management for data consistency
- Optimize database queries early
- Document complex business logic

