data-formulator / rules
Cursor rule18k starsChanged 7 months agoMITView on GitHub
Prevent information exposure through exception messages in HTTP responses
Trending
Steady talk.about the whole repository
Who's talking about microsoft/data-formulator
- A Hacker News story“Show HN: Data Formulator – AI-powered data visualization from Microsoft Research”Hacker News · Oct 21, 2024 · 212 points
- @sungkim.bsky.social“Microsoft Data Formulator Data Formulator is an AI-powered tool for analysts to iteratively create rich …”Bluesky · Feb 11, 2025 · 39 likes
- @msftresearch.bsky.social“Data Formulator from @msftresearch.bsky.social is currently the top trending repo on @github.com! Have you …”Bluesky · Feb 12, 2025 · 13 likes
- @josefslerka.bsky.social“github.com/microsoft/da... ❤️”Bluesky · Mar 21, 2025 · 6 likes
- @github-trending-js.bsky.social“🔥 Hot Repo! 🔥 (100+ new stars) 📦 microsoft / data-formulator ⭐ 15,511 (+112) 🗒 TypeScript 🪄 Create …”Bluesky · May 13, 2026 · 3 likes
The biggest 5 of 31 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 31
Talked about on Bluesky, GitHub and Hacker News (31 times).
On Bluesky · 22
- Feb 11, 2025Microsoft Data Formulator Data Formulator is an AI-powered tool for analysts to iteratively create rich visualizations. Data Formulator… — @sungkim.bsky.social39 likes and reposts
- Feb 12, 2025Data Formulator from @msftresearch.bsky.social is currently the top trending repo on @github.com! Have you tried the no-code, AI-driven,… — @msftresearch.bsky.social13 likes and reposts
- Mar 21, 2025github.com/microsoft/da... ❤️ — @josefslerka.bsky.social6 likes and reposts
- May 13, 2026🔥 Hot Repo! 🔥 (100+ new stars) 📦 microsoft / data-formulator ⭐ 15,511 (+112) 🗒 TypeScript 🪄 Create rich visualizations with AI — @github-trending-js.bsky.social3 likes and reposts
- Feb 17, 2025Data Formulator from @microsoft.com enables users to create complex data visualizations without needing expertise in data transformation or… — @gradientflow.com3 likes and reposts
17 more on Bluesky
- Apr 21, 2025📦 microsoft / data-formulator ⭐ 11,387 (+52) 🗒 TypeScript 🪄 Create rich visualizations with AI — @github-trending-js.bsky.social2 likes and reposts
- Mar 22, 2025🚀 Skyrocketing! 🚀 (200+ new stars) 📦 microsoft / data-formulator ⭐ 10,632 (+490) 🗒 TypeScript 🪄 Create rich visualizations with AI — @github-trending-js.bsky.social2 likes and reposts
- Mar 20, 2025🪄 Create rich visualizations with AI — @midnattssol.bsky.social2 likes and reposts
- Mar 19, 2025🚀 Skyrocketing! 🚀 (200+ new stars) 📦 microsoft / data-formulator ⭐ 9,335 (+310) 🗒 TypeScript 🪄 Create rich visualizations with AI — @github-trending.bsky.social2 likes and reposts
- Mar 18, 2025🚀 Skyrocketing! 🚀 (200+ new stars) 📦 microsoft / data-formulator ⭐ 9,111 (+252) 🗒 TypeScript 🪄 Create rich visualizations with AI — @github-trending-js.bsky.social2 likes and reposts
- Feb 12, 2025Here is an interesting open source LLM data visualization library from @microsoft.com that's trending! github.com/microsoft/da... — @cloudlogicallyinc.bsky.social2 likes and reposts
- Feb 11, 2025🚀 Skyrocketing! 🚀 (200+ new stars) 📦 microsoft / data-formulator ⭐ 2,810 (+328) 🗒 TypeScript 🪄 Create rich visualizations with AI — @github-trending.bsky.social2 likes and reposts
- Feb 9, 2025🔥 Hot Repo! 🔥 (100+ new stars) 📦 microsoft / data-formulator ⭐ 1,824 (+146) 🗒 TypeScript 🪄 Create rich visualizations with AI — @github-trending-js.bsky.social2 likes and reposts
- Feb 23, 2026🔥 Hot Repo! 🔥 (100+ new stars) 📦 microsoft / data-formulator ⭐ 15,022 (+112) 🗒 TypeScript 🪄 Create rich visualizations with AI — @github-trending-js.bsky.social1 likes and repost
- Nov 18, 2025GitHub - microsoft/data-formulator: 🪄 Create rich visualizations with AI github.com/microsoft/da... — @cjlise.eurosky.social1 likes and repost
- Oct 19, 2025https://github.com/microsoft/data-formulator/ — @tom-doerr.bsky.social1 likes and repost
- Aug 18, 2025🔥 Hot Repo! 🔥 (100+ new stars) 📦 microsoft / data-formulator ⭐ 13,138 (+113) 🗒 TypeScript 🪄 Create rich visualizations with AI — @github-trending-js.bsky.social1 likes and repost
- Apr 20, 2025https://github.com/microsoft/data-formulator — @tom-doerr.bsky.social1 likes and repost
- Mar 12, 2025📦 microsoft / data-formulator ⭐ 8,689 (+76) 🗒 TypeScript 🪄 Create rich visualizations with AI — @github-trending-js.bsky.social1 likes and repost
- Oct 23, 2024GitHub - microsoft/data-formulator: 🪄 Create rich visualizations with AI https://github.com/microsoft/data-formulator — @tech-trending.bsky.social1 likes and repost
- Jun 3, 2025repo: github.com/microsoft/d... — @graplify.bsky.social0 likes and reposts · 1 reply
- Feb 13, 2025🎉 Celebrating! 🎉 (500+ new stars) 📦 microsoft / data-formulator ⭐ 5,525 (+794) 🗒 TypeScript 🪄 Create rich visualizations with AI — @github-trending-js.bsky.social0 likes and reposts · 1 reply
On GitHub · 7
- Jul 27, 2026Repomix now fails on repos using backslash in .gitignore patterns — yamadashy/repomix1 reaction · 10 comments
- Oct 13, 2026Evidence: record the question each result answers and its named inputs — quentin-hickam/analytics-workbench0 reactions
- Oct 8, 2026[Candidate] microsoft/data-formulator/.cursor/skills/error-handling - error-handling — ProSkillsMD/proskills0 reactions · 1 comment
- Aug 3, 2026fix(file): handle escaped gitignore device-name rules — yamadashy/repomix0 reactions · 2 comments
- May 9, 2026【学术讨论】AI 数据可视化分析系统 - 技术升级方向调研 — nanyihao199983/ai-path-analysis0 reactions · 1 comment
2 more on GitHub
- Feb 11, 2025Support code-interpreter with data visualization — refly-ai/refly0 reactions
- Feb 7, 2025Chore: Resolves #11800: Web: Improve reload behavior in dev mode — laurent22/joplin0 reactions · 2 comments
On Hacker News · 2
- Oct 21, 2024Show HN: Data Formulator – AI-powered data visualization from Microsoft Research212 points · 34 comments
- Oct 2, 2024Data Formulator: AI-powered visualization tool from microsoft research1 point
Where files are headingNew Cursor rule files have more rules about planning and tracking tasks, and fewer about code style.
Of the Cursor rule files we read, the 1,533 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository21 other files it gives its agents.
- .github/copilot-instructions.mdCopilot instructions
- .cursor/rules/backend-test-conventions.mdcCursor rule
- .cursor/rules/dataframe-serialization.mdcCursor rule
- .cursor/rules/dev-guides-first.mdcCursor rule
- .cursor/rules/frontend-test-conventions.mdcCursor rule
- .cursor/rules/i18n-no-hardcoded-strings.mdcCursor rule
- .cursor/rules/implementation-review-checklist.mdcCursor rule
- .cursor/rules/incremental-development-cadence.mdcCursor rule
- .cursor/rules/language-injection-conventions.mdcCursor rule
- .cursor/rules/log-sanitization.mdcCursor rule
- .cursor/rules/package-manager-conventions.mdcCursor rule
- .cursor/rules/path-safety.mdcCursor rule
- .cursor/rules/test-driven-workflow.mdcCursor rule
- .cursor/rules/unified-error-protocol.mdcCursor rule
- error-handlingSkill
- language-injectionSkill
- path-safetySkill
- coreSkill
- data-loadingSkill
- data-loadingSkill
- reportSkill
The file
We split this error-response-safety.mdc into the rules it gives an agent
8 rules. About 0 are common, 0 are distinctive, and 8 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
8
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 9
Never return raw exception text (str(e), f"...{e}") directly in HTTP responses.
- Very specific: line 20
All application-controlled errors return HTTP 200 with status: "error" in the body.
- Very specific: line 21
Only auth errors (401/403) and uncontrolled transport errors (404/413/500) use non-200.
- Very specific: line 43
Use stream_error_event() to yield a unified NDJSON error line.
- Very specific: line 82
Use classify_and_raise_db_error() instead of the legacy sanitize_db_error_message():
- Very specific: line 122
Never: use naked except: — always specify at least except Exception:
- Very specific: line 123
Use specific exception types when possible (except (ValueError, TypeError):)
- Very specific: line 124
Always log caught exceptions: logger.warning(...) for degraded operations, logger.debug(...) for expected failures
≈ “Common” is an estimate: at least 1 in 5 of the 3,030 Cursor rule files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
---
description: Prevent information exposure through exception messages in HTTP responses
globs: py-src/**/*.py
alwaysApply: false
---
# Error Response Safety
Never return raw exception text (`str(e)`, `f"...{e}"`) directly in HTTP responses.
Python exceptions may contain stack traces, file paths, database connection strings,
API keys, or internal IP addresses — all of which are security risks (CWE-209).
See `docs/dev-guides/7-unified-error-handling.md` for the full error handling contract.
## Unified Error System
New error paths should use the `AppError` / `error_handler` infrastructure from
`errors.py` and `error_handler.py`. Legacy `message` / `error_message` bodies are
historical formats; do not add compatibility branches for them in new code.
All application-controlled errors return **HTTP 200** with `status: "error"` in the body.
Only auth errors (401/403) and uncontrolled transport errors (404/413/500) use non-200.
### Non-streaming routes
Raise `AppError` for new code or when structured error codes are useful. The
global error handler returns HTTP 200 + JSON error envelope:
```python
from data_formulator.errors import AppError, ErrorCode
# Business error — raise with appropriate code and safe message
raise AppError(ErrorCode.TABLE_NOT_FOUND, "Table not found")
# LLM / external API error — use classify_and_wrap_llm_error
from data_formulator.error_handler import classify_and_wrap_llm_error
except Exception as e:
raise classify_and_wrap_llm_error(e) from e
```
### Streaming routes
Use `stream_error_event()` to yield a unified NDJSON error line.
Validation before the stream starts returns `200 application/json` (not NDJSON):
```python
from data_formulator.errors import AppError, ErrorCode
from data_formulator.error_handler import (
classify_and_wrap_llm_error,
stream_error_event,
stream_preflight_error,
)
except AppError as e:
yield stream_error_event(e)
except Exception as e:
yield stream_error_event(classify_and_wrap_llm_error(e))
```
### Real examples from migrated endpoints
```python
# /data-agent-streaming — standard NDJSON error event
except Exception as e:
logger.error("Error in data-agent-streaming", exc_info=e)
from data_formulator.error_handler import stream_error_event, classify_and_wrap_llm_error
yield stream_error_event(classify_and_wrap_llm_error(e))
# /generate-report-chat — same pattern
except Exception as e:
logger.exception("generate-report-chat failed")
from data_formulator.error_handler import stream_error_event, classify_and_wrap_llm_error
yield stream_error_event(classify_and_wrap_llm_error(e))
# Validation failure before stream starts — use 200 JSON, not NDJSON
if not request.is_json:
return stream_preflight_error(AppError(ErrorCode.INVALID_REQUEST, "Invalid request"))
```
### Database / workspace errors (tables.py)
Use `classify_and_raise_db_error()` instead of the legacy `sanitize_db_error_message()`:
```python
from data_formulator.routes.tables import classify_and_raise_db_error
except Exception as e:
classify_and_raise_db_error(e) # raises AppError with safe message
```
### Connector errors (data_connector.py)
Use `classify_and_raise_connector_error()` instead of the legacy `_sanitize_error()`:
```python
from data_formulator.data_connector import classify_and_raise_connector_error
except Exception as e:
classify_and_raise_connector_error(e) # raises AppError with safe message
```
### Legacy functions (deprecated)
These functions still exist as wrappers but should NOT be used in new code:
- `sanitize_db_error_message()` → use `classify_and_raise_db_error()`
- `_sanitize_error()` → use `classify_and_raise_connector_error()`
- `safe_error_response()` / `sanitize_error_message()` → use `raise AppError(...)`
- `classify_llm_error()` is used internally by `classify_and_wrap_llm_error()`
## Rules
1. **Application errors** — HTTP 200 + `status: "error"`; prefer `error: {...}` for new code and never expose exception details.
2. **Auth errors** — `AUTH_REQUIRED`/`AUTH_EXPIRED` → 401, `ACCESS_DENIED` → 403 (transport layer interception).
3. **Transport errors** (uncontrolled) — only `404` (no route), `413` (body limit), `500` (unhandled crash) may be non-200.
4. **Streaming errors** — always use `stream_error_event()` for NDJSON error lines.
5. **Logging** — always log the full exception server-side (`logger.warning` / `logger.error`
with `exc_info=True` when needed). The client never needs the stack trace.
6. **Debug detail** — `AppError.detail` is only included in responses when `app.debug is True`.
## Bare except Policy
- **Never** use naked `except:` — always specify at least `except Exception:`
- Use specific exception types when possible (`except (ValueError, TypeError):`)
- Always log caught exceptions: `logger.warning(...)` for degraded operations, `logger.debug(...)` for expected failures
- Process cleanup code (`terminate`, `join`, `close`) is exempt from logging requirements
## Common Mistakes
```python
# ❌ BAD — raw exception leaks internal details
return jsonify({"message": str(e)}), 500
return jsonify({"error": f"Failed: {e}"}), 502
yield json.dumps({"type": "error", "error": str(e)}) + "\n"
# ❌ BAD — non-200 HTTP status code for application errors
return jsonify({"status": "error", "error_message": "..."}), 400
# ❌ BAD — naked except catches SystemExit/KeyboardInterrupt
except:
pass
# ❌ BAD — silent swallow without logging
except Exception:
pass
# ✅ GOOD — non-streaming (global handler returns HTTP 200)
raise AppError(ErrorCode.TABLE_NOT_FOUND, "Table not found")
# ✅ GOOD — streaming
yield stream_error_event(AppError(ErrorCode.LLM_TIMEOUT, "Timeout", retry=True))
# ✅ GOOD — graceful degradation with logging
except Exception as e:
logger.warning("Could not read schema for %s", table_name, exc_info=e)
# ✅ GOOD — specific exception types
except (ValueError, TypeError):
pass # safe fallback
```
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

