借用 4 萬星的 awesome-cursorrules 思路,把「某個技術棧該怎麼寫」固化成專案規則檔,讓 Cursor / Claude Code / Codex 每次都照你的慣例產碼,而不是吐通用範本。
# Project Rules — {{PROJECT_NAME}}
> Read this before writing or editing any code. These rules override your default conventions.
## Tech stack (authoritative versions)
- Language: {{LANGUAGE}} (e.g. TypeScript 5.x, strict mode on)
- Framework: {{FRAMEWORK_AND_VERSION}} (e.g. Next.js 15 App Router)
- Styling: {{STYLING}} (e.g. Tailwind CSS + shadcn/ui — do NOT introduce styled-components)
- State: {{STATE_MANAGEMENT}} (e.g. Zustand for client, TanStack Query for server state)
- Testing: {{TESTING}} (e.g. Vitest + Playwright)
- Package manager: {{PACKAGE_MANAGER}} (e.g. pnpm — use pnpm, never npm/yarn)
## Conventions (be specific and verifiable)
- File naming: {{FILE_NAMING}} (e.g. kebab-case for files, PascalCase for components)
- Imports: {{IMPORT_RULE}} (e.g. use the `@/` alias, no deep relative `../../..`)
- Components: {{COMPONENT_RULE}} (e.g. Server Components by default; add 'use client' only when needed)
- Errors: {{ERROR_RULE}} (e.g. never swallow errors; surface a typed error object)
## Hard bans (do NOT do these)
- {{BAN_1}} (e.g. no `any` — use `unknown` + a type guard)
- {{BAN_2}} (e.g. no inline secrets — read from env via the config module)
- {{BAN_3}} (e.g. no new dependencies without asking first)
## Definition of done
- Code type-checks ({{TYPECHECK_CMD}}) and lints ({{LINT_CMD}}) clean.
- Tests pass: {{TEST_CMD}}.
- New behavior has at least one test.
# (Cursor only) save as .cursor/rules/{{STACK}}.mdc with this frontmatter:
# ---
# description: Rules for {{FRAMEWORK_AND_VERSION}}
# globs: {{GLOB_PATTERN}} # e.g. **/*.ts, **/*.tsx
# alwaysApply: false
# ---不用離開網站,直接看這組 prompt 跑出來長怎樣(AI 即時生成,扣 1 點)。
不只複製貼上 — 下載後放到 ~/.claude/skills/cursorrules-tech-stack-to-agents-md/SKILL.md,之後每個 session 自動可用(觸發時自動載入)。
mkdir -p ~/.claude/skills/cursorrules-tech-stack-to-agents-md && mv ~/Downloads/SKILL.md ~/.claude/skills/cursorrules-tech-stack-to-agents-md/SKILL.mdNew-Item -ItemType Directory -Force "$env:USERPROFILE\.claude\skills\cursorrules-tech-stack-to-agents-md" | Out-Null; Move-Item "$env:USERPROFILE\Downloads\SKILL.md" "$env:USERPROFILE\.claude\skills\cursorrules-tech-stack-to-agents-md\SKILL.md"**這是什麼/解決什麼痛點** AI 編碼助手(Cursor、Claude Code、Codex)預設用「網路上的平均寫法」生程式碼:它不知道你用 Next.js 15 還是 13、用 Tailwind 還是 styled-components、團隊是否禁用 `any`、檔案命名要 kebab-case 還是 camelCase。結果就是每次都要在 review 時把它「拉回」你的慣例。解法是把這些慣例一次寫成一份專案規則檔——Cursor 叫 `.cursor/rules/*.mdc`,Claude Code 叫 `CLAUDE.md`,Codex 叫 `AGENTS.md`——助手每次開工都先讀它,產出自然對齊。 **為什麼這個來源值得用** PatrickJS 的 awesome-cursorrules 是這個領域的指標倉庫(約 4 萬星、CC0 公共領域授權),整理了 13+ 大類、上百個技術棧的規則範例:前端框架(React / Next.js / Vue / Angular / Svelte / Astro / Solid / Qwik)、後端(Node / FastAPI / Django / Go / Spring / Laravel / Rails / Deno)、行動端(React Native / Flutter / SwiftUI / Android)、樣式(Tailwind / shadcn/ui / Chakra)、狀態管理(Redux / Zustand / Pinia / TanStack Query)、測試(Cypress / Playwright / Jest / Vitest)、部署(Vercel / Netlify / Cloudflare)等。它的價值不在「複製某個檔案」,而在示範了一份好規則該涵蓋哪些面向。CC0 是最自由的授權,內容可任意商用、改寫、再散布,零限制。 **怎麼用(步驟)** 1. 確認你的助手吃哪個檔名:Cursor → `.cursor/rules/<stack>.mdc`(帶 frontmatter:`description` / `globs` 指定套用的檔案模式如 `**/*.tsx` / `alwaysApply`);Claude Code → 專案根的 `CLAUDE.md`;Codex → `AGENTS.md`。 2. 用下方 `full_prompt` 範本當骨架,把 `{{...}}` 填成你專案的真實值(框架版本、語言、樣式方案、測試工具、命名規則、禁用清單)。 3. 規則要「可驗證、具體」:寫「禁用 `any`,改用 `unknown` + 型別守衛」比寫「請寫好的型別」有用一百倍。 4. 提交進 git,全團隊(含每個 AI session)共用同一份規則,對齊所有貢獻者。 **何時用** 任何有固定技術棧、且你發現自己一直在 review 時糾正 AI 同樣幾件事的專案。一次寫好、長期受益。 📎 來源:PatrickJS/awesome-cursorrules(作者 PatrickJS,CC0 公共領域授權)— 本篇為繁中改寫整理,原始倉庫與各技術棧規則範例見上方連結。
[PROJECT_NAME]專案名稱
[LANGUAGE]主要語言與版本/模式,例如 TypeScript 5.x strict
[FRAMEWORK_AND_VERSION]框架與精確版本,例如 Next.js 15 App Router
[STYLING]樣式方案,並註明禁止引入哪些替代方案
[STATE_MANAGEMENT]狀態管理方案(client / server 分別寫)
[TESTING]填下面的欄位,上方 prompt 會即時替換 [方括號] 內容。填好後按「複製組好的 prompt」直接丟進工具。
# Project Rules — {{PROJECT_NAME}}
> Read this before writing or editing any code. These rules override your default conventions.
## Tech stack (authoritative versions)
- Language: {{LANGUAGE}} (e.g. TypeScript 5.x, strict mode on)
- Framework: {{FRAMEWORK_AND_VERSION}} (e.g. Next.js 15 App Router)
- Styling: {{STYLING}} (e.g. Tailwind CSS + shadcn/ui — do NOT introduce styled-components)
- State: {{STATE_MANAGEMENT}} (e.g. Zustand for client, TanStack Query for server state)
- Testing: {{TESTING}} (e.g. Vitest + Playwright)
- Package manager: {{PACKAGE_MANAGER}} (e.g. pnpm — use pnpm, never npm/yarn)
## Conventions (be specific and verifiable)
- File naming: {{FILE_NAMING}} (e.g. kebab-case for files, PascalCase for components)
- Imports: {{IMPORT_RULE}} (e.g. use the `@/` alias, no deep relative `../../..`)
- Components: {{COMPONENT_RULE}} (e.g. Server Components by default; add 'use client' only when needed)
- Errors: {{ERROR_RULE}} (e.g. never swallow errors; surface a typed error object)
## Hard bans (do NOT do these)
- {{BAN_1}} (e.g. no `any` — use `unknown` + a type guard)
- {{BAN_2}} (e.g. no inline secrets — read from env via the config module)
- {{BAN_3}} (e.g. no new dependencies without asking first)
## Definition of done
- Code type-checks ({{TYPECHECK_CMD}}) and lints ({{LINT_CMD}}) clean.
- Tests pass: {{TEST_CMD}}.
- New behavior has at least one test.
# (Cursor only) save as .cursor/rules/{{STACK}}.mdc with this frontmatter:
# ---
# description: Rules for {{FRAMEWORK_AND_VERSION}}
# globs: {{GLOB_PATTERN}} # e.g. **/*.ts, **/*.tsx
# alwaysApply: false
# ---這組 prompt 專為 Claude Code 設計。把 prompt 內 19 個方括號 [變數] 換成你自己的內容,貼進 Claude Code 執行即可。難度為入門,新手可以直接套用。
完整 prompt 免費開放閱讀,不用註冊;登入後可一鍵複製、收藏與留言。
prompt 文字本身你可自由使用與修改。但 AI 生成物(圖/音樂/影片/文字)的商用授權,取決於你在 Claude Code 使用的方案與其官方服務條款,請以該工具的授權規範為準。
Studio engineer 視角拆解 Suno 致命弱點(油炸 vocals、高頻 artifact)+ 4 步驟 DAW workflow + Suno Studio 修音 prompt
提案產生器 / 會議處理器 / 內容再利用 / 週五回顧 / 收工 reset — 試了 40 個只有這 5 個沒被丟掉、各省 30+ 分鐘 / 次。
適合:部落格、Medium、Notion 公開頁、Substack — 任何支援 iframe / HTML 嵌入的地方。對方點「看完整」會回到本站、是 prompt 庫的免費 backlink。
<iframe src="https://prompt.luvai.net/embed/cursorrules-tech-stack-to-agents-md" width="100%" height="380" frameborder="0" style="border:1px solid #e0dcd0;border-radius:4px;" loading="lazy" title="PromptCraft Embed"></iframe>
把方括號 [ ] 內的變數換成你的內容,丟進 Claude Code。
測試工具組合
[PACKAGE_MANAGER]套件管理器,並要求只用這一個
[FILE_NAMING]檔名與元件命名規則
[IMPORT_RULE]import 路徑規則,例如使用 @/ alias
[COMPONENT_RULE]元件預設行為規則
[ERROR_RULE]錯誤處理規則
[BAN_1]硬性禁止事項一
[BAN_2]硬性禁止事項二
[BAN_3]硬性禁止事項三
[TYPECHECK_CMD]型別檢查指令
[LINT_CMD]lint 指令
[TEST_CMD]測試指令
[STACK]Cursor .mdc 檔名用的技術棧短名
[GLOB_PATTERN]Cursor frontmatter 套用的檔案模式,例如 **/*.tsx
六個月在 Claude / GPT-4 / Gemini 上用人工 rater A/B 測 200+ prompt 後寫的。包含 persona+constraint stacking / anti-example / role reversal QA / cognitive scaffold / emotional priming / uncertainty CoT / steelman first。
一年的 role-play system prompt + 14-step framework 後總結:真正改變品質的是 5 個單行 prompt。沒有 role、沒有 markdown、沒有「you are an expert」。