OpenSpec-practise
CLAUDE.md624 starsChanged 53 days agoApache-2.0View on GitHub
This is OpenSpec Practise — a learning and demonstration repository for Spec-Driven Development (SDD) using the OpenSpec framework (v1.5.0). It contains a minimal e-commerce system implemented in both Node.js and Python, all driven by OpenSpec specifications. The core idea: define specifications first (proposal → design → specs → tasks), then write code, ensuring humans and AI share the same understanding of requirements. Both implementations follow the same four-layer architecture with strict dependency direction:
- Installs packages
We split this CLAUDE.md into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 60
All prices in integer cents (priceCents) to avoid floating-point issues.
≈ “Common” is an estimate: at least 1 in 5 of the 25,680 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Project Overview
This is OpenSpec Practise — a learning and demonstration repository for Spec-Driven Development (SDD) using the OpenSpec framework (v1.5.0). It contains a minimal e-commerce system implemented in both Node.js and Python, all driven by OpenSpec specifications. The core idea: define specifications first (proposal → design → specs → tasks), then write code, ensuring humans and AI share the same understanding of requirements.
Repository Architecture
docs/ # Chinese documentation (manuals, guides, analysis)
docs-en/ # English documentation (same content, translated)
openspec/ # Root OpenSpec configuration for this project
config.yaml # Project context, rules, schema definition
.claude/ # Claude Code native AI commands and skills (v1.5.0)
commands/opsx/ # /opsx:propose, /opsx:apply, /opsx:archive, /opsx:explore, /opsx:sync
skills/ # Corresponding skill definitions (SKILL.md)
examples/
ecommerce-mini/ # Node.js implementation (v20+, zero npm deps, native http)
src/domain/ # Entity type definitions (JSDoc) + pure domain logic
src/services/ # Use-case orchestration (CartService, CatalogService, OrderService)
src/http/ # HTTP layer — server.js (dev), server.prod.js (prod with JWT + file persistence)
src/repo/ # In-memory Map-based repositories
src/persist/ # File-based JSON persistence (FileStore)
__tests__/ # unit.spec.js (service-level), integration.spec.js (E2E), performance.spec.js
data/ # Seed data: products.json, carts.json, orders.json
ecommerce-mini-python/ # Python implementation (FastAPI + Pydantic)
src/domain/models.py # Pydantic models (Product, Cart, Order, CartItem, OrderItem)
src/services/ # Business logic (cart.py, catalog.py, order.py)
src/api/server.py # FastAPI app with all endpoints
src/repo/memory.py # Generic MemoryRepo[T]
tests/test_smoke.py # Pytest smoke/integration tests via TestClient
openspec/ # Root: specifications driving both implementations
config.yaml # Project context, rules, store/references support (v1.5.0)
specs/ # Master specs: cart/catalog/order/payment/domain-model/error-handling
changes/ # Active changes
changes/archive/ # Archived: 2025-01-27-v1-mvp (proposal/design/specs/tasks)Layered Architecture
Both implementations follow the same four-layer architecture with strict dependency direction:
HTTP Layer ──► Service Layer ──► Domain Layer
│
└──► Repository Layer ──► Data Store (Map / File)| Layer | Node.js dir | Python dir | Responsibility |
| HTTP | src/http/ | src/api/ | Route handling, JSON parse/format, error→HTTP status mapping |
| Service | src/services/ | src/services/ | Use-case orchestration (createOrder: validate cart → check stock → deduct → save order → clear cart) |
| Domain | src/domain/ | src/domain/ | Pure entities/types with no dependencies (JSDoc typedefs / Pydantic models) |
| Repository | src/repo/, src/persist/ | src/repo/ | Data access; Map in dev, FileStore in prod (Node.js only) |
Key design decisions:
- All prices in integer cents (
priceCents) to avoid floating-point issues. - Node.js uses native
httpmodule (zero dependencies); Python uses FastAPI for type safety and auto-docs. - MVP uses in-memory storage with single-threaded atomicity; prod extends with file persistence.
Common Commands
Node.js (examples/ecommerce-mini/)
npm test # Run all tests (node:test runner — unit + integration + performance)
npm start # Dev server on port 3000 (in-memory storage, mock auth)
npm run start:prod # Prod server on port 3002 (file persistence + JWT auth)Python (examples/ecommerce-mini-python/)
pip install -r requirements.txt # Install FastAPI, Pydantic, pytest, httpx, uvicorn
pytest # Run test suite (smoke + out-of-stock)
python -m uvicorn src.api.server:app --reload # Dev server on port 8000OpenSpec SDD Workflow (v1.5.0)
The SDD workflow uses these slash commands (available in .claude/commands/opsx/):
- Explore (
/opsx:explore): Think through ideas, investigate the codebase, weigh options — before any artifact exists. A no-stakes thinking partner. - Propose (
/opsx:propose <name>): Create the change viaopenspec new change+openspec instructionsCLI pattern. Generates proposal.md, design.md, tasks.md with schema-driven instructions. - Apply (
/opsx:apply): Implement tasks usingopenspec instructions apply --jsonfor dynamic context. Works through task checklist, marking- [ ]→- [x]. - Sync (
/opsx:sync): 🆕 Synchronize delta specs back to main specs before archiving. - Archive (
/opsx:archive): Archive completed changes toopenspec/changes/archive/YYYY-MM-DD-<name>/.
v1.5.0 Key Changes
- Stores (beta): Standalone planning repos for cross-repo features. Managed via
openspec store setup/register/list/doctor/remove. Config supportsstore:andreferences:fields. - Fluid workflow: Actions on a change can be invoked anytime — not phase-locked. Explore can hand off to propose, apply can suggest artifact updates, etc.
- Schema-driven artifacts: Artifacts are defined by
schema.yaml, not hardcoded. CLI provides instructions per artifact type viaopenspec instructions <artifact-id>.
Specs use Given/When/Then (Gherkin) format for scenarios. Every requirement includes a Priority (P0/P1/P2) and Rationale. Normative language uses SHALL or MUST.
The AI tooling is generated by openspec init --tools claude and updated via openspec update.
In this repository6 other files it gives its agents.
- openspec-apply-changeSkill
- openspec-archive-changeSkill
- openspec-exploreSkill
- openspec-proposeSkill
- openspec-sync-specsSkill
- openspec-update-changeSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

