greencoder/rules icon
public
Published on 6/30/2025
Sample rule

Rules

Build & Development Commands

  • Use npm run dev or yarn dev for development server startup - Run npm run build or yarn build for production builds - Use npm run lint to check code style and catch potential issues - Execute npm run type-check for TypeScript type validation - Use docker-compose up for containerized development environments - Prefer package.json scripts over direct CLI commands for consistency - Always run npm install or yarn install after pulling new dependencies

Testing Guidelines

  • Write unit tests for all business logic and utility functions - Use descriptive test names that explain the expected behavior - Follow the AAA pattern: Arrange, Act, Assert in test structure - Maintain at least 80% code coverage for critical components - Run npm test before committing any changes - Use integration tests for API endpoints and database interactions - Mock external dependencies and API calls in unit tests - Write end-to-end tests for critical user workflows

Code Style & Guidelines

  • Follow consistent indentation (2 or 4 spaces, never mix with tabs) - Use meaningful variable and function names that express intent - Keep functions small and focused on a single responsibility - Add JSDoc comments for public APIs and complex functions - Use TypeScript interfaces and types for better code documentation - Follow the project's ESLint and Prettier configurations - Use async/await instead of Promise chains for better readability - Implement proper error handling with try-catch blocks - Avoid deep nesting by using early returns and guard clauses

Documentation Guidelines

  • Maintain an up-to-date README.md with setup and usage instructions - Document all environment variables and configuration options - Include code examples in API documentation - Use inline comments sparingly, only for complex business logic - Keep documentation close to the code it describes - Update documentation whenever you change functionality - Include troubleshooting sections for common issues - Document deployment processes and environment requirements - Use clear, concise language avoiding technical jargon when possible