The official policy on repeating a course is stated in the Stanford Bulletin.
The Registrar's Office uses the following terminology:
Repeat a Course for Credit: when we state that a course can be repeated for credit, it means that a student may enroll in the course up to the "Total Completions Allowed" and for the "Total Units Allowed" as entered in Course Catalog in PeopleSoft. The default values are 99 total completions allowed and 999 total units allowed. You are free, however, to communicate different values by filling in the relevant field on the web form; note that these fields are typically empty unless you send us data. For example, if a 5-unit course can be taken 3 times, you enter 3 total completions allowed and 15 total units allowed.
Retake a Course: any course that is not repeatable-for credit may be retaken by a student, typically in order to improve the grade. See the Stanford Bulletin for the rules concerning retaking a course.
From year to year, a course must always be either repeatable-for-credit or not -repeatable-for-credit. If that status changes, you must create a new course with a new course ID. Crosslisted courses must share the same repeatable-for-credit rule.