---
name: "couchdb-mapreduce-views"
description: "Build document databases with ACID document revisions, JavaScript MapReduce, and HTTP API."
metadata:
  author: "Apache Software Foundation"
  version: "1.0.0"
  runtime_compatibility:
    - "codex"
    - "claude-code"
    - "cursor"
    - "windsurf"
triggers:
  - "create couchdb map view"
  - "setup couchdb replication"
  - "resolve couchdb document conflicts"
permissions:
  fs_read: true
  fs_write: "workspace"
  shell_exec: false
  net_access: false
---

# Apache CouchDB MapReduce Views & Offline Sync

Configures Apache CouchDB: creating design documents, writing JavaScript map/reduce functions, managing revision conflicts (_rev), configuring clustering, and handling multi-master replication.

## When to Invoke
Invoke this skill whenever you need to:
- create couchdb map view
- setup couchdb replication
- resolve couchdb document conflicts

## Execution SOP & Rules
1. Define view map function in design document: emit([doc.year, doc.month], 1) and use _sum reducer.
2. Query views with query parameters: ?group_level=2&stale=update_after for responsive aggregation.
3. Initiate replication via HTTP POST to /_replicate with source, target, and continuous: true.
4. Inspect conflicting revisions by querying ?conflicts=true and purge stale branches via DELETE with _rev.

## Verification Checklist
- Run local linting, syntax validation, and type-checks before reporting completion.
- Ensure all created or modified files adhere to workspace boundaries and avoid uncommitted secrets.
- Verify tests or build commands exit cleanly with return code 0.
