@sandgarden/gloria 0.0.0-stage → 0.3.87
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/collector/stub.sh +463 -0
- package/gloria.js +150 -0
- package/index.js +1 -0
- package/package.json +16 -4
- package/skills/checking-coding-standards/SKILL.md +137 -0
- package/skills/debugging-production-errors/SKILL.md +124 -0
- package/skills/deriving-agent-code-style/SKILL.md +147 -0
- package/skills/documenting-service-dependencies/SKILL.md +400 -0
- package/skills/extracting-coding-standards/SKILL.md +182 -0
- package/skills/identifying-skills-for-a-project/SKILL.md +111 -0
- package/skills/investigating-production-incidents/SKILL.md +100 -0
- package/skills/mapping-packages-for-coding-agents/SKILL.md +116 -0
- package/skills/setting-up-a-project/SKILL.md +162 -0
- package/skills/setting-up-a-project/TDD.rules.md +196 -0
- package/skills/setting-up-a-project/git-commit-rules.md +16 -0
- package/skills/setting-up-gloria/SKILL.md +139 -0
- package/skills/setting-up-gloria/USING-GLORIA.md +144 -0
- package/skills/using-coding-standards/SKILL.md +117 -0
- package/skills/using-the-skills-library/SKILL.md +89 -0
- package/README.md +0 -3
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
# Rules for Claude
|
|
2
|
+
|
|
3
|
+
## ABSOLUTE RULES - NO EXCEPTIONS
|
|
4
|
+
|
|
5
|
+
### 1. Test-Driven Development is MANDATORY
|
|
6
|
+
|
|
7
|
+
**The Iron Law**: NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST
|
|
8
|
+
|
|
9
|
+
Every single line of production code MUST follow this cycle:
|
|
10
|
+
|
|
11
|
+
1. **RED**: Write failing test FIRST
|
|
12
|
+
2. **Verify RED**: Run test, watch it fail for the RIGHT reason
|
|
13
|
+
3. **GREEN**: Write MINIMAL code to pass the test
|
|
14
|
+
4. **Verify GREEN**: Run test, confirm it passes
|
|
15
|
+
5. **REFACTOR**: Clean up with tests staying green
|
|
16
|
+
|
|
17
|
+
### 2. Violations = Delete and Start Over
|
|
18
|
+
|
|
19
|
+
If ANY of these occur, you MUST delete the code and start over:
|
|
20
|
+
|
|
21
|
+
- ❌ Wrote production code before test → DELETE CODE, START OVER
|
|
22
|
+
- ❌ Test passed immediately → TEST IS WRONG, FIX TEST FIRST
|
|
23
|
+
- ❌ Can't explain why test failed → NOT TDD, START OVER
|
|
24
|
+
- ❌ "I'll add tests later" → DELETE CODE NOW
|
|
25
|
+
- ❌ "Just this once without tests" → NO. DELETE CODE.
|
|
26
|
+
- ❌ "It's too simple to test" → NO. TEST FIRST.
|
|
27
|
+
- ❌ "Tests after achieve same goal" → NO. DELETE CODE.
|
|
28
|
+
|
|
29
|
+
### 3. Test Coverage Requirements
|
|
30
|
+
|
|
31
|
+
- **Minimum 90%** coverage on ALL metrics:
|
|
32
|
+
- Lines: 90%+
|
|
33
|
+
- Functions: 90%+
|
|
34
|
+
- Branches: 85%+
|
|
35
|
+
- Statements: 90%+
|
|
36
|
+
- Coverage below threshold = Implementation incomplete
|
|
37
|
+
- Untested code = Code that shouldn't exist
|
|
38
|
+
|
|
39
|
+
### 4. Implementation Order
|
|
40
|
+
|
|
41
|
+
Follow the plan tasks listed in @IMPLEMENTATION_PLAN.md in EXACT order.
|
|
42
|
+
|
|
43
|
+
### 5. Before Writing ANY Code
|
|
44
|
+
|
|
45
|
+
Ask yourself:
|
|
46
|
+
|
|
47
|
+
1. Did I write a failing test for this?
|
|
48
|
+
2. Did I run the test and see it fail?
|
|
49
|
+
3. Did it fail for the expected reason?
|
|
50
|
+
|
|
51
|
+
If ANY answer is "no" → STOP. Write the test first.
|
|
52
|
+
|
|
53
|
+
### 6. Test File Structure
|
|
54
|
+
|
|
55
|
+
For every production file, there MUST be a corresponding test file:
|
|
56
|
+
|
|
57
|
+
- `src/example.ts` → `src/__tests__/example.test.ts`
|
|
58
|
+
- `src/another-example.ts` → `src/__tests__/another-example.test.ts`
|
|
59
|
+
- `src/causes_edge_cases.ts` → `src/__tests__/causes_edge_cases.test.ts`
|
|
60
|
+
|
|
61
|
+
### 7. Task Completion Requirements
|
|
62
|
+
|
|
63
|
+
**MANDATORY RULE**: NO TASK IS COMPLETE until:
|
|
64
|
+
|
|
65
|
+
- ✅ ALL tests pass (100% green)
|
|
66
|
+
- ✅ Build succeeds with ZERO errors
|
|
67
|
+
- ✅ NO linter errors or warnings
|
|
68
|
+
- ✅ Coverage meets minimum thresholds (90%+)
|
|
69
|
+
|
|
70
|
+
A task with failing tests, build errors, or linter warnings is INCOMPLETE. Period.
|
|
71
|
+
|
|
72
|
+
### 8. Git Commits - Commit Early, Commit Often
|
|
73
|
+
|
|
74
|
+
**MANDATORY RULE**: COMMIT EARLY, COMMIT OFTEN
|
|
75
|
+
|
|
76
|
+
- **Commit after EACH successful TDD cycle**:
|
|
77
|
+
- ✅ After RED-GREEN-REFACTOR cycle completes
|
|
78
|
+
- ✅ After each test file is created
|
|
79
|
+
- ✅ After each module implementation
|
|
80
|
+
- ✅ After fixing bugs or issues
|
|
81
|
+
- ✅ After updating documentation
|
|
82
|
+
|
|
83
|
+
- **Frequency Requirements**:
|
|
84
|
+
- Minimum: After each completed subtask
|
|
85
|
+
- Maximum: No more than 30 minutes without a commit
|
|
86
|
+
- Never have more than one feature in a single commit
|
|
87
|
+
|
|
88
|
+
- **Each commit MUST**:
|
|
89
|
+
- Have failing tests written first
|
|
90
|
+
- Pass all tests
|
|
91
|
+
- Build successfully
|
|
92
|
+
- Have no linter errors
|
|
93
|
+
- Meet coverage requirements (if code was added)
|
|
94
|
+
- Include clear commit message mentioning TDD
|
|
95
|
+
|
|
96
|
+
- **Commit Message Format**:
|
|
97
|
+
|
|
98
|
+
```
|
|
99
|
+
type(scope): brief description
|
|
100
|
+
|
|
101
|
+
- RED: What tests were written first
|
|
102
|
+
- GREEN: What minimal code was added
|
|
103
|
+
- Status: X tests passing, build successful
|
|
104
|
+
- Coverage: X% (if applicable)
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
- **Benefits of Frequent Commits**:
|
|
108
|
+
- Easy rollback if something breaks
|
|
109
|
+
- Clear history of TDD progression
|
|
110
|
+
- Smaller, reviewable changes
|
|
111
|
+
- Proof of TDD discipline
|
|
112
|
+
|
|
113
|
+
## Development Workflow
|
|
114
|
+
|
|
115
|
+
For EACH feature/function:
|
|
116
|
+
|
|
117
|
+
```
|
|
118
|
+
1. Write test file or add test case
|
|
119
|
+
2. Run: <test command>
|
|
120
|
+
3. See RED (test fails)
|
|
121
|
+
4. Understand WHY it fails
|
|
122
|
+
5. Write minimal production code
|
|
123
|
+
6. Run: <test command>
|
|
124
|
+
7. See GREEN (test passes)
|
|
125
|
+
8. Refactor if needed
|
|
126
|
+
9. Run: <test command> (stays green)
|
|
127
|
+
10. Check coverage: <coverage command>
|
|
128
|
+
11. Repeat for next feature
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## Commands You'll Use Constantly
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
# Watch mode - keep this running ALWAYS
|
|
135
|
+
<test command>
|
|
136
|
+
|
|
137
|
+
# Run once
|
|
138
|
+
<test command>
|
|
139
|
+
|
|
140
|
+
# Check coverage
|
|
141
|
+
<coverage command>
|
|
142
|
+
|
|
143
|
+
# Build - MUST succeed before task is complete
|
|
144
|
+
<build command>
|
|
145
|
+
|
|
146
|
+
# Check for Linter errors
|
|
147
|
+
<linter command>
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## Red Flags - STOP Immediately
|
|
151
|
+
|
|
152
|
+
If you catch yourself:
|
|
153
|
+
|
|
154
|
+
- Opening a code file before a test file
|
|
155
|
+
- Writing function implementation before test
|
|
156
|
+
- Thinking "I know this works"
|
|
157
|
+
- Copying code from examples without tests
|
|
158
|
+
- Skipping test runs
|
|
159
|
+
- Ignoring failing tests
|
|
160
|
+
- Writing multiple features before testing
|
|
161
|
+
|
|
162
|
+
**STOP. DELETE. START WITH TEST.**
|
|
163
|
+
|
|
164
|
+
## The Mindset
|
|
165
|
+
|
|
166
|
+
- Tests are not optional
|
|
167
|
+
- Tests are not added after
|
|
168
|
+
- Tests DRIVE the implementation
|
|
169
|
+
- If it's not tested, it doesn't exist
|
|
170
|
+
- Coverage below 90% = unfinished work
|
|
171
|
+
|
|
172
|
+
## Accountability Check
|
|
173
|
+
|
|
174
|
+
Before marking ANY task complete, verify:
|
|
175
|
+
|
|
176
|
+
1. ✓ Test written first?
|
|
177
|
+
2. ✓ Test failed first?
|
|
178
|
+
3. ✓ Minimal code to pass?
|
|
179
|
+
4. ✓ All tests green?
|
|
180
|
+
5. ✓ Coverage maintained (90%+)?
|
|
181
|
+
6. ✓ Build succeeds (`<build command>`)?
|
|
182
|
+
7. ✓ No linter errors?
|
|
183
|
+
|
|
184
|
+
Missing ANY ✓ = Task is NOT complete. Fix it first.
|
|
185
|
+
|
|
186
|
+
## Final Rule
|
|
187
|
+
|
|
188
|
+
**When in doubt**: Write a test.
|
|
189
|
+
**When not in doubt**: Write a test anyway.
|
|
190
|
+
**When it seems too simple**: Especially write a test.
|
|
191
|
+
|
|
192
|
+
There are NO exceptions to TDD in this project. None.
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
_This document is your contract. Breaking these rules means breaking the project's core quality commitment. The discipline of TDD is what separates professional, reliable code from hopeful guesswork._
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
## Git Commit Rules
|
|
2
|
+
|
|
3
|
+
**COMMIT EARLY, COMMIT OFTEN** - This is mandatory.
|
|
4
|
+
|
|
5
|
+
- Commit after every successful TDD cycle (RED-GREEN-REFACTOR)
|
|
6
|
+
- Commit after completing any discrete unit of work
|
|
7
|
+
- Commit before switching context or taking breaks
|
|
8
|
+
- Never have more than 30 minutes of uncommitted work
|
|
9
|
+
- Each commit should be atomic: one logical change per commit
|
|
10
|
+
|
|
11
|
+
Why this matters:
|
|
12
|
+
|
|
13
|
+
- Small commits are easier to review and revert
|
|
14
|
+
- Frequent commits prevent loss of work
|
|
15
|
+
- Atomic commits make git history useful for debugging
|
|
16
|
+
- Regular commits force you to think in small, testable increments
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: setting-up-gloria
|
|
3
|
+
description: For a project that's already set up (has, or intentionally has no, its own CLAUDE.md/AGENTS.md) and just needs Gloria wired in — not for a brand-new project with no CLAUDE.md yet (use `setting-up-a-project` for that, which chains into this skill automatically at the end). Use when installing Gloria into a repo ("set up gloria", "install gloria in this project"), when a repo is missing .gloria/USING-GLORIA.md or the gloria section in CLAUDE.md/AGENTS.md, or after a gloria plugin update to refresh a stale doc — copies the canonical USING-GLORIA.md agent doc into the repo, wires an evergreen Gloria section into the agent instruction files (with the user's permission), and offers to register the project with gloria.dev. Idempotent; safe to re-run.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Setting Up Gloria
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Wire Gloria into the current repo so every coding agent that works here knows
|
|
11
|
+
what Gloria is and when to use it. Two files carry that:
|
|
12
|
+
|
|
13
|
+
1. **`.gloria/USING-GLORIA.md`** — the agent playbook, copied verbatim from
|
|
14
|
+
the `USING-GLORIA.md` that sits next to this SKILL.md (the skill's base
|
|
15
|
+
directory). Committed to the repo.
|
|
16
|
+
2. **A marked section in the repo's agent instruction files** (`CLAUDE.md`
|
|
17
|
+
and/or `AGENTS.md`) that points unconditionally at the doc. The section is
|
|
18
|
+
evergreen — it names no features, so it never changes across Gloria
|
|
19
|
+
releases; only the doc does.
|
|
20
|
+
|
|
21
|
+
Never modify the user's files without showing them exactly what will change
|
|
22
|
+
and getting a yes first.
|
|
23
|
+
|
|
24
|
+
This skill assumes the repo is already set up (or deliberately has no
|
|
25
|
+
CLAUDE.md of its own) — it only ever inserts/updates the marked Gloria
|
|
26
|
+
section inside existing instruction files, or creates a bare `AGENTS.md`
|
|
27
|
+
holding just that section. For a brand-new, empty repo that needs a full
|
|
28
|
+
CLAUDE.md authored from scratch, use `setting-up-a-project` instead — it
|
|
29
|
+
runs the full interview and, as its last step, offers to run this skill
|
|
30
|
+
automatically.
|
|
31
|
+
|
|
32
|
+
## The instruction-file section
|
|
33
|
+
|
|
34
|
+
Insert this text exactly, markers included. The markers are how re-runs find
|
|
35
|
+
and replace the section instead of duplicating it.
|
|
36
|
+
|
|
37
|
+
```markdown
|
|
38
|
+
<!-- gloria:start -->
|
|
39
|
+
|
|
40
|
+
## Gloria
|
|
41
|
+
|
|
42
|
+
This project uses [Gloria](https://gloria.dev) to keep agent-written code
|
|
43
|
+
aligned with intent — dependency monitoring, shared skills, and more. Gloria's
|
|
44
|
+
tools and skills apply to everyday coding tasks, not just Gloria-specific
|
|
45
|
+
requests.
|
|
46
|
+
|
|
47
|
+
Before starting work in this repo, read `.gloria/USING-GLORIA.md`. It explains
|
|
48
|
+
which Gloria tools and skills to use, and when. When it names a trigger that
|
|
49
|
+
matches your current task, using the corresponding tool/skill is required, not
|
|
50
|
+
optional.
|
|
51
|
+
|
|
52
|
+
<!-- gloria:end -->
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Workflow
|
|
56
|
+
|
|
57
|
+
### 1. Detect state
|
|
58
|
+
|
|
59
|
+
- Find the repo root (`git rev-parse --show-toplevel`; fall back to the
|
|
60
|
+
working directory if not a git repo).
|
|
61
|
+
- Locate the shipped doc: the `USING-GLORIA.md` in this skill's base
|
|
62
|
+
directory. If it is missing, stop and tell the user the plugin install
|
|
63
|
+
looks broken — do not synthesize the doc from memory.
|
|
64
|
+
- Check what already exists at the repo root:
|
|
65
|
+
- `.gloria/USING-GLORIA.md` — present? Compare its `gloria-doc-version`
|
|
66
|
+
stamp (first line) with the shipped copy's.
|
|
67
|
+
- `CLAUDE.md`, `AGENTS.md` — which exist, and does each already contain a
|
|
68
|
+
`<!-- gloria:start -->` ... `<!-- gloria:end -->` block?
|
|
69
|
+
|
|
70
|
+
### 2. Propose and ask permission — once
|
|
71
|
+
|
|
72
|
+
Tell the user precisely what will happen, in one message, and ask a single
|
|
73
|
+
yes/no. Cover only the actions actually needed, e.g.:
|
|
74
|
+
|
|
75
|
+
- create (or replace, if the stamp differs) `.gloria/USING-GLORIA.md`;
|
|
76
|
+
- insert the Gloria section into `CLAUDE.md` and `AGENTS.md` (or "replace the
|
|
77
|
+
existing Gloria section in ...");
|
|
78
|
+
- create `AGENTS.md` containing the section, when neither instruction file
|
|
79
|
+
exists.
|
|
80
|
+
|
|
81
|
+
If everything is already current, say so and skip to step 5. If the user
|
|
82
|
+
declines the file edits, stop — do not partially apply.
|
|
83
|
+
|
|
84
|
+
### 3. Write the doc
|
|
85
|
+
|
|
86
|
+
Copy the shipped `USING-GLORIA.md` to `.gloria/USING-GLORIA.md` **verbatim**
|
|
87
|
+
(create the `.gloria/` directory if needed). Do not edit, reformat, or
|
|
88
|
+
"improve" the content — refreshes must stay a pure file copy.
|
|
89
|
+
|
|
90
|
+
### 4. Wire the instruction files
|
|
91
|
+
|
|
92
|
+
For each of `CLAUDE.md` and `AGENTS.md` that exists at the repo root:
|
|
93
|
+
|
|
94
|
+
- If it contains a marker block, replace everything from
|
|
95
|
+
`<!-- gloria:start -->` through `<!-- gloria:end -->` (inclusive) with the
|
|
96
|
+
section above.
|
|
97
|
+
- Otherwise append the section at the end of the file, preceded by one blank
|
|
98
|
+
line.
|
|
99
|
+
|
|
100
|
+
If neither file exists, create `AGENTS.md` containing only the section
|
|
101
|
+
(AGENTS.md is the cross-agent standard; Claude Code reads it too).
|
|
102
|
+
|
|
103
|
+
### 5. Offer project registration
|
|
104
|
+
|
|
105
|
+
- Call the `gloria` MCP tool `get_info`.
|
|
106
|
+
- If the call fails (not authenticated / server unreachable), tell the user
|
|
107
|
+
the files are wired but registration needs an MCP login, mention the
|
|
108
|
+
login step for their agent, and finish. Setup is still a success.
|
|
109
|
+
- Call `list_projects` and look for a project matching this repo (by name or
|
|
110
|
+
repo URL). If none matches, offer to run `register_project`. Registration
|
|
111
|
+
is optional — a "no" still completes setup.
|
|
112
|
+
|
|
113
|
+
### 6. Report
|
|
114
|
+
|
|
115
|
+
Summarize what changed (files created/updated, section inserted where,
|
|
116
|
+
registration outcome) and suggest committing the changes, e.g.
|
|
117
|
+
`chore: wire gloria agent doc into instruction files`.
|
|
118
|
+
|
|
119
|
+
Token-usage tracking (declaring work items, minting the collector's ingest
|
|
120
|
+
credential) moved to the Miranda plugin's own `setting-up-usage-tracking`
|
|
121
|
+
skill — offer that separately if the user has Miranda installed and hasn't
|
|
122
|
+
set it up yet.
|
|
123
|
+
|
|
124
|
+
## Idempotency rules
|
|
125
|
+
|
|
126
|
+
- Re-running with identical content is a no-op; say "already current".
|
|
127
|
+
- A stale `.gloria/USING-GLORIA.md` (older stamp) is overwritten wholesale.
|
|
128
|
+
- Marker blocks are always replaced in place, never duplicated. If a file
|
|
129
|
+
somehow contains multiple marker blocks, replace the first and remove the
|
|
130
|
+
rest, and mention it.
|
|
131
|
+
- Never touch anything outside the marker block in an instruction file, and
|
|
132
|
+
never edit any other file.
|
|
133
|
+
|
|
134
|
+
## When to suggest this skill proactively
|
|
135
|
+
|
|
136
|
+
- A Gloria MCP tool's `get_info` response carries a `latestAgentDocVersion`
|
|
137
|
+
newer than the repo's `.gloria/USING-GLORIA.md` stamp → offer a refresh.
|
|
138
|
+
- The user just installed or updated the Gloria plugin in a repo with no
|
|
139
|
+
`.gloria/USING-GLORIA.md` → offer initial setup.
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
<!-- gloria-doc-version: 0.3.87 -->
|
|
2
|
+
|
|
3
|
+
# Using Gloria
|
|
4
|
+
|
|
5
|
+
[Gloria](https://gloria.dev) keeps agent-written code aligned with intent. It
|
|
6
|
+
watches the places where implementation drifts from what the team wants —
|
|
7
|
+
dependencies, shared skills, project documents — and gives you, the coding
|
|
8
|
+
agent, tools to keep them in sync. This project has adopted Gloria: the
|
|
9
|
+
triggers below are commitments the team has made, not suggestions. When a
|
|
10
|
+
trigger matches the task you are doing, take the corresponding action.
|
|
11
|
+
|
|
12
|
+
Gloria is available two ways, and both apply to you:
|
|
13
|
+
|
|
14
|
+
- **MCP tools** on the `gloria` server (dependencies, skills library,
|
|
15
|
+
documents, Doc Holiday).
|
|
16
|
+
- **Agent skills** installed with the Gloria plugin (invoke them by name; do
|
|
17
|
+
not improvise their workflows by hand).
|
|
18
|
+
|
|
19
|
+
**Vocabulary — "register" and "sync" mean call a Gloria tool.** When the user
|
|
20
|
+
says **"register"** or **"sync"** a resource **with Gloria** — a dependency, a
|
|
21
|
+
project, a coding standard, a rule, a snippet, a document — they mean: call the
|
|
22
|
+
matching Gloria MCP tool (`put_dependency`, `register_project`,
|
|
23
|
+
`register_standard`, `put_rule`, `put_snippet`, `put_document`), **not** perform
|
|
24
|
+
the underlying action informally or just edit a file. "Register this dependency"
|
|
25
|
+
→ `put_dependency`; "sync my project with Gloria" → `register_project` (via the
|
|
26
|
+
`documenting-service-dependencies` skill); "register our standards" → the
|
|
27
|
+
`extracting-coding-standards` skill's `register_standard` / `put_rule` /
|
|
28
|
+
`put_snippet` flow. If a request names one of these resources with "register" or
|
|
29
|
+
"sync", route it to the corresponding tool or skill below.
|
|
30
|
+
|
|
31
|
+
## Start of every session
|
|
32
|
+
|
|
33
|
+
One cheap check, done as early as possible — before other Gloria work, and
|
|
34
|
+
regardless of what the task turns out to be:
|
|
35
|
+
|
|
36
|
+
**Check this file isn't stale.** Call `get_info` (cheap) and compare its
|
|
37
|
+
`latestAgentDocVersion` field to the `gloria-doc-version` stamped at the top
|
|
38
|
+
of this file. If newer, tell the user and offer to re-run `setting-up-gloria`
|
|
39
|
+
— see "Keeping this file current" below.
|
|
40
|
+
|
|
41
|
+
If this org also uses Miranda (token-cost tracking), its plugin's own
|
|
42
|
+
`.miranda/USING-MIRANDA.md` — installed by the `setting-up-usage-tracking`
|
|
43
|
+
skill — has its own "start of every session" obligation (declaring the work
|
|
44
|
+
item via `tag_session_work_item`). That lives there, not here.
|
|
45
|
+
|
|
46
|
+
## Keeping this file current
|
|
47
|
+
|
|
48
|
+
This file is written by the `setting-up-gloria` skill and stamped with the
|
|
49
|
+
plugin version that shipped it (see the first line). Check it for staleness
|
|
50
|
+
at the start of every session (see above), not just the first time some
|
|
51
|
+
other task happens to call a Gloria tool. Never edit this file by hand — it
|
|
52
|
+
is replaced verbatim on refresh.
|
|
53
|
+
|
|
54
|
+
## When to use Gloria
|
|
55
|
+
|
|
56
|
+
| The moment in your work | Required action |
|
|
57
|
+
| ------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
58
|
+
| You added, removed, or swapped an external service, SaaS API, SDK, or API client | Update the dependency inventory: run the `documenting-service-dependencies` skill, or for a single obvious change sync directly with `put_dependency` / `delete_dependency` |
|
|
59
|
+
| You changed how an internal system is reached (new database, queue, internal API, or a changed endpoint/auth) | Same as above — internal dependencies are monitored too |
|
|
60
|
+
| The user asks what this project depends on, or whether a vendor/service is healthy | `list_dependencies` / `get_dependency` — answer from Gloria's inventory, not just from reading code |
|
|
61
|
+
| You are about to author a new agent skill, or the user asks "do we have a skill for X?" | `search_skills` FIRST. Only author when nothing fits; follow the `using-the-skills-library` skill |
|
|
62
|
+
| You built a skill or workflow worth reusing across the org | Publish it: `publish_skill` (see `using-the-skills-library`) |
|
|
63
|
+
| The user wants a skill from an external marketplace the org subscribes to | `list_marketplaces`, then `install_skill` |
|
|
64
|
+
| You produced a durable project document (dependency inventory, architecture map, docs site map) | Store it with `put_document` so teammates and other agents see it |
|
|
65
|
+
| A Gloria tool reports the project is not registered | `get_info`, then offer `register_project` |
|
|
66
|
+
| The user updated the Gloria plugin, or this file looks wrong or stale | Offer to re-run `setting-up-gloria` |
|
|
67
|
+
| The user asks for documentation to be written or updated via Doc Holiday | Use the `doc_holiday_*` tools (see below) |
|
|
68
|
+
|
|
69
|
+
## MCP tools reference
|
|
70
|
+
|
|
71
|
+
All tools run as the authenticated user against their active organization.
|
|
72
|
+
Reads need `inventory:read` (any member); writes need `inventory:write`;
|
|
73
|
+
`publish_skill` needs admin (`settings:manage`).
|
|
74
|
+
|
|
75
|
+
**Org & projects**
|
|
76
|
+
|
|
77
|
+
- `get_info` — org id/name/slug plus `latestAgentDocVersion`. Cheap; call it
|
|
78
|
+
first when you need org context or a staleness check.
|
|
79
|
+
- `register_project` — register this repo as a gloria.dev project.
|
|
80
|
+
- `list_projects` — the org's registered projects.
|
|
81
|
+
|
|
82
|
+
**Dependencies (Canary)**
|
|
83
|
+
|
|
84
|
+
- `put_dependency` — create/update a dependency and its health-check
|
|
85
|
+
definition. May return a Configure-secrets link when a check needs a
|
|
86
|
+
credential; pass that link to the user, never ask for the secret in chat.
|
|
87
|
+
- `get_dependency`, `list_dependencies` — inventory and current status.
|
|
88
|
+
- `delete_dependency` — remove a dependency that no longer exists in code.
|
|
89
|
+
|
|
90
|
+
**Skills library**
|
|
91
|
+
|
|
92
|
+
- `search_skills` — search the org's library; always precedes authoring.
|
|
93
|
+
- `get_skill` — fetch a skill bundle (latest or a specific version).
|
|
94
|
+
- `publish_skill` — publish an immutable new version org-wide.
|
|
95
|
+
- `list_skill_versions` — a skill's version history.
|
|
96
|
+
- `list_marketplaces`, `install_skill` — external marketplaces the org
|
|
97
|
+
subscribes to, and installing from them via the host agent's native
|
|
98
|
+
mechanism.
|
|
99
|
+
|
|
100
|
+
**Documents**
|
|
101
|
+
|
|
102
|
+
- `put_document` — store a Markdown document against the project.
|
|
103
|
+
|
|
104
|
+
**Doc Holiday** (documentation automation; requires the org's Doc Holiday API
|
|
105
|
+
key, configured in gloria.dev Settings)
|
|
106
|
+
|
|
107
|
+
- Browse: `doc_holiday_list_publications`, `doc_holiday_get_publication`,
|
|
108
|
+
`doc_holiday_list_conversations`, `doc_holiday_list_conversation_turns`,
|
|
109
|
+
`doc_holiday_get_conversation_turn`,
|
|
110
|
+
`doc_holiday_list_conversation_comments`,
|
|
111
|
+
`doc_holiday_get_conversation_diffs`.
|
|
112
|
+
- Act: `doc_holiday_request_documentation` (new docs from a prompt),
|
|
113
|
+
`doc_holiday_request_work` (follow-up work on a conversation).
|
|
114
|
+
|
|
115
|
+
## Skills reference
|
|
116
|
+
|
|
117
|
+
Invoke these by name when their trigger matches; each skill contains its own
|
|
118
|
+
full workflow.
|
|
119
|
+
|
|
120
|
+
- `documenting-service-dependencies` — map and document every external and
|
|
121
|
+
internal service dependency, with health checks, and sync them to Gloria.
|
|
122
|
+
Trigger: dependency changes; "document our integrations"; "what does this
|
|
123
|
+
connect to?"
|
|
124
|
+
- `using-the-skills-library` — search/publish/install org skills. Trigger:
|
|
125
|
+
about to author a skill; "do we already have a skill for this?"; sharing a
|
|
126
|
+
reusable skill.
|
|
127
|
+
- `identifying-skills-for-a-project` — inventory the skills a project uses
|
|
128
|
+
and recommend gaps. Trigger: "what skills would help this project?"
|
|
129
|
+
- `defining-the-documentation-site-map` — plan a Diátaxis-organized docs site
|
|
130
|
+
from the source. Trigger: "what should our docs contain?"
|
|
131
|
+
- `setting-up-gloria` — wire Gloria into a repo (this file + instruction-file
|
|
132
|
+
section) and offer registration. Trigger: "set up gloria"; plugin updated;
|
|
133
|
+
this file missing or stale.
|
|
134
|
+
|
|
135
|
+
## First-time and recovery
|
|
136
|
+
|
|
137
|
+
- **Project not registered** — `register_project` needs `inventory:write`.
|
|
138
|
+
Offer it once; if the user declines, continue without syncing.
|
|
139
|
+
- **MCP auth fails** — the user must log in to the `gloria` server: Claude
|
|
140
|
+
Code `/mcp` → gloria → authenticate; Codex `codex mcp login gloria`;
|
|
141
|
+
OpenCode follows its MCP auth flow. Until then, skills still work — queue
|
|
142
|
+
the sync and mention it.
|
|
143
|
+
- **This file is missing, stale, or contradicts the tools you see** — trust
|
|
144
|
+
the live MCP server, and offer to re-run `setting-up-gloria`.
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: using-coding-standards
|
|
3
|
+
description: Use while writing code in a project with a registered gloria Coding Standards library — before implementing anything pattern-shaped (a DAO, an API route, a migration, a test harness, a channel adapter), and whenever CLAUDE.md carries a "## Coding Standards" section with a gloria:standards stamp. Also fires for "follow/use our standards while writing this", "write this the way we do", and "register/contribute this back as a snippet". Drives the write-time discipline: find_snippets before writing, adopt or adapt the canonical exemplar, leave a gloria:snippet provenance marker, contribute reusable shapes back via put_snippet, and justify deliberate divergence.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Using Coding Standards While Writing
|
|
7
|
+
|
|
8
|
+
## "Register" / "contribute a snippet" means call put_snippet
|
|
9
|
+
|
|
10
|
+
Consulting the library is a gloria MCP call, not memory: **`find_snippets`**
|
|
11
|
+
before writing pattern-shaped code. And when the user says **"register"**,
|
|
12
|
+
**"contribute"**, or **"add" this back as a snippet** — or you produce a reusable
|
|
13
|
+
shape worth sharing — that means **calling the gloria MCP tool `put_snippet`**
|
|
14
|
+
(with the user's approval), not just leaving the code in place. The write-time
|
|
15
|
+
loop is: `find_snippets` → adopt/adapt → leave the `gloria:snippet` marker →
|
|
16
|
+
`put_snippet` for genuinely reusable new shapes.
|
|
17
|
+
|
|
18
|
+
## Overview
|
|
19
|
+
|
|
20
|
+
A project with a gloria standards library has already decided what its patterns look like.
|
|
21
|
+
This skill is the write-time half of the loop: **consult the library before writing
|
|
22
|
+
pattern-shaped code, copy the canonical exemplar instead of improvising, and leave a marker
|
|
23
|
+
so reuse is verifiable.**
|
|
24
|
+
|
|
25
|
+
**Core principle: the snippet is the decision, the marker is the receipt.** Adopting the
|
|
26
|
+
canonical snippet keeps the codebase converged; the provenance marker makes that reuse
|
|
27
|
+
greppable, so the checker verifies claimed reuse deterministically instead of guessing.
|
|
28
|
+
|
|
29
|
+
## When to Use
|
|
30
|
+
|
|
31
|
+
- About to write something pattern-shaped: a new DAO, statement builder, API route,
|
|
32
|
+
migration, worker handler, test file, UI list component — any "another one of those"
|
|
33
|
+
- The repo's `CLAUDE.md`/`AGENTS.md` has a `## Coding Standards` section (the
|
|
34
|
+
`<!-- gloria:standards vN -->` stamp is the tell)
|
|
35
|
+
|
|
36
|
+
**Don't use for:** genuinely one-off logic with no repeating shape; repos with no registered
|
|
37
|
+
standards (nothing to consult); extracting or checking standards (their own skills).
|
|
38
|
+
|
|
39
|
+
## Process
|
|
40
|
+
|
|
41
|
+
### Step 1 — Search before writing
|
|
42
|
+
|
|
43
|
+
Before writing the first line of a pattern-shaped change:
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
find_snippets { projectSlug, language, query }
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Query with the pattern's name as the repo speaks it ("D1 DAO", "api route zod", "d1
|
|
50
|
+
migration"). The search ladders exact → contains → fuzzy, so a short natural phrase works.
|
|
51
|
+
|
|
52
|
+
### Step 2 — Decide on the ladder
|
|
53
|
+
|
|
54
|
+
| Match | Action |
|
|
55
|
+
| -------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
|
|
56
|
+
| **Strong match** — the snippet is the shape you need | Adopt it. Fill every `TODO:` placeholder. Marker: `(verbatim)` |
|
|
57
|
+
| **Partial match** — right pattern, needs structural adaptation | Adapt it. Keep the structural skeleton, change what must change, fill every placeholder. Marker: `(adapted)` |
|
|
58
|
+
| **No match, but the shape will recur** | Write it well, then contribute it back: `put_snippet` with placeholders and linked `ruleIds` (ask the user before publishing) |
|
|
59
|
+
| **No match, genuinely one-off** | Write normally. No marker, no contribution |
|
|
60
|
+
|
|
61
|
+
Never leave a `TODO:` placeholder unfilled in committed code — placeholders are the snippet's
|
|
62
|
+
customization points, and an unfilled one means the adaptation is incomplete.
|
|
63
|
+
|
|
64
|
+
### Step 3 — Leave the provenance marker
|
|
65
|
+
|
|
66
|
+
On the adopted/adapted unit (top of the function, class, or file section it produced), in the
|
|
67
|
+
language's comment syntax:
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
// gloria:snippet <project>/<snippet-id> (verbatim|adapted)
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Exact grammar: the literal `gloria:snippet`, one space, the project slug, `/`, the snippet id,
|
|
74
|
+
one space, then `(verbatim)` or `(adapted)`. Examples:
|
|
75
|
+
|
|
76
|
+
```typescript
|
|
77
|
+
// gloria:snippet gloria-dev/d1-dao (adapted)
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
```sql
|
|
81
|
+
-- gloria:snippet gloria-dev/d1-migration (verbatim)
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
`verbatim` means structure copied with only placeholders filled; `adapted` means you changed
|
|
85
|
+
structure beyond the placeholders. When in doubt, `adapted`.
|
|
86
|
+
|
|
87
|
+
### Step 4 — Justify divergence
|
|
88
|
+
|
|
89
|
+
If a strong match exists but you deliberately deviate from it, say why in an adjacent comment:
|
|
90
|
+
|
|
91
|
+
```typescript
|
|
92
|
+
// gloria:snippet gloria-dev/d1-dao (adapted) — diverges: streaming read, so no
|
|
93
|
+
// row-array mapping; see #412
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Documented divergence is legitimate for `observed`-authority rules and snippet patterns; the
|
|
97
|
+
checker treats it as intent, not drift. **`enforced` rules have no such escape hatch** — never
|
|
98
|
+
"diverge" from a rule a tool blocks.
|
|
99
|
+
|
|
100
|
+
## Common Mistakes
|
|
101
|
+
|
|
102
|
+
| Mistake | Fix |
|
|
103
|
+
| ---------------------------------------------- | -------------------------------------------------------------------------- |
|
|
104
|
+
| Writing the pattern from memory, then checking | `find_snippets` first — the snippet may encode decisions you'd re-litigate |
|
|
105
|
+
| Adopting without filling placeholders | Every `TODO:` filled before the code is done |
|
|
106
|
+
| Marker on the wrong granularity | Mark the unit the snippet produced, not the whole file it lives in |
|
|
107
|
+
| Claiming `(verbatim)` after structural edits | Structural change = `(adapted)`; the checker compares faithfulness |
|
|
108
|
+
| Silent divergence from a strong match | One comment line saying why; silence reads as unattributed duplication |
|
|
109
|
+
| Contributing one-off code as a snippet | Contribute only shapes that will recur; ask the user before `put_snippet` |
|
|
110
|
+
|
|
111
|
+
## Quality Checklist
|
|
112
|
+
|
|
113
|
+
- [ ] `find_snippets` called before writing anything pattern-shaped
|
|
114
|
+
- [ ] Every adopted/adapted snippet carries a correctly-formed `gloria:snippet` marker
|
|
115
|
+
- [ ] Every `TODO:` placeholder filled
|
|
116
|
+
- [ ] Deliberate divergence justified in an adjacent comment
|
|
117
|
+
- [ ] Recurring new shapes offered back via `put_snippet` (with user approval)
|