hieudoanm/hieudoanm.github.io/couchdb
Claude Code and agent skill by hieudoanm/hieudoanm.github.io
Trust tier 2
- community
Source check pending
Checking that the SKILL.md file is still in the repository.
CouchDB — source-first JSON document database with HTTP API, multi-master replication, and map/reduce views.
Install
npx vskill@latest install hieudoanm/hieudoanm.github.io/couchdbSKILL.md
The same SKILL.md was published earlier as hieudoanm/hieudoanm.github.io/couchdb.
CouchDB is a JSON document database with a pure HTTP API, built around master-master replication and an MVCC document model designed for offline-friendly, fault-tolerant applications.
1. Core Concepts
- Documents are JSON objects stored under a unique
_idwith a_rev(revision) token. - Databases are collections of documents; views/indexes are per-database.
- Replication synchronizes databases between nodes or clients continuously or on demand.
- MVCC: document revisions are immutable; conflicts are resolved by application merge logic or by picking the latest valid revision.
- Query via views, defined as map/reduce functions written in JavaScript. Live listing with
_changesand filtering with_selector(Mango).
2. Access via HTTP
- REST API:
GET/PUT/POST/DELETE /db/{docid}. - Maintenance:
GET /_all_dbs,_changesfeed,_compact,_replicate.
Runnable: `examples/docker/compose/databases/documental/couchdb/docker-compose.yaml`
- Authentication:
Basic,JWT, orCookie(session) vs.PW/Local(DB setup). Use_usersDB for_designdocs? (Create dedicated users.) - Use
ETag/If-Match and_revto implement optimistic concurrency: always send_revon update; a409 Conflictmeans a revision mismatch. - Bulk operations:
_bulk_docswithall_or_nothing; transactions not supported — use independent documents.
3. Views and Indexes
- Design documents (
_design/*) contain view functions; they run against a snapshot of the database (B-tree) and are rebuilt lazily via the_viewendpoints. - Map function:
emit(key, value); reduce optional:sum,count, or custom. - For range lookups pass
startkey/endkey,include_docs=true. - Mango (Query Server) indexes (
_index) provide$eq,$gt,$regex-style selectors; create via_indexendpoint. - Prefer views over full scan for hot paths; sparse views (only emit needed docs) reduce index size.
4. Conflicts and Replication
- Replication is asynchronous; each node can have different revision trees.
- Conflicts appear as
_conflictsin a document; resolve by updating the base revision with merged content. - Replicated conflicts must be resolved client-side; design the app to tolerate eventual consistency.
- Use filtered replication with
_selector/filter functions to replicate subsets (e.g., per-user).
5. Operational Practices
- Run at least 3 nodes; use the cluster module (Paxos-based) for automatic sharding.
- Compact databases and views periodically:
_compactand_view_cleanuprelease disk (tombstone overhead). - Monitor via
_stats,_active_tasks, Prometheus (/ _metrics). - Store attachments either inline or in a separate blob store — attachments bloat replication and compaction.
- Backup via replication to a separate CouchDB instance or the snapshot tooling (e.g.,
couchdb-dumps).
6. Common Pitfalls
- Ignoring
_revand generating 409 conflicts — always marshal from latest revision. - Building views that emit for every document — this creates huge indexes and slows replication.
- Using CouchDB as a relational DB with joins and transactions.
- Letting attachment blobs clog the database — prefer external storage or large
_attachmentlimits. - Not resolving conflicts: they silently accumulate and can cause data inconsistency.
General Rules of Thumb
- Design for eventual consistency and conflict resolution first; CouchDB is intentionally final-less.
- Use views for stable, well-defined queries; use Mango for ad-hoc/exploratory filtering.
- Keep documents small and coarse-grained — one JSON document per business entity, not per field.
- Monitor compaction and tombstone growth; schedule compaction off-peak.
Quick-Start Checklist
- [ ] Chose your transport: HTTP API or SDK (e.g.,
pouchdb,couchbaseSDK,nano). - [ ] Set up authentication (users DB, JWT/scoped users) and CORS allowances.
- [ ] Design documents with unique
_ids and a revision-merge strategy. - [ ] Add views/Mango indexes only for actual lookup patterns.
- [ ] Configure replication topology (master-master, filtered) with conflict handling.
- [ ] Plan compaction schedule and backup replication strategy.
- [ ] Enable monitoring for replication lag, disk usage, and tombstone overhead.
- [ ] Test offline behavior and synchronous merge paths before shipping.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryChecking.skills/programming/database/document/couchdb/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/hieudoanm/hieudoanm.github.io/couchdb)