Skip to content

Commit 36dc150

Browse files
escapedcatclaude
andauthored
docs: add ai agent support (skill, guide, llms.txt) (#4804)
* docs: add committing-with-commitlint agent skill * docs: add ai agents guide * docs: generate llms.txt via vitepress-plugin-llms Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * docs: clarify fallback baseline in agent skill Reword the absent-rule guidance so it does not attribute the conservative baseline to the Conventional Commits spec, document that config-conventional allows 100-char headers, and note the empty-rules failure when no config exists. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent abe87df commit 36dc150

5 files changed

Lines changed: 701 additions & 0 deletions

File tree

docs/.vitepress/config.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { defineConfig } from "vitepress";
2+
import llmstxt from "vitepress-plugin-llms";
23
import { tabsMarkdownPlugin } from "vitepress-plugin-tabs";
34

45
// https://vitepress.dev/reference/site-config
@@ -31,6 +32,7 @@ export default defineConfig({
3132
{ text: "Local setup", link: "/local-setup" },
3233
{ text: "CI setup", link: "/ci-setup" },
3334
{ text: "Use prompt", link: "/use-prompt" },
35+
{ text: "AI agents", link: "/ai-agents" },
3436
],
3537
},
3638
{
@@ -100,4 +102,8 @@ export default defineConfig({
100102
md.use(tabsMarkdownPlugin);
101103
},
102104
},
105+
106+
vite: {
107+
plugins: [llmstxt()],
108+
},
103109
});

docs/guides/ai-agents.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Guide: AI Agents
2+
3+
AI coding agents (Claude Code, Copilot, Cursor, and others) write a growing share of
4+
commits. Your commitlint configuration is a machine-readable contract: agents follow
5+
rules that are enforced and drift on rules that are not. This guide shows how to make
6+
agents first-class citizens of your commit convention.
7+
8+
## Install the commitlint skill
9+
10+
For tools that support the [Agent Skills](https://agentskills.io) format (such as
11+
Claude Code), commitlint ships a skill that teaches the agent to read your resolved
12+
configuration, write a compliant message, and self-correct when the commit-msg hook
13+
rejects:
14+
15+
```bash
16+
mkdir -p .claude/skills/committing-with-commitlint
17+
curl -fLo .claude/skills/committing-with-commitlint/SKILL.md \
18+
https://raw.githubusercontent.com/conventional-changelog/commitlint/master/skills/committing-with-commitlint/SKILL.md
19+
```
20+
21+
For other tools, consult their documentation for where skills are loaded from — the
22+
skill file itself is tool-neutral.
23+
24+
## No skill support?
25+
26+
Add this to your `AGENTS.md`, `CLAUDE.md`, or equivalent agent instructions file:
27+
28+
```markdown
29+
## Commit convention
30+
31+
This repository enforces its commit convention with commitlint.
32+
33+
- Read the rules before committing: `npx commitlint --print-config json`
34+
- Validate a message before using it: `printf '%s' "<message>" | npx commitlint`
35+
(exit 0 = valid)
36+
- If the commit-msg hook rejects a commit, fix the rules named in brackets
37+
(e.g. `[subject-case]`) and retry. Never use `git commit --no-verify`.
38+
```
39+
40+
## CLI primitives for agents and automation
41+
42+
| Command | Purpose |
43+
| --------------------------------------- | -------------------------------------------------------------- |
44+
| `npx commitlint --print-config json` | The resolved configuration (rules, parser preset) as JSON |
45+
| `printf '%s' "<msg>" \| npx commitlint` | Validate a candidate message from stdin |
46+
| `npx commitlint --last` | Lint the last commit |
47+
| `npx commitlint --edit $1` | Lint a commit-msg file (hook usage) |
48+
| `npx commitlint --strict` | Exit code 2 for warnings, 3 for errors (instead of 1 for both) |
49+
50+
## For LLMs reading these docs
51+
52+
The full documentation is available in LLM-friendly form:
53+
54+
- <https://commitlint.js.org/llms.txt> — index of all pages
55+
- <https://commitlint.js.org/llms-full.txt> — entire documentation as one markdown file

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
"typescript": "^6.0.0",
6161
"vite": "^8.0.0",
6262
"vitepress": "^1.3.4",
63+
"vitepress-plugin-llms": "^1.13.1",
6364
"vitepress-plugin-tabs": "^0.9.0",
6465
"vitest": "~4.1.0",
6566
"vitest-environment-commitlint": "workspace:^",

0 commit comments

Comments
 (0)