Skip to content

Commit e32c3b4

Browse files
committed
docs: add skills
1 parent c1fa489 commit e32c3b4

3 files changed

Lines changed: 472 additions & 0 deletions

File tree

.claude/skills/explore/SKILL.md

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
---
2+
name: explore
3+
description: Write a markdown exploration document for a topic, feature idea, architecture question, or research area. Use when asked to "explore X", "research X", "write an exploration", "investigate X", or "do a deep dive on X". Produces a numbered doc in docs/explorations/ with mermaid diagrams, recommendations, and checklists.
4+
---
5+
6+
# Write an exploration
7+
8+
You are an expert autonomous exploration agent. Your mission: write a
9+
thorough markdown exploration of the topic in `$ARGUMENTS` and save it
10+
to `docs/explorations/` following this repo's conventions.
11+
12+
## File naming
13+
14+
Explorations are numbered sequentially with an implementation-status
15+
checkbox embedded in the filename:
16+
17+
```
18+
docs/explorations/NNNN_[_]_TITLE_IN_CAPS.md
19+
```
20+
21+
- `NNNN` — zero-padded sequence number. Compute the next one:
22+
23+
```bash
24+
ls docs/explorations | sed -n 's/^\([0-9]\{4\}\)_.*/\1/p' | sort -n | tail -1 | awk '{printf "%04d\n", $1+1}'
25+
```
26+
27+
- `[_]` — always start unchecked. It is renamed to `[x]` later, when
28+
the exploration's recommendations have been implemented (commit
29+
message: `docs(exploration): check off <topic>`).
30+
- `TITLE_IN_CAPS` — short title, UPPERCASE, words joined by
31+
underscores (e.g. `0153_[x]_SOCIAL_DATA_WORKSPACE_UI.md`). Prefer a
32+
distilled title over echoing the prompt verbatim.
33+
34+
## Research before writing
35+
36+
Be thorough — the document must be grounded in reality, not vibes:
37+
38+
1. **Search the codebase.** Find the actual files, packages, and seams
39+
the topic touches. Cite real paths (e.g.
40+
`apps/web/src/components/DataWorkspaceView.tsx`,
41+
`packages/social/src/lenses/graph-lenses.ts`) so the exploration
42+
connects to the code as it exists today.
43+
2. **Search the web** for prior art, libraries, benchmarks, and
44+
tradeoff analyses relevant to the topic.
45+
3. **Be creative** — explore multiple angles, perspectives, and
46+
competing options before recommending one.
47+
48+
## Document structure
49+
50+
Recent explorations converge on this skeleton — follow it unless the
51+
topic clearly demands otherwise:
52+
53+
```markdown
54+
# <Title>
55+
56+
## Problem Statement
57+
## Executive Summary
58+
## Current State In The Repository ← cite real file paths
59+
## External Research ← web findings, prior art
60+
## Key Findings
61+
## Options And Tradeoffs ← multiple angles, compared
62+
## Recommendation
63+
## Example Code ← if applicable
64+
## Risks And Open Questions
65+
## Implementation Checklist ← - [ ] items, concrete steps
66+
## Validation Checklist ← - [ ] items, how we know it worked
67+
## References
68+
```
69+
70+
Requirements:
71+
72+
- **Mermaid diagrams** — include a variety where appropriate
73+
(flowcharts, sequence diagrams, ER diagrams, state diagrams).
74+
Nearly every exploration in this repo has at least one.
75+
- **Recommendations** — end with a clear recommended path and concrete
76+
next steps, not just a survey.
77+
- **Checklists** — every implementation and validation step as
78+
`- [ ]` items, so progress can be tracked and the file eventually
79+
checked off.
80+
81+
## Committing
82+
83+
Commit the new doc with:
84+
85+
```
86+
docs(exploration): explore <topic>
87+
```

