Skip to content

Instantly share code, notes, and snippets.

@rezamonangg
Created May 1, 2025 15:47
Show Gist options
  • Save rezamonangg/627357c051c6a02a436497e86408fc74 to your computer and use it in GitHub Desktop.
Save rezamonangg/627357c051c6a02a436497e86408fc74 to your computer and use it in GitHub Desktop.
# ──────────────────────────────────────────────────────
# Windsurf cursor rules for Django + React development
# ──────────────────────────────────────────────────────
[general]
# Always suggest next steps before running any commands.
suggest-first = true
# Enforce one task at a time. Keep PRs focused and atomic.
one-task-at-a-time = true
# Parent Task Completion Rule
# If all child checklist items under a parent task in TODO.md are marked as complete ([x]),
# automatically mark the parent task as complete ([x]) as well.
# This ensures that high-level milestones always reflect the status of their sub-tasks.
parent-todo-auto-complete = true
# Testing and Refactoring Rule
# If any unit test fails, always refactor or fix the code until all tests pass (are green) before proceeding.
# Do not proceed with new features or commits until the test suite is green.
test-refactor-until-green = true
# Pre-commit rule for CC commands
# Before every commit (CC), always run all unit tests and ensure they pass (are green).
# If any test fails, do not proceed with the commit.
precommit-cc-require-green-tests = true
# TODO Completion Rule for CC
# When running a CC command:
# 1. After all pre-commit checks (tests green), automatically mark the relevant task(s) as complete in TODO.md.
# 2. Only then proceed to run the commit.
# This ensures your TODO list always reflects the latest project status after each atomic commit.
todo-mark-complete-before-cc = true
# Custom shorthand: “CC” = “Commit with Context”
# Commits should include new files and modified classes, with clear intent.
custom-commands = [
"CC: commit --all -m 'feat: <intent>"
]
# When modifying code, always look for existing implementations first.
prefer-iterate-existing = true
# Don’t radically change patterns; start by iterating on what’s already there.
avoid-drastic-pattern-changes = true
# Favor simple, straightforward solutions.
prefer-simplicity = true
# Avoid code duplication: check ‘backend/’ for Django, ‘frontend/’ for React.
duplication-check-paths = ["backend/", "frontend/"]
# Only make well-understood, request-driven changes.
changes-must-be-explicit = true
# When fixing bugs, exhaust existing implementations before introducing new tech.
bugfix-exhaust-existing = true
bugfix-remove-old-on-introduce-new = true
# Keep code clean and organized at all times.
maintain-cleanliness = true
# Avoid one-off scripts in files; opt for ad-hoc CLI or management commands.
avoid-scripts-in-files = true
# File length caps: 300 lines per file; 20 lines per method.
max-file-lines = 300
max-method-lines = 20
# Mock data only in test code.
mocking-policy = "tests-only"
# Never overwrite the .env file without explicit confirmation.
protect-env-file = true
# Only touch code relevant to the current task.
scoped-changes-only = true
# Require thorough tests for all major functionality.
enforce-thorough-tests = true
# Don’t refactor working architectures unless explicitly instructed.
avoid-unneeded-refactors = true
# Always consider how changes affect other modules and methods.
impact-awareness = true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment