| name | add-content |
| description | Create new files in knowledge base with directory governance. Use when user wants to save, create, or add content. Reads RULE.md to understand directory purpose and follows specified rules. Recommends target directory based on content analysis. |
Add Content Skill
Generic file creation Skill that works with any directory structure by reading RULE.md to understand purpose and rules.
When to use this Skill
- User says "save", "create", "add", "note", "記錄", "筆記"
- User provides content to store
- User provides URLs to archive
- User mentions "readlater", "bookmark", "save article"
- User requests content preservation
Workflow
1. Content Analysis
Determine content type:
- URL: Web content to archive
- Text: Note or article
- Code: Code snippet
- Structured data: JSON, YAML, etc.
- Mixed: Multiple content types
Extract key information:
- Main topics and themes
- Keywords and technical terms
- Content category (technical, personal, work, etc.)
- Content length and complexity
2. Directory Discovery
Scan knowledge base:
- Identify root directory (current working directory or user-specified)
- List main directories using
lsor Glob - Read RULE.md from each main directory
- Build directory catalog with purposes
Example scan result:
ReadLater/ - Purpose: "Archive web content for later reading"
Research/ - Purpose: "Technical and academic research notes"
Work/ - Purpose: "Professional work-related content"
Personal/ - Purpose: "Personal life documentation"
Miscellaneous/ - Purpose: "General notes and articles"
3. Smart Classification
Match content to directories:
- Analyze content topics vs directory purposes
- Check if content type matches directory specialization
- Consider user's past behavior (if known)
- Rank directories by suitability (0-100 score)
Classification logic:
- URL + directory purpose mentions "web archival" → high score
- Technical content + directory purpose mentions "research" → high score
- Work keywords + directory purpose mentions "professional" → high score
- Default to "Miscellaneous" or similar general-purpose directory
4. User Confirmation
Present recommendation:
I analyzed your content about [topic].
Recommended location: [Directory]/
Reason: [Why this directory suits the content]
Is this correct?
- Yes (proceed with this directory)
- No, use different directory (please specify path)
- Show me other options
If user requests alternatives:
- Show top 3 ranked directories with scores and reasons
- Allow user to choose or specify custom path
If user specifies custom path:
- Validate path exists or create if requested
- Continue with specified path
5. Read Target RULE.md
Locate and read RULE.md:
- Check target directory for RULE.md
- If not found, check parent directories (inheritance)
- If no RULE.md found, ask user if should create one
Parse RULE.md for:
- File naming conventions (e.g.,
YYYY-MM-DD-title.md) - Required file structure (e.g., directories, metadata files)
- Frontmatter requirements (if any)
- Special instructions (e.g., "fetch from URL", "generate summary")
- Business logic workflows (e.g., web archival process)
- Format examples
6. Execute Operation Per RULE.md
Follow RULE.md instructions exactly:
Example 1 - Simple Note:
RULE.md says: "Files named YYYY-MM-DD-title.md with markdown format"
→ Generate filename: 2025-10-28-transformer-architecture.md
→ Create file with content
→ Save in target directory
Example 2 - Web Archival:
RULE.md says:
"When user provides URL:
1. Fetch content using WebFetch
2. Convert to markdown
3. Create directory: Articles/YYYY/MM/YYYY-MM-DD_title-slug/
4. Save article.md and metadata.yaml"
→ Execute WebFetch on URL
→ Extract title, content, date
→ Convert to clean markdown
→ Create directory structure
→ Save article.md with content
→ Create metadata.yaml with:
- url: [original URL]
- title: [article title]
- date: [fetch date]
- summary: [brief summary]
→ Optionally save images if referenced
Example 3 - Structured Content (WorkLog):
RULE.md says:
"Daily logs in YYYY/QX/MM-Month/ structure.
MUST verify datetime first.
Format: [specific template shown in RULE.md]"
→ Execute `date` command to verify current date
→ Parse date: 2025-10-28 → 2025/Q4/10-October/
→ Check if directory structure exists, create if needed
→ Read RULE.md template section
→ Create/update 2025-10-28.md with template format
→ Fill in sections per RULE.md specifications
Key principles:
- Execute special instructions literally (e.g., "fetch from URL")
- Follow naming conventions exactly
- Create directories as specified
- Include required metadata/frontmatter
- Apply format examples shown in RULE.md
7. Governance Update
Update README.md:
- Read current README.md in target directory
- Find appropriate section (Files, Subdirectories, etc.)
- Add new entry with:
- Filename with link
- Brief description (from content analysis or user input)
- Timestamp: current date
- Update "Recent Changes" section
- Update "Last updated" timestamp
- Save README.md
Update parent README.md if needed:
- If created new subdirectory, update parent's README.md
- Add entry for new subdirectory with description
Verify updates:
- Check README.md is valid markdown
- Ensure no duplicate entries
- Confirm timestamps are current
8. Report to User
Confirm operation complete:
✅ Content created successfully
Location: [full path to file]
Format: [file format used]
Governance: [which RULE.md applied]
README.md updated:
- [target directory]/README.md
- [parent directory]/README.md (if applicable)
Summary:
[Brief summary of what was created and where]
Special Cases
URL Content Archival
When content is URL and RULE.md specifies archival:
Validate URL:
- Check URL format is valid
- Optionally test if URL is accessible
Check for Duplicates:
- Search existing README.md for this URL
- If found: warn user, ask if should re-archive
Fetch Content:
- Use WebFetch tool with prompt: "Extract the main article content, title, and publication date"
- Handle fetch errors gracefully
Process Content:
- Convert HTML to clean markdown
- Extract images if RULE.md requests
- Generate title slug for directory name
- Create brief summary (2-3 sentences)
Save Per RULE.md:
- Follow directory structure exactly
- Create all specified files
- Include all required metadata
Structured Content with Frontmatter
If RULE.md requires YAML frontmatter:
---
title: [Title]
date: [Date]
tags: [tag1, tag2]
category: [Category]
---
[Content here]
Generate frontmatter with:
- Required fields per RULE.md
- Inferred values from content analysis
- User-provided metadata if available
Multiple Files
If RULE.md specifies creating multiple files:
- Create all files in specified order
- Ensure cross-references are correct
- Update README.md to list all created files
- Report all files created
Custom Business Logic in RULE.md
Parse RULE.md for custom instructions:
Pattern detection:
- "When user provides URL..." → URL handling logic
- "When user mentions [keyword]..." → Keyword-triggered workflow
- "MUST verify [condition]" → Mandatory pre-check
- "After creation, [action]" → Post-creation hook
Execute custom logic:
- Follow instructions step-by-step
- Use specified tools (WebFetch, Bash, etc.)
- Maintain specified format
- Report custom workflow execution
Error Handling
No Suitable Directory Found
- Ask user: "I couldn't find a suitable directory. Please specify where to save this content, or I can help you create a new directory."
- Offer to create new directory with RULE.md
RULE.md Missing
- Check parent directories for inheritance
- If no RULE.md in tree: ask user if should create one
- Fallback: use basic file creation with sensible defaults
Ambiguous Classification
- Present multiple options with scores
- Explain reasoning for each
- Let user choose or specify custom path
RULE.md Instructions Unclear
- Ask user for clarification
- Offer to interpret instructions and ask for confirmation
- Document unclear instructions for future improvement
File Already Exists
- Check if filename conflicts with existing file
- Offer to: append timestamp, rename, overwrite, or choose different name
- Never overwrite without confirmation
Operation Fails
- Report error clearly
- Explain what went wrong
- Suggest alternatives or fixes
- Don't leave partial state (clean up if needed)
Integration with Governance
This Skill automatically invokes the governance protocol:
Before operation:
- Locate and read RULE.md
- Validate operation is allowed
- Check README.md for context
During operation:
- Follow RULE.md specifications
- Execute any special workflows
After operation:
- Update README.md
- Update parent README.md if needed
- Verify updates successful
Examples
Example 1: Simple Note
User: "Save this note: Today I learned about transformer architecture in deep learning"
Skill workflow:
- Analyzes content → Technical/AI topic
- Scans directories → Finds Research/AI/, Research/DeepLearning/, Miscellaneous/
- Reads RULE.md files → Research/AI/ purpose: "AI and machine learning research"
- Recommends Research/AI/ (score: 95)
- User confirms
- Reads Research/AI/RULE.md → Files named
YYYY-MM-DD-topic.md - Creates
2025-10-28-transformer-architecture.md - Updates Research/AI/README.md
- Reports success with file location
Example 2: Web Archival
User: "readlater https://example.com/interesting-article"
Skill workflow:
- Detects URL
- Scans directories → Finds ReadLater/
- Reads ReadLater/RULE.md → Purpose: "Archive web content"
- Instructions: "Fetch URL, convert to markdown, save in Articles/YYYY/MM/"
- Recommends ReadLater/ (score: 100, exact match)
- User confirms (or auto-confirm for obvious match)
- Executes RULE.md instructions:
- WebFetch URL
- Extracts title: "Interesting Article About AI"
- Converts to markdown
- Creates
ReadLater/Articles/2025/10/2025-10-28_interesting-article-about-ai/ - Saves article.md and metadata.yaml
- Updates ReadLater/README.md and ReadLater/Articles/2025/10/README.md
- Reports success with summary
Example 3: WorkLog Entry
User: "Update my worklog"
Skill workflow:
- Detects worklog keyword
- Scans directories → Finds Work/WorkLog/
- Reads Work/WorkLog/RULE.md:
- Purpose: "Daily work logs"
- Structure: YYYY/QX/MM-Month/
- MUST verify datetime first
- Format: [specific template]
- Recommends Work/WorkLog/ (score: 100)
- User confirms
- Executes RULE.md instructions:
- Runs
date→ 2025-10-28 - Parses to 2025/Q4/10-October/
- Checks if directory exists, creates if needed
- Checks if 2025-10-28.md exists
- Creates/updates file with template from RULE.md
- Runs
- Updates hierarchical README.md files:
- Work/WorkLog/2025/Q4/10-October/README.md
- Work/WorkLog/2025/Q4/README.md
- Work/WorkLog/README.md
- Reports success with daily log location
Best Practices
- Always read RULE.md completely - Don't assume, read the full file
- Ask for confirmation on ambiguous choices - User knows their needs
- Follow RULE.md exactly - It's the contract for directory behavior
- Update README.md immediately - Don't batch updates
- Report clearly - User should know exactly what happened
- Handle errors gracefully - Don't leave broken state
- Preserve existing structure - Don't modify unrelated files
- Document custom workflows - If RULE.md has special instructions, note them
Notes
- This Skill is generic - it works with ANY directory structure
- Business logic comes from RULE.md, not hardcoded in Skill
- Classification is smart but always asks for user confirmation
- RULE.md format is natural language - no strict schema required
- Integration with governance agent is automatic
- Works in parallel with CLAUDE.md subagents independently