# Pern Stack

> Build, review, debug, and improve full-stack applications using PostgreSQL, Express.js, React, and Node.js with maintainable and production-ready practices.

- Skill: `rafidstudio/pern-stack` (Agent Skill)
- Install (CLI): `npx skillmds@latest add rafidstudio/pern-stack`
- Raw SKILL.md: https://api.skillmd.com/api/skills/rafidstudio/pern-stack/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Web & Frontend
- Author: rafidstudio (https://skillmd.com/u/rafidstudio)
- Updated: 2026-09-22
- Page: https://skillmd.com/skills/rafidstudio/pern-stack

---


# pern-stack

Use this skill when working on a full-stack web application built with or intended to use the PERN stack:

- PostgreSQL for data storage.

- Express.js for backend APIs.

- React for the frontend.

- Node.js as the runtime.

Use this skill for projects, feature development, refactoring, debugging, code review, architecture decisions and production improvements.

## When to Use

Use this skill for PERN applications, including new projects, feature development, refactoring, debugging, code review, architecture decisions, and production improvements.

## Instructions

1. **Understand the Project**

   * Review requirements, project structure, existing conventions, and the current frontend, backend, API, and database setup.

2. **Design the Architecture**

   * Keep frontend, backend, business logic, API, and data-access responsibilities clear.
   * Prefer simple, maintainable, domain-focused architecture.

3. **Backend & API**

   * Design consistent APIs and validate requests at the boundary.
   * Keep business logic separate from routes.
   * Handle authentication, authorization, errors, and transactions properly.
   * Use parameterized queries or a trusted ORM/query builder.

4. **Database**

   * Design PostgreSQL schemas with appropriate types, relationships, constraints, indexes, and migrations.
   * Consider data integrity and query performance.

5. **Frontend**

   * Build maintainable React components with clear responsibilities.
   * Handle loading, error, empty, and success states.
   * Manage client/server state appropriately and avoid unnecessary complexity.

6. **Security**

   * Never trust client input.
   * Protect sensitive routes and credentials.
   * Use secure authentication, password hashing, validation, CORS, and rate limiting where required.
   * Never expose sensitive internal errors.

7. **Testing & Review**

   * Test critical business logic, APIs, authentication, authorization, validation, and database workflows.
   * When debugging, trace the full data flow, identify the root cause, check edge cases, and prevent regressions.

8. **Performance & Production**

   * Optimize queries, indexes, API requests, and React rendering.
   * Use pagination and caching when justified.
   * Verify migrations, security, logging, environment configuration, tests, and deployment before production.

## General Principles

* Prefer correctness, maintainability, and security.
* Reuse sound existing patterns.
* Avoid unnecessary dependencies and abstractions.
* Keep changes focused and reviewable.
* Do not rewrite working code without a clear reason.
* Consider scalability and failure scenarios.
* Explain important trade-offs when multiple approaches are valid.

