Hive
feat(specs): expose a write_spec MCP prompt with the house style guide
GitHub issue · Closed
Summary
While iterating on the feedback Marek left on spec 2, it became clear that the writing-and-review patterns that make Tuist RFCs and Hive specs work well are codifiable. The recurring critiques map onto a small set of rules: hold altitude (a spec is a contract, not an implementation walkthrough), name decisions and give them reasons, lean don’t dump on open questions, and pre-empt the things reviewers consistently push on (security posture, capacity, reuse claims, cross-surface consistency).
To make those rules reach the people drafting specs, this PR exposes them as a first-class MCP prompt on the Hive MCP server. Clients (Claude Code, Cursor, anything that speaks prompts/get) pull write_spec on demand before drafting, and the guidelines land in the agent’s context with no extra plumbing.
I considered two homes for the text: a markdown file under docs/, or an Elixir module parallel to Hive.Agents.StyleGuide. I went with the module, since the same body can later feed an internal Condukt agent that drafts specs (parallel to how RevisionSummaryAgent consumes Hive.Agents.StyleGuide) without duplicating the text. The MCP prompt module composes the guide from Hive.Specs.StyleGuide and accepts an optional topic argument that gets woven into the lede so the model is primed before the guidelines load.
For agents that never call prompts/list, a one-line nudge in the create_spec and update_spec tool descriptions points at the prompt as a belt-and-suspenders fallback. The prompt only helps if the client pulls it; the tool-description hint is the cheap backup.
Hive.Specs.StyleGuide(lib/hive/specs/style_guide.ex) holds the guide text withbody/0andwrite_spec_prompt/1(optional topic woven into the lede). Mirrors the shape ofHive.Agents.StyleGuide.Hive.MCP.Components.Prompts.WriteSpec(lib/hive/mcp/components/prompts/write_spec.ex) implementsEMCP.Prompt, exposing the guide as thewrite_specMCP prompt with an optionaltopicargument.- Registered in
Hive.MCP.Servervia the EMCPprompts:option (first prompt on the Hive MCP server). create_specandupdate_spectool descriptions append a one-line hint pointing atwrite_specso agents that bypassprompts/liststill get nudged.
Testing
mise exec -- mix formaton the touched filesmise exec -- mix compile --warnings-as-errorsmise exec -- mix test test/hive/specs/style_guide_test.exs test/hive/mcp/components/prompts/write_spec_test.exs(11/11 pass)mise exec -- mix test test/hive/mcp/(23/23 pass; confirms the tool-description edits didn’t break neighbouring tests)mise exec -- mix credo --strict lib/hive/specs/style_guide.ex lib/hive/mcp/components/prompts/write_spec.ex(clean)
No GitHub comments yet.