Community程式設計與開發github.com

agents-md-starter 專案規則設定工具

自動建立或升級專案的 AGENTS.md(Codex、Cursor 等工具可讀取)與匯入它的 CLAUDE.md,讓 Claude Code、Codex、Cursor 和 Gemini CLI 共用同一組專案規則。

agents-md-starter 專案規則設定工具 是什麼?

這是一個 AI 代理技能(Agent Skill),專門用來在軟體專案中建立或升級統一的 AI 代理規則檔案。它會掃描存放庫,自動偵測使用的程式語言、套件管理器、實際的建置/測試/語法檢查指令、框架、目錄結構,以及既有的規則檔案(如 .cursorrules、CLAUDE.md、copilot-instructions 等),然後產出精簡且經過驗證的規則檔案(AGENTS.md),再建立一個匯入它的 CLAUDE.md。此技能支援 Claude Code、Codex、Cursor 和 Gemini CLI 等主流 AI 代理工具。它會先掃描專案(僅分析檔案結構,不執行程式碼),再讀取所有現有規則與 CI 工作流程,確認實際使用的建置與測試指令,最後將所有規則整合到單一的 AGENTS.md 中。此技能特別適合用於讓多個 AI 代理遵循相同約定、將 .cursorrules 遷移至 AGENTS.md,或是為新專案初始化代理規則。

相容平台✓Claude Code✓Codex CLI✓Cursor✓Gemini CLI
npx skills add https://github.com/getpaidskills/skills/tree/HEAD/skills/agents-md-starter

Installed? Explore more 程式設計與開發 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

agents-md-starter

輸出:在存放庫根目錄建立 AGENTS.md 作為單一事實來源,以及包含 @AGENTS.md(Claude Code 會讀取 CLAUDE.md 並支援 @path 匯入)的 CLAUDE.md。檔案中的每個指令必須已經成功執行過,或清楚標示為未驗證。

步驟 1 — 掃描

python3 scripts/scan_repo.py /path/to/repo            # 人類可讀摘要
python3 scripts/scan_repo.py /path/to/repo --json     # 以 JSON 格式輸出事實
python3 scripts/scan_repo.py /path/to/repo --draft > AGENTS.draft.md   # 填入範本

它會偵測:以檔案數量統計的程式語言、從鎖定檔案判斷的套件管理器、package.json 中的腳本、Makefile 目標、pyproject.toml 工具(pytest、ruff、mypy、uv/poetry)、Go/Rust/Java 建置檔案、框架(Next.js、Astro、Vite、Django、FastAPI、Rails…)、單體倉庫工作區、CI 工作流程、環境變數範例檔案,以及現有的代理規則檔案。它絕不會執行存放庫中的程式碼。

步驟 2 — 先讀再寫

  • 閱讀找到的每一個現有規則檔案(CLAUDE.md、.cursorrules、.cursor/rules/*.mdc、.github/copilot-instructions.md、GEMINI.md、CONTRIBUTING.md)。保留其中真正的規則;進行合併、去重,並刪除那些過於通用的規則(例如「撰寫乾淨的程式碼」)。
  • 閱讀 CI 工作流程:CI 執行的指令是「測試通過」最可靠的定義。
  • 快速瀏覽 2 到 3 個具代表性的原始碼檔案,以掌握實際的程式碼慣例(命名方式、錯誤處理、匯入風格)— 切勿發明程式碼中不存在的慣例。

步驟 3 — 驗證指令

執行草稿中的安裝/建置/測試/語法檢查指令(以安全的方式進行:不部署、不對真實資料庫執行遷移、不發佈)。對於每個指令:如果成功就保留它;如果修正方式很明顯,就修正它;否則標記為 (unverified) 並告知使用者。如果測試套件執行緩慢,請記錄所需時間。

步驟 4 — 撰寫 AGENTS.md

從 assets/AGENTS.template.md 開始。內容好的規則:

  • 簡短。 目標是在 150 行以內。代理在每次任務時都會讀取這些規則;每一行都會消耗上下文。
  • 具體且可檢查:「在提交前執行 pnpm test --filter web」勝過「測試你的程式碼」。
  • 將指令放在前面。然後是佈局、慣例、注意事項和「禁止」規則。
  • 記錄非顯而易見的事項:不應編輯的生成檔案、測試所需的環境變數、應在本地跳過的某個慢速測試、密碼絕對不能放置的位置。
  • 單體倉庫:根目錄的 AGENTS.md 用於共用規則 + 巢狀的 packages/x/AGENTS.md 用於套件專用的指令(支援此功能的代理會讀取最近的檔案)。

步驟 5 — 連接其他工具

  • Claude Code:從 assets/CLAUDE.template.md 建立 CLAUDE.md(它包含 @AGENTS.md)。如果 CLAUDE.md 已存在,則將其規則移至 AGENTS.md,並在匯入語句之後僅保留 Claude 專用的備註。
  • Codex:原生讀取 AGENTS.md — 無需其他操作。
  • Cursor:讀取根目錄的 AGENTS.md;將 .cursorrules 的內容遷移至 AGENTS.md,並在使用者同意後刪除 .cursorrules(已棄用)。僅保留 .cursor/rules/*.mdc 用於 glob 範圍規則。
  • Gemini CLI:預設讀取 GEMINI.md;在 .gemini/settings.json 中設定 "context": {"fileName": ["AGENTS.md", "GEMINI.md"]},或建立一個指向 AGENTS.md 的一行 GEMINI.md。如果此設定鍵已變更,請查閱已安裝版本的說明文件。
  • 符號連結(ln -s AGENTS.md CLAUDE.md)也可行,但在沒有啟用 core.symlinks 的 Windows 檢出環境中會失敗;匯入方式較為安全。

請參閱 references/tool-support.md 了解每個工具讀取的檔案。

步驟 6 — 報告

列出:已建立/修改的檔案、已驗證的指令(含結果)、標記為未驗證的指令、因重複或過於通用而刪除的規則,以及任何需要使用者決定的事項(例如是否刪除 .cursorrules?)。除非使用者要求,否則請勿提交變更。

Individual skills in this repo

This repo contains 4 individual skills — each has its own dedicated page.

getpaidskills/directory-launch-kit

Prepares a product for submission to launch platforms and directories (Product Hunt, Show HN, BetaList, Uneed, Fazier, SaaSHub, TinyLaunch, AI tool directories, agent-skill marketplaces, Reddit, V2EX and more) without submitting anything itself. Picks only the directories the product fits, writes the copy for each form within its field limits from one product.json, resizes screenshots to each platform's sizes (Product Hunt 1270x760 gallery and 240x240 thumbnail, 1200x630 OG), builds a tracker CSV, re-checks prices and rules on the live pages, and later verifies which listings went live and whether their backlinks are follow or nofollow. Use when the user asks where to launch, how to submit to Product Hunt or AI directories, wants launch copy, a directory list, backlinks, or a launch tracker.

getpaidskills/launch-checklist

Pre-launch audit for a website or SaaS - checks SEO tags (title, description, canonical, lang, Open Graph), robots.txt, sitemap.xml, favicon and apple-touch-icon, real 404 status, HTTPS redirect, legal pages (privacy, terms, refund), image alt text, page weight and response time, plus a payment self-check (webhook signature, raw body, idempotency, refunds, secrets, success-page grants), then lists the problems and fixes them in the codebase. Ships a no-dependency crawler script (audit_site.py) that produces a pass/warn/fail report. Use when the user says they are about to launch, ship, go live, submit to Product Hunt or AI directories, or asks "is my site ready", "SEO check", "why is my site not indexed", or wants a launch checklist, or asks whether their payment or webhook setup is safe.

getpaidskills/legal-pages

Drafts a Privacy Policy, Terms of Service and Refund Policy for a SaaS, digital product or website from a short questionnaire, adapted to the payment provider (Creem, Paddle, Lemon Squeezy as Merchant of Record, or Stripe/direct) and to where users are (EU/UK GDPR, California CCPA/CPRA, China PIPL notes), then renders them as Markdown, HTML or Next.js pages and links them in the footer. Output is a starting template, NOT legal advice - the user must review it and have it checked by a qualified lawyer. Use when the user needs privacy policy, terms, refund policy, legal pages, or a payment provider (Paddle/Creem/Lemon Squeezy/Stripe) review asks for them.

getpaidskills/og-image-kit

Generates Open Graph / Twitter (X) share images for every page of a website and wires up the og:* and twitter:* meta tags, then verifies the social preview. Supports Next.js App Router (opengraph-image.tsx with next/og ImageResponse), Astro (build-time PNGs via satori + resvg) and any static site (Pillow script). Use when the user asks for OG images, social share cards, link previews, "my link looks bad on X/Slack/LinkedIn/WeChat", twitter:card, or before launching a site.

相關技能