Skip to content

Commit dc34ceb

Browse files
authored
Merge pull request #2721 from nanocoai/docs/skills-model
docs: customizing intro, skills model, and skill guidelines
2 parents 820cd8e + ad3dfad commit dc34ceb

9 files changed

Lines changed: 382 additions & 691 deletions

File tree

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,10 @@ groups/*
3939
.nanoclaw/
4040

4141
agents-sdk-docs
42+
.agents
43+
AGENTS.md
44+
45+
# Internal working docs, never committed
46+
docs/maintainer-guide.md
47+
docs/drafts/
48+
forks.md

CLAUDE.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,9 @@ This project uses pnpm with `minimumReleaseAge: 4320` (3 days) in `pnpm-workspac
274274
| [docs/build-and-runtime.md](docs/build-and-runtime.md) | Runtime split (Node host + Bun container), lockfiles, image build surface, CI, key invariants |
275275
| [docs/v1-to-v2-changes.md](docs/v1-to-v2-changes.md) | v1→v2 architecture diff — vocabulary for where v1 things moved |
276276
| [docs/migration-dev.md](docs/migration-dev.md) | Migration development guide — testing, debugging, dev loop |
277+
| [docs/customizing.md](docs/customizing.md) | Short intro to customizing via skills |
278+
| [docs/skills-model.md](docs/skills-model.md) | The skills model in full: recipes, tests, upgrades, migrations |
279+
| [docs/skill-guidelines.md](docs/skill-guidelines.md) | Authoritative checklist for writing a skill |
277280

278281
## Container Build Cache
279282

CONTRIBUTING.md

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,26 +29,27 @@ Every user should have clean and minimal code that does exactly what they need.
2929

3030
### Skill types
3131

32-
#### 1. Feature skills (branch-based)
32+
#### 1. Channel and provider skills (registry branches)
3333

34-
Add capabilities to NanoClaw by merging a git branch. The SKILL.md contains setup instructions; the actual code lives on a `skill/*` branch.
34+
Add a messaging channel or an agent provider. The SKILL.md contains the install steps; the actual code lives on a long-lived registry branch (`channels` or `providers`) that we keep in sync with `main`.
3535

36-
**Location:** `.claude/skills/` on `main` (instructions only), code on `skill/*` branch
36+
**Location:** `.claude/skills/` on `main` (instructions only), code on the `channels` or `providers` branch
3737

38-
**Examples:** `/add-telegram`, `/add-slack`, `/add-discord`, `/add-gmail`
38+
**Examples:** `/add-telegram`, `/add-slack`, `/add-discord`, `/add-opencode`
3939

4040
**How they work:**
4141
1. User runs `/add-telegram`
42-
2. Claude follows the SKILL.md: fetches and merges the `skill/telegram` branch
43-
3. Claude walks through interactive setup (env vars, bot creation, etc.)
42+
2. Claude follows the SKILL.md: `git fetch origin channels`, then copies each file in with `git show origin/channels:<path> > <path>`. Install is an additive fetch, never a `git merge`.
43+
3. The adapter's registration test is fetched the same way and run as verification
44+
4. Claude walks through interactive setup (tokens, bot creation, etc.)
4445

45-
**Contributing a feature skill:**
46+
**Contributing a channel or provider skill:**
4647
1. Fork `nanocoai/nanoclaw` and branch from `main`
47-
2. Make the code changes (new files, modified source, updated `package.json`, etc.)
48-
3. Add a SKILL.md in `.claude/skills/<name>/` with setup instructions — step 1 should be merging the branch
49-
4. Open a PR. We'll create the `skill/<name>` branch from your work
48+
2. Build the adapter following [docs/skill-guidelines.md](docs/skill-guidelines.md): a self-registering module, one appended barrel import, and a registration test that imports the real barrel
49+
3. Add a SKILL.md in `.claude/skills/<name>/` with the fetch-and-copy steps, and a REMOVE.md that reverses every change
50+
4. Open a PR. We'll land the code on the registry branch from your work
5051

51-
See `/add-telegram` for a good example. See [docs/skills-as-branches.md](docs/skills-as-branches.md) for the full system design.
52+
See `/add-slack` for a good example. See [docs/skills-model.md](docs/skills-model.md) for why install is a fetch, never a merge.
5253

5354
#### 2. Utility skills (with code files)
5455

@@ -58,7 +59,7 @@ Standalone tools that ship code files alongside the SKILL.md. The SKILL.md tells
5859

5960
**Examples:** a self-contained CLI or helper shipped in a `scripts/` subfolder of the skill.
6061

61-
**Key difference from feature skills:** No branch merge needed. The code is self-contained in the skill directory and gets copied into place during installation.
62+
**Key difference from channel/provider skills:** the code is self-contained in the skill directory and gets copied into place during installation; nothing is fetched from a registry branch.
6263

6364
**Guidelines:**
6465
- Put code in separate files, not inline in the SKILL.md
@@ -93,6 +94,10 @@ Skills that run inside the agent container, not on the host. These teach the con
9394
- Use `allowed-tools` frontmatter to scope tool permissions
9495
- Keep them focused — the agent's context window is shared across all container skills
9596

97+
### Writing a good skill
98+
99+
The authoring bar is [docs/skill-guidelines.md](docs/skill-guidelines.md): mostly adds, minimal reach-ins into existing code, a test for every functional integration point, and a REMOVE.md whenever apply leaves anything behind. [docs/skills-model.md](docs/skills-model.md) explains the model behind it.
100+
96101
### SKILL.md format
97102

98103
All skills use the [Claude Code skills standard](https://code.claude.com/docs/en/skills):

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ If a step fails, `nanoclaw.sh` hands off to Claude Code to diagnose and resume.
200200

201201
Only security fixes, bug fixes, and clear improvements will be accepted to the base configuration. That's all.
202202

203-
Everything else (new capabilities, OS compatibility, hardware support, enhancements) should be contributed as skills on the `channels` or `providers` branch.
203+
Everything else (new capabilities, OS compatibility, hardware support, enhancements) should be contributed as skills: channel and provider code on the `channels`/`providers` registry branches, everything else as a self-contained skill. See [docs/customizing.md](docs/customizing.md) and [CONTRIBUTING.md](CONTRIBUTING.md).
204204

205205
This keeps the base system minimal and lets every user customize their installation without inheriting features they don't want.
206206

docs/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,5 @@ The files in this directory are original design documents and developer referenc
99
| [SPEC.md](SPEC.md) | [Architecture](https://docs.nanoclaw.dev/concepts/architecture) |
1010
| [SECURITY.md](SECURITY.md) | [Security model](https://docs.nanoclaw.dev/concepts/security) |
1111
| [REQUIREMENTS.md](REQUIREMENTS.md) | [Introduction](https://docs.nanoclaw.dev/introduction) |
12-
| [skills-as-branches.md](skills-as-branches.md) | [Skills system](https://docs.nanoclaw.dev/integrations/skills-system) |
1312
| [docker-sandboxes.md](docker-sandboxes.md) | [Docker Sandboxes](https://docs.nanoclaw.dev/advanced/docker-sandboxes) |
1413
| [APPLE-CONTAINER-NETWORKING.md](APPLE-CONTAINER-NETWORKING.md) | [Container runtime](https://docs.nanoclaw.dev/advanced/container-runtime) |

docs/customizing.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Customizing NanoClaw
2+
3+
NanoClaw is made to be forked and changed. The catch with most projects is that once you edit the code, every upstream update turns into a merge fight, and the more you customized, the worse it gets.
4+
5+
NanoClaw avoids that with one simple idea: **every change you make is a skill.**
6+
7+
## The idea in a minute
8+
9+
- A **skill** is a small, self-contained add-on. It brings its own code and knows how to install itself.
10+
- Your **fork is just a list of skills**, plus one "recipe" that says which skills you have and how they fit together.
11+
- Because your changes live beside the core instead of tangled into it, **pulling in updates stays easy**.
12+
13+
## What makes it work
14+
15+
A good skill mostly **adds** things: new files, a line appended to an existing file, a dependency. It avoids rewriting existing code in place.
16+
17+
And it ships a test for each spot where it touches the rest of the system. When an update moves something your skill depends on, that test fails and points at the fix, instead of you finding out when things break in production.
18+
19+
## How you actually work
20+
21+
You don't have to think in skills while you're building. **Edit the code directly, get it working, then turn your changes into skills afterward.** A coding agent does the conversion for you, following [skill-guidelines.md](skill-guidelines.md).
22+
23+
The only rule worth remembering: **a change isn't really part of your fork until it's a skill**, because that's the form that survives an upgrade.
24+
25+
## Upgrading
26+
27+
Always upgrade by running `/update-nanoclaw`. **Don't just `git pull`.** The command sets a rollback point, pulls the upstream changes, runs your tests, and walks you through anything that needs fixing, usually a small, local fix in one skill.
28+
29+
## The deal
30+
31+
We keep the core small and stable, and every breaking change ships with its migration. You keep your changes as skills, with tests. Do that, and upgrades won't break you. Changes edited directly into the core are the one thing the model can't protect.
32+
33+
## Go deeper
34+
35+
- **[The skills model in full](skills-model.md)**: how skills, recipes, tests, and upgrades work under the hood.
36+
- **[Skill guidelines](skill-guidelines.md)**: the authoritative checklist for writing one.

0 commit comments

Comments
 (0)