Prompt file imported from Zynapses/Radiant (
.windsurf/workflows/no-mock-data.md). Copyright stays with the author.
No Mock Data Policy
CRITICAL RULE: Mock data is NOT allowed in production code. Administrators must always see real data to make informed decisions.
What is prohibited
- Mock data constants - Variables named
mock*,fake*,dummy*, orsample*containing hardcoded data - Fallback to mock data - Using mock data when API calls fail (use error states instead)
- Demo/placeholder data - Hardcoded arrays or objects used for UI demonstration
What to use instead
- API calls - Always fetch real data from backend APIs
- Loading states - Show spinners/skeletons while data loads
- Error states - Display error messages with retry buttons when API calls fail
- Empty states - Show "No data available" when there's no real data
Example - WRONG ❌
const mockUsers = [
{ id: '1', name: 'John Doe' },
{ id: '2', name: 'Jane Smith' },
];
// Fallback to mock data
const data = apiData || mockUsers;
Example - CORRECT ✅
const [users, setUsers] = useState<User[]>([]);
const [loading, setLoading] = useState(true);
const [error, setError] = useState<string | null>(null);
useEffect(() => {
async function loadData() {
try {
const res = await fetch('/api/users');
if (res.ok) {
const { data } = await res.json();
setUsers(data || []);
} else {
setError('Failed to load users');
}
} catch {
setError('Connection failed');
}
setLoading(false);
}
loadData();
}, []);
if (loading) return <Spinner />;
if (error) return <ErrorMessage message={error} onRetry={loadData} />;
if (users.length === 0) return <EmptyState message="No users found" />;
Enforcement
When reviewing or creating code:
- Search for patterns:
const mock,= mock,|| mock,function mock - Remove any mock data constants
- Replace with proper API loading patterns
- Add appropriate loading, error, and empty states
