Skip to content

Commit f435ce5

Browse files
authored
Merge pull request #596 from cipherstash/docs/claude-md-skills-sync
docs: add CLAUDE.md and require skills to be checked on every stack change
2 parents 7f22cf3 + a36add6 commit f435ce5

2 files changed

Lines changed: 80 additions & 1 deletion

File tree

AGENTS.md

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,46 @@ If these variables are missing, tests that require live encryption will fail or
9393
- `docs/plans/*`: Internal design plans. User-facing documentation lives at https://cipherstash.com/docs (not in this repo).
9494
- `skills/*`: Agent skills (`stash-cli`, `stash-encryption`, `stash-drizzle`, `stash-dynamodb`, `stash-supabase`, `stash-supply-chain-security`)
9595

96+
## Agent Skills — these ship to customers
97+
98+
`skills/*/SKILL.md` are **published artifacts, not internal notes.** Treat a wrong
99+
sentence in one of them the way you'd treat a wrong line of code:
100+
101+
- `packages/cli/tsup.config.ts` copies `skills/` into `dist/skills/`, so they ship
102+
inside the `stash` npm tarball (and the `@cipherstash/wizard` one).
103+
- `installSkills()` (`packages/cli/src/commands/init/lib/install-skills.ts`) copies the
104+
per-integration set into the user's `.claude/skills/` or `.codex/skills/` at handoff time.
105+
- `readBundledSkill()` inlines a skill's body into the user's `AGENTS.md` for editor
106+
agents (Cursor / Windsurf / Cline). Only `SKILL.md` is inlined — content split into
107+
sibling files is silently dropped on that path, so keep each `SKILL.md` self-sufficient.
108+
109+
**Every change to a package's public API, the CLI command surface, or a user-facing
110+
workflow must check the affected skills in the same PR.** These skills drift silently:
111+
nothing type-checks them, and the damage lands in a customer's repo, not ours.
112+
113+
| If you change… | Check |
114+
|---|---|
115+
| `packages/cli` commands, flags, or prompts | `skills/stash-cli` |
116+
| `packages/stack` encryption API, schema builders, subpath exports | `skills/stash-encryption` |
117+
| Drizzle / Supabase / DynamoDB integrations | `skills/stash-drizzle`, `skills/stash-supabase`, `skills/stash-dynamodb` |
118+
| The rollout/cutover lifecycle (`packages/migrate`, `stash encrypt *`) | `skills/stash-encryption` and `skills/stash-cli` |
119+
| pnpm config, CI workflows, dependency policy | `skills/stash-supply-chain-security` |
120+
| The durable agent rules themselves | `packages/cli/src/commands/init/doctrine/AGENTS-doctrine.md` |
121+
122+
For CLI changes there is a mechanical check — the command registry is the source of
123+
truth, so diff the skill against it rather than proofreading:
124+
125+
```bash
126+
pnpm --filter stash build
127+
node packages/cli/dist/bin/stash.js manifest --json
128+
```
129+
130+
Every command and flag named in `skills/stash-cli/SKILL.md` must resolve against that
131+
manifest (the deprecated `db install` / `db upgrade` / `db status` aliases excepted —
132+
they're intentionally absent from the registry).
133+
134+
Skills must not contain Linear issue IDs; they're public. GitHub issue numbers are fine.
135+
96136
## Supply Chain Security
97137

98138
This repo applies a set of supply-chain controls (post-install script policy, install cooldown, frozen-lockfile CI, registry pinning, Dependabot cooldown, CODEOWNERS) sourced from [lirantal/npm-security-best-practices](https://github.com/lirantal/npm-security-best-practices). They're validated by `e2e/tests/supply-chain.e2e.test.ts` so silent regressions fail CI. See `skills/stash-supply-chain-security/SKILL.md` for the full guide.
@@ -184,7 +224,15 @@ pnpm changeset:publish
184224
Layout in this file and the package list in `SECURITY.md` in the
185225
same PR. These files have drifted badly before; don't let them.
186226

187-
8. **Add a changeset before opening or finalising the PR** when the
227+
8. **Check the skills.** If you changed a package's public API, the CLI
228+
command surface, or a user-facing workflow, open the affected
229+
`skills/*/SKILL.md` and fix anything your change made wrong — in the
230+
same PR. Skills ship inside the `stash` tarball and are copied into
231+
customer repos, so drift here becomes wrong guidance in someone
232+
else's codebase. See "Agent Skills — these ship to customers" above
233+
for the package→skill map and the `stash manifest --json` check.
234+
235+
9. **Add a changeset before opening or finalising the PR** when the
188236
change affects a published package's public behaviour or surface
189237
(new feature, bug fix, breaking change, UX-visible tweak). Run
190238
`pnpm changeset` (interactive) or hand-write a markdown file under
@@ -206,6 +254,9 @@ pnpm changeset:publish
206254
`CHANGELOG.md` entries, so a missing changeset means the change
207255
ships invisibly.
208256

257+
A skills-only change is **not** internal: `skills/` ships inside the
258+
`stash` tarball, so it needs a `stash` patch changeset.
259+
209260
## Useful Links
210261

211262
- `README.md` for quickstart and feature overview

CLAUDE.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# CipherStash Stack — Claude Code
2+
3+
The project instructions for this repo live in `AGENTS.md`, shared by every agent
4+
that works here. It is imported below rather than duplicated, so there is exactly
5+
one source of truth.
6+
7+
@AGENTS.md
8+
9+
## Before you finish
10+
11+
Two rules from `AGENTS.md` are the ones most often missed. They are repeated here
12+
because both fail silently — nothing in CI catches either:
13+
14+
1. **Check the skills.** If you changed a package's public API, the CLI command
15+
surface, or a user-facing workflow, update the affected `skills/*/SKILL.md` in
16+
the same PR. These files ship inside the `stash` npm tarball and get copied
17+
into customer repos, so drift becomes wrong guidance in someone else's
18+
codebase. See "Agent Skills — these ship to customers".
19+
20+
2. **Add a changeset** when the change affects a published package's surface —
21+
including a skills-only change, since `skills/` ships in the `stash` tarball.
22+
23+
## Package-specific notes
24+
25+
`packages/cli` has its own `AGENTS.md` covering the two Vitest configs (unit vs.
26+
the pty-driven e2e suite) and when each needs to run. Read it before touching
27+
`packages/cli/src/bin/main.ts`, `packages/cli/src/messages.ts`, or the command
28+
registry at `packages/cli/src/cli/registry.ts`.

0 commit comments

Comments
 (0)