@contentrain/skills 0.2.0 → 0.3.0

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 CHANGED
@@ -1,24 +1,46 @@
1
1
  # `@contentrain/skills`
2
2
 
3
3
  [![npm version](https://img.shields.io/npm/v/%40contentrain%2Fskills?label=%40contentrain%2Fskills)](https://www.npmjs.com/package/@contentrain/skills)
4
+ [![Agent Skills](https://img.shields.io/badge/Agent_Skills-15_skills-8B5CF6)](https://agentskills.io)
4
5
  [![GitHub source](https://img.shields.io/badge/source-Contentrain%2Fai-181717?logo=github)](https://github.com/Contentrain/ai/tree/main/packages/skills)
6
+ [![Docs](https://img.shields.io/badge/docs-ai.contentrain.io-0f172a)](https://ai.contentrain.io/packages/skills)
5
7
 
6
8
  Workflow skills and framework guides for Contentrain-aware AI agents.
7
9
 
10
+ Start here:
11
+
12
+ - [2-minute product demo](https://ai.contentrain.io/demo)
13
+ - [Rules & skills docs](https://ai.contentrain.io/packages/rules)
14
+ - [Framework integration guide](https://ai.contentrain.io/guides/frameworks)
15
+
8
16
  This package follows the [Agent Skills standard](https://agentskills.io) for progressive disclosure: each skill has a `SKILL.md` (loaded on activation) and optional `references/` (loaded on demand).
9
17
 
10
18
  ## Install
11
19
 
20
+ ### Via npm (programmatic access to catalogs and constants)
21
+
12
22
  ```bash
13
23
  pnpm add @contentrain/skills
14
24
  ```
15
25
 
16
- Or install directly via the skills CLI:
26
+ ### Via skills CLI (install skills into your AI agent)
17
27
 
18
28
  ```bash
19
- npx skills add contentrain/contentrain-ai --skill='*'
29
+ # Install all 15 skills
30
+ npx skills add Contentrain/ai/packages/skills
31
+
32
+ # Install a specific skill
33
+ npx skills add Contentrain/ai/packages/skills --skill contentrain-normalize
34
+
35
+ # Install to a specific agent
36
+ npx skills add Contentrain/ai/packages/skills --agent claude-code
37
+
38
+ # List available skills
39
+ npx skills add Contentrain/ai/packages/skills --list
20
40
  ```
21
41
 
42
+ Works with Claude Code, Cursor, Windsurf, GitHub Copilot, OpenAI Codex, Gemini CLI, and 40+ other agents.
43
+
22
44
  ## What It Contains
23
45
 
24
46
  ### Agent Skills (standard format)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentrain/skills",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "license": "MIT",
5
5
  "description": "AI agent skills for Contentrain — workflow procedures, framework integration guides",
6
6
  "type": "module",
@@ -9,7 +9,7 @@
9
9
  "url": "git+https://github.com/Contentrain/ai.git",
10
10
  "directory": "packages/skills"
11
11
  },
12
- "homepage": "https://github.com/Contentrain/ai/tree/main/packages/skills",
12
+ "homepage": "https://ai.contentrain.io/packages/rules#skills",
13
13
  "bugs": {
14
14
  "url": "https://github.com/Contentrain/ai/issues"
15
15
  },
@@ -17,8 +17,14 @@
17
17
  "contentrain",
18
18
  "ai",
19
19
  "skills",
20
+ "agent-skills",
20
21
  "mcp",
21
22
  "workflow",
23
+ "claude-code",
24
+ "cursor",
25
+ "windsurf",
26
+ "copilot",
27
+ "codex",
22
28
  "vue",
23
29
  "react",
24
30
  "nuxt",
@@ -10,6 +10,34 @@ metadata:
10
10
 
11
11
  Contentrain is a Git-based, AI-first content management system. Content lives in `.contentrain/` as JSON and Markdown files, managed through MCP tools. This skill covers architecture, content formats, and tool usage.
12
12
 
13
+ ## Ecosystem Overview
14
+
15
+ Contentrain consists of 6 packages that work together:
16
+
17
+ | Package | Role | How agent uses it |
18
+ |---|---|---|
19
+ | @contentrain/mcp | 16 MCP tools (scan, apply, validate, merge...) | MCP tool calls |
20
+ | contentrain (CLI) | init, serve, generate, doctor, diff, status | Shell commands |
21
+ | @contentrain/types | Shared TypeScript contracts | Type safety |
22
+ | @contentrain/query | Generated SDK client (Prisma-pattern) | `import from '#contentrain'` |
23
+ | @contentrain/rules | Behavioral guardrails (~86 lines, always-loaded) | Auto-loaded by IDE |
24
+ | @contentrain/skills | Procedural workflows (this file) | On-demand by agent |
25
+
26
+ ### CLI Serve — Review & Approval Bridge
27
+
28
+ For workflows requiring human review (normalize, content review):
29
+
30
+ ```bash
31
+ contentrain serve # http://localhost:3333
32
+ ```
33
+
34
+ | Page | When to use |
35
+ |---|---|
36
+ | /normalize | Extraction/reuse preview and approval |
37
+ | /branches | Merge or delete pending branches |
38
+ | /validate | Review validation errors visually |
39
+ | /content | Browse models and entries |
40
+
13
41
  ## Architecture: Agent vs MCP
14
42
 
15
43
  The system separates **intelligence** (agent) from **infrastructure** (MCP tools).
@@ -94,6 +122,7 @@ slug: getting-started
94
122
  | `contentrain_apply` | Apply normalize operation (extract or reuse) |
95
123
  | `contentrain_validate` | Validate content against model schemas |
96
124
  | `contentrain_submit` | Push contentrain/* branches to remote |
125
+ | `contentrain_merge` | Merge a review-mode branch into contentrain locally |
97
126
  | `contentrain_bulk` | Run batch operations on existing content |
98
127
 
99
128
  ## Calling Sequences
@@ -121,6 +150,18 @@ apply(reuse, dry_run:true) --> [review] --> apply(reuse, dry_run:false)
121
150
  --> validate --> submit --> [repeat per model]
122
151
  ```
123
152
 
153
+ ## MUST Rules
154
+
155
+ These are enforced by MCP — violating them causes errors. Know them upfront:
156
+
157
+ - MUST call `contentrain_status` before any write operation on existing projects
158
+ - MUST call `contentrain_describe_format` before creating models or content
159
+ - MUST use `dry_run: true` before `contentrain_apply` execute
160
+ - MUST call `contentrain_validate` before `contentrain_submit`
161
+ - MUST run `npx contentrain generate` after model/content changes that affect SDK
162
+ - MUST NOT write to `.contentrain/meta/`, `.contentrain/client/`, `.contentrain/context.json` directly
163
+ - MUST NOT auto-merge normalize branches (always review mode)
164
+
124
165
  ## Key Guardrails
125
166
 
126
167
  1. **Always call `contentrain_status` first** when working with an existing project
@@ -147,3 +188,10 @@ apply(reuse, dry_run:true) --> [review] --> apply(reuse, dry_run:false)
147
188
  | [i18n](references/i18n.md) | Internationalization quality rules |
148
189
  | [Security](references/security.md) | XSS prevention, secret detection, URL validation |
149
190
  | [Workflow](references/workflow.md) | Git workflow, branch naming, conflict resolution |
191
+
192
+ ## Related Skills
193
+
194
+ - **contentrain-normalize** — Two-phase extraction and source patching
195
+ - **contentrain-serve** — Browser-based review and approval UI
196
+ - **contentrain-generate** — SDK client generation
197
+ - **contentrain-sdk** — @contentrain/query usage
@@ -145,11 +145,14 @@ contentrain_submit # Push (always review mode)
145
145
 
146
146
  ### Rule 6: Branch and Worktree
147
147
 
148
- - Every write operation automatically creates a worktree and branch
148
+ - A dedicated `contentrain` branch is the single source of truth for content state, created at init and protected from deletion
149
+ - Every write operation creates a temporary worktree on a new feature branch forked from `contentrain`
149
150
  - Branch naming: `contentrain/{operation}/{model}/{timestamp}` (locale included when applicable)
150
151
  - Do not create branches manually. MCP handles Git transactions
151
- - `auto-merge` mode: branch merged to base branch after commit
152
- - `review` mode: branch pushed to remote by `contentrain_submit`
152
+ - Developer's working tree is never mutated during MCP operations (no stash, no checkout, no merge on the developer's tree)
153
+ - context.json is committed together with content changes, not as a separate commit
154
+ - `auto-merge` mode: feature branch merged into `contentrain`, baseBranch advanced via update-ref, `.contentrain/` files selectively synced to developer's working tree (dirty files skipped with warning)
155
+ - `review` mode: feature branch pushed to remote by `contentrain_submit`
153
156
 
154
157
  ### Rule 7: Branch Health
155
158
 
@@ -19,7 +19,7 @@ Contentrain supports two workflow modes, configured in `.contentrain/config.json
19
19
  { "workflow": "auto-merge" }
20
20
  ```
21
21
 
22
- - Branch is created, changes are committed, branch is **automatically merged to main**.
22
+ - Feature branch is created from the `contentrain` branch, changes are committed, feature branch is **merged into `contentrain`**, then baseBranch is advanced via **update-ref** (fast-forward), and `.contentrain/` files are **selectively synced** to the developer's working tree.
23
23
  - No review step -- changes go live immediately.
24
24
  - Best for: solo developers, rapid iteration, prototyping, vibe coding.
25
25
  - Status flow: `draft` --> `published` (skips `in_review`).
@@ -72,37 +72,55 @@ contentrain/{operation}/{model}/{locale}/{timestamp}
72
72
 
73
73
  ## 3. Git Workflow
74
74
 
75
- ### 3.1 Worktree-Based Transactions
75
+ ### 3.1 Dedicated `contentrain` Branch
76
+
77
+ The `contentrain` branch is the **single source of truth** for content state:
78
+
79
+ - Created automatically at `contentrain_init`.
80
+ - All content writes happen on feature branches forked from `contentrain`.
81
+ - The `contentrain` branch is **protected from deletion**.
82
+ - context.json is committed together with content changes, not as a separate commit.
83
+
84
+ ### 3.2 Worktree-Based Transactions
76
85
 
77
86
  Every write operation follows this flow:
78
87
 
79
- 1. MCP creates a **Git worktree** on a new branch.
80
- 2. Changes are made in the worktree (content files, model files).
81
- 3. Changes are committed to the branch.
82
- 4. **auto-merge mode:** Branch is merged to main. Worktree is cleaned up.
83
- 5. **review mode:** Branch is pushed to remote. Worktree is cleaned up. Studio notifies reviewers.
88
+ 1. MCP creates a **temporary Git worktree** on a new feature branch forked from `contentrain`.
89
+ 2. Changes are made in the worktree (content files, model files, context.json).
90
+ 3. Changes are committed to the feature branch.
91
+ 4. **auto-merge mode:** Feature branch is merged into `contentrain`, then baseBranch is advanced via **update-ref** (fast-forward), then `.contentrain/` files are **selectively synced** to the developer's working tree. Dirty files are skipped with a warning. Worktree is cleaned up.
92
+ 5. **review mode:** Feature branch is pushed to remote for team review. Worktree is cleaned up. Studio notifies reviewers.
93
+
94
+ Developer's working tree is **never mutated** during MCP git operations. There is no stash, no checkout, and no merge on the developer's tree.
95
+
96
+ ### 3.3 Developer Manual Editing
97
+
98
+ If the developer manually edits `.contentrain/` files in their working tree, MCP selective sync skips those dirty files and issues a warning. The developer must commit or discard their local changes before MCP can sync those files.
84
99
 
85
- ### 3.2 Critical Rules
100
+ ### 3.4 Critical Rules
86
101
 
87
- - **NEVER commit directly to main.** All changes go through branches.
102
+ - **NEVER commit directly to main or the `contentrain` branch.** All changes go through feature branches.
88
103
  - **NEVER create branches manually.** MCP tools handle all Git operations.
89
104
  - **NEVER force-push or rebase** Contentrain branches.
105
+ - **NEVER delete the `contentrain` branch.** It is the content state SSOT.
90
106
  - Worktrees are temporary. They are created for the operation and cleaned up afterward.
91
107
  - Each branch contains a cohesive set of changes (e.g., all entries for one model update).
92
108
 
93
- ### 3.3 Branch Lifecycle
109
+ ### 3.5 Branch Lifecycle
94
110
 
95
111
  ```
96
- Created (worktree) --> Committed --> Merged/Pushed --> Cleaned up
97
- |
98
- v
99
- auto-merge: merged to main
100
- review: pushed to remote, awaiting review
112
+ Feature branch created (worktree on contentrain)
113
+ --> Changes committed
114
+ --> auto-merge: feature merged into contentrain
115
+ --> update-ref advances baseBranch
116
+ --> selective sync .contentrain/ to developer's tree
117
+ --> review: feature pushed to remote, awaiting review
118
+ --> Worktree cleaned up
101
119
  ```
102
120
 
103
- Merged branches are retained for `branchRetention` days (default: 30) for audit trail, then pruned.
121
+ The `contentrain` branch is permanent and protected. Feature branches are retained for `branchRetention` days (default: 30) for audit trail, then pruned.
104
122
 
105
- ### 3.4 Branch Health
123
+ ### 3.6 Branch Health
106
124
 
107
125
  MCP enforces branch health limits to prevent branch accumulation:
108
126
 
@@ -160,7 +178,7 @@ published --> archived
160
178
  |-------|-----------|---------|
161
179
  | `draft` | Branch exists, not yet reviewed/merged | Content created or updated |
162
180
  | `in_review` | PR/branch open, labeled `contentrain-content` | `contentrain_submit` in review mode |
163
- | `published` | Content is on main branch | Auto-merge, or PR merged after review |
181
+ | `published` | Content is on `contentrain` branch and synced to baseBranch | Auto-merge, or PR merged after review |
164
182
  | `rejected` | PR closed without merge | Studio reviewer rejects changes |
165
183
  | `archived` | Metadata-only state | Manual action -- content hidden but retained |
166
184
 
@@ -208,8 +226,9 @@ published --> archived
208
226
 
209
227
  ```
210
228
  contentrain_submit
211
- --> Merge branch to main
212
- --> Update context.json
229
+ --> Merge feature branch into contentrain
230
+ --> Advance baseBranch via update-ref (fast-forward)
231
+ --> Selectively sync .contentrain/ files to developer's working tree
213
232
  --> Clean up worktree
214
233
  --> Status: published
215
234
  ```
@@ -218,8 +237,7 @@ contentrain_submit
218
237
 
219
238
  ```
220
239
  contentrain_submit
221
- --> Push branch to remote
222
- --> Update context.json
240
+ --> Push feature branch to remote
223
241
  --> Clean up worktree
224
242
  --> Status: in_review
225
243
  --> Studio notifies reviewers
@@ -97,3 +97,10 @@ Report:
97
97
  - locale or entry count affected
98
98
  - validation outcome if run
99
99
  - submit status
100
+
101
+ ## Related Skills
102
+
103
+ - **contentrain-content** — Single-entry content operations
104
+ - **contentrain-validate-fix** — Validate after bulk changes
105
+ - **contentrain-generate** — Regenerate SDK after bulk locale copy
106
+ - **contentrain** — Core architecture and MCP tool catalog
@@ -18,6 +18,16 @@ The user wants to create new content, add entries to a collection, populate a si
18
18
 
19
19
  ---
20
20
 
21
+ ## MUST Rules
22
+
23
+ - MUST call `contentrain_describe` before writing content (know the schema)
24
+ - MUST provide ALL required fields in entries
25
+ - MUST create entries for ALL supported locales when model has `i18n: true`
26
+ - MUST NOT set system fields (id, slug, createdAt, updatedAt, status, source)
27
+ - MUST run `npx contentrain generate` after adding new models or changing fields
28
+
29
+ ---
30
+
21
31
  ## Steps
22
32
 
23
33
  ### 1. Check Project State
@@ -150,6 +160,16 @@ Call `contentrain_submit` to push branches to remote:
150
160
 
151
161
  Report the Studio URL if provided in the tool response -- the user can review and approve content there.
152
162
 
163
+ ### After Save: SDK Regeneration
164
+
165
+ When new models are created or fields change, regenerate the SDK client:
166
+
167
+ ```bash
168
+ npx contentrain generate
169
+ ```
170
+
171
+ This updates TypeScript types for the new content. See: **contentrain-generate** skill.
172
+
153
173
  ### 12. Final Summary
154
174
 
155
175
  Report to the user:
@@ -160,3 +180,10 @@ Report to the user:
160
180
  - The submission status (auto-merged or pending review).
161
181
  - Studio link for visual review (if available).
162
182
  - Next steps: run `/contentrain-generate` to update SDK types if models changed.
183
+
184
+ ## Related Skills
185
+
186
+ - **contentrain-serve** — Browser-based review for content branches
187
+ - **contentrain-generate** — SDK client regeneration after content changes
188
+ - **contentrain-quality** — Content quality, SEO, and accessibility rules
189
+ - **contentrain** — Core architecture and MCP tool catalog
@@ -60,3 +60,18 @@ Summarize:
60
60
  - action taken
61
61
  - base branch affected
62
62
  - any follow-up branch still pending
63
+
64
+ ## Browser Alternative
65
+
66
+ For visual branch review, use CLI serve:
67
+
68
+ ```bash
69
+ contentrain serve
70
+ ```
71
+
72
+ Navigate to http://localhost:3333/branches to see all pending branches with diffs, and merge or delete them visually.
73
+
74
+ ## Related Skills
75
+
76
+ - **contentrain-serve** — Browser-based branch review and merge
77
+ - **contentrain** — Core architecture and MCP tool catalog
@@ -60,3 +60,10 @@ Recommended order:
60
60
  ### 5. Re-run Doctor
61
61
 
62
62
  After changes, run `contentrain doctor` again to confirm the project is healthy.
63
+
64
+ ## Related Skills
65
+
66
+ - **contentrain-init** — Re-initialize if project structure is broken
67
+ - **contentrain-validate-fix** — Fix content/model validation errors
68
+ - **contentrain-generate** — Regenerate SDK if client is stale
69
+ - **contentrain** — Core architecture and MCP tool catalog
@@ -181,3 +181,10 @@ Report to the user:
181
181
  - TypeScript types: available via `index.d.ts`.
182
182
  - Next steps: import `query` from `#contentrain` and start querying content.
183
183
  - Reminder: re-run `contentrain generate` after model or content changes.
184
+
185
+ ## Related Skills
186
+
187
+ - **contentrain** — Core architecture and MCP tool catalog
188
+ - **contentrain-normalize** — Normalize workflow requires SDK regen after Phase 2
189
+ - **contentrain-content** — Content changes require SDK regen for type updates
190
+ - **contentrain-sdk** — @contentrain/query usage after generation
@@ -110,11 +110,13 @@ import { query, singleton, dictionary, document } from '#contentrain'
110
110
  ```ts
111
111
  const posts = query('blog-post')
112
112
  .locale('en') // set locale
113
- .where('status', 'published') // exact match filter
113
+ .where('status', 'published') // equality filter (shorthand)
114
+ .where('views', 'gt', 100) // operator filter: eq|ne|gt|gte|lt|lte|in|contains
114
115
  .sort('date', 'desc') // sort by field
115
116
  .limit(10) // limit results
116
117
  .offset(5) // skip results
117
118
  .include('author', 'tags') // resolve relation fields (1 level deep)
119
+ .count() // --> number (count of matches)
118
120
  .all() // --> T[] (returns array)
119
121
  .first() // --> T | undefined (first match)
120
122
  ```
@@ -143,22 +145,22 @@ Parameterized templates use `{placeholder}` syntax in dictionary values. The `ge
143
145
  ```ts
144
146
  const article = document('blog-article')
145
147
  .locale('en')
146
- .where('category', 'tech')
148
+ .where('category', 'tech') // equality shorthand
149
+ .where('title', 'contains', 'Guide') // operator syntax
147
150
  .include('author') // resolve relations in frontmatter
148
151
  .bySlug('getting-started') // --> T | undefined (find by slug)
149
152
 
150
- const docs = document('doc-page').locale('en').all() // --> T[]
151
- const first = document('doc-page').locale('en').first() // --> T | undefined
153
+ const docs = document('doc-page').locale('en').all() // --> T[]
154
+ const first = document('doc-page').locale('en').first() // --> T | undefined
155
+ const total = document('doc-page').locale('en').count() // --> number
152
156
  ```
153
157
 
154
158
  ### DOES NOT EXIST -- never use these
155
159
 
156
- - `.filter()` -- use `.where(field, value)` instead
160
+ - `.filter()` -- use `.where(field, value)` or `.where(field, op, value)` instead
157
161
  - `.byId()` -- use `.where('id', value).first()` instead
158
- - `.count()` -- use `.all().length` instead
159
162
  - `dictionary().all()` -- use `.get()` instead
160
163
  - Queries are SYNC -- do not use `await` with `query()`, `singleton()`, `dictionary()`, or `document()`
161
- - `.where('field', 'eq', value)` -- just `.where('field', value)`
162
164
  - `.get()` on QueryBuilder -- use `.all()` or `.first()`
163
165
 
164
166
  ---
@@ -96,4 +96,21 @@ Report to the user:
96
96
  - What was created in `.contentrain/`.
97
97
  - Which models were set up.
98
98
  - How to import content in their code (show the `#contentrain` import).
99
- - Next steps: create content, run `npx contentrain generate`, start the dev server.
99
+ - **Next step: Run `npx contentrain generate` to create the typed SDK client.** Without this, `#contentrain` imports won't work. See: **contentrain-generate** skill.
100
+ - Start the dev server and verify imports work.
101
+
102
+ ### Post-Init: Start Review UI
103
+
104
+ After initialization, start the local review UI to explore the project:
105
+
106
+ ```bash
107
+ contentrain serve
108
+ ```
109
+
110
+ This opens http://localhost:3333 where you can browse models, content, and validation results.
111
+
112
+ ## Related Skills
113
+
114
+ - **contentrain-serve** — Local review UI
115
+ - **contentrain-generate** — SDK client generation
116
+ - **contentrain** — Core architecture and MCP tool catalog
@@ -139,3 +139,10 @@ Report:
139
139
  - field count
140
140
  - any relation targets
141
141
  - whether content migration is needed next
142
+
143
+ ## Related Skills
144
+
145
+ - **contentrain-content** — Create content for this model after defining it
146
+ - **contentrain-validate-fix** — Validate model and content after changes
147
+ - **contentrain-generate** — Regenerate SDK after model changes
148
+ - **contentrain** — Core architecture and MCP tool catalog
@@ -17,6 +17,18 @@ Phase 1 alone is valuable: content becomes manageable in Studio, translatable, a
17
17
 
18
18
  ---
19
19
 
20
+ ## MUST Rules
21
+
22
+ - MUST scan before extract (`contentrain_scan` → `contentrain_apply`)
23
+ - MUST `dry_run: true` before `dry_run: false` for every `contentrain_apply` call
24
+ - MUST merge Phase 1 branch before starting Phase 2
25
+ - MUST run `npx contentrain generate` after Phase 2 completes
26
+ - MUST NOT reuse without scoped model or domain (whole-project patching is blocked)
27
+ - MUST NOT patch `.contentrain/` files via reuse (content files are read-only for reuse)
28
+ - MUST NOT exceed 100 patches per `contentrain_apply` call
29
+
30
+ ---
31
+
20
32
  ## Two-Phase Architecture
21
33
 
22
34
  | Aspect | Phase 1: Extraction | Phase 2: Reuse |
@@ -105,6 +117,52 @@ Call `contentrain_validate` to check schema compliance, i18n completeness, and d
105
117
 
106
118
  Tell the user: "Phase 1 complete. Content is now in Contentrain and can be managed, translated, and published from Studio. When ready, proceed with Phase 2 to update source files."
107
119
 
120
+ ### Step 5: User Review
121
+
122
+ Two paths — agent chooses based on context:
123
+
124
+ **Path A — Browser Review (recommended for visual diff):**
125
+ 1. Ensure `contentrain serve` is running (or ask user to start it)
126
+ 2. Summarize the dry_run output to the user
127
+ 3. Direct user to http://localhost:3333/normalize
128
+ 4. Explain: "On this page you can review the extraction plan and Approve or Reject it."
129
+ 5. Wait for user decision
130
+
131
+ **Path B — Terminal Review:**
132
+ 1. Show dry_run output to user
133
+ 2. Ask for explicit approval
134
+ 3. If approved: `contentrain_apply(mode: 'extract', dry_run: false)` → execute
135
+ 4. `contentrain_validate` → `contentrain_submit`
136
+ 5. `contentrain_merge(branch: 'cr/normalize/extract/...', confirm: true)` to merge locally
137
+
138
+ ### Step 6: Merge Phase 1 Branch
139
+
140
+ Phase 2 CANNOT start until Phase 1 branch is merged. Three options:
141
+ - **Browser:** localhost:3333/branches → click Merge
142
+ - **MCP Tool:** `contentrain_merge(branch: 'cr/normalize/extract/...', confirm: true)`
143
+ - **Git platform:** Create PR → review → merge
144
+
145
+ Verify with `contentrain_status` — check that extract branch is no longer in unmerged list.
146
+
147
+ ### Step 7: Phase 2 Prerequisite Check
148
+
149
+ Before starting reuse:
150
+ 1. Call `contentrain_status` and verify extract branch is merged
151
+ 2. If not merged → inform user and wait
152
+ 3. If merged → proceed to Phase 2 reuse
153
+
154
+ ### Step 8: SDK Regeneration (after Phase 2)
155
+
156
+ After all reuse operations are complete, source files now use `#contentrain` imports.
157
+ The SDK client MUST be regenerated:
158
+
159
+ ```bash
160
+ npx contentrain generate
161
+ ```
162
+
163
+ Without this, `#contentrain` imports will fail at build time.
164
+ See: **contentrain-generate** skill for details.
165
+
108
166
  ---
109
167
 
110
168
  ## Phase 2: Reuse (Step-by-Step)
@@ -183,3 +241,10 @@ Ask the user which model or domain to process next. Repeat steps 1-5 for each re
183
241
  - [Extraction Details](references/extraction.md) -- Phase 1 extraction rules, parameters, and examples
184
242
  - [Reuse Details](references/reuse.md) -- Phase 2 replacement expressions by stack and patching rules
185
243
  - [What Is Content](references/what-is-content.md) -- Heuristics for identifying content vs code strings
244
+
245
+ ## Related Skills
246
+
247
+ - **contentrain-serve** — Browser-based review UI for extraction approval
248
+ - **contentrain-generate** — SDK client regeneration (required after reuse)
249
+ - **contentrain-sdk** — @contentrain/query usage in source code
250
+ - **contentrain** — Core architecture and full MCP tool catalog
@@ -178,3 +178,10 @@ Noun or noun phrase, sentence case, no trailing colons. Helper text: one sentenc
178
178
  - [SEO Rules](references/seo.md) -- SEO optimization rules for content fields, meta tags, and structured data
179
179
  - [Accessibility](references/accessibility.md) -- Accessibility rules for content: alt text, ARIA, color contrast, reading level
180
180
  - [Media Rules](references/media.md) -- Media asset rules: image optimization, video handling, file naming conventions
181
+
182
+ ## Related Skills
183
+
184
+ - **contentrain-review** — Apply quality checks during content review
185
+ - **contentrain-content** — Content creation following quality rules
186
+ - **contentrain-translate** — Translation quality and i18n rules
187
+ - **contentrain** — Core architecture and MCP tool catalog
@@ -168,3 +168,9 @@ Only make changes after user approval.
168
168
  If fixes were applied, call `contentrain_validate` again to confirm all issues are resolved.
169
169
 
170
170
  Report the final status: "All checks passed" or list remaining issues that require manual attention.
171
+
172
+ ## Related Skills
173
+
174
+ - **contentrain-serve** — Visual review at http://localhost:3333/content
175
+ - **contentrain-quality** — Quality checklist reference
176
+ - **contentrain** — Core architecture and MCP tool catalog
@@ -43,7 +43,9 @@ const doc = document('blog-post').bySlug('getting-started')
43
43
  |--------|-------------|
44
44
  | `.all()` | Get all entries |
45
45
  | `.first()` | Get first entry |
46
- | `.where(field, op, value)` | Filter (`eq`, `ne`, `gt`, `gte`, `lt`, `lte`, `in`, `contains`) |
46
+ | `.count()` | Return count of matching entries |
47
+ | `.where(field, value)` | Equality filter (shorthand for `eq`) |
48
+ | `.where(field, op, value)` | Operator filter: `eq`, `ne`, `gt`, `gte`, `lt`, `lte`, `in`, `contains` |
47
49
  | `.sort(field, direction?)` | Sort (`asc`/`desc`, default `asc`) |
48
50
  | `.limit(n)` | Limit results |
49
51
  | `.offset(n)` | Skip results |
@@ -71,7 +73,9 @@ const doc = document('blog-post').bySlug('getting-started')
71
73
  | `.all()` | Get all documents |
72
74
  | `.bySlug(slug)` | Get document by slug |
73
75
  | `.first()` | Get first document |
74
- | `.where(field, op, value)` | Filter by frontmatter field |
76
+ | `.count()` | Return count of matching documents |
77
+ | `.where(field, value)` | Equality filter (shorthand) |
78
+ | `.where(field, op, value)` | Operator filter (same ops as QueryBuilder) |
75
79
  | `.include(relation)` | Resolve relation fields |
76
80
 
77
81
  ## CDN Mode (Remote Data)
@@ -107,6 +111,28 @@ const doc = await client.document('docs').locale('en').bySlug('intro')
107
111
  | `in` | `.where('category', 'in', ['a','b'])` | In array |
108
112
  | `contains` | `.where('tags', 'contains', 'vue')` | String/array contains |
109
113
 
114
+ ### CDN Entry Metadata, Media & Forms
115
+
116
+ ```typescript
117
+ // Entry metadata (status, publish_at, expire_at)
118
+ const posts = await client.collection('blog').locale('en').withMeta().all()
119
+
120
+ // Media manifest & variant URLs
121
+ const media = client.media()
122
+ const asset = await media.asset('hero.jpg')
123
+ const url = media.url(asset, 'thumb')
124
+
125
+ // Forms (config fetch + submit)
126
+ const form = client.form()
127
+ const config = await form.config('contact')
128
+ const result = await form.submit('contact', { name: 'Alice' })
129
+
130
+ // Conversation API (external AI content operations)
131
+ const conv = client.conversation()
132
+ const response = await conv.send('Create a blog post about Vue 4')
133
+ const history = await conv.history(response.conversationId)
134
+ ```
135
+
110
136
  ### CDN vs Local
111
137
 
112
138
  | Aspect | Local (`#contentrain`) | CDN (`createContentrain()`) |
@@ -143,3 +169,9 @@ const doc = await client.document('docs').locale('en').bySlug('intro')
143
169
  | Reference | Description |
144
170
  |-----------|-------------|
145
171
  | [Bundler Configuration](references/bundler-config.md) | Vite, Next.js, Nuxt, SvelteKit, Metro alias setup |
172
+
173
+ ## Related Skills
174
+
175
+ - **contentrain-generate** — Generate the SDK client before using it
176
+ - **contentrain-quality** — Content quality rules for entries you query
177
+ - **contentrain** — Core architecture and MCP tool catalog
@@ -94,3 +94,10 @@ The serve UI is a **monitoring + approval surface**, not an action trigger:
94
94
  - **Prompts**: every page shows copyable agent prompts that developers paste into their AI agent
95
95
 
96
96
  All mutations (create, edit, delete, scan, fix, normalize) are **agent-driven via MCP tools**. The UI never triggers these directly.
97
+
98
+ ## Related Skills
99
+
100
+ - **contentrain-normalize** — Normalize workflow uses serve for extraction/reuse review and approval
101
+ - **contentrain-diff** — Terminal-based branch review alternative to serve /branches page
102
+ - **contentrain-review** — Content review workflow uses serve for visual inspection
103
+ - **contentrain** — Core architecture and MCP tool catalog
@@ -135,6 +135,14 @@ After all translations are saved, re-generate the SDK client so the application
135
135
  npx contentrain generate
136
136
  ```
137
137
 
138
+ ### After Translation: SDK Regeneration
139
+
140
+ New locale data requires SDK client regeneration:
141
+
142
+ ```bash
143
+ npx contentrain generate
144
+ ```
145
+
138
146
  ### 8. Save Translations
139
147
 
140
148
  After approval, call `contentrain_content_save` for each model and target locale:
@@ -178,3 +186,10 @@ Report to the user:
178
186
  - Submission status.
179
187
  - Reminder to review translations for nuance that automated checks cannot catch.
180
188
  - Suggestion: run `/contentrain-review` to verify overall i18n coverage.
189
+
190
+ ## Related Skills
191
+
192
+ - **contentrain-serve** — Review translated content in browser
193
+ - **contentrain-generate** — SDK regeneration for new locale data
194
+ - **contentrain-quality** — Translation quality rules
195
+ - **contentrain** — Core architecture and MCP tool catalog
@@ -90,3 +90,9 @@ If validation still fails:
90
90
 
91
91
  - summarize remaining blockers precisely
92
92
  - tell the user which model/entry needs manual attention
93
+
94
+ ## Related Skills
95
+
96
+ - **contentrain-review** — Full content review workflow
97
+ - **contentrain-content** — Fix content entries after validation errors
98
+ - **contentrain** — Core architecture and MCP tool catalog