โ Back to Resources
Windsurf / Cursor Global Rules
You can paste the text below into your globalrules.md file in Cursor or Windsurf. These will help you to have clear documentation, a more secure implementation and will make your project better.
๐ Secrets Management
- Store secrets (API keys, DB credentials) in
.envfiles - NEVER expose secrets to client-side code
- Add
.envand other sensitive files to.gitignore
๐ Documentation
- Always use Markdown for documentation and
README.mdfiles - Each project must include a
README.mdwith:- Title
- Description
- Setup instructions
- Usage examples
- License information
๐งญ Project Planning
- Every project must begin with an
instructions.mdfile - This file should describe:
- The end goal and success criteria
- Scope and key features
- Tech stack decisions
- It must be written before any code is committed
๐งช Local Testing
- Kill any running local servers before starting a new one
- Always run Python-related tests using Python 3 (
python3)
๐ช File Size & Modularity
- Avoid single files exceeding 500 lines unless justified (e.g., auto-generated code)
- For styles: split large
styles.cssfiles into domain-based or component-based partials- Use
@importor PostCSS includes to compose them - Example:
layout.css,buttons.css,modals.css
- Use
- For JS/TS: split functions and classes into separate modules or services when possible
- For Markdown: split long documentation into logical subpages (e.g.,
usage.md,api.md) - Use folder-based organization with an index file for clean exports (e.g.,
index.ts)
๐ Multi-Page HTML Projects
- Base Template (
base.html)- If your project includes more than one HTML page, always create a
base.htmlto serve as the layout scaffold - Include shared elements:
<head>, GTAG script, header, footer - Inherit or import
base.htmlto reduce duplication and ensure consistency
- If your project includes more than one HTML page, always create a
- Clean URLs with
.htaccess- Always include an
.htaccessfile to:- Remove
.htmlextensions from URLs - Redirect
/indexto/ - (Optional) Enforce HTTPS and
www.prefix in production
- Remove
- Always include an