Add STYLE.md to a project
This guide adds a STYLE.md to a project so every agent working in the repo applies the style. By the end, the repo has a STYLE.md file and an AGENTS.md note pointing to it.
You need a style reference — a share slug or a /share URL, or your own style’s id once you’re signed in. See Core concepts.
Option 1: The CLI (recommended)
npx styleref init writes STYLE.md and adds a note to AGENTS.md in one step:
npx styleref init 1an6edgp-c42c0cba5315This writes the compiled STYLE.md to the project root and appends a line to AGENTS.md telling agents to follow it. See the CLI reference.
Option 2: The REST API
Fetch the STYLE.md body and write it yourself:
curl "https://styleref.io/api/v1/styles/1an6edgp-c42c0cba5315/style.md" > STYLE.mdThen add one line to AGENTS.md (create the file if it doesn’t exist):
Follow STYLE.md for all visual, brand, and voice decisions.Option 3: An agent with MCP
If your coding agent is connected to the MCP server, use the setup-style-md prompt. It tells the agent to fetch the style as STYLE.md, write it to the repo root, and wire the AGENTS.md reference — see Resources & prompts.
Keep it in sync
Treat STYLE.md as generated, not hand-edited. When the style changes, re-run the same command to regenerate the file rather than editing it in place. The generator: "styleref.io" frontmatter marks it as compiled output.
Verify
Confirm the file is well-formed:
npx styleref validateA valid file reports no errors. See Validate & lint.
Next steps
- Validate & lint — check the file on every change.
- The “Styled with STYLE.md” badge — advertise the convention in your README.
- CLI reference —
init,pull,validate.