specpack

io.github.THE-KIPDEV由 GitHub 账号 THE-KIPDEV 发布v0.1.0更新于 Oct 25, 2026

Audit and write CLAUDE.md / AGENTS.md / Cursor rules; generate full build specs for new projects.

已验证Streamable HTTP可网页运行效率与工作流开发者工具

概览

AI 生成的概览

检查并生成 AI 编码代理读取的指令文件(CLAUDE.md、AGENTS.md、Cursor 规则),并把问卷答案转成完整的项目构建规格。

可以做什么
审计代理文件:为 CLAUDE.md、AGENTS.md 和 Cursor 规则计算冗余评分,列出应保留、删除或外移的行并给出精简副本(仅本地服务器)。根据仓库清单生成精简的代理文件,不写入任何内容(仅本地服务器)。列出七种支持的项目类型,并获取某一类型的问卷。根据答案生成确定性的构建规格及配套代理文件,可写入指定输出目录。让服务器端 AI 根据自然语言描述填写问卷答案,并查询套餐与剩余配额。
适用场景
适合在维护 CLAUDE.md、AGENTS.md 或 Cursor 规则、希望删减浪费 token 的行时使用;也适合在启动新项目时,根据简短描述生成结构化的构建规格和代理文件。
运行要求
本地 npm 包需 Node.js 18 或更高版本,通过 npx 运行;也提供远程 streamable HTTP 端点,但两个本地文件工具仅在本地服务器中可用。免费配额无需账号;可选 API 密钥可通过 SPECPACK_API_KEY 或 Authorization Bearer 头提供,以获得更多规格和 AI 草稿。规格与 AI 工具需要网络访问。
安装前请注意
规格和 AI 草稿工具会把你的答案或项目描述发送到 prompt-generator-website.com;audit 和 init 保持离线。AI 草稿会消耗有限的免费配额(无密钥时三次),更多需付费 Pass 或 Pro。generate_spec 可向输出目录写入文件。API 密钥是机密,保存在本地配置文件中。

安装

在 SourceWeft 中

  1. 打开 控制台中的 specpack,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Web executable,通过 Streamable HTTP。 远程服务在工作区中配置后即可从网页运行时运行。

交给智能体安装

把这段提示词粘贴到 Claude Code、Codex、Cursor 等智能体,或 SourceWeft 对话中。智能体会读取该服务器的安装指南,先向你展示发布者、端点和登录方式,经你同意后再把它添加到你的客户端。密钥不会写进任何命令。

阅读 https://sourceweft.com/mcp/io.github.THE-KIPDEV%2Fspecpack/install.md,并按其中说明把这个 MCP 服务器接入我的客户端。修改任何配置之前,先告诉我它的发布者、端点和登录方式,等我确认。不要把 API 密钥写进命令或我会提交的文件;问我密钥应从哪里获取。

查看智能体所依据的安装指南

其他 MCP 客户端

把它添加到你客户端的 mcpServers 配置中。

{
  "mcpServers": {
    "specpack": {
      "type": "http",
      "url": "https://prompt-generator-website.com/mcp"
    }
  }
}

README

specpack

Lint and generate the files your AI coding agent reads — CLAUDE.md, AGENTS.md, .cursorrules, Cursor rules — and turn a project description into a full build spec. CLI, library and MCP server.

bash
npx specpack audit          # bloat score for the agent files in this repo (offline)npx specpack init           # write a lean AGENTS.md from your manifests (offline)npx specpack spec --describe "Booking app for dog groomers with deposits and SMS reminders"

[npm] [CI] [license]

CLAUDE.md / AGENTS.md are loaded into the agent's context on every session. Every line that restates package.json, pastes a file tree or tells the model to "write clean code" costs tokens and competes with the two rules that actually matter. specpack audit finds those lines; specpack init starts you at the trimmed end.

Node ≥ 18. No account needed. audit and init never touch the network.


specpack audit — how much of your memory file does nothing?

Each line is classified keep, cut (removing it changes nothing: role-play preamble, generic advice, restated manifests, duplicates, emphasis inflation, prose) or offload (true but situational: file trees, schema dumps, endpoint lists, long code blocks, setup/deploy sections — move them to their own file and reference them with @docs/…). Same rules as the browser tool at prompt-generator-website.com/claude-md-audit.

Real output on a typical file:

