Trvly Development Standards
Instructions for maintaining code quality and consistency in the Trvly project.
General Guidelines
Follow these core principles when writing code:
Use meaningful variable and function names that clearly convey purposeWrite clear and concise commentsFollow the project's coding standards and style guideEnsure that all code is well-documentedCoding Style
Formatting
Use 4 spaces for indentation (no tabs)Keep line length to a maximum of 80 charactersPlace opening braces on the same line as the statementNaming Conventions
Follow the project's naming conventions for variables, functions, and classesUse descriptive names that indicate purpose and typeString Conventions
Use single quotes for strings in JavaScript and PythonExample: `const message = 'Hello, world';`Comment Style
Format Rules
Use single-line comments (`//` or `#`) for brief explanationsUse multi-line comments (`/* ... */` or `""" ... """`) for detailed explanationsBegin all comments with a capital letterContent Guidelines
Write comments that explain **why** the code does something, not what it doesKeep comments up-to-date with code changesRemove outdated or obsolete comments during refactoringCode Suggestions
When using GitHub Copilot or other AI assistants:
Accept suggestions that improve code readability and maintainabilityAlways review and test code suggestions before committing**Never** accept suggestions that introduce: - Security vulnerabilities
- Performance issues
- Code that violates project standards
Documentation
Requirements
Document all new features and changesUpdate relevant documentation files when making code changesEnsure documentation stays synchronized with codeFormat
Use clear, concise languageInclude examples where helpfulDocument public APIs, functions, and classesTesting
Test Coverage
Write unit tests for all new codeEnsure existing tests pass before committing changesAim for comprehensive test coverageTesting Tools
Use automated testing tools where possibleRun the full test suite before submitting pull requestsWrite tests that are maintainable and readableSecurity
Best Practices
**Never** use hardcoded credentials or sensitive information in codeFollow secure coding best practicesSanitize all user inputsUse environment variables for configuration secretsReview code for common vulnerabilities (SQL injection, XSS, etc.)Code Review
Have security-sensitive code reviewed by team membersUse static analysis tools to detect potential issuesFeedback
Improvement
Provide feedback on Copilot's suggestions to improve its performanceReport issues or bugs with Copilot to the development teamShare successful patterns and workflows with the teamExample Usage
When writing a new function:
1. Use meaningful names following project conventions
2. Add comments explaining the purpose and any non-obvious logic
3. Write unit tests covering normal and edge cases
4. Ensure code follows the 80-character line limit
5. Review for security issues before committing
6. Update relevant documentation