# Agent Guidelines for Adopt-a-Street ## Commands **Backend** (from `/backend`): `npm test` (no tests configured yet), `npx eslint .` (lint) **Frontend** (from `/frontend`): `npm test` (run all tests), `npm test -- --testNamePattern="test name"` (single test), `npm run build` (build), `npm start` (dev server) ## Code Style ### Backend (Node.js/Express) - **Imports**: Use `require()` for CommonJS modules; group by: built-in → third-party → local (models, middleware, routes) - **Formatting**: 2-space indent, trailing commas in objects/arrays, double quotes for strings - **Naming**: camelCase for variables/functions, PascalCase for models/schemas, lowercase for routes - **Error Handling**: Use try-catch in async routes; log errors with `console.error(err.message)`; return generic "Server error" (500) or specific error messages (400) - **Responses**: Return JSON with `res.json()` for success, `res.status(code).json({ msg: "..." })` or `res.status(code).send("...")` for errors ### Frontend (React) - **Imports**: ES6 `import`; group by: React → third-party → local components → context → styles - **Components**: Functional components with hooks; export default at end - **Naming**: PascalCase for components, camelCase for functions/variables - **State**: Use `useState` for local state, Context API for global state (AuthContext pattern) - **Error Handling**: Handle errors in async operations, display user-friendly messages ### General - **Types**: No TypeScript configured; use JSDoc comments for complex functions if needed - **ESLint**: Follows eslint config in backend; "no-unused-vars" and "no-undef" set to warn