Examples
Real-world examples of YAML Toolkit for Obsidian rules using the universal FOR pattern.
Note: Examples show Condition → Action format. Enter these in separate fields in the plugin.
Content Management
Mark Drafts for Review
Input:
---
title: My Note
status: draft
tags: [project, active]
---Condition: status = "draft" AND HAS tags
Action (Rule 1): SET status "ready-for-review"
Action (Rule 2): SET reviewed_date "2025-11-24T21:45:00"
Output (after both rules):
---
title: My Note
status: ready-for-review
tags: [project, active]
reviewed_date: 2025-11-24T21:45:00
---Multiple Fields
To set multiple top-level fields, create two separate rules with the same condition.
Archive Old Notes
Input:
---
title: Old Project
created_date: 2023-06-15
tags: [notes, project]
---Condition: created_date < "2024-01-01" AND NOT tags contains "keep"
Action: FOR tags APPEND "archived"
Output:
---
title: Old Project
created_date: 2023-06-15
tags: [notes, project, archived]
---Tagging Operations
Add Tag to Untagged Notes
Input:
---
title: Untagged Note
status: active
---Condition: NOT HAS tags
Action: SET tags ["untagged"]
Output:
---
title: Untagged Note
status: active
tags: [untagged]
---Tag Migration
Input:
---
title: Project Note
tags: [old-tag, project, active]
---Condition: tags contains "old-tag"
Action: FOR tags WHERE $ = "old-tag" REMOVE, FOR tags ADD "new-tag"
Output:
---
title: Project Note
tags: [project, active, new-tag]
---Clean Up Multiple Deprecated Tags
Input:
---
title: Legacy Note
tags: [draft, wip, temp, project, active]
---Condition: HAS tags
Action: FOR tags REMOVE_ALL ["draft", "wip", "temp"]
Output:
---
title: Legacy Note
tags: [project, active]
---Metadata Management
Add Missing Status
Input:
---
title: New Note
---Condition: NOT HAS status
Action (Rule 1): SET status "draft"
Action (Rule 2): SET created_date "2025-11-24T22:10:00"
Output (after both rules):
---
title: New Note
status: draft
created_date: 2025-11-24T22:10:00
---Update Metadata
Input:
---
title: Settings
custom_field: old-value
---Condition: custom_field = "old-value"
Action (Rule 1): SET custom_field "new-value"
Action (Rule 2): SET updated_date "2025-11-24"
Output (after both rules):
---
title: Settings
custom_field: new-value
updated_date: 2025-11-24
---Priority Management
Flag High Priority
Input:
---
title: Critical Task
priority: 9
tags: [work, project]
---Condition: priority > 7 AND NOT tags contains "urgent"
Action: FOR tags APPEND "urgent"
Output:
---
title: Critical Task
priority: 9
tags: [work, project, urgent]
---Reset Priorities
Input:
---
title: Finished Task
status: completed
priority: 5
---Condition: status = "completed"
Action: DELETE priority, SET completed_date ""
Output:
---
title: Finished Task
status: completed
completed_date: 2025-11-24T22:10:00
---Date Operations
Mark Overdue
Input:
---
title: Late Task
deadline: 2025-11-01
status: active
---Condition: HAS deadline AND deadline < "" AND status != "completed"
Action: SET status "overdue"
Output:
---
title: Late Task
deadline: 2025-11-01
status: overdue
---String Operations
Strip Title Prefixes
Input:
---
title: Dr. John Smith
author: Dr. Jane Doe
---Condition: author contains "Dr."
Action: REPLACE author /^Dr\.?\s+// ""
Output:
---
title: Dr. John Smith
author: Jane Doe
---Mark Drafts with Prefix
Input:
---
title: Important Article
status: draft
---Condition: status = "draft" AND NOT title contains "DRAFT: "
Action: INSERT title "DRAFT: " AT 0
Output:
---
title: DRAFT: Important Article
status: draft
---Build Processing Log
Input:
---
title: Research Note
notes: "Initial draft completed"
---Condition: HAS notes
Action: INSERT notes "\n\n---\nReviewed: 2025-12-05" AT -1
Output:
---
title: Research Note
notes: "Initial draft completed\n\n---\nReviewed: 2025-12-05"
---Numeric Operations
Track View Count
Input:
---
title: Popular Article
views: 42
---Condition: HAS views
Action: INCREMENT views 1
Output:
---
title: Popular Article
views: 43
---Initialize Missing Counter
Input:
---
title: New Article
---Condition: NOT HAS views
Action: INCREMENT views 1
Output:
---
title: New Article
views: 1
---Complex Rules
Conditional Workflow
Input:
---
title: High Priority Item
status: active
priority: 8
tags: [project]
---Condition: (status = "active" OR status = "pending") AND priority >= 5 AND NOT tags contains "reviewed"
Action (Rule 1): SET status "in-review"
Action (Rule 2): SET review_date "2025-11-24T22:10:00"
Action (Rule 3): FOR tags ADD "reviewed"
Output (after all three rules):
---
title: High Priority Item
status: in-review
priority: 8
tags: [project, reviewed]
review_date: 2025-11-24T22:10:00
---Multiple Operations
This workflow requires three separate rules with the same condition.
Working with Arrays of Objects
These examples show operations for arrays of structured objects (tasks, meetings, reading lists), not simple scalar arrays (tags).
Update Specific Array Items
What makes this unique: Update fields within specific array items based on their properties.
Example: Task Management
Input:
---
title: Weekly Tasks
tasks:
- name: Review PR #123
status: pending
priority: 8
assignee: alice
- name: Update documentation
status: pending
priority: 3
assignee: bob
- name: Fix critical bug
status: done
priority: 9
assignee: alice
---Rule: Flag high-priority pending tasks as urgent
Condition: HAS tasks
Action: FOR tasks WHERE status = "pending" AND priority >= 7 SET status "urgent", flagged trueOutput:
---
title: Weekly Tasks
tasks:
- name: Review PR #123
status: urgent # ← Changed
priority: 8
assignee: alice
flagged: true # ← Added
- name: Update documentation
status: pending # ← Unchanged (priority too low)
priority: 3
assignee: bob
- name: Fix critical bug
status: done # ← Unchanged (already done)
priority: 9
assignee: alice
---More Examples:
Reassign tasks:
Action: FOR tasks WHERE assignee = "bob" SET assignee "alice", reassignedDate "{{today}}"Mark books finished:
Action: FOR readingList WHERE currentPage = pages SET status "finished", completedDate "{{today}}"Sort Object Arrays
Example: Sort Tasks by Priority
Input:
---
title: Project Tasks
tasks:
- name: Write tests
priority: 3
- name: Fix security issue
priority: 9
- name: Update README
priority: 1
- name: Review code
priority: 7
---Condition: (none needed)
Action: FOR tasks SORT BY priority DESC
Output:
---
title: Project Tasks
tasks:
- name: Fix security issue
priority: 9
- name: Review code
priority: 7
- name: Write tests
priority: 3
- name: Update README
priority: 1
---Prioritize Specific Items
What makes this unique: Move items based on properties without full sorting.
Example: Move High-Priority Items to Top
Input:
---
title: My Reading List
books:
- title: Casual Read
priority: normal
- title: Important Research
priority: high
- title: Quick Reference
priority: low
- title: Critical Paper
priority: high
---Condition: (none needed)
Action: FOR books WHERE priority = "high" MOVE TO START
Output:
---
title: My Reading List
books:
- title: Important Research # ← Moved to top
priority: high
- title: Critical Paper # ← Moved to top
priority: high
- title: Casual Read # ← Stays below
priority: normal
- title: Quick Reference # ← Stays at bottom
priority: low
---More Examples:
Move unwatched movies to top:
Action: FOR watchlist WHERE watched = false MOVE TO STARTMove completed tasks to end:
Action: FOR tasks WHERE status = "done" MOVE TO ENDMove urgent items after specific item:
Action: FOR tasks WHERE priority = "urgent" MOVE TO AFTER name = "Planning meeting"Multi-Step Workflow
Example: Update and Organize Tasks
Input:
---
title: Sprint Tasks
tasks:
- name: Bug fix
status: pending
points: 3
- name: New feature
status: in-progress
points: 8
- name: Code review
status: pending
points: 2
---Step 1 - Mark small pending tasks as quick-wins:
Action: FOR tasks WHERE status = "pending" AND points <= 3 SET status "quick-win"
Step 2 - Move quick-wins to top:
Action: FOR tasks WHERE status = "quick-win" MOVE TO START
Step 3 - Sort remaining by points:
Action: FOR tasks SORT BY points DESC
Final Output:
---
title: Sprint Tasks
tasks:
- name: Bug fix # ← Quick-win at top
status: quick-win
points: 3
- name: Code review # ← Quick-win at top
status: quick-win
points: 2
- name: New feature # ← Sorted by points
status: in-progress
points: 8
---Understanding Array Types
Scalar arrays (simple values):
tags: [project, active, urgent]
categories: [work, personal]- Operations:
ADD,REMOVE_ALL,REMOVE_ANY,SORT,DEDUPLICATE,MOVE, etc. - Target: The values themselves
Object arrays (structured data):
tasks:
- name: Task 1
status: pending
priority: 8- Operations:
FOR array WHERE condition SET,FOR array WHERE condition MOVE,FOR array SORT BY - Target: Specific objects based on their properties
See Actions for complete operation reference.
Advanced Operators
Powerful Features
These examples showcase advanced condition operators that provide precise querying, type validation, and nested array filtering capabilities.
Using .length - Count and Filter
Find notes with many tags:
Input:
---
title: Popular Article
tags: [javascript, typescript, react, vue, angular, svelte, node, deno]
---Condition: tags.length >= 5
Action: FOR tags APPEND "well-tagged"
Output:
---
title: Popular Article
tags: [javascript, typescript, react, vue, angular, svelte, node, deno, well-tagged]
---Find short titles that need expansion:
Input:
---
title: API
status: draft
---Condition: title.length < 10 AND status = "draft"
Action: FOR tags APPEND "needs-better-title"
Output:
---
title: API
status: draft
tags: [needs-better-title]
---Count metadata fields:
Input:
---
title: Minimal Note
author: Alice
---Condition: metadata.length < 5
Where metadata is treated as an object, this checks the number of keys.
Using empty / !empty - Detect Empty Values
Clean up empty tags arrays:
Input:
---
title: Note
tags: []
status: active
---Condition: tags empty
Action: DELETE tags
Output:
---
title: Note
status: active
---Find notes with actual content:
Input:
---
title: Draft
content: ""
---Condition: content empty AND NOT HAS published_date
Action: FOR tags APPEND "empty-draft"
Output:
---
title: Draft
content: ""
tags: [empty-draft]
---Distinguish between missing and empty:
# File 1: tags not present
# tags empty → false (can't be empty if doesn't exist)
# tags exists → false
# File 2: tags: []
# tags empty → true
# tags exists → true
# File 3: tags: null
# tags empty → false (null ≠ empty)
# tags :null → trueUsing Type Checking - Normalize Data
Convert string tags to arrays:
Input:
---
title: Legacy Note
tags: "old-format-tag"
---Condition: tags exists AND tags !:array
Action:
SET tags ["legacy", "{{fm:tags}}"]Output:
---
title: Legacy Note
tags: [legacy, old-format-tag]
---Find notes with numeric status (should be string):
Input:
---
title: Broken Note
status: 1
---Condition: status :number
Action: SET status "active"
Output:
---
title: Broken Note
status: active
---Validate required field types:
Condition: priority exists AND priority !:number
Action: DELETE priority, FOR tags APPEND "invalid-priority"
This finds and fixes notes where priority exists but isn't a number.
Using ANY / ALL - Query Nested Data
Find notes with any active project:
Input:
---
title: Projects Dashboard
projects:
- name: Website Redesign
status: active
priority: 8
- name: Mobile App
status: pending
priority: 3
- name: API Refactor
status: planning
priority: 5
---Condition: ANY projects WHERE status = "active"
Action: FOR tags APPEND "has-active-projects"
Output:
---
title: Projects Dashboard
projects:
- name: Website Redesign
status: active
priority: 8
- name: Mobile App
status: pending
priority: 3
- name: API Refactor
status: planning
priority: 5
tags: [has-active-projects]
---Verify all tasks are assigned:
Input:
---
title: Sprint Board
tasks:
- name: Bug fix
assignee: alice
- name: Feature work
assignee: bob
- name: Testing
assignee: alice
---Condition: ALL tasks WHERE assignee exists
Action: FOR tags APPEND "fully-assigned"
Combine ANY with high priority:
Input:
---
title: Urgent Projects
projects:
- name: Security Patch
priority: 10
status: active
- name: Documentation
priority: 2
status: active
---Condition: ANY projects WHERE priority > 8
Action: SET urgent true, FOR tags APPEND "critical"
Output:
---
title: Urgent Projects
urgent: true
projects:
- name: Security Patch
priority: 10
status: active
- name: Documentation
priority: 2
status: active
tags: [critical]
---Nested quantifiers - Find files with pending work:
Input:
---
title: Team Workload
teams:
- name: Backend
tasks:
- status: done
- status: done
- name: Frontend
tasks:
- status: pending
- status: done
---Condition: ANY teams WHERE ANY tasks WHERE status = "pending"
Action: FOR tags APPEND "has-pending-work"
Explanation: Searches through teams, and for each team, checks if ANY of its tasks are pending. If any team has pending tasks, the condition matches.
Using Negative Indexing - Access from End
Access array items from the end without knowing the array length.
Check last task completion:
Input:
---
title: Project Tasks
tasks:
- name: Setup
status: done
- name: Development
status: done
- name: Testing
status: pending
---Condition: tasks[-1].status = "done"
Result: Condition is false (last task is "pending")
Update most recent entry:
Input:
---
title: Activity Log
history:
- date: 2025-01-01
event: Created
reviewed: false
- date: 2025-01-05
event: Updated
reviewed: false
---Condition: history[-1].reviewed = false
Action: FOR history[-1] SET reviewed true
Output:
---
title: Activity Log
history:
- date: 2025-01-01
event: Created
reviewed: false
- date: 2025-01-05
event: Updated
reviewed: true # ← Last entry updated
---Insert before last item:
Input:
---
title: Tag Management
tags: [project, active, important, final]
---Action: FOR tags INSERT "archived" AT -2
Output:
---
title: Tag Management
tags: [project, active, important, archived, final]
# ↑ inserted before last
---Access nested arrays from end:
Input:
---
title: Multi-Project Dashboard
projects:
- name: Alpha
tasks:
- id: T1
priority: 5
- id: T2
priority: 9
- name: Beta
tasks:
- id: T3
priority: 2
---Condition: projects[-1].tasks[-1].priority < 5
Action: SET needs_attention true
Result: Condition is true (Beta's last task has priority 2)
Use cases:
- Process most recent log entries
- Check latest task status
- Update final array elements
- Insert items relative to end
Relative Positioning - MOVE TO AFTER/BEFORE
Position items relative to other items in the array without full sorting.
Prioritize urgent tasks after planning:
Input:
---
title: Sprint Tasks
tasks:
- name: Sprint Planning
type: planning
priority: normal
- name: Code Review
type: review
priority: normal
- name: Security Patch
type: hotfix
priority: critical
- name: Feature Development
type: development
priority: normal
- name: Testing
type: qa
priority: low
---Condition: ANY tasks WHERE priority = "critical"
Action: FOR tasks WHERE priority = "critical" MOVE TO AFTER type = "planning"
Output:
---
title: Sprint Tasks
tasks:
- name: Sprint Planning
type: planning
priority: normal
- name: Security Patch # ← Moved right after planning
type: hotfix
priority: critical
- name: Code Review # ← Pushed down
type: review
priority: normal
- name: Feature Development
type: development
priority: normal
- name: Testing
type: qa
priority: low
---Insert review step before deployment:
Input:
---
title: Release Workflow
steps:
- name: Build
status: completed
- name: Deployment
status: pending
- name: QA Review
status: pending
---Action: FOR steps WHERE name = "QA Review" MOVE TO BEFORE name = "Deployment"
Output:
---
title: Release Workflow
steps:
- name: Build
status: completed
- name: QA Review # ← Moved before deployment
status: pending
- name: Deployment # ← Now comes after review
status: pending
---Group related items together:
Input:
---
title: Documentation Tasks
items:
- category: Setup
task: Installation
- category: Advanced
task: Custom Config
- category: Setup
task: Quick Start
- category: Reference
task: API Docs
- category: Setup
task: Prerequisites
---Action: FOR items WHERE category = "Setup" MOVE TO START
Output:
---
title: Documentation Tasks
items:
- category: Setup # ← All Setup items
task: Installation # grouped at start
- category: Setup
task: Quick Start
- category: Setup
task: Prerequisites
- category: Advanced # ← Other categories below
task: Custom Config
- category: Reference
task: API Docs
---Use cases:
- Position urgent work after planning
- Enforce workflow ordering (review before deployment)
- Group related items without full sort
- Maintain manual ordering with selective positioning
Working with Deeply Nested Data
Access and modify complex multi-level structures.
Multi-level object paths:
Input:
---
title: User Profile
metadata:
author:
profile:
name: Alice Johnson
verified: false
contact:
email: alice@example.com
phone: +1-555-0123
---Condition: metadata.author.profile.verified = false
Action: SET metadata.author.profile.verified true
Output:
---
title: User Profile
metadata:
author:
profile:
name: Alice Johnson
verified: true # ← Updated deep nested field
contact:
email: alice@example.com
phone: +1-555-0123
---Nested arrays within objects:
Input:
---
title: Project Management
projects:
- name: Website
phases:
- name: Design
tasks:
- id: T1
title: Wireframes
status: done
assignee: Alice
- id: T2
title: Mockups
status: pending
assignee: Bob
- name: Development
tasks:
- id: T3
title: Backend API
status: pending
assignee: Alice
---Condition: projects[0].phases[0].tasks[0].assignee = "Alice"
Action: FOR projects[0].phases[0].tasks WHERE status = "pending" SET status "active", started ""
Output:
---
title: Project Management
projects:
- name: Website
phases:
- name: Design
tasks:
- id: T1
title: Wireframes
status: done
assignee: Alice
- id: T2
title: Mockups
status: active # ← Updated
started: "2026-01-06" # ← Added
assignee: Bob
- name: Development
tasks:
- id: T3
title: Backend API
status: pending
assignee: Alice
---Complex nested API configuration:
Input:
---
title: API Configuration
config:
services:
- name: prod-api
region: us-east
endpoints:
- path: /api/v1/users
methods: [GET, POST]
rateLimit: 1000
auth: required
- path: /api/v1/posts
methods: [GET, POST, PUT, DELETE]
rateLimit: 500
auth: required
---Condition: config.services[0].endpoints[0].rateLimit < 2000
Action: SET config.services[0].endpoints[0].rateLimit 5000
Output:
---
title: API Configuration
config:
services:
- name: prod-api
region: us-east
endpoints:
- path: /api/v1/users
methods: [GET, POST]
rateLimit: 5000 # ← Updated nested value
auth: required
- path: /api/v1/posts
methods: [GET, POST, PUT, DELETE]
rateLimit: 500
auth: required
---Combine with negative indexing:
Input:
---
title: Team Structure
teams:
- name: Backend
members:
- name: Alice
role: senior
active: true
- name: Bob
role: junior
active: false
- name: Frontend
members:
- name: Charlie
role: lead
active: true
---Condition: teams[-1].members[-1].role = "lead"
Action: FOR teams[-1].members[-1] SET badge "team-lead"
Output:
---
title: Team Structure
teams:
- name: Backend
members:
- name: Alice
role: senior
active: true
- name: Bob
role: junior
active: false
- name: Frontend
members:
- name: Charlie
role: lead
active: true
badge: team-lead # ← Added to last team's last member
---Use cases:
- Manage complex configuration structures
- Update nested project/task hierarchies
- Access deeply nested API settings
- Modify multi-level organizational data
Complex Multi-Step Workflows
Execute sophisticated operations by combining multiple actions in sequence.
Complete Task Workflow
Perform an entire task lifecycle in a single action:
Input:
---
title: Sprint Board
status: active
tasks:
- name: Design mockups
status: done
priority: 5
- name: Implement API
status: pending
priority: 8
- name: Write tests
status: pending
priority: 7
- name: Deploy
status: pending
priority: 9
processed_count: 42
---Condition: status = "active" AND ANY tasks WHERE status = "done"
Action:
SET status "processing",
FOR tasks WHERE status = "pending" SET status "active", started "{{today}}",
FOR tasks WHERE status = "done" MOVE TO END,
FOR tasks SORT BY priority DESC,
INCREMENT processed_count 1,
SET last_run "{{now}}",
FOR tags APPEND "processing"Output:
---
title: Sprint Board
status: processing # ← Updated
last_run: "2026-01-06T12:00:00Z" # ← Added
processed_count: 43 # ← Incremented
tags: [processing] # ← Added
tasks:
- name: Deploy # ← Moved to top (highest priority)
status: active # ← Changed from pending
started: "2026-01-06" # ← Added
priority: 9
- name: Implement API # ← Sorted by priority
status: active
started: "2026-01-06"
priority: 8
- name: Write tests
status: active
started: "2026-01-06"
priority: 7
- name: Design mockups # ← Moved to end (done)
status: done
priority: 5
---What happened:
- Status changed to "processing"
- All pending tasks activated with start date
- Completed tasks moved to end
- Tasks sorted by priority (highest first)
- Counter incremented
- Timestamp and tag added
Data Normalization Pipeline
Clean and standardize data in multiple steps:
Input:
---
title: Legacy Import
tags: [Project, project, ACTIVE, active, draft, Draft]
author: " Dr. Jane Smith "
status: PENDING
created_date: "01/15/2025"
metadata:
version: "1.0"
type: document
---Condition: HAS tags AND tags.length > 0
Action:
FOR tags DEDUPLICATE,
FOR tags SORT ASC,
REPLACE author /^\s+|\s+$/g "",
REPLACE author /dr\.?\s+/i "",
REPLACE status /^(.+)$/ "${1.toLowerCase()}",
REPLACE created_date /(\d{2})\/(\d{2})\/(\d{4})/ "$3-$1-$2",
SET normalized true,
SET normalized_date "{{today}}",
FOR tags APPEND "normalized"Output:
---
title: Legacy Import
tags: [ACTIVE, Draft, Project, active, draft, normalized, project] # ← Deduplicated & sorted
author: Jane Smith # ← Trimmed & title removed
status: pending # ← Lowercase
created_date: "2025-01-15" # ← Reformatted to ISO
normalized: true # ← Added
normalized_date: "2026-01-06" # ← Added
metadata:
version: "1.0"
type: document
---Project Completion Workflow
Complex workflow managing project lifecycle:
Input:
---
title: Website Redesign
status: in-progress
started_date: "2025-01-01"
tasks:
- name: Planning
status: done
completed: "2025-01-03"
- name: Design
status: done
completed: "2025-01-10"
- name: Development
status: done
completed: "2025-01-20"
- name: Testing
status: cancelled
tags: [active, project, in-progress]
team_hours: 245
---Condition: status = "in-progress" AND ALL tasks WHERE status != "pending" AND ALL tasks WHERE status = "done" OR status = "cancelled"
Action:
SET status "completed",
SET completed_date "{{today}}",
FOR tasks WHERE status = "done" SET archived true,
FOR tasks WHERE status = "done" MOVE TO START,
FOR tasks WHERE status = "cancelled" MOVE TO END,
FOR tasks SORT BY completed ASC,
FOR tags REMOVE_ALL ["active", "in-progress", "pending"],
FOR tags APPEND "completed",
FOR tags APPEND "archived",
INCREMENT projects_completed 1,
FOR history APPEND {date: "{{now}}", event: "project-completed", hours: "{{fm:team_hours}}"}Output:
---
title: Website Redesign
status: completed # ← Updated
started_date: "2025-01-01"
completed_date: "2026-01-06" # ← Added
projects_completed: 1 # ← Added/incremented
tags: [archived, completed, project] # ← Cleaned & updated
team_hours: 245
tasks:
- name: Planning # ← Sorted by completion
status: done
completed: "2025-01-03"
archived: true
- name: Design
status: done
completed: "2025-01-10"
archived: true
- name: Development
status: done
completed: "2025-01-20"
archived: true
- name: Testing # ← Cancelled moved to end
status: cancelled
history:
- date: "2026-01-06T12:00:00Z"
event: project-completed
hours: 245
---Content Publishing Workflow
Article preparation and publication in one action:
Input:
---
title: Getting Started with YAML
status: reviewed
author: Jane Smith
word_count: 2500
tags: [tutorial, draft, needs-review]
reviewers:
- name: Alice
approved: true
- name: Bob
approved: true
featured_image: cover.jpg
---Condition: status = "reviewed" AND ALL reviewers WHERE approved = true AND HAS featured_image AND word_count > 1000
Action:
SET status "published",
SET published_date "{{today}}",
SET url_slug "{{fm:title}}",
REPLACE url_slug /[^a-z0-9]+/ig "-",
REPLACE url_slug /^-+|-+$/g "",
FOR tags REMOVE_ALL ["draft", "needs-review"],
FOR tags PREPEND "published",
FOR tags SORT ASC,
FOR reviewers SET notified true,
FOR history APPEND {date: "{{now}}", event: "published", author: "{{fm:author}}"},
INCREMENT articles_published 1,
SET seo_optimized trueOutput:
---
title: Getting Started with YAML
status: published # ← Updated
published_date: "2026-01-06" # ← Added
url_slug: "getting-started-with-yaml" # ← Generated from title
author: Jane Smith
word_count: 2500
articles_published: 1 # ← Added/incremented
seo_optimized: true # ← Added
tags: [published, tutorial] # ← Cleaned & reordered
featured_image: cover.jpg
reviewers:
- name: Alice
approved: true
notified: true # ← Added
- name: Bob
approved: true
notified: true # ← Added
history:
- date: "2026-01-06T12:00:00Z"
event: published
author: Jane Smith
---Automated Quality Control
Multi-step validation and enhancement:
Input:
---
title: Product Requirements
status: draft
tags: []
word_count: 150
sections:
- name: Overview
completed: true
- name: Features
completed: false
- name: Timeline
completed: false
---Condition: status = "draft" AND word_count > 100
Action:
SET reviewed_date "{{today}}",
FOR sections WHERE completed = false SET flagged true,
FOR sections WHERE completed = false MOVE TO START,
FOR tags APPEND "needs-work",
FOR tags APPEND "incomplete",
SET completion_rate "{{fm:sections | filter('completed=true').length / fm:sections.length * 100}}",
INCREMENT review_iterations 1,
SET next_review "{{today | addDays(7)}}"Output:
---
title: Product Requirements
status: draft
reviewed_date: "2026-01-06" # ← Added
review_iterations: 1 # ← Added/incremented
next_review: "2026-01-13" # ← Added (7 days later)
completion_rate: 33 # ← Calculated
tags: [incomplete, needs-work] # ← Added
word_count: 150
sections:
- name: Features # ← Moved to start (incomplete)
completed: false
flagged: true # ← Added
- name: Timeline
completed: false
flagged: true # ← Added
- name: Overview # ← Completed item last
completed: true
---Use Cases for Multi-Step Workflows
Project Management:
- Initialize new projects with metadata
- Transition project phases automatically
- Complete projects with archival
- Track metrics and history
Content Management:
- Prepare drafts for review
- Publish content with SEO optimization
- Archive old content
- Normalize imported data
Task Management:
- Activate pending tasks
- Mark overdue items
- Complete workflows
- Reorganize by priority
Data Quality:
- Clean and deduplicate
- Normalize formats
- Validate completeness
- Add derived metadata
Best Practices:
- Test workflows on single files first
- Use dry run to preview changes
- Keep related operations together
- Document complex workflows
- Break extremely long chains into multiple rules