You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[prompts] Make validation automatic instead of optional
Changes all style-creation prompts to automatically validate instead of
asking the user. Validation is fast (offline only), catches issues early,
and provides immediate feedback without friction.
Rationale:
- All validation tools are offline (no API calls, no cost)
- Fast execution (milliseconds)
- Follows development tool patterns (ESLint, TypeScript, tests)
- Results are informational - users can ignore warnings for prototypes
- Better to show issues immediately than discover them later
Updated prompts:
- create-and-preview-style: Step 5 now validates automatically
- build-custom-map: Step 5 now validates automatically
- design-data-driven-style: Step 8 now validates automatically
- setup-mapbox-project: Validates before presenting final summary
Changes:
- Removed user question "Would you like to validate?"
- Added automatic validation step after style creation
- Validation results included in final summary
- Note added that warnings can be ignored for prototypes
Benefits:
- Catches expression errors before runtime
- Ensures WCAG accessibility compliance by default
- Identifies optimization opportunities immediately
- Especially valuable for AI-generated styles (build-custom-map)
- Data-driven styles get complex expression validation
Example flow:
1. Create style ✓
2. Generate preview ✓
3. Automatically validate ✓ (new - runs without asking)
4. Present: Preview URL + Validation report
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: src/prompts/DesignDataDrivenStylePrompt.ts
+17-16Lines changed: 17 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -395,31 +395,32 @@ Show property values as labels:
395
395
- Use red/green combinations (colorblind-unfriendly)
396
396
- Forget to handle null/undefined property values
397
397
398
-
## Step 8: Validate the Style (Recommended for Production)
398
+
## Step 8: Validate the Style
399
399
400
-
After creating your data-driven style:
400
+
After creating your data-driven style, automatically run validation:
401
401
402
-
1. **Ask the user about validation:**
403
-
- "Would you like to validate this data-driven style for production readiness? This will check expression syntax, accessibility, and optimize the style."
404
-
- Data-driven styles use complex expressions that benefit from validation
405
-
406
-
2. **If yes, validate:**
402
+
1. **Run validation:**
407
403
- Use the prepare-style-for-production prompt
408
404
- Pass the style ID as the style_id_or_json parameter
405
+
- Data-driven styles use complex expressions that benefit from validation
409
406
- This checks:
410
407
* Expression syntax and type correctness
411
-
* Color contrast for accessibility (WCAG AA/AAA)
408
+
* Color contrast for accessibility (WCAG AA)
412
409
* Overall style optimization
410
+
- Validation is fast (offline processing only)
411
+
412
+
2. **Present validation results:**
413
+
- Include validation summary with the preview:
414
+
* ✅ Issues found or "Style is production-ready"
415
+
* Expression validation status (critical for data-driven styles)
416
+
* Accessibility compliance (WCAG AA)
417
+
* Optimization recommendations
413
418
- This ensures your expressions work correctly with real data
414
419
415
-
3. **If no:**
416
-
- Note: "You can validate later using prepare-style-for-production when ready for production"
417
-
418
-
4. **When validation is especially important:**
419
-
- ✅ Production maps with real user data
420
-
- ✅ Styles with complex nested expressions
421
-
- ✅ Maps requiring accessibility compliance
422
-
- ⚠️ Quick prototypes can skip validation initially
420
+
3. **Note for users:**
421
+
- Validation runs automatically to catch issues early
422
+
- For quick prototypes, warnings can be addressed later
423
+
- Complex nested expressions especially benefit from validation
0 commit comments