0% found this document useful (0 votes)
9 views2 pages

Rules

The document outlines best practices for code quality, security, and performance optimization in software development, emphasizing clean code, user input validation, and efficient database handling. It also provides specific guidelines for shortcode and WPBakery refactoring, recommending the removal of unused elements and the use of standard HTML/CSS where applicable. Additionally, it highlights the importance of following WordPress coding standards and ensuring compatibility with the latest versions and plugins.

Uploaded by

Tube YoU
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views2 pages

Rules

The document outlines best practices for code quality, security, and performance optimization in software development, emphasizing clean code, user input validation, and efficient database handling. It also provides specific guidelines for shortcode and WPBakery refactoring, recommending the removal of unused elements and the use of standard HTML/CSS where applicable. Additionally, it highlights the importance of following WordPress coding standards and ensuring compatibility with the latest versions and plugins.

Uploaded by

Tube YoU
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

@Codebase, DONT TOUCH ANY STILING IF IT IS ALREADY THERE UNLESS I SAY SO

GENERAL:
1. Code Quality
Always write clean, simple, and maintainable code.
Follow best practices for readability and modularity.
Use async/await to handle asynchronous operations cleanly.
Ensure code is easily extendable and follows DRY (Don't Repeat Yourself)
principles.
2. Security
Always validate and sanitize user input (e.g., zod or express-validator).
Use parameterized queries to prevent SQL Injection.
Hash passwords using bcrypt and securely store credentials.
Prevent XSS (Cross-Site Scripting) and CSRF (Cross-Site Request Forgery) attacks.
3. Prisma Best Practices
Use Prisma Migrations (npx prisma migrate dev) to track schema changes.
Optimize database queries (use select, include, and take where applicable).
Avoid N+1 query problems by using include for relations.
Gracefully handle database connections (use prisma.$disconnect() on app exit).
Always return clean JSON responses when handling API requests.
4. PWA Design Patterns
Service Workers for offline functionality.
Manifest File for app-like behavior.
Push Notifications & Background Sync where applicable.
Ensure fast and optimized performance for smooth UX.
5. Focus on Input Scope
NEVER refactor unrelated code unless explicitly requested.
ONLY modify what is directly tied to the input question.
6. Performance Optimization
Optimize for speed and scalability, especially for high concurrency.
Cache frequently used queries (e.g., Redis for performance boost).
7. Profile.jsx Rules
Used only to display user info, change theme, and log out.
Not responsible for fetching or modifying data elsewhere.
Main user fetch happens in App.js (client folder) for updated user state.

---------------------------------

Shortcode Refactoring Rules


Identify Unused Shortcodes: Remove shortcodes that are no longer used or supported.
Replace Deprecated Shortcodes: Update old or deprecated shortcodes with equivalent
modern ones.
Convert Shortcodes to Blocks (if using Gutenberg): Replace WPBakery shortcodes with
Gutenberg blocks for better compatibility.
Custom Shortcodes: Move custom shortcodes to a separate plugin for easier
maintenance.
WPBakery-Specific Refactoring Rules
Remove Excessive Nesting: Avoid deeply nested WPBakery elements that increase page
complexity.
Convert WPBakery to Standard HTML/CSS (if possible): If WPBakery is not needed,
replace it with standard HTML and CSS for performance gains.
Check for WPBakery Add-ons: Remove any unused WPBakery add-ons to reduce
dependencies.
Performance & Optimization Rules
Minimize Inline Styles: WPBakery often adds inline styles—replace them with
optimized external CSS.
Reduce Render Blocking Assets: Optimize JavaScript and CSS loading to improve page
speed.
Lazy Load Elements: Ensure images and videos use lazy loading for faster
performance.
Theme Code Refactoring Rules
Follow WordPress Coding Standards: Use PHPCS (PHP CodeSniffer) with WordPress
rulesets.
Use Hooks Instead of Direct Modifications: Prefer add_action() and add_filter()
instead of modifying core files.
Ensure Compatibility: Test for compatibility with the latest WordPress version and
major plugins.

You might also like