.claude/skills/implement/SKILL.md

Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
---
2+
name: implement
3+
description: Autonomously implement what was just written — an /explore exploration, a plan, or a spec in the conversation. Use when the user says "implement it", "build it", "ship it", "do it", "make it so", "implement this exploration/plan", or "this looks good, go". Works on a new branch, checks off checklist items and commits as it goes, opens a PR, and merges to main.
4+
---
5+
6+
# Implement it
7+
8+
Take whatever was just written — usually an `/explore` doc in
9+
`docs/explorations/`, sometimes a plan or spec in the conversation — and
10+
**build the whole thing**: new branch, check off each checklist item and
11+
commit as you go, open a PR, get it green, merge to `main`. Aim to
12+
complete everything, not a slice.
13+
14+
> The spirit: _"This looks good. Implement it. Work on a new branch,
15+
> check off checklist items and commit as you go. Make a PR when
16+
> everything is complete and merge it into main. Try to complete
17+
> everything."_
18+
19+
The bookkeeping (find the doc, track checklist progress, flip boxes,
20+
mark the doc done) is handled by a zero-dep driver. **You** write the
21+
code; the driver is your hands for the mechanical parts.
22+
23+
> Paths below are relative to the **repo root**. The driver lives at
24+
> `.claude/skills/implement/driver.mjs`.
25+
26+
## The loop
27+
28+
1. **Identify the spec.** If it's an exploration, get its path:
29+
```bash
30+
node .claude/skills/implement/driver.mjs find # highest-numbered unimplemented [_] doc
31+
node .claude/skills/implement/driver.mjs find turso # or match by number/title
32+
```
33+
If the spec is a conversation plan or some other doc, use that as the
34+
checklist source instead — the rest of the loop is identical (skip the
35+
doc-rename in step 6).
36+
2. **Branch.** Off the latest `main`:
37+
```bash
38+
git fetch origin && git switch -c "$(node .claude/skills/implement/driver.mjs branch <doc>)" origin/main
39+
```
40+
3. **See what's left** and work the items top to bottom:
41+
```bash
42+
node .claude/skills/implement/driver.mjs status <doc>
43+
```
44+
4. **For each Implementation item:** write the code (read neighbors
45+
first, match the package's patterns), then prove it — `pnpm --filter
46+
<pkg> test`, `pnpm typecheck`. When it's actually done, flip the box
47+
and commit:
48+
```bash
49+
node .claude/skills/implement/driver.mjs check <doc> "Add a per-cell lock"
50+
git add -A && git commit -m "feat(scope): <what landed>"
51+
```
52+
One commit per item (or per coherent group). Conventional-commit
53+
prefixes are enforced by `commit-msg`.
54+
5. **Validation checklist:** run each check, flip its box as it passes.
55+
6. **Mark the doc done** once `status` shows 0 remaining (skip if the
56+
spec wasn't an exploration):
57+
```bash
58+
node .claude/skills/implement/driver.mjs done <doc> # renames [_] -> [x], prints the commit msg
59+
git add -A && git commit -m "docs(exploration): check off <topic>"
60+
```
61+
7. **Ship it** — see below.
62+
63+
## Setup (once per fresh worktree)
64+
65+
`node_modules` is usually **absent** in a worktree. The driver and
66+
changelog script are zero-dep, but `pnpm test`/`typecheck`/`lint` need:
67+
68+
```bash
69+
pnpm install --frozen-lockfile --prefer-offline # ~18s
70+
```
71+
72+
## Driver commands
73+
74+
```
75+
find [query] highest-numbered [_] doc, or match by number/title
76+
status <doc> Implementation/Validation progress + remaining items
77+
check <doc> "<substring>" flip the one unchecked item containing <substring>
78+
done <doc> rename [_] -> [x] (refuses if any box is unchecked)
79+
branch <doc> suggest a branch name (claude/NNNN-slug)
80+
```
81+
82+
`check` and `find` **error on ambiguity** — pass a longer, unique
83+
substring (or the full number) and they resolve.
84+
85+
## Ship it (PR + merge to main)
86+
87+
Every PR must satisfy the `changelog-section` required check. Add a
88+
user-facing fragment (or the `skip-changelog` label for pure
89+
refactors/chores/CI):
90+
91+
```bash
92+
node scripts/changelog/new.mjs --title "Deals now sync after import" \
93+
--summary "Importing contacts no longer creates duplicate deals." --tags crm
94+
git add -A && git commit -m "docs(changelog): add fragment"
95+
```
96+
97+
Valid `--tags`: `app, crm, finance, tasks, ai, plugins, editor, sync,
98+
identity, platform, performance, devtools, ci`.
99+
100+
Push, open the PR, wait for the required checks, merge:
101+
102+
```bash
103+
git push -u origin HEAD # add --no-verify only if a known-flaky pre-push hook blocks
104+
gh pr create --fill
105+
gh pr checks <N> --watch # required: editor-ux, lint, test (1/3..3/3), typecheck, changelog-section
106+
gh api --method PUT repos/{owner}/{repo}/pulls/<N>/merge -f merge_method=merge
107+
```
108+
109+
**Only merge-commit is allowed** (`--squash`/`--rebase` → 405). The
110+
branch auto-deletes on merge. After merging, switch back and pull:
111+
112+
```bash
113+
git switch main && git pull origin main
114+
```
115+
116+
If `main` moved while the PR was open the branch goes **BEHIND** (strict
117+
checks) and the merge is blocked. Either update the branch
118+
(`gh pr update-branch <N>` or merge `main` in and push) and re-wait for
119+
checks, or — **only if you are the repo owner/admin** (a ruleset bypass
120+
actor) — admin-merge past it:
121+
122+
```bash
123+
gh pr merge <N> --merge --admin
124+
```
125+
126+
## Gotchas
127+
128+
- **Merge method is merge-commit only.** The "Protect main" ruleset sets
129+
`allowed_merge_methods: ["merge"]`. `gh pr merge --squash`/`--rebase`
130+
→ HTTP 405. Always `merge_method=merge`.
131+
- **Strict required checks** mean the branch must be **up to date with
132+
main** to merge. A long-running PR will need a branch update before it
133+
goes green. Owner/admin is a bypass actor and can admin-merge.
134+
- **`gh pr merge --delete-branch` can fail when the main worktree is
135+
checked out.** Use the `gh api ... PUT .../merge` form above;
136+
`delete_branch_on_merge` is on, so the branch is cleaned up anyway.
137+
- **`core.bare` sometimes flips to `true` mid-session** in this repo;
138+
git then errors `this operation must be run in a work tree`. Fix:
139+
`git config core.bare false`.
140+
- **Pre-push hooks run `pnpm typecheck && pnpm test` (~30s) and flake**
141+
on the full suite. AGENTS.md says never `--no-verify`; in practice a
142+
known unrelated flake is the one time it's justified — CI's required
143+
checks are the real gate, so the PR still can't merge broken. Don't
144+
use it to skip a failure your change actually caused.
145+
- **`docs(exploration): check off <topic>`** is the conventional message
146+
for the `[_]``[x]` rename; `done` prints the exact line.
147+
- **Don't add scope beyond the checklist.** Implement the doc; resist
148+
gold-plating (AGENTS.md "DON'T: add features beyond what's requested").
149+
150+
## Troubleshooting
151+
152+
- `error: cannot read docs/explorations` — you're not at the repo root.
153+
`cd` to the repo root; driver paths are root-relative.
154+
- `ambiguous — N matches` from `find`/`check` — pass a longer unique
155+
substring, or the 4-digit number for `find`.
156+
- `refusing: N checklist item(s) still unchecked` from `done` — finish
157+
(or `check`) the listed items first; `done` won't mark a half-built
158+
doc complete.
159+
- `No valid tags` from `new.mjs` — use a tag from the list above.
160+
- `changelog-section` check failing — the PR has no fragment and no
161+
`skip-changelog` label. Add one of them.

0 commit comments

Comments
 (0)