@buresmi7/agent-doc-rules-skill 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +250 -0
- package/SKILL.md +129 -0
- package/agents/openai.yaml +4 -0
- package/assets/templates/AGENTS.overlay.md +35 -0
- package/assets/templates/AGENTS.project.md +31 -0
- package/bin/install.mjs +128 -0
- package/docs/adoption.md +144 -0
- package/docs/config-reference.md +208 -0
- package/docs/context-placement.md +147 -0
- package/docs/recipes.md +136 -0
- package/docs/tool-map.md +65 -0
- package/package.json +42 -0
- package/references/agents-rubric.md +44 -0
- package/references/agents-rules.md +89 -0
- package/references/doc-audit.md +58 -0
- package/references/documentation-architecture.md +63 -0
- package/references/factual-review.md +108 -0
- package/references/influences.md +63 -0
- package/references/readme-rubric.md +38 -0
- package/references/readme-rules.md +124 -0
- package/references/security-review.md +75 -0
- package/references/validation.md +96 -0
- package/references/writing-style.md +77 -0
package/README.md
ADDED
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
# Agent Doc Rules Skill
|
|
2
|
+
|
|
3
|
+
`agent-doc-rules` is an Agent Skill for repository documentation and agent
|
|
4
|
+
context architecture.
|
|
5
|
+
|
|
6
|
+
Use it when a project needs to decide what belongs in human documentation, what
|
|
7
|
+
belongs in always-loaded agent instructions, and what should become a
|
|
8
|
+
task-specific skill for agents.
|
|
9
|
+
|
|
10
|
+
## What It Does
|
|
11
|
+
|
|
12
|
+
- Keeps `AGENTS.md` short, local, and useful for agent routing.
|
|
13
|
+
- Shapes `README.md` as a human entry point, not a full manual.
|
|
14
|
+
- Separates long-lived docs from task-specific agent workflows.
|
|
15
|
+
- Reviews repository docs for false, contradictory, unsupported, stale, or
|
|
16
|
+
misleading claims.
|
|
17
|
+
- Reviews agent-facing docs for data leaks, prompt-injection language,
|
|
18
|
+
validation bypasses, and backdoor-style guidance.
|
|
19
|
+
- Applies plain-English writing rules to repository documentation.
|
|
20
|
+
- Uses progressive disclosure so detailed rules live in references, not in the
|
|
21
|
+
always-loaded skill entry point.
|
|
22
|
+
|
|
23
|
+
## Install
|
|
24
|
+
|
|
25
|
+
Install from npm into the current Codex project:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npx @buresmi7/agent-doc-rules-skill
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Replace an existing project install:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
npx @buresmi7/agent-doc-rules-skill install --force
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
The npm installer copies only the skill artifact into
|
|
38
|
+
`.agents/skills/agent-doc-rules/`. It does not copy this monorepo's E2E
|
|
39
|
+
fixtures, support scripts, generated maintainer skills, or root docs.
|
|
40
|
+
|
|
41
|
+
Install a tagged skill directory with the `skills` CLI when a consuming project
|
|
42
|
+
wants a `skills-lock.json` entry:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
npx skills add https://github.com/<owner>/<repo>/tree/<tag>/packages/agent-doc-rules-skill --skill agent-doc-rules -a codex -y --copy
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Install the local working tree for development:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
npx skills add ./packages/agent-doc-rules-skill --skill agent-doc-rules -a codex -y --copy
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
For project-scoped Codex installs, the skill is installed under
|
|
55
|
+
`.agents/skills/agent-doc-rules/`.
|
|
56
|
+
|
|
57
|
+
Install optional documentation validation tools:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
pnpm add -D @agent-doc-rules/docs-validator @agent-doc-rules/docs-duplicates
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Recommended scripts:
|
|
64
|
+
|
|
65
|
+
```json
|
|
66
|
+
{
|
|
67
|
+
"scripts": {
|
|
68
|
+
"docs:markdown": "agent-doc-rules-docs markdown",
|
|
69
|
+
"docs:wording": "agent-doc-rules-docs wording",
|
|
70
|
+
"docs:security": "agent-doc-rules-docs security",
|
|
71
|
+
"docs:style": "agent-doc-rules-docs-duplicates style",
|
|
72
|
+
"docs:links": "agent-doc-rules-docs links",
|
|
73
|
+
"docs:duplicates": "agent-doc-rules-docs-duplicates check",
|
|
74
|
+
"docs:check": "agent-doc-rules-docs check && agent-doc-rules-docs-duplicates style && agent-doc-rules-docs-duplicates check"
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Usage
|
|
80
|
+
|
|
81
|
+
Ask the agent to use the skill by name.
|
|
82
|
+
|
|
83
|
+
Main examples:
|
|
84
|
+
|
|
85
|
+
```text
|
|
86
|
+
Use $agent-doc-rules to create a concise root AGENTS.md for this repository.
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
```text
|
|
90
|
+
Use $agent-doc-rules to review this README for stale commands and duplicated rules.
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
```text
|
|
94
|
+
Use $agent-doc-rules to review these docs for factual accuracy, contradictions,
|
|
95
|
+
and unsupported claims.
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
```text
|
|
99
|
+
Use $agent-doc-rules to decide whether this note belongs in README.md,
|
|
100
|
+
AGENTS.md, docs/, or a task-specific skill.
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
```text
|
|
104
|
+
Use $agent-doc-rules to add a project-specific documentation overlay.
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Common tasks:
|
|
108
|
+
|
|
109
|
+
- create or repair `AGENTS.md`,
|
|
110
|
+
- write or review a README,
|
|
111
|
+
- decide whether information belongs in docs, `AGENTS.md`, or a skill,
|
|
112
|
+
- add a project-specific documentation overlay,
|
|
113
|
+
- review agent-facing docs for security risks,
|
|
114
|
+
- review docs for factual accuracy, plain English, and duplicated rules.
|
|
115
|
+
|
|
116
|
+
## Adoption And Tools
|
|
117
|
+
|
|
118
|
+
- [Adoption Guide](docs/adoption.md) shows the smallest setup for consuming
|
|
119
|
+
repositories.
|
|
120
|
+
- [Tool Map](docs/tool-map.md) maps common documentation tasks to the right
|
|
121
|
+
skill reference or CLI.
|
|
122
|
+
- [Config Reference](docs/config-reference.md) documents
|
|
123
|
+
`agent-doc-rules.config.json`.
|
|
124
|
+
- [Recipes](docs/recipes.md) gives before-and-after patterns based on the E2E
|
|
125
|
+
scenarios.
|
|
126
|
+
|
|
127
|
+
## Feature Guide
|
|
128
|
+
|
|
129
|
+
- [Agent Instructions](#agent-instructions)
|
|
130
|
+
- [README Shaping](#readme-shaping)
|
|
131
|
+
- [Documentation Placement](#documentation-placement)
|
|
132
|
+
- [Documentation Repair](#documentation-repair)
|
|
133
|
+
- [Factual Documentation Review](#factual-documentation-review)
|
|
134
|
+
- [Documentation Security Review](#documentation-security-review)
|
|
135
|
+
- [Plain-English Cleanup](#plain-english-cleanup)
|
|
136
|
+
- [Validation Tools](#validation-tools)
|
|
137
|
+
- [Starter Templates](#starter-templates)
|
|
138
|
+
- [Adoption Docs](#adoption-docs)
|
|
139
|
+
|
|
140
|
+
### Agent Instructions
|
|
141
|
+
|
|
142
|
+
Create or repair `AGENTS.md` files so agents get a brief project orientation,
|
|
143
|
+
short routing rules, local constraints, nested instruction pointers, and
|
|
144
|
+
verification commands. The detailed rules live in
|
|
145
|
+
[`references/agents-rules.md`](references/agents-rules.md), with review checks
|
|
146
|
+
in [`references/agents-rubric.md`](references/agents-rubric.md).
|
|
147
|
+
|
|
148
|
+
### README Shaping
|
|
149
|
+
|
|
150
|
+
Keep README files useful as human entry points. The skill trims runbooks,
|
|
151
|
+
removes stale commands, and links to deeper docs instead of copying detail into
|
|
152
|
+
the README. See [`references/readme-rules.md`](references/readme-rules.md) and
|
|
153
|
+
[`references/readme-rubric.md`](references/readme-rubric.md).
|
|
154
|
+
|
|
155
|
+
### Documentation Placement
|
|
156
|
+
|
|
157
|
+
Decide whether a fact belongs in `README.md`, `docs/`, `AGENTS.md`, a skill,
|
|
158
|
+
or a skill reference. The compact rule set is
|
|
159
|
+
[`references/documentation-architecture.md`](references/documentation-architecture.md);
|
|
160
|
+
the fuller guide is [`docs/context-placement.md`](docs/context-placement.md).
|
|
161
|
+
|
|
162
|
+
### Documentation Repair
|
|
163
|
+
|
|
164
|
+
Move bloated, stale, duplicated, or inbox-style documentation into the right
|
|
165
|
+
canonical home. The audit workflow lives in
|
|
166
|
+
[`references/doc-audit.md`](references/doc-audit.md).
|
|
167
|
+
|
|
168
|
+
### Factual Documentation Review
|
|
169
|
+
|
|
170
|
+
Check documentation claims against project evidence before editing. If a
|
|
171
|
+
requested change conflicts with local manifests, source files, configs, tests,
|
|
172
|
+
or canonical docs, the skill tells the agent to report the conflict instead of
|
|
173
|
+
writing unsupported text. See
|
|
174
|
+
[`references/factual-review.md`](references/factual-review.md).
|
|
175
|
+
|
|
176
|
+
### Documentation Security Review
|
|
177
|
+
|
|
178
|
+
Review agent-facing docs as instructions that can influence future edits. The
|
|
179
|
+
security checklist covers data exfiltration, remote execution, credential
|
|
180
|
+
handling, prompt-injection language, validation bypasses, backdoor-style
|
|
181
|
+
guidance, remote tracking assets, and encoded payloads. See
|
|
182
|
+
[`references/security-review.md`](references/security-review.md).
|
|
183
|
+
|
|
184
|
+
### Plain-English Cleanup
|
|
185
|
+
|
|
186
|
+
Rewrite repository documentation in direct, specific language. The skill cuts
|
|
187
|
+
padding, avoids generic AI phrasing, and keeps the reader's task first. See
|
|
188
|
+
[`references/writing-style.md`](references/writing-style.md).
|
|
189
|
+
|
|
190
|
+
### Validation Tools
|
|
191
|
+
|
|
192
|
+
Use the optional CLIs to check Markdown, deterministic prose wording,
|
|
193
|
+
deterministic security patterns, AI sentence style, local links, and likely
|
|
194
|
+
duplicate documentation passages. Duplicate review supports
|
|
195
|
+
`docs.duplicates.ignorePairs` for narrow, documented overlaps such as E2E
|
|
196
|
+
criteria repeating the rule under test. The validation guidance lives in
|
|
197
|
+
[`references/validation.md`](references/validation.md).
|
|
198
|
+
|
|
199
|
+
### Starter Templates
|
|
200
|
+
|
|
201
|
+
Start new agent instruction files from the templates in
|
|
202
|
+
[`assets/templates/`](assets/templates/) instead of copying unrelated project
|
|
203
|
+
rules.
|
|
204
|
+
|
|
205
|
+
### Adoption Docs
|
|
206
|
+
|
|
207
|
+
Use the product docs when rolling the skill into another repository:
|
|
208
|
+
|
|
209
|
+
- [Adoption Guide](docs/adoption.md)
|
|
210
|
+
- [Tool Map](docs/tool-map.md)
|
|
211
|
+
- [Config Reference](docs/config-reference.md)
|
|
212
|
+
- [Recipes](docs/recipes.md)
|
|
213
|
+
|
|
214
|
+
## Context Placement
|
|
215
|
+
|
|
216
|
+
Context placement decides the durable home for each project fact.
|
|
217
|
+
|
|
218
|
+
Use:
|
|
219
|
+
|
|
220
|
+
- `README.md` for human orientation and first useful commands,
|
|
221
|
+
- `docs/` for long-lived explanations, how-to guides, references, and runbooks,
|
|
222
|
+
- `AGENTS.md` for short always-loaded agent routing and local invariants,
|
|
223
|
+
- `.agents/skills/<name>/` for repeated task workflows that agents should load
|
|
224
|
+
only when relevant,
|
|
225
|
+
- `references/` inside a skill for detailed rules loaded on demand,
|
|
226
|
+
- `assets/` inside a skill for templates and reusable output material.
|
|
227
|
+
|
|
228
|
+
See [Context Placement](docs/context-placement.md) for the full model.
|
|
229
|
+
|
|
230
|
+
## Influences
|
|
231
|
+
|
|
232
|
+
See [Influences And Attribution](references/influences.md) for attribution,
|
|
233
|
+
design influences, and duplicate-review provenance.
|
|
234
|
+
|
|
235
|
+
## Development
|
|
236
|
+
|
|
237
|
+
From the monorepo root:
|
|
238
|
+
|
|
239
|
+
```bash
|
|
240
|
+
corepack pnpm install
|
|
241
|
+
corepack pnpm run skills:sync
|
|
242
|
+
corepack pnpm run test:install
|
|
243
|
+
corepack pnpm test
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
Run agent E2E tests only when an agent runner is configured:
|
|
247
|
+
|
|
248
|
+
```bash
|
|
249
|
+
corepack pnpm run test:agent
|
|
250
|
+
```
|
package/SKILL.md
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: agent-doc-rules
|
|
3
|
+
description: Maintain repo-level AGENTS.md, README.md, docs placement, factual review, and agent workflow extraction. Use for agent docs, documentation architecture, plain-English repository documentation, overlays, and stale-doc repair; do not use as a general product-doc writer.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Agent Doc Rules
|
|
7
|
+
|
|
8
|
+
Use this skill to keep repository instructions and documentation small,
|
|
9
|
+
canonical, plain, and easy for agents and people to use.
|
|
10
|
+
|
|
11
|
+
## Workflow
|
|
12
|
+
|
|
13
|
+
1. Inspect the repository before editing. Identify existing `AGENTS.md`,
|
|
14
|
+
`README.md`, docs, templates, local overrides, and verification commands.
|
|
15
|
+
2. Load only the references needed for the task:
|
|
16
|
+
- For `AGENTS.md`, read [references/agents-rules.md](references/agents-rules.md).
|
|
17
|
+
- For `AGENTS.md` reviews, also read
|
|
18
|
+
[references/agents-rubric.md](references/agents-rubric.md).
|
|
19
|
+
- For documentation writing, rewriting, or style cleanup, read
|
|
20
|
+
[references/writing-style.md](references/writing-style.md).
|
|
21
|
+
- For README work, read
|
|
22
|
+
[references/readme-rules.md](references/readme-rules.md) and
|
|
23
|
+
[references/writing-style.md](references/writing-style.md). If the README
|
|
24
|
+
carries a long runbook or procedure, also read
|
|
25
|
+
[docs/context-placement.md](docs/context-placement.md) and
|
|
26
|
+
[references/doc-audit.md](references/doc-audit.md).
|
|
27
|
+
- For README reviews, also read
|
|
28
|
+
[references/readme-rubric.md](references/readme-rubric.md).
|
|
29
|
+
- For documentation placement, canonical homes, or skill/template structure,
|
|
30
|
+
read [docs/context-placement.md](docs/context-placement.md) and
|
|
31
|
+
[references/documentation-architecture.md](references/documentation-architecture.md).
|
|
32
|
+
- For repairing bloated docs, moving inbox notes, or auditing duplicated
|
|
33
|
+
durable facts, read [references/doc-audit.md](references/doc-audit.md).
|
|
34
|
+
- For factual accuracy, contradictions, unsupported claims, stale facts, or
|
|
35
|
+
misleading documentation review, read
|
|
36
|
+
[references/factual-review.md](references/factual-review.md).
|
|
37
|
+
- For documentation security review, agent-instruction abuse, secret
|
|
38
|
+
exfiltration risks, or backdoor-style guidance, read
|
|
39
|
+
[references/security-review.md](references/security-review.md).
|
|
40
|
+
- For documentation validation or duplicate checks, read
|
|
41
|
+
[references/validation.md](references/validation.md).
|
|
42
|
+
3. When starter content is useful, adapt the templates in
|
|
43
|
+
[assets/templates/](assets/templates/) instead of copying unrelated prose.
|
|
44
|
+
4. Keep each reusable rule in one canonical file. Link to canonical rules from
|
|
45
|
+
other files instead of duplicating them.
|
|
46
|
+
5. Preserve project-specific facts from the consuming repository, but do not
|
|
47
|
+
invent or carry forward unsupported workflows, tools, services, hosts, issue
|
|
48
|
+
processes, or commands. When a manifest such as `package.json` exists, use it
|
|
49
|
+
to verify documented scripts. Do not infer hidden harness commands such as
|
|
50
|
+
`test:agent` unless they are visible in the target project manifest and
|
|
51
|
+
relevant to the user's task.
|
|
52
|
+
6. Before finishing README, `AGENTS.md`, docs, skill, reference, or template
|
|
53
|
+
changes, run or name the repository's relevant Markdown, link, or
|
|
54
|
+
documentation checks. Prefer `npm run docs:check` when it exists. If a check
|
|
55
|
+
cannot run, state why and the residual risk.
|
|
56
|
+
|
|
57
|
+
For context-placement or notes-triage tasks, make one pass over every source
|
|
58
|
+
fact and assign it to a canonical home:
|
|
59
|
+
|
|
60
|
+
- `README.md` for project purpose, first useful command, and a compact docs
|
|
61
|
+
index.
|
|
62
|
+
- `docs/` reference pages for schemas, commands, APIs, and contracts.
|
|
63
|
+
- `docs/` explanation or architecture pages for rationale and trade-offs.
|
|
64
|
+
- `docs/` how-to or troubleshooting pages for fixture failures and repair
|
|
65
|
+
steps.
|
|
66
|
+
- `AGENTS.md` for short routing, local invariants, verification commands, and
|
|
67
|
+
the skipped-check residual-risk rule.
|
|
68
|
+
- The original inbox file, such as `notes.md`, should be removed or reduced to a
|
|
69
|
+
short pointer after durable facts move.
|
|
70
|
+
|
|
71
|
+
For design influences and attribution, see
|
|
72
|
+
[references/influences.md](references/influences.md).
|
|
73
|
+
|
|
74
|
+
## Output Rules
|
|
75
|
+
|
|
76
|
+
- Keep always-loaded agent instructions concise and scannable.
|
|
77
|
+
- If existing docs already satisfy the task, make no file changes. Do not
|
|
78
|
+
rewrite compliant docs for style-only normalization.
|
|
79
|
+
- Do not rewrite supported local skipped-check wording only to match this
|
|
80
|
+
skill's preferred phrasing.
|
|
81
|
+
- Write repository docs in plain, concrete English unless the consuming
|
|
82
|
+
repository sets a different language rule.
|
|
83
|
+
- When creating or repairing `AGENTS.md`, put
|
|
84
|
+
`.agents/skills/agent-doc-rules/references/agents-rules.md` in a dedicated
|
|
85
|
+
top-level `Shared Rules` or `Skill Reference` section. Do not copy the
|
|
86
|
+
referenced rule text, and do not bury the shared-rule link under
|
|
87
|
+
`Source Of Truth`.
|
|
88
|
+
- Root `AGENTS.md` files should start with a brief project orientation from the
|
|
89
|
+
local README or manifest, not only generic section headings.
|
|
90
|
+
- When creating a nested `AGENTS.md`, add a short root `AGENTS.md` pointer that
|
|
91
|
+
names the nested file path and says when agents should read it.
|
|
92
|
+
- Keep troubleshooting, setup, release, and repair procedures in human docs;
|
|
93
|
+
put only routing links and short invariants in `AGENTS.md`.
|
|
94
|
+
- When simplifying existing docs, do not add generic setup, install, test,
|
|
95
|
+
deployment, or package-manager steps unless the source docs, user request, or
|
|
96
|
+
local manifests support them.
|
|
97
|
+
- Move ordinary human runbooks to `docs/` and link to them; do not turn them
|
|
98
|
+
into task-specific skills unless they are repeated agent workflows.
|
|
99
|
+
- For documentation placement tasks, put rationale and trade-off explanations in
|
|
100
|
+
durable `docs/` explanation or architecture files, not only in `README.md` and
|
|
101
|
+
not in schema, importer, command, or API reference pages. Even a one-sentence
|
|
102
|
+
reason needs a `docs/` owner; `README.md` may summarize and link. Put fixture
|
|
103
|
+
failure or repair steps in `docs/` how-to or troubleshooting files. Keep
|
|
104
|
+
`README.md`, reference docs, and `AGENTS.md` to short pointers for those
|
|
105
|
+
details.
|
|
106
|
+
- During notes triage, treat facts introduced as a reason, rationale, why, or
|
|
107
|
+
trade-off as explanation content. Create or update a `docs/` explanation or
|
|
108
|
+
architecture page for that content instead of leaving the README as the only
|
|
109
|
+
home.
|
|
110
|
+
- When project notes describe a repeated workflow meant for agents, create or
|
|
111
|
+
update a task-specific `.agents/skills/<name>/SKILL.md` and link to it instead
|
|
112
|
+
of storing the full workflow in the README or `AGENTS.md`.
|
|
113
|
+
- When adding a project skill, create or update `AGENTS.md` with a short routing
|
|
114
|
+
pointer to that skill; do not copy the full workflow there.
|
|
115
|
+
- When adding verification guidance, include the command or check and state that
|
|
116
|
+
skipped checks need a reason and residual-risk note.
|
|
117
|
+
- When a repository exposes `docs:check`, prefer it for README, `AGENTS.md`,
|
|
118
|
+
docs, skill, reference, and template changes.
|
|
119
|
+
- Put detailed procedures in references, docs, runbooks, or task-specific
|
|
120
|
+
skills.
|
|
121
|
+
- When moving facts out of an inbox file such as `notes.md`, remove that inbox
|
|
122
|
+
file or reduce it to a short pointer; do not leave duplicated durable facts
|
|
123
|
+
behind.
|
|
124
|
+
- Make local overrides explicit, narrow, and easy to find.
|
|
125
|
+
- Keep persisted content in the language required by the consuming repository.
|
|
126
|
+
- Do not include secrets, real customer names, emails, account IDs, private host
|
|
127
|
+
names, tokens, or environment-specific notes in reusable docs. When source
|
|
128
|
+
notes contain sensitive examples, keep only a short safety rule that names the
|
|
129
|
+
sensitive categories to avoid.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Local Agent Rules Overlay
|
|
2
|
+
|
|
3
|
+
Use this template when a project consumes `agent-doc-rules` but needs local
|
|
4
|
+
rules that are not reusable across repositories.
|
|
5
|
+
|
|
6
|
+
## Shared Core
|
|
7
|
+
|
|
8
|
+
This project installs `agent-doc-rules` at:
|
|
9
|
+
|
|
10
|
+
```text
|
|
11
|
+
.agents/skills/agent-doc-rules/
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
`skills-lock.json` records the source. Shared rules apply unless this file
|
|
15
|
+
states a narrower local override.
|
|
16
|
+
|
|
17
|
+
## Shared Rules
|
|
18
|
+
|
|
19
|
+
- AGENTS.md rules: `.agents/skills/agent-doc-rules/references/agents-rules.md`
|
|
20
|
+
- README rules: `.agents/skills/agent-doc-rules/references/readme-rules.md`
|
|
21
|
+
- Documentation architecture: `.agents/skills/agent-doc-rules/references/documentation-architecture.md`
|
|
22
|
+
|
|
23
|
+
## Local Overrides
|
|
24
|
+
|
|
25
|
+
- Add language, security, workflow, or phase constraints specific to this
|
|
26
|
+
project.
|
|
27
|
+
- Keep overrides explicit and avoid copying shared rules.
|
|
28
|
+
|
|
29
|
+
## Project Sources Of Truth
|
|
30
|
+
|
|
31
|
+
- Add canonical docs, specifications, decision logs, or issue templates.
|
|
32
|
+
|
|
33
|
+
## Project Verification
|
|
34
|
+
|
|
35
|
+
- Add project-specific test, lint, validation, or manual review steps.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Project Name - AI Agent Instructions
|
|
2
|
+
|
|
3
|
+
Briefly describe what this repository contains and what agents should keep in
|
|
4
|
+
mind before making changes.
|
|
5
|
+
|
|
6
|
+
## Shared Rules
|
|
7
|
+
|
|
8
|
+
- AGENTS.md rules: `.agents/skills/agent-doc-rules/references/agents-rules.md`
|
|
9
|
+
- README rules: `.agents/skills/agent-doc-rules/references/readme-rules.md`
|
|
10
|
+
- Documentation architecture: `.agents/skills/agent-doc-rules/references/documentation-architecture.md`
|
|
11
|
+
|
|
12
|
+
## Local Overrides
|
|
13
|
+
|
|
14
|
+
- Add project-specific rules that override the shared core.
|
|
15
|
+
- Keep each override narrow and explicit.
|
|
16
|
+
|
|
17
|
+
## Source Of Truth
|
|
18
|
+
|
|
19
|
+
- Link to the canonical project specification, architecture docs, decision log,
|
|
20
|
+
or README.
|
|
21
|
+
- State which document wins when local docs conflict.
|
|
22
|
+
|
|
23
|
+
## Project Constraints
|
|
24
|
+
|
|
25
|
+
- Add safety, security, phase, or workflow constraints that are specific to this
|
|
26
|
+
repository.
|
|
27
|
+
|
|
28
|
+
## Verification
|
|
29
|
+
|
|
30
|
+
- List project-specific checks that should be run before finishing changes.
|
|
31
|
+
- Add the local reporting rule for checks that cannot run.
|
package/bin/install.mjs
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { cp, mkdir, readFile, rm, stat } from 'node:fs/promises';
|
|
3
|
+
import { basename, dirname, join, resolve } from 'node:path';
|
|
4
|
+
import { fileURLToPath } from 'node:url';
|
|
5
|
+
|
|
6
|
+
const packageRoot = resolve(dirname(fileURLToPath(import.meta.url)), '..');
|
|
7
|
+
const defaultTarget = join(process.cwd(), '.agents', 'skills', 'agent-doc-rules');
|
|
8
|
+
const skillEntries = [
|
|
9
|
+
'SKILL.md',
|
|
10
|
+
'README.md',
|
|
11
|
+
'agents',
|
|
12
|
+
'assets',
|
|
13
|
+
'docs',
|
|
14
|
+
'references',
|
|
15
|
+
];
|
|
16
|
+
|
|
17
|
+
await main().catch((error) => {
|
|
18
|
+
console.error(`agent-doc-rules-skill: ${error.message}`);
|
|
19
|
+
process.exit(1);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
async function main() {
|
|
23
|
+
const options = parseArgs(process.argv.slice(2));
|
|
24
|
+
|
|
25
|
+
if (options.help) {
|
|
26
|
+
console.log(usage());
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const target = resolve(process.cwd(), options.target ?? defaultTarget);
|
|
31
|
+
assertSafeTarget(target);
|
|
32
|
+
|
|
33
|
+
const packageJson = JSON.parse(await readFile(join(packageRoot, 'package.json'), 'utf8'));
|
|
34
|
+
const existingTarget = await stat(target).catch((error) => {
|
|
35
|
+
if (error?.code === 'ENOENT') {
|
|
36
|
+
return undefined;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
throw error;
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
if (existingTarget && !existingTarget.isDirectory()) {
|
|
43
|
+
throw new Error(`Target exists but is not a directory: ${target}`);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (existingTarget && !options.force) {
|
|
47
|
+
throw new Error(`Target already exists: ${target}\nRe-run with --force to replace it.`);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (options.dryRun) {
|
|
51
|
+
console.log(`Would install ${packageJson.name}@${packageJson.version} to ${target}`);
|
|
52
|
+
console.log(`Entries: ${skillEntries.join(', ')}`);
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (existingTarget) {
|
|
57
|
+
await rm(target, { recursive: true, force: true });
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
await mkdir(target, { recursive: true });
|
|
61
|
+
|
|
62
|
+
for (const entry of skillEntries) {
|
|
63
|
+
await cp(join(packageRoot, entry), join(target, entry), { recursive: true });
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
console.log(`Installed ${packageJson.name}@${packageJson.version} to ${target}`);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function parseArgs(argv) {
|
|
70
|
+
const args = [...argv];
|
|
71
|
+
const options = {
|
|
72
|
+
dryRun: false,
|
|
73
|
+
force: false,
|
|
74
|
+
help: false,
|
|
75
|
+
target: undefined,
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
if (args[0] === 'install') {
|
|
79
|
+
args.shift();
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
for (let index = 0; index < args.length; index += 1) {
|
|
83
|
+
const arg = args[index];
|
|
84
|
+
|
|
85
|
+
if (arg === '--dry-run') {
|
|
86
|
+
options.dryRun = true;
|
|
87
|
+
} else if (arg === '--force' || arg === '-f') {
|
|
88
|
+
options.force = true;
|
|
89
|
+
} else if (arg === '--help' || arg === '-h') {
|
|
90
|
+
options.help = true;
|
|
91
|
+
} else if (arg === '--target' || arg === '-t') {
|
|
92
|
+
const value = args[index + 1];
|
|
93
|
+
|
|
94
|
+
if (!value) {
|
|
95
|
+
throw new Error(`${arg} requires a path value`);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
options.target = value;
|
|
99
|
+
index += 1;
|
|
100
|
+
} else if (arg.startsWith('--target=')) {
|
|
101
|
+
options.target = arg.slice('--target='.length);
|
|
102
|
+
} else {
|
|
103
|
+
throw new Error(`Unknown argument: ${arg}\n\n${usage()}`);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return options;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function assertSafeTarget(target) {
|
|
111
|
+
if (basename(target) !== 'agent-doc-rules') {
|
|
112
|
+
throw new Error('Target directory must be named agent-doc-rules.');
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function usage() {
|
|
117
|
+
return [
|
|
118
|
+
'Usage: agent-doc-rules-skill [install] [options]',
|
|
119
|
+
'',
|
|
120
|
+
'Installs the agent-doc-rules skill into the current project.',
|
|
121
|
+
'',
|
|
122
|
+
'Options:',
|
|
123
|
+
' -t, --target <path> Target skill directory. Defaults to .agents/skills/agent-doc-rules',
|
|
124
|
+
' -f, --force Replace an existing target directory',
|
|
125
|
+
' --dry-run Show what would be installed without writing files',
|
|
126
|
+
' -h, --help Show this help',
|
|
127
|
+
].join('\n');
|
|
128
|
+
}
|