# Prompty — One Prompt File for VS Code/Python/TS > Prompty is a Markdown-based `.prompty` format that runs the same prompt from VS Code, Python, or TypeScript with consistent templating and providers. ## Install Paste the prompt below into your AI tool: ## Quick Use 1. Install a runtime (Python): ```bash pip install "prompty[jinja2,openai]" ``` 2. Create `greeting.prompty` and invoke it: ```python import prompty result = prompty.invoke("greeting.prompty", inputs={"name": "Jane"}) print(result) ``` 3. (TypeScript) Install and invoke: ```bash npm install @prompty/core @prompty/openai ``` ## Intro Prompty is a Markdown-based `.prompty` format that runs the same prompt from VS Code, Python, or TypeScript with consistent templating and providers. - **Best for:** teams standardizing prompts across IDEs and runtimes, with reproducible config and templating - **Works with:** VS Code extension, Python package, TypeScript packages, providers like OpenAI/Anthropic/Foundry - **Setup time:** 10–25 minutes ## Practical Notes - Quant: keep prompts in git and require PR review for `.prompty` changes. - Data point: `.prompty` files embed model/provider settings next to the template. ## Pattern: prompt as an interface contract Use `.prompty` as a contract between product and engineering: - define inputs (variables), - define provider + model settings, - and keep the prompt body readable Markdown. ## Pattern: run the same prompt in three places 1) In VS Code for authoring and preview. 2) In Python for batch jobs / eval harnesses. 3) In TypeScript for web backends. This reduces "works on my machine" drift where the template differs per runtime. ### FAQ **Q: Is Prompty stable?** A: It’s labeled v2 alpha in the repo; expect API/file-format changes. **Q: Can I use it without VS Code?** A: Yes. You can invoke `.prompty` from Python or TypeScript runtimes. **Q: How do I keep secrets out of git?** A: Reference env vars in connections (e.g. `${env:OPENAI_API_KEY}`) instead of hardcoding. ## Source & Thanks > Source: https://github.com/microsoft/prompty > License: MIT > GitHub stars: 1,209 · forks: 114 --- ## 快速使用 1. 安装运行时(Python): ```bash pip install "prompty[jinja2,openai]" ``` 2. 创建 `greeting.prompty` 并调用: ```python import prompty result = prompty.invoke("greeting.prompty", inputs={"name": "Jane"}) print(result) ``` 3.(TypeScript)安装并调用: ```bash npm install @prompty/core @prompty/openai ``` ## 简介 Prompty 是基于 Markdown 的 `.prompty` 提示词格式:同一份文件可在 VS Code、Python、TypeScript 中运行,模板与 provider 配置一致。 - **适合谁:** 需要跨 IDE 与运行时统一提示词、并希望配置与模板可复现的团队 - **可搭配:** VS Code 插件、Python 包、TypeScript 包,支持 OpenAI/Anthropic/Foundry 等 provider - **准备时间:** 10–25 分钟 ## 实战建议 - 量化建议:把 `.prompty` 纳入 git,并对变更走 PR 评审。 - 数据点:`.prompty` 把 model/provider 配置与模板放在同一文件里。 ## 常用打法:把提示词当“接口契约”管理 用 `.prompty` 把提示词变成可协作的契约: - 明确输入变量, - 固化 provider + model 设置, - 正文保持可读的 Markdown。 ## 常用打法:同一份提示词跑三处 1)VS Code 里写与预览; 2)Python 里做批处理/评测; 3)TypeScript 里跑在线服务。 这样可以减少“不同运行时各写一份模板”的漂移。 ### FAQ **Prompty 稳定吗?** 答:仓库标注 v2 alpha,API/格式可能变化。 **不装 VS Code 也能用吗?** 答:可以,Python/TypeScript 运行时都能执行 `.prompty`。 **密钥怎么管理?** 答:用环境变量引用(如 `${env:OPENAI_API_KEY}`),不要写进仓库。 ## 来源与感谢 > Source: https://github.com/microsoft/prompty > License: MIT > GitHub stars: 1,209 · forks: 114 --- Source: https://tokrepo.com/en/workflows/prompty-one-prompt-file-for-vs-code-python-ts Author: Prompt Lab