@contentrain/skills 0.1.2 → 0.2.1
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 +65 -60
- package/dist/index.cjs +65 -1
- package/dist/index.d.cts +50 -2
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +50 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +65 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -1
- package/skills/contentrain/SKILL.md +149 -0
- package/skills/contentrain/references/architecture.md +212 -0
- package/skills/contentrain/references/content-formats.md +279 -0
- package/skills/contentrain/references/i18n.md +298 -0
- package/skills/contentrain/references/mcp-pipelines.md +195 -0
- package/skills/contentrain/references/mcp-tools.md +308 -0
- package/skills/contentrain/references/model-kinds.md +330 -0
- package/skills/contentrain/references/schema-types.md +177 -0
- package/skills/contentrain/references/security.md +146 -0
- package/skills/contentrain/references/workflow.md +285 -0
- package/skills/contentrain-bulk/SKILL.md +99 -0
- package/skills/contentrain-content/SKILL.md +162 -0
- package/skills/contentrain-diff/SKILL.md +62 -0
- package/skills/contentrain-doctor/SKILL.md +62 -0
- package/skills/contentrain-generate/SKILL.md +183 -0
- package/skills/contentrain-generate/references/generated-client.md +198 -0
- package/skills/contentrain-init/SKILL.md +99 -0
- package/skills/contentrain-model/SKILL.md +141 -0
- package/skills/contentrain-normalize/SKILL.md +185 -0
- package/skills/contentrain-normalize/references/extraction.md +164 -0
- package/skills/contentrain-normalize/references/reuse.md +146 -0
- package/skills/contentrain-normalize/references/what-is-content.md +115 -0
- package/skills/contentrain-quality/SKILL.md +180 -0
- package/skills/contentrain-quality/references/accessibility.md +160 -0
- package/skills/contentrain-quality/references/content-quality.md +299 -0
- package/skills/contentrain-quality/references/media.md +170 -0
- package/skills/contentrain-quality/references/seo.md +229 -0
- package/skills/contentrain-review/SKILL.md +170 -0
- package/skills/contentrain-sdk/SKILL.md +145 -0
- package/skills/contentrain-sdk/references/bundler-config.md +135 -0
- package/skills/contentrain-serve/SKILL.md +96 -0
- package/skills/contentrain-translate/SKILL.md +180 -0
- package/skills/contentrain-validate-fix/SKILL.md +92 -0
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: accessibility
|
|
3
|
+
description: "Accessibility rules for content: alt text, ARIA, color contrast, reading level"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Accessibility Rules
|
|
7
|
+
|
|
8
|
+
These rules are MANDATORY for all AI agents creating or editing content in Contentrain projects.
|
|
9
|
+
Violations will be flagged during validation. No exceptions unless explicitly overridden by `context.json` configuration.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Image Accessibility
|
|
14
|
+
|
|
15
|
+
1. Every `image` type field MUST have a corresponding alt text value. If the model defines an `image_alt` field, populate it. If not, include alt text guidance in the image field's `description` metadata.
|
|
16
|
+
|
|
17
|
+
2. Alt text MUST describe the image's **content and function**, not its appearance.
|
|
18
|
+
- GOOD: `"CEO Jane Doe speaking at the 2024 product launch"`
|
|
19
|
+
- BAD: `"A photo with blue tones and a person on stage"`
|
|
20
|
+
|
|
21
|
+
3. Decorative images (visual separators, background textures) MUST have alt text set to an empty string `""`. Never leave alt text undefined or null -- explicitly set it to `""`.
|
|
22
|
+
|
|
23
|
+
4. Complex images (charts, infographics, diagrams) MUST have a short alt text summarizing the conclusion, plus a detailed description in an adjacent text field or in the body content.
|
|
24
|
+
- Example alt: `"Bar chart showing Q3 revenue grew 22% year-over-year"`
|
|
25
|
+
- Example adjacent text: full data table or written summary
|
|
26
|
+
|
|
27
|
+
5. Alt text MUST NOT exceed **125 characters**. Screen readers may truncate longer text.
|
|
28
|
+
|
|
29
|
+
6. Icon images used as interactive elements MUST have alt text describing the **action**, not the icon.
|
|
30
|
+
- GOOD: `"Search"`, `"Close menu"`, `"Open settings"`
|
|
31
|
+
- BAD: `"Magnifying glass icon"`, `"X icon"`
|
|
32
|
+
|
|
33
|
+
7. Do not begin alt text with "Image of" or "Photo of" -- the screen reader already announces it as an image.
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Language & Readability
|
|
38
|
+
|
|
39
|
+
1. Target a **grade 8-10 reading level** (Flesch-Kincaid) for general content.
|
|
40
|
+
|
|
41
|
+
2. Target **grade 6-8** for public-facing critical content: legal notices, safety information, error messages, onboarding flows.
|
|
42
|
+
|
|
43
|
+
3. Use plain language. Prefer common words over formal synonyms:
|
|
44
|
+
- "use" not "utilize"
|
|
45
|
+
- "start" not "commence"
|
|
46
|
+
- "help" not "facilitate"
|
|
47
|
+
- "buy" not "purchase"
|
|
48
|
+
- "end" not "terminate"
|
|
49
|
+
|
|
50
|
+
4. Define every acronym and abbreviation on first use: `"Content Management System (CMS)"`. After the first definition, use the acronym freely.
|
|
51
|
+
|
|
52
|
+
5. Do not use jargon unless the content targets a technical audience. Check `context.json > tone` to determine the audience. When `tone` is `"technical"`, domain-specific terms are acceptable without definitions.
|
|
53
|
+
|
|
54
|
+
6. Keep sentences short: **15-20 words average**. Break long sentences at natural clause boundaries.
|
|
55
|
+
|
|
56
|
+
7. Keep paragraphs short: **3-5 sentences maximum**. Use line breaks between paragraphs.
|
|
57
|
+
|
|
58
|
+
8. Use active voice. Passive voice is acceptable only when the actor is unknown or irrelevant.
|
|
59
|
+
- GOOD: `"The system saves your changes automatically."`
|
|
60
|
+
- BAD: `"Your changes are saved automatically by the system."`
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## Link Text
|
|
65
|
+
|
|
66
|
+
1. Link text MUST be descriptive and self-explanatory. It must make sense **out of context** because screen readers present links in an isolated list.
|
|
67
|
+
- GOOD: `"Download the 2024 Annual Report"`
|
|
68
|
+
- BAD: `"Click here"`
|
|
69
|
+
|
|
70
|
+
2. NEVER use these as standalone link text: `"click here"`, `"read more"`, `"learn more"`, `"here"`, `"link"`, `"this"`.
|
|
71
|
+
|
|
72
|
+
3. For file downloads, include the file type and size in the link text:
|
|
73
|
+
- `"Download the Q3 Budget (PDF, 2.4 MB)"`
|
|
74
|
+
|
|
75
|
+
4. Do not use the raw URL as link text unless the content is specifically listing URLs.
|
|
76
|
+
|
|
77
|
+
5. Keep link text concise -- describe the destination or action in 2-8 words.
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## Heading Semantics
|
|
82
|
+
|
|
83
|
+
1. Headings MUST describe the content of their section. Never use headings purely for visual styling (font size, bold).
|
|
84
|
+
|
|
85
|
+
2. Heading levels MUST reflect **document hierarchy**:
|
|
86
|
+
- `h2` for top-level sections within the page
|
|
87
|
+
- `h3` for subsections of an `h2`
|
|
88
|
+
- `h4` for subsections of an `h3`
|
|
89
|
+
- Never skip levels (e.g., `h2` directly to `h4`)
|
|
90
|
+
|
|
91
|
+
3. Every distinct content section SHOULD have a heading.
|
|
92
|
+
|
|
93
|
+
4. Headings MUST NOT be empty or contain only whitespace.
|
|
94
|
+
|
|
95
|
+
5. Do not duplicate heading text within the same page unless sections are genuinely distinct (e.g., "Overview" under two different parent headings is acceptable).
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## Content Structure
|
|
100
|
+
|
|
101
|
+
1. Use **semantic markup** appropriate to the content type:
|
|
102
|
+
- Unordered lists (`ul`) for items without sequence
|
|
103
|
+
- Ordered lists (`ol`) for steps or ranked items
|
|
104
|
+
- Headings for section titles
|
|
105
|
+
- Paragraphs for body text
|
|
106
|
+
- Blockquotes for quoted material
|
|
107
|
+
|
|
108
|
+
2. Tables MUST include a header row or header column. Keep table structure simple -- avoid merged cells and nested tables.
|
|
109
|
+
|
|
110
|
+
3. Provide a text alternative for every piece of non-text content (images, charts, embedded media).
|
|
111
|
+
|
|
112
|
+
4. Sequential content (steps, instructions, timelines) MUST follow logical reading order. Do not rely on CSS or layout to reorder content.
|
|
113
|
+
|
|
114
|
+
5. Lists MUST have at least two items. A single-item list should be rewritten as a paragraph or inline text.
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## Color & Visual References
|
|
119
|
+
|
|
120
|
+
1. NEVER use color alone to convey meaning.
|
|
121
|
+
- BAD: `"Required fields are highlighted in red."`
|
|
122
|
+
- GOOD: `"Required fields are marked with an asterisk (*)."`
|
|
123
|
+
|
|
124
|
+
2. Do not reference visual position in content text.
|
|
125
|
+
- BAD: `"Click the button on the right."`
|
|
126
|
+
- GOOD: `"Click the Submit button."`
|
|
127
|
+
|
|
128
|
+
3. Ensure all text content is meaningful without any visual context. Content must be understandable when read aloud or rendered in plain text.
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## Error Messages & Forms
|
|
133
|
+
|
|
134
|
+
1. Error messages MUST identify **which field** has the error.
|
|
135
|
+
|
|
136
|
+
2. Error messages MUST describe **what the error is** and how to fix it.
|
|
137
|
+
- GOOD: `"Enter a valid email address (e.g., name@example.com)."`
|
|
138
|
+
- BAD: `"Invalid input."`
|
|
139
|
+
|
|
140
|
+
3. Use **positive framing** -- tell the user what to do, not what they did wrong.
|
|
141
|
+
- GOOD: `"Enter a date in YYYY-MM-DD format."`
|
|
142
|
+
- BAD: `"Wrong date format."`
|
|
143
|
+
|
|
144
|
+
4. Group related form fields with descriptive labels. Every input field MUST have a label.
|
|
145
|
+
|
|
146
|
+
5. Do not use placeholder text as a substitute for labels.
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## Multimedia
|
|
151
|
+
|
|
152
|
+
1. Video content MUST reference a transcript -- either as inline content, a URL, or a relation to a document entry.
|
|
153
|
+
|
|
154
|
+
2. Audio content MUST have a text transcript available.
|
|
155
|
+
|
|
156
|
+
3. If content auto-plays, note this in metadata so the frontend can provide pause/stop controls. Auto-playing media with audio is strongly discouraged.
|
|
157
|
+
|
|
158
|
+
4. Time-based media (video, audio, animations) MUST include duration information when the model supports it.
|
|
159
|
+
|
|
160
|
+
5. Animated content (GIFs, auto-playing videos) should be flagged if longer than 5 seconds -- provide a mechanism to pause.
|
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: content-quality
|
|
3
|
+
description: "Detailed content writing rules: structure, tone, content type patterns, lifecycle"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Content Quality Rules
|
|
7
|
+
|
|
8
|
+
These rules govern how AI agents create and edit content in Contentrain projects.
|
|
9
|
+
Every rule is mandatory. Violations must be fixed before committing.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## 1. Writing Structure
|
|
14
|
+
|
|
15
|
+
### 1.1 Heading Hierarchy
|
|
16
|
+
|
|
17
|
+
- Use exactly ONE H1 per page. The H1 is the page/entry title.
|
|
18
|
+
- Follow sequential order: H1 -> H2 -> H3 -> H4 -> H5 -> H6.
|
|
19
|
+
- NEVER skip levels. An H4 must be preceded by an H3 in the same section.
|
|
20
|
+
- Do not use headings for visual styling. A heading implies a content section.
|
|
21
|
+
|
|
22
|
+
### 1.2 Titles
|
|
23
|
+
|
|
24
|
+
- Length: 50-60 characters. Measure before committing.
|
|
25
|
+
- Place the primary keyword within the first 30 characters.
|
|
26
|
+
- Use action-oriented phrasing: "Build a REST API" not "REST API Overview".
|
|
27
|
+
- No clickbait: "You Won't Believe..." is forbidden.
|
|
28
|
+
- No ALL CAPS titles. Use sentence case or title case per project convention.
|
|
29
|
+
- Every title must be unique within its collection.
|
|
30
|
+
|
|
31
|
+
### 1.3 Excerpts and Descriptions
|
|
32
|
+
|
|
33
|
+
- Length: 120-160 characters. Must be a complete sentence.
|
|
34
|
+
- Summarize the VALUE the reader gets, not the process of writing.
|
|
35
|
+
- GOOD: "Learn how to deploy a Node.js app to production in under 5 minutes."
|
|
36
|
+
- BAD: "This article discusses deployment."
|
|
37
|
+
- End with a period. No trailing ellipsis.
|
|
38
|
+
- Must differ from the title -- do not repeat the title verbatim.
|
|
39
|
+
|
|
40
|
+
### 1.4 Body Content
|
|
41
|
+
|
|
42
|
+
- Prefer active voice. Passive voice is acceptable only when the actor is unknown or irrelevant.
|
|
43
|
+
- Target reading grade 8-10 (Flesch-Kincaid). Avoid unnecessarily complex sentences.
|
|
44
|
+
- Paragraphs: 3-5 sentences each. Break longer paragraphs.
|
|
45
|
+
- Use transition sentences between sections to maintain flow.
|
|
46
|
+
- Front-load key information -- most important point first in each paragraph.
|
|
47
|
+
- One idea per paragraph. Do not combine unrelated points.
|
|
48
|
+
|
|
49
|
+
### 1.5 Lists
|
|
50
|
+
|
|
51
|
+
- Use parallel grammatical structure across all items.
|
|
52
|
+
- GOOD: "Install dependencies", "Configure the server", "Run the tests"
|
|
53
|
+
- BAD: "Install dependencies", "Server configuration", "You should run tests"
|
|
54
|
+
- Punctuation: if items are complete sentences, end each with a period. If fragments, no terminal punctuation. Be consistent within a single list.
|
|
55
|
+
- Ordered lists for sequential steps. Unordered lists for non-sequential items.
|
|
56
|
+
- Minimum 2 items in any list. A single-item list is not a list.
|
|
57
|
+
|
|
58
|
+
### 1.6 No Placeholder Text
|
|
59
|
+
|
|
60
|
+
Reject and replace any of the following immediately:
|
|
61
|
+
|
|
62
|
+
- "Lorem ipsum" or any Latin filler text
|
|
63
|
+
- "TODO", "TBD", "FIXME", "XXX" in content fields
|
|
64
|
+
- "[insert here]", "[your text]", "[placeholder]"
|
|
65
|
+
- "Sample text", "Example content", "Test entry"
|
|
66
|
+
- Empty strings in required fields
|
|
67
|
+
|
|
68
|
+
If the agent cannot produce real content, it must leave the entry in `draft` status and flag the field explicitly. Never commit placeholder text.
|
|
69
|
+
|
|
70
|
+
### 1.7 No Duplicate Content
|
|
71
|
+
|
|
72
|
+
- The same text block must not appear in multiple entries within a collection.
|
|
73
|
+
- Titles must be unique across all entries in the same collection.
|
|
74
|
+
- Descriptions/excerpts must be unique across all entries in the same collection.
|
|
75
|
+
- If content is shared across entries, extract it to a referenced entry and use a `relation` field.
|
|
76
|
+
- Before writing, query existing entries to confirm no duplication.
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## 2. Tone and Voice
|
|
81
|
+
|
|
82
|
+
### 2.1 Project Tone Configuration
|
|
83
|
+
|
|
84
|
+
- Read `.contentrain/context.json` -> `conventions.tone` before writing any content.
|
|
85
|
+
- If the field exists, match the specified tone exactly.
|
|
86
|
+
- If `context.json` does not exist or `conventions.tone` is absent, default to **neutral professional** tone.
|
|
87
|
+
- Never override or ignore the configured tone.
|
|
88
|
+
|
|
89
|
+
### 2.2 Vocabulary Compliance
|
|
90
|
+
|
|
91
|
+
- Read `.contentrain/vocabulary.json` before writing content.
|
|
92
|
+
- Use canonical terms exactly as defined. Never invent synonyms for canonical terms.
|
|
93
|
+
- If vocabulary defines "Sign up", do not write "Register", "Create account", or "Join".
|
|
94
|
+
- Respect `brand_terms`: use exact casing and spacing as defined.
|
|
95
|
+
- If brand defines "GitHub", never write "Github", "github", or "GH".
|
|
96
|
+
- Respect `forbidden_terms`: never use any term on this list.
|
|
97
|
+
- If `vocabulary.json` does not exist, proceed without term constraints but maintain internal consistency -- pick one term and use it everywhere.
|
|
98
|
+
|
|
99
|
+
### 2.3 Content Type Voice Mapping
|
|
100
|
+
|
|
101
|
+
Match voice to content type:
|
|
102
|
+
|
|
103
|
+
| Content Type | Voice | Characteristics |
|
|
104
|
+
|---|---|---|
|
|
105
|
+
| Marketing / Landing pages | Persuasive | Benefit-focused, confident, action-oriented, second person ("you") |
|
|
106
|
+
| Documentation / Guides | Instructional | Step-by-step, precise, imperative mood ("Run the command"), third person for concepts |
|
|
107
|
+
| Error messages | Empathetic | Solution-oriented, no blame, explain what happened and what to do next |
|
|
108
|
+
| UI labels | Concise | Consistent terminology, sentence case, no articles unless needed for clarity |
|
|
109
|
+
| Blog posts | Conversational-professional | Engaging, informative, first person plural ("we") acceptable |
|
|
110
|
+
| Changelogs | Factual | Past tense, specific, version-referenced, no marketing language |
|
|
111
|
+
|
|
112
|
+
### 2.4 Consistency Within an Entry
|
|
113
|
+
|
|
114
|
+
- Do not shift tone mid-entry. If the opening is formal, maintain formality throughout.
|
|
115
|
+
- Do not mix second person ("you") and third person ("the user") within the same entry.
|
|
116
|
+
- Maintain consistent use of contractions: either use them throughout or not at all per project tone.
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## 3. Content Type Patterns
|
|
121
|
+
|
|
122
|
+
### 3.1 Blog Post (document kind)
|
|
123
|
+
|
|
124
|
+
Required structure:
|
|
125
|
+
|
|
126
|
+
1. **Hook opening** (1-2 sentences): State the problem, ask a question, or present a surprising fact.
|
|
127
|
+
2. **Context** (1 paragraph): Why this topic matters now.
|
|
128
|
+
3. **Scannable body**: Use H2/H3 subheadings every 2-4 paragraphs. Each section is self-contained.
|
|
129
|
+
4. **Conclusion** (1 paragraph): Summarize key takeaways.
|
|
130
|
+
5. **Call-to-action**: Direct the reader to a next step (related post, product, signup).
|
|
131
|
+
|
|
132
|
+
Do not start with "In this article, we will discuss..." -- start with value.
|
|
133
|
+
|
|
134
|
+
### 3.2 Landing Page (singleton kind)
|
|
135
|
+
|
|
136
|
+
Required sections in order:
|
|
137
|
+
|
|
138
|
+
1. **Hero statement**: One sentence, max 10 words. State the core value proposition.
|
|
139
|
+
2. **Problem**: 2-3 sentences describing the pain point.
|
|
140
|
+
3. **Solution**: How the product/service solves it. Benefit-focused, not feature-focused.
|
|
141
|
+
4. **Features**: 3-6 features, each with a heading and 1-2 sentence description.
|
|
142
|
+
5. **Social proof**: Testimonials, logos, statistics. Must reference real data.
|
|
143
|
+
6. **CTA**: Clear, single action. Use action verbs: "Start free trial", "Get started", "Book a demo".
|
|
144
|
+
|
|
145
|
+
### 3.3 Documentation (document kind)
|
|
146
|
+
|
|
147
|
+
Required structure:
|
|
148
|
+
|
|
149
|
+
1. **Prerequisites callout**: List what the reader needs before starting (tools, accounts, knowledge).
|
|
150
|
+
2. **Overview** (1-2 sentences): What the reader will accomplish.
|
|
151
|
+
3. **Step-by-step instructions**: Numbered steps, one action per step, code blocks where applicable.
|
|
152
|
+
4. **Expected result**: What the reader should see/have after completing the steps.
|
|
153
|
+
5. **Troubleshooting**: Common errors and their solutions. Minimum 2 items.
|
|
154
|
+
|
|
155
|
+
Use imperative mood: "Run the command" not "You should run the command".
|
|
156
|
+
|
|
157
|
+
### 3.4 Error Messages (dictionary kind)
|
|
158
|
+
|
|
159
|
+
Structure each error message with three parts:
|
|
160
|
+
|
|
161
|
+
1. **What happened**: State the error clearly. "Your session has expired."
|
|
162
|
+
2. **Why**: Brief explanation. "Sessions expire after 30 minutes of inactivity."
|
|
163
|
+
3. **How to fix**: Actionable next step. "Sign in again to continue."
|
|
164
|
+
|
|
165
|
+
Rules:
|
|
166
|
+
- No blame language: "Invalid input" not "You entered invalid input".
|
|
167
|
+
- No technical jargon in user-facing errors.
|
|
168
|
+
- No naked error codes: always pair codes with human-readable text.
|
|
169
|
+
|
|
170
|
+
### 3.5 Form Labels (dictionary kind)
|
|
171
|
+
|
|
172
|
+
- Use noun or noun phrase: "Email address", "Password", "Company name".
|
|
173
|
+
- Sentence case consistently: "Email address" not "Email Address".
|
|
174
|
+
- No colons at the end of labels.
|
|
175
|
+
- Helper text: one sentence explaining what to enter or format requirements.
|
|
176
|
+
- Consistent phrasing across all forms in the project.
|
|
177
|
+
|
|
178
|
+
### 3.6 Navigation Items (dictionary kind)
|
|
179
|
+
|
|
180
|
+
- 1-2 words maximum.
|
|
181
|
+
- Use verbs for actions: "Sign in", "Download", "Contact".
|
|
182
|
+
- Use nouns for destinations: "Dashboard", "Settings", "Pricing".
|
|
183
|
+
- No abbreviations unless universally understood.
|
|
184
|
+
- Consistent capitalization: match the project convention.
|
|
185
|
+
|
|
186
|
+
### 3.7 Notifications (dictionary kind)
|
|
187
|
+
|
|
188
|
+
- Start with what happened: "Your file has been uploaded."
|
|
189
|
+
- Include timestamp context when relevant: "2 minutes ago".
|
|
190
|
+
- End with next action if applicable: "View file" or "Dismiss".
|
|
191
|
+
- Keep under 100 characters for mobile readability.
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
## 4. Content Lifecycle
|
|
196
|
+
|
|
197
|
+
### 4.1 Draft Status
|
|
198
|
+
|
|
199
|
+
- Focus on completeness over polish.
|
|
200
|
+
- ALL required fields must have real values -- no placeholders.
|
|
201
|
+
- Optional fields may be empty but should be populated when possible.
|
|
202
|
+
- Drafts do not need final copy-editing but must be factually correct.
|
|
203
|
+
- Flag any fields the agent could not confidently populate.
|
|
204
|
+
|
|
205
|
+
### 4.2 Review Status
|
|
206
|
+
|
|
207
|
+
- Vocabulary compliance: every term matches `vocabulary.json`.
|
|
208
|
+
- Tone consistency: matches `context.json` -> `conventions.tone` throughout.
|
|
209
|
+
- Factual accuracy: all claims, statistics, and references are verifiable.
|
|
210
|
+
- Cross-locale coverage: if entry exists in source locale, all target locales must have corresponding entries.
|
|
211
|
+
- Field constraint compliance: all values within min/max length, pattern, and type constraints.
|
|
212
|
+
|
|
213
|
+
### 4.3 Published Status
|
|
214
|
+
|
|
215
|
+
ALL of the following must be true:
|
|
216
|
+
|
|
217
|
+
- Every required field is populated with final content.
|
|
218
|
+
- Every supported locale has a complete translation.
|
|
219
|
+
- Zero placeholder text anywhere in the entry.
|
|
220
|
+
- All relation fields reference existing, published entries.
|
|
221
|
+
- SEO fields (title, description, slug) are populated and valid.
|
|
222
|
+
- Content passes tone and vocabulary checks.
|
|
223
|
+
|
|
224
|
+
### 4.4 Archive Criteria
|
|
225
|
+
|
|
226
|
+
Move content to archived status when:
|
|
227
|
+
|
|
228
|
+
- It references deprecated features, APIs, or products.
|
|
229
|
+
- Dates or events referenced are more than 12 months past.
|
|
230
|
+
- The content has been superseded by a newer entry.
|
|
231
|
+
- Statistics or data points are outdated and cannot be updated.
|
|
232
|
+
|
|
233
|
+
Never delete content. Archive it. Deletion is a manual human decision.
|
|
234
|
+
|
|
235
|
+
---
|
|
236
|
+
|
|
237
|
+
## 5. Contentrain-Specific Rules
|
|
238
|
+
|
|
239
|
+
### 5.1 System-Managed Fields
|
|
240
|
+
|
|
241
|
+
NEVER write to these fields -- they are managed by the system:
|
|
242
|
+
|
|
243
|
+
- `id` -- auto-generated unique identifier
|
|
244
|
+
- `createdAt` -- set on creation
|
|
245
|
+
- `updatedAt` -- set on every save
|
|
246
|
+
- `status` -- managed through workflow transitions
|
|
247
|
+
- `order` -- managed through UI reordering
|
|
248
|
+
|
|
249
|
+
If a write payload includes any system field, remove it before saving.
|
|
250
|
+
|
|
251
|
+
### 5.2 Metadata Directory
|
|
252
|
+
|
|
253
|
+
- NEVER write to `.contentrain/meta/` -- all metadata files are system-managed.
|
|
254
|
+
- NEVER modify `.contentrain/models/` directly -- use MCP tools.
|
|
255
|
+
- Read these directories for context, but treat them as read-only.
|
|
256
|
+
|
|
257
|
+
### 5.3 Vocabulary Usage
|
|
258
|
+
|
|
259
|
+
- Load `vocabulary.json` at the start of every content operation.
|
|
260
|
+
- Cross-reference every noun, verb, and technical term against the vocabulary.
|
|
261
|
+
- If a term is not in the vocabulary but should be, flag it for human review -- do not add it.
|
|
262
|
+
- Vocabulary applies across ALL entries, ALL collections, ALL locales.
|
|
263
|
+
|
|
264
|
+
### 5.4 Model Field Constraints
|
|
265
|
+
|
|
266
|
+
Before writing any field value:
|
|
267
|
+
|
|
268
|
+
1. Read the model definition from `.contentrain/models/`.
|
|
269
|
+
2. Check `required` -- required fields must have non-empty values.
|
|
270
|
+
3. Check `min` / `max` -- string length must be within bounds.
|
|
271
|
+
4. Check `pattern` -- value must match regex if defined.
|
|
272
|
+
5. Check `unique` -- value must not duplicate any existing entry in the collection.
|
|
273
|
+
6. Check `options` -- if the field is an enum/select, value must be from the defined list.
|
|
274
|
+
|
|
275
|
+
Constraint violations must be fixed before saving. Never save invalid data.
|
|
276
|
+
|
|
277
|
+
### 5.5 Collection Entry Consistency
|
|
278
|
+
|
|
279
|
+
- All entries within a collection must follow the same structural pattern.
|
|
280
|
+
- If existing entries use a specific content structure (e.g., all blog posts start with a hook), new entries must follow the same pattern.
|
|
281
|
+
- Before creating a new entry, read 2-3 existing entries to understand the established pattern.
|
|
282
|
+
- If no existing entries exist, follow the content type pattern defined in Section 3.
|
|
283
|
+
|
|
284
|
+
---
|
|
285
|
+
|
|
286
|
+
## Validation Checklist
|
|
287
|
+
|
|
288
|
+
Before committing any content, verify:
|
|
289
|
+
|
|
290
|
+
- [ ] Heading hierarchy is sequential (H1 -> H2 -> H3, no skips)
|
|
291
|
+
- [ ] Title is 50-60 characters, keyword-rich, unique
|
|
292
|
+
- [ ] Description is 120-160 characters, complete sentence, unique
|
|
293
|
+
- [ ] No placeholder text anywhere
|
|
294
|
+
- [ ] No duplicate content across entries
|
|
295
|
+
- [ ] Tone matches `context.json` configuration
|
|
296
|
+
- [ ] All terms match `vocabulary.json`
|
|
297
|
+
- [ ] All field constraints (length, pattern, required) are satisfied
|
|
298
|
+
- [ ] Content follows the correct content type pattern
|
|
299
|
+
- [ ] System fields are not included in write payload
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: media
|
|
3
|
+
description: "Media asset rules: image optimization, video handling, file naming conventions"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Media Rules
|
|
7
|
+
|
|
8
|
+
These rules are MANDATORY for all AI agents creating or editing content in Contentrain projects.
|
|
9
|
+
Follow these guidelines when populating image, video, or file fields in any content model.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Image Dimensions (Recommended)
|
|
14
|
+
|
|
15
|
+
1. Use these standard dimensions unless the project's `context.json` specifies overrides:
|
|
16
|
+
|
|
17
|
+
| Purpose | Width | Height | Aspect Ratio |
|
|
18
|
+
|---|---|---|---|
|
|
19
|
+
| Hero / Banner | 1200px | 630px | ~1.91:1 |
|
|
20
|
+
| Thumbnail / Card | 400px | 300px | 4:3 |
|
|
21
|
+
| Avatar / Profile | 200px | 200px | 1:1 (square) |
|
|
22
|
+
| Icon | 64px or 128px | 64px or 128px | 1:1 (square) |
|
|
23
|
+
| Full-width content | 1200px | proportional | varies |
|
|
24
|
+
| Social share (og:image) | 1200px | 630px | 1.91:1 |
|
|
25
|
+
|
|
26
|
+
2. Hero/banner dimensions (1200x630) double as optimal `og:image` dimensions for social sharing.
|
|
27
|
+
|
|
28
|
+
3. All images MUST be usable at mobile widths. Minimum renderable width: **320px**. Do not provide images narrower than this.
|
|
29
|
+
|
|
30
|
+
4. When a model defines `width` and `height` fields alongside an image field, populate them with the actual image dimensions to prevent layout shift.
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## File Formats
|
|
35
|
+
|
|
36
|
+
1. **WebP** is the preferred format for all web images. Use it as the default unless a specific reason requires another format.
|
|
37
|
+
|
|
38
|
+
2. **PNG**: use only when transparency is required and SVG is not suitable.
|
|
39
|
+
|
|
40
|
+
3. **JPEG/JPG**: acceptable for photographs when WebP is not available. Use quality 75-85 for a good compression/quality balance.
|
|
41
|
+
|
|
42
|
+
4. **SVG**: REQUIRED for logos, icons, and any vector graphics. Do not rasterize vector content.
|
|
43
|
+
|
|
44
|
+
5. **AVIF**: acceptable as a progressive enhancement for browsers that support it. Always provide a WebP or JPEG fallback.
|
|
45
|
+
|
|
46
|
+
6. **GIF**: do NOT use for animations. Use MP4 video instead for better compression and performance. Static GIFs are acceptable but WebP is preferred.
|
|
47
|
+
|
|
48
|
+
7. **Never use** these formats for web content: BMP, TIFF, RAW, PSD, AI, EPS. Convert to a web-safe format before storing.
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## File Size Limits
|
|
53
|
+
|
|
54
|
+
1. Enforce these maximum file sizes:
|
|
55
|
+
|
|
56
|
+
| Asset Type | Max Size |
|
|
57
|
+
|---|---|
|
|
58
|
+
| Hero / Banner image | 200 KB |
|
|
59
|
+
| Thumbnail | 50 KB |
|
|
60
|
+
| Avatar / Icon | 30 KB |
|
|
61
|
+
| Content image | 150 KB |
|
|
62
|
+
| SVG file | 50 KB |
|
|
63
|
+
| Video poster image | 100 KB |
|
|
64
|
+
|
|
65
|
+
2. **Total images per page**: aim for under **1 MB combined**. Flag content entries that reference more than 1 MB of images.
|
|
66
|
+
|
|
67
|
+
3. If an image exceeds the size limit, instruct the user to compress or resize it before storing. Do not silently accept oversized files.
|
|
68
|
+
|
|
69
|
+
4. SVG files SHOULD be optimized (e.g., with SVGO) to remove editor metadata, comments, and unnecessary attributes.
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## File Naming Convention
|
|
74
|
+
|
|
75
|
+
1. Use **kebab-case** for all media file names: lowercase, words separated by hyphens.
|
|
76
|
+
|
|
77
|
+
2. File names MUST be **descriptive** — include context and subject:
|
|
78
|
+
- GOOD: `homepage-hero-banner.webp`, `blog-author-jane-doe.jpg`, `product-dashboard-preview.webp`
|
|
79
|
+
- BAD: `IMG_4523.jpg`, `photo1.png`, `untitled.webp`, `Screenshot 2024-01-15.png`, `image.jpg`
|
|
80
|
+
|
|
81
|
+
3. When providing multiple sizes of the same image, include dimensions in the filename:
|
|
82
|
+
- `hero-1200x630.webp`, `hero-600x315.webp`
|
|
83
|
+
- Or use size suffixes: `hero-lg.webp`, `hero-md.webp`, `hero-sm.webp`
|
|
84
|
+
|
|
85
|
+
4. Allowed characters in file names: lowercase letters (`a-z`), digits (`0-9`), hyphens (`-`), and a single dot before the extension. No spaces, underscores, or special characters.
|
|
86
|
+
|
|
87
|
+
5. File extensions MUST be lowercase: `.webp` not `.WebP`, `.jpg` not `.JPG`.
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## Alt Text Pairing
|
|
92
|
+
|
|
93
|
+
1. Every content model with an `image` field SHOULD define a companion `image_alt` field (type: `string`). If the model does not have one, request that it be added.
|
|
94
|
+
|
|
95
|
+
2. When both `image` and `image_alt` fields exist, ALWAYS populate both. Never leave `image_alt` empty unless the image is decorative (set to `""`).
|
|
96
|
+
|
|
97
|
+
3. If no dedicated alt text field exists, include alt text guidance in the image field's `description` metadata so future content editors know to provide it.
|
|
98
|
+
|
|
99
|
+
4. In document/markdown models, always use the full image syntax with alt text: ``. Never use ``.
|
|
100
|
+
|
|
101
|
+
5. See `accessibility-rules.md` for detailed alt text writing guidelines.
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## Video Guidelines
|
|
106
|
+
|
|
107
|
+
1. **Format**: MP4 with H.264 codec for maximum browser compatibility. WebM (VP9) is acceptable as a secondary format.
|
|
108
|
+
|
|
109
|
+
2. Every video MUST have a **poster/thumbnail image**. If the model has a `poster` or `thumbnail` field, populate it. The poster image follows the same format and size rules as other images.
|
|
110
|
+
|
|
111
|
+
3. If the model defines a `duration` field, populate it in seconds (integer). This helps the frontend display duration badges and improves accessibility.
|
|
112
|
+
|
|
113
|
+
4. Every video MUST reference a transcript or caption:
|
|
114
|
+
- A `transcript_url` field pointing to a text/VTT file
|
|
115
|
+
- A relation to a document entry containing the transcript
|
|
116
|
+
- Or inline transcript in an adjacent richtext/markdown field
|
|
117
|
+
|
|
118
|
+
5. **Max file size** for self-hosted embedded video: **50 MB**. For larger videos, use external hosting.
|
|
119
|
+
|
|
120
|
+
6. Prefer **external hosting** (YouTube, Vimeo, or CDN) for videos over 50 MB. Store the external URL in a `url` type field, not the video binary.
|
|
121
|
+
|
|
122
|
+
7. Do not auto-play videos with audio. If the model has an `autoplay` field, set it to `false` by default.
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## Asset Organization
|
|
127
|
+
|
|
128
|
+
1. All media MUST be stored under the path defined in `config.json > assets_path`. The default is `.contentrain/assets/`.
|
|
129
|
+
|
|
130
|
+
2. Organize assets using ONE of these conventions per project (check existing structure first):
|
|
131
|
+
|
|
132
|
+
**By domain:**
|
|
133
|
+
```
|
|
134
|
+
assets/blog/
|
|
135
|
+
assets/team/
|
|
136
|
+
assets/products/
|
|
137
|
+
assets/marketing/
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
**By type:**
|
|
141
|
+
```
|
|
142
|
+
assets/images/
|
|
143
|
+
assets/videos/
|
|
144
|
+
assets/documents/
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
3. Check the existing asset directory structure before adding new files. Follow the established convention. Do not mix conventions within a project.
|
|
148
|
+
|
|
149
|
+
4. Reference all media with **relative paths from the project root**:
|
|
150
|
+
- GOOD: `.contentrain/assets/blog/post-hero.webp`
|
|
151
|
+
- BAD: `/Users/jane/project/.contentrain/assets/blog/post-hero.webp`
|
|
152
|
+
|
|
153
|
+
5. Do not create deeply nested directories (max 3 levels under `assets/`). Deep nesting makes paths fragile and hard to manage.
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
## Responsive Images
|
|
158
|
+
|
|
159
|
+
1. When the content model supports multiple image sizes, provide variants for:
|
|
160
|
+
- **Small** (mobile): 320-768px wide
|
|
161
|
+
- **Medium** (tablet): 768-1024px wide
|
|
162
|
+
- **Large** (desktop): 1024px+ wide
|
|
163
|
+
|
|
164
|
+
2. Use descriptive size suffixes in filenames: `-sm`, `-md`, `-lg` or explicit dimensions (`-400w`, `-800w`, `-1200w`).
|
|
165
|
+
|
|
166
|
+
3. Always provide at least the **largest size**. Smaller sizes are recommended but optional — CDN or image optimization services can generate them from the original.
|
|
167
|
+
|
|
168
|
+
4. If the model has a single `image` field (no responsive variants), provide the largest recommended size. The frontend is responsible for responsive rendering.
|
|
169
|
+
|
|
170
|
+
5. Store the original/largest image. Never store only a downscaled version — you lose the ability to generate other sizes later.
|