text
$ npx specpack audit CLAUDE.mdCLAUDE.md  59% bloat  · 44 lines · ~341 tokens every session  10 keep · 12 cut · 15 offload of 37 non-empty lines · ceiling 200, trimmed files land near 60  Over half of this file is doing nothing. It is not neutral weight — it is what your real rules are competing against.
     3  cut     You are an expert senior full-stack developer with 10 years of experience.        ↳ role-play preamble: CLAUDE.md is project memory, not a system prompt. "You are an expert…" costs tokens and changes nothing about the code produced.     4  cut     Please always write clean, readable and maintainable code.        ↳ default behaviour: Removing this line does not make the model write worse code — it already tries to do this. It only dilutes the lines that matter.     5  cut     IMPORTANT: follow best practices at all times.     …    12  cut     - Next.js 15.1        ↳ restates a manifest: package.json / composer.json / requirements.txt already state this, and the agent reads them. Keep it only if the version pin has a non-obvious reason.     …    18  offload ## Database schema        ↳ situational section: Only a fraction of your sessions need this. Move the section to its own file and point at it with @docs/… so it loads when the task asks for it.     …    31  offload src/        ↳ file tree: Root of a pasted directory tree. The agent can run ls and get the real one — a copy goes stale after the first refactor.     …  Trimmed copy (8 lines): specpack audit CLAUDE.md --trimmed

Without arguments it audits every agent file in the current directory: CLAUDE.md, AGENTS.md, .cursorrules, .windsurfrules, .github/copilot-instructions.md, CLAUDE.local.md, .cursor/rules/*.mdc. - reads stdin.

Option
--trimmedprint only the keep-only version (> CLAUDE.trimmed.md)
--jsonevery line with verdict, rule and reason, plus stats and the trimmed file
--allalso list the kept lines and why
--max-bloat <pct>exit code 1 when a file is above the threshold

In CI

yaml
# .github/workflows/agent-files.ymlname: Agent fileson: [pull_request]jobs:  audit:    runs-on: ubuntu-latest    steps:      - uses: actions/checkout@v4      - run: npx -y specpack audit --max-bloat 30

specpack init — a lean AGENTS.md from what the repo already says

Reads package.json (scripts, lockfile → package manager, framework), tsconfig.json, the Prisma schema, pyproject.toml / requirements*.txt (uv, Poetry), composer.json, go.mod, Cargo.toml, Gemfile, Makefile, Docker Compose, .nvmrc, .env.example, .claude/commands. Only what a file states is written: nothing is guessed, no patch versions, no "You are an expert" preamble. Sections with nothing detected are left out.

Real output on a Next.js + Prisma repository:

text
$ npx specpack init✓ Wrote AGENTS.md (37 lines, 0% bloat)  Scanned from package.json, tsconfig.json, prisma/schema.prisma, .nvmrc, docker-compose.yml, .env.example, .gitignore, .claude/commands/.
markdown
# AGENTS.md — ledgerly
Invoicing app for freelancers. A web application.
## Stack- Next.js (App Router)- Tailwind CSS- Zod- Stripe- Vitest- Playwright- ESLint- TypeScript (strict)- Prisma + PostgreSQL (schema: prisma/schema.prisma)- Local services via Docker Compose (docker-compose.yml): db
## Commands- `pnpm dev` — `next dev --turbopack -p 3001` (port 3001)- `pnpm build` — `next build`- `pnpm start` — `next start`- `pnpm test` — `vitest run`- `pnpm test:e2e` — `playwright test`- `pnpm lint` — `next lint`- `pnpm db:migrate` — `prisma migrate dev`- `pnpm db:seed` — `tsx prisma/seed.ts`- `docker compose up -d`
## Project rulesThese are things the agent cannot guess from the code. Follow them exactly.- Use pnpm (pnpm-lock.yaml), not npm or yarn — another package manager ignores the lockfile.- Runtime: Node 20 (.nvmrc).- Environment variables are listed in `.env.example`; the real `.env` is git-ignored — do not commit it.<!-- Add the rules the code cannot tell the agent, one per line: the directory scheduled for deletion,     money stored in cents, the command that must never run against staging. -->

Then add the rules only you know under Project rules — that is the part that matters.

Option
--format agentsAGENTS.md (default)
--format claudeCLAUDE.md — imports @AGENTS.md when it exists, plus Claude Code specifics (slash commands, .mcp.json servers)
--format cursor.cursor/rules/project.mdc (always-applied rule)
--format allthe three
--dry-run / --forcepreview / overwrite (existing files are never overwritten otherwise)

specpack spec — a full build spec for a new project

For a project that does not exist yet, prompt-generator-website.com turns a questionnaire (7 project types: SaaS, e-commerce, business site, marketplace, blog, web app, landing page) into a complete specification — stack, database schema, authentication, type-specific features, pages, design, SEO, security, legal, deployment, file structure — plus AGENTS.md, CLAUDE.md, .cursor/rules/project.mdc, .cursorrules, .windsurfrules and .github/copilot-instructions.md that keep the agent on-spec for the whole build.

bash
# AI drafts the answers from a description (10–40 s), then the spec is generatednpx specpack spec --describe "Booking app for dog groomers with deposits and SMS reminders" --out ./groombook
# your own answers (see GET /questions in the API)npx specpack spec --answers answers.json --type saas
# or answer the questionnaire in the terminalnpx specpack spec

The spec engine is deterministic: the same answers always give the same bytes. Free without an account: 2 specs and 3 AI drafts. More: a 7-day Pass or Pro at prompt-generator-website.com/pricing; then specpack login pgw_… (or SPECPACK_API_KEY). specpack whoami shows what is left.

MCP server

Seven tools for Claude Code, Cursor, Windsurf, VS Code and any MCP client:

ToolWhere it runs
audit_agent_filelocalbloat score, lines to cut/offload with reasons, trimmed copy
draft_agent_filelocallean AGENTS.md / CLAUDE.md / Cursor rule from the manifests (returns it, writes nothing)
list_project_typesAPIthe 7 project types
get_questionnaireAPIevery question for a type; the agent fills it from the conversation and the repo
generate_specAPIspec + agent files, written to output_dir if given (files picks which). No AI on the server
draft_answersAPIAI fills the questionnaire from a description (uses an AI draft)
get_usageAPIplan and what is left

Claude Code

bash
claude mcp add specpack -- npx -y specpack mcp

Cursor (.cursor/mcp.json), Windsurf, Claude Desktop

json
{  "mcpServers": {    "specpack": { "command": "npx", "args": ["-y", "specpack", "mcp"], "env": { "SPECPACK_API_KEY": "" } }  }}

Remote, nothing to install (streamable HTTP; audit_agent_file and draft_agent_file read local files, so they only exist in the local server): https://prompt-generator-website.com/mcp — optional header Authorization: Bearer pgw_….

bash
claude mcp add --transport http specpack https://prompt-generator-website.com/mcp

Library

ts
import { audit, scanProject, renderAgentsMd, SpecpackClient } from "specpack";
const { stats, lines, trimmed } = audit(fs.readFileSync("CLAUDE.md", "utf8"));console.log(`${stats.bloat}% bloat`, lines.filter((l) => l.verdict === "cut").length, "lines to cut");
const agentsMd = renderAgentsMd(scanProject("."));
const client = new SpecpackClient({ apiKey: process.env.SPECPACK_API_KEY });const draft = await client.draft("A booking app for dog groomers");const spec = await client.createSpec(draft.type, draft.answers); // spec.spec, spec.files["AGENTS.md"]…

createMcpServer() is exported from specpack/mcp. API errors are SpecpackError with code (quota_exceeded, unauthorized, invalid_request, …), status and upgradeUrl.

Reference

  • Exit codes: 0 ok · 1 failure, or --max-bloat exceeded · 2 usage error or quota exceeded.
  • Environment: SPECPACK_API_KEY, SPECPACK_API_URL (testing), NO_COLOR.
  • Key storage: ~/.config/specpack/config.json ($XDG_CONFIG_HOME honoured), mode 600.
  • HTTP API: API-V1.md.
  • Privacy: audit and init read local files and send nothing. spec sends your answers or description to prompt-generator-website.com.

License

MIT © Kipdev

来源:README.md,提交 782b7f0

工具

5

list_project_types

List project types

The project types the spec generator knows (saas, ecommerce, business, marketplace, blog, webapp, landing), with what each covers.

无需输入参数。

get_questionnaire

Get the questionnaire

The questions for one project type: universal questions first, then type-specific ones. Each has an id, a type (text, textarea, select, radio, multiselect, boolean, number), options where relevant, and sometimes a condition (ask it only when another answer matches). Answer from what you know of the project, then pass the answers to generate_spec. Only project_name and project_description are required; skipped questions fall back to defaults.

输入参数type必填

generate_spec

Generate the spec and agent files

Turns questionnaire answers into a complete build specification (stack, database schema, auth flows, pages, design system, SEO, security, legal, deployment, file structure) and the matching agent files. Deterministic: the same answers always give the same bytes. Values: select/radio = one option value, multiselect = array of option values, boolean = true/false, number = number. Returns the requested files; by default AGENTS.md (full spec + working agreement) and CLAUDE.md (imports AGENTS.md) — write them at the repository root. Uses one spec from the quota (2 free without an API key).

输入参数type必填filesanswers必填

draft_answers

Draft answers with AI

Asks the server's AI (Claude) to fill the whole questionnaire from a plain-language project description; returns the project type, the answers and the assumptions it made. Takes 10-40 s and consumes one AI draft (3 free without an API key). Prefer answering get_questionnaire yourself when you already know the project; use this when you only have a one-line idea. Review the assumptions with the user before calling generate_spec.

输入参数typedescription必填

get_usage

Plan and usage

Current plan and quota usage (specs and AI drafts) for the API key, or for this address when no key is set.

无需输入参数。

版本历史

1
  1. v0.1.0最新Sep 18, 2026

评分

已满足适用检查项的 100%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通必需25 分
  • 已声明认证方式必需10 分
  • 已列出工具必需15 分
  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分