Core Philosophy: Modular, Functional, Maintainable
Critical Patterns: Error Handling, Validation, Security, Logging, Pure Functions
ALWAYS: Handle errors gracefully, validate input, use env vars for secrets, write pure functions
NEVER: Expose sensitive info, hardcode credentials, skip input validation, mutate state
Language-agnostic: Apply to all programming languages
This file provides essential development patterns that apply across all programming languages. For detailed standards, see:
standards/code-quality.md - Modular, functional code patternsstandards/security-patterns.md - Language-agnostic patternsstandards/test-coverage.md - Testing standardsstandards/documentation.md - Documentation standardsstandards/code-analysis.md - Analysis frameworkModular: Everything is a component - small, focused, reusable Functional: Pure functions, immutability, composition over inheritance Maintainable: Self-documenting, testable, predictable
ALWAYS write pure functions:
ALWAYS handle errors gracefully:
ALWAYS validate input data:
NEVER expose sensitive information:
USE consistent logging levels:
component/
├── index.js # Public interface
├── core.js # Core logic (pure functions)
├── utils.js # Helpers
└── tests/ # Tests
Code Smells:
Security Issues:
ALWAYS write tests:
Test Structure:
describe('Component', () => {
it('should handle valid input', () => {
// Arrange
const input = validData;
// Act
const result = component(input);
// Assert
expect(result).toBe(expected);
});
it('should handle invalid input', () => {
// Test error cases
});
});
ALWAYS document:
Use clear, concise language:
These patterns are language-agnostic. For language-specific implementations:
TypeScript/JavaScript: See project context for Next.js, React, Node.js patterns Python: See project context for FastAPI, Django patterns Go: See project context for Go-specific patterns Rust: See project context for Rust-specific patterns
Before committing code, verify:
For more detailed guidelines, see:
standards/code-quality.md - Comprehensive code standardsstandards/security-patterns.md - Detailed pattern catalogstandards/test-coverage.md - Testing best practicesstandards/documentation.md - Documentation guidelinesstandards/code-analysis.md - Code analysis frameworkworkflows/code-review.md - Code review process