Files
my-vault/.claude/commands/add-frontmatter.md
T

201 lines
3.6 KiB
Markdown
Raw Normal View History

2025-09-13 12:20:50 -04:00
---
2025-09-15 08:49:07 -04:00
description:
Add or update YAML frontmatter properties to enhance note organization
2025-09-13 12:20:50 -04:00
argument-hint: [file or folder path]
allowed-tools: Read, Write, Edit, Glob
---
2025-09-15 08:49:07 -04:00
You will analyze Obsidian notes and add intelligent YAML frontmatter properties
to enhance organization and discoverability.
2025-09-13 12:20:50 -04:00
## Input
2025-09-15 08:49:07 -04:00
2025-09-13 12:20:50 -04:00
- Path: ${1} (file or folder to process)
- Current date: !`date +%Y-%m-%d`
## Your Task
### Step 1: Identify Notes to Process
2025-09-15 08:49:07 -04:00
2025-09-13 12:20:50 -04:00
```bash
# If single file
Read the specified file
# If folder
Find all .md files in folder
```
### Step 2: Analyze Note Content
For each note, examine:
2025-09-15 08:49:07 -04:00
2025-09-13 12:20:50 -04:00
- Main topics and themes
- Note type (meeting, daily, reference, project)
- Key entities (people, projects, dates)
- Existing properties (preserve valid ones)
- Title quality (add/improve if needed)
### Step 3: Generate Appropriate Properties
#### Standard Properties by Note Type
**Meeting Notes:**
2025-09-15 08:49:07 -04:00
2025-09-13 12:20:50 -04:00
```yaml
---
title: [Descriptive meeting title]
date: YYYY-MM-DD
type: meeting
2025-09-15 08:49:07 -04:00
attendees: ['Person 1', 'Person 2']
2025-09-13 12:20:50 -04:00
project: Project Name
tags: [meeting, project-name]
2025-09-15 08:49:07 -04:00
action_items:
- 'Action item 1'
- 'Action item 2'
2025-09-13 12:20:50 -04:00
status: complete
---
```
**Daily Notes:**
2025-09-15 08:49:07 -04:00
2025-09-13 12:20:50 -04:00
```yaml
---
title: Daily Note - YYYY-MM-DD
date: YYYY-MM-DD
type: daily-note
tags: [daily]
highlights:
2025-09-15 08:49:07 -04:00
- 'Key event or thought'
2025-09-13 12:20:50 -04:00
mood: productive
---
```
**Reference/Article Notes:**
2025-09-15 08:49:07 -04:00
2025-09-13 12:20:50 -04:00
```yaml
---
title: [Article or concept title]
type: reference
source: "[[Source Note]]" or URL
author: Author Name
date_saved: YYYY-MM-DD
tags: [topic1, topic2]
key_concepts: [concept1, concept2]
---
```
**Project Notes:**
2025-09-15 08:49:07 -04:00
2025-09-13 12:20:50 -04:00
```yaml
---
title: [Project Name - Component]
type: project
status: in-progress
deadline: YYYY-MM-DD
2025-09-15 08:49:07 -04:00
stakeholders: ['Person 1', 'Team 2']
2025-09-13 12:20:50 -04:00
tags: [project, area]
priority: high
---
```
### Step 4: Apply Properties
For each note:
2025-09-15 08:49:07 -04:00
2025-09-13 12:20:50 -04:00
1. Check for existing frontmatter
2. Merge new properties (don't duplicate)
3. Fix any deprecated formats:
- `tag``tags`
- `alias``aliases`
- `cssclass``cssclasses`
4. Ensure valid YAML syntax
### Step 5: Update File
```yaml
# Format:
---
property: value
2025-09-15 08:49:07 -04:00
list_property: ['item1', 'item2']
2025-09-13 12:20:50 -04:00
date_property: YYYY-MM-DD
2025-09-15 08:49:07 -04:00
linked_property: '[[Note Name]]'
2025-09-13 12:20:50 -04:00
---
[Original content]
```
## Property Guidelines
### Naming Conventions
2025-09-15 08:49:07 -04:00
2025-09-13 12:20:50 -04:00
- Use lowercase with underscores: `date_created`, `action_items`
- Be consistent with existing vault patterns
- Prefer clear over clever names
### Value Types
2025-09-15 08:49:07 -04:00
2025-09-13 12:20:50 -04:00
- **Text**: Simple strings, use quotes for links
- **List**: Arrays for multiple values
- **Date**: ISO format (YYYY-MM-DD)
- **Number**: For counts, ratings, priorities
- **Checkbox**: For boolean states
### Quality Checks
2025-09-15 08:49:07 -04:00
2025-09-13 12:20:50 -04:00
- ✅ Valid YAML syntax
- ✅ No duplicate properties
- ✅ Appropriate property types
- ✅ Quoted internal links
- ✅ Meaningful values (not empty)
## Special Cases
### Untitled Notes
2025-09-15 08:49:07 -04:00
2025-09-13 12:20:50 -04:00
Generate title from:
2025-09-15 08:49:07 -04:00
2025-09-13 12:20:50 -04:00
1. First heading if exists
2. First paragraph summary
3. Main topic/concept discussed
### Bulk Processing
2025-09-15 08:49:07 -04:00
2025-09-13 12:20:50 -04:00
When processing folders:
2025-09-15 08:49:07 -04:00
2025-09-13 12:20:50 -04:00
- Maintain consistency across similar notes
- Use same property names for same concepts
- Report summary of changes made
### Existing Properties
2025-09-15 08:49:07 -04:00
2025-09-13 12:20:50 -04:00
- Preserve valid existing properties
- Update deprecated formats
- Merge new properties carefully
- Never delete without reason
## Examples
### Before:
2025-09-15 08:49:07 -04:00
2025-09-13 12:20:50 -04:00
```markdown
Had a great meeting with the team about Q1 planning...
```
### After:
2025-09-15 08:49:07 -04:00
2025-09-13 12:20:50 -04:00
```markdown
---
title: Q1 Planning Team Meeting
date: 2025-09-02
type: meeting
2025-09-15 08:49:07 -04:00
attendees: ['Team']
2025-09-13 12:20:50 -04:00
project: Q1 Planning
tags: [meeting, planning, q1-2025]
status: complete
---
Had a great meeting with the team about Q1 planning...
```
2025-09-15 08:49:07 -04:00
Remember: Properties should enhance organization, not clutter. Only add what
provides value for finding and connecting notes.