sagarithm-kit / rules
Cursor rule17 starsChanged 12 days agoApache-2.0View on GitHub
"Code is ephemeral; specifications and contract interfaces are durable. Without a clear specification, tests verify assumptions rather than requirements." Specification-Driven Architecture ensures that every feature, service, and module is specified with mathematical precision prior to code authoring. It establishes unambiguous boundaries between what a system must do (contracts) and how it does it (implementation). Every production specification in Sagarithm Kit must reside in docs/specs/[name]-spec.md and include: 1. Drafting: Write the specification with complete type signatures. 2. Invariant Review: Verify acyclic…
Where files are headingNew Cursor rule files have more rules about planning and tracking tasks, and fewer about code style.
Of the Cursor rule files we read, the 4,183 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository252 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- .cursor/rules/ai-systems-and-rag.mdcCursor rule
- .cursor/rules/architecture-system-design.mdcCursor rule
- .cursor/rules/backend-distributed-systems.mdcCursor rule
- .cursor/rules/database-architecture-and-modeling.mdcCursor rule
- .cursor/rules/delivery-shipping-and-launch.mdcCursor rule
- .cursor/rules/devops-sre-observability.mdcCursor rule
- .cursor/rules/documentation-architectural-decision-records.mdcCursor rule
- .cursor/rules/engineering-ai-data-remediation-engineer.mdcCursor rule
- .cursor/rules/engineering-ai-engineer.mdcCursor rule
- .cursor/rules/engineering-api-platform-engineer.mdcCursor rule
- .cursor/rules/engineering-autonomous-optimization-architect.mdcCursor rule
- .cursor/rules/engineering-backend-architect.mdcCursor rule
- .cursor/rules/engineering-cms-developer.mdcCursor rule
- .cursor/rules/engineering-codebase-onboarding-engineer.mdcCursor rule
- .cursor/rules/engineering-code-reviewer.mdcCursor rule
- .cursor/rules/engineering-database-optimizer.mdcCursor rule
- .cursor/rules/engineering-data-engineer.mdcCursor rule
- .cursor/rules/engineering-desktop-app-engineer.mdcCursor rule
- .cursor/rules/engineering-devops-automator.mdcCursor rule
- .cursor/rules/engineering-drupal-performance.mdcCursor rule
- .cursor/rules/engineering-drupal-shopping-cart.mdcCursor rule
- .cursor/rules/engineering-email-intelligence-engineer.mdcCursor rule
- .cursor/rules/engineering-embedded-firmware-engineer.mdcCursor rule
- .cursor/rules/engineering-feishu-integration-developer.mdcCursor rule
- .cursor/rules/engineering-filament-optimization-specialist.mdcCursor rule
- .cursor/rules/engineering-finops-engineer.mdcCursor rule
- .cursor/rules/engineering-frontend-developer.mdcCursor rule
- .cursor/rules/engineering-git-workflow-master.mdcCursor rule
- .cursor/rules/engineering-i18n-engineer.mdcCursor rule
- .cursor/rules/engineering-identity-access-engineer.mdcCursor rule
- .cursor/rules/engineering-incident-response-commander.mdcCursor rule
- .cursor/rules/engineering-it-service-manager.mdcCursor rule
- .cursor/rules/engineering-minimal-change-engineer.mdcCursor rule
- .cursor/rules/engineering-mobile-app-builder.mdcCursor rule
- .cursor/rules/engineering-mobile-release-engineer.mdcCursor rule
- .cursor/rules/engineering-multi-agent-systems-architect.mdcCursor rule
- .cursor/rules/engineering-network-engineer.mdcCursor rule
- .cursor/rules/engineering-orgscript-engineer.mdcCursor rule
- .cursor/rules/engineering-payments-billing-engineer.mdcCursor rule
- .cursor/rules/engineering-prompt-engineer.mdcCursor rule
- .cursor/rules/engineering-rapid-prototyper.mdcCursor rule
- .cursor/rules/engineering-realtime-collaboration-engineer.mdcCursor rule
- .cursor/rules/engineering-search-relevance-engineer.mdcCursor rule
- .cursor/rules/engineering-section-508-specialist.mdcCursor rule
- .cursor/rules/engineering-senior-developer.mdcCursor rule
- .cursor/rules/engineering-software-architect.mdcCursor rule
- .cursor/rules/engineering-solidity-smart-contract-engineer.mdcCursor rule
- .cursor/rules/engineering-sre.mdcCursor rule
- .cursor/rules/engineering-technical-writer.mdcCursor rule
- .cursor/rules/engineering-uswds-developer.mdcCursor rule
- .cursor/rules/engineering-video-streaming-engineer.mdcCursor rule
- .cursor/rules/engineering-voice-ai-integration-engineer.mdcCursor rule
- .cursor/rules/engineering-webassembly-engineer.mdcCursor rule
- .cursor/rules/engineering-wechat-mini-program-developer.mdcCursor rule
- .cursor/rules/engineering-wordpress-performance.mdcCursor rule
- .cursor/rules/engineering-wordpress-shopping-cart.mdcCursor rule
- .cursor/rules/frontend-ui-engineering.mdcCursor rule
- The first 60 shown.
The file
We split this architecture-spec-driven-development.mdc into the rules it gives an agent
3 rules. About 0 are common, 2 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
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 20
Every production specification in Sagarithm Kit must reside in docs/specs/[name]-spec.md and include:
- Distinctive: line 51
Drafting: Write the specification with complete type signatures.
- Distinctive: line 52
Invariant Review: Verify acyclic dependency rules and ensure no circular imports are introduced.
≈ “Common” is an estimate: at least 1 in 5 of the 6,668 Cursor rule 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
<!-- SAGARITHM:START - DO NOT EDIT DIRECTLY -->
---
description: "Transforms validated ideas into formal, testable architectural specifications. Defines bounded contexts, contract interfaces, state machines, and acceptance criteria before implementation."
globs: ["**/*"]
alwaysApply: false
---
# Specification-Driven Architecture
# 📐 Specification-Driven Architecture
> **"Code is ephemeral; specifications and contract interfaces are durable. Without a clear specification, tests verify assumptions rather than requirements."**
Specification-Driven Architecture ensures that every feature, service, and module is specified with mathematical precision prior to code authoring. It establishes unambiguous boundaries between what a system *must do* (contracts) and *how it does it* (implementation).
---
## 🏛️ Specification Anatomy
Every production specification in Sagarithm Kit must reside in `docs/specs/[name]-spec.md` and include:
1. **Context & Motivation**: Why this abstraction exists and the business/system need it fulfills.
2. **Domain Boundary & Ubiquitous Language**: Clear definitions of domain entities, value objects, and states.
3. **Public Interface Contracts**: Strongly-typed function signatures, DTOs, and event payloads (in TypeScript/Rust/Go).
4. **State Machine & Invariants**: Exhaustive states (e.g., `PENDING` -> `PROCESSING` -> `COMPLETED` | `FAILED`) and prohibited transitions.
5. **Acceptance Criteria (Given / When / Then)**: Concrete, automatable behavioral scenarios.
6. **Non-Functional Requirements**: Latency budgets (p99), memory ceiling, and security boundary isolation.
---
## 🛑 Anti-Rationalization Matrix
| Agent Excuse / Shortcut | Architectural Reality | Mandatory Requirement |
|---|---|---|
| *"The requirements are obvious from the prompt."* | Prompts are ambiguous natural language. Implementation details hide silent breaking changes. | Author the contract interfaces and DTOs before touching application code. |
| *"I'll write the spec while writing the code."* | Writing specs concurrently produces code-coupled specs that merely mirror whatever code was typed. | Spec must be drafted, reviewed, and finalized before the first implementation line. |
| *"We don't need formal state machines for this flow."* | Implicit state machines cause distributed edge-case bugs and race conditions. | Map all valid states and illegal transitions explicitly. |
| *"Any generic error handling is fine for now."* | Undefined failure states cause unrecoverable crashes and corrupted data stores. | Specify discrete, typed error cases for every public contract. |
---
## ⚙️ Standard Workflow: Spec to Implementation
```
1. Draft Spec (docs/specs/) ──► 2. Invariant Review ──► 3. Contract Tests (Red)
│
▼
4. Implementation (Green)
```
1. **Drafting**: Write the specification with complete type signatures.
2. **Invariant Review**: Verify acyclic dependency rules and ensure no circular imports are introduced.
3. **Contract Tests**: Convert the Acceptance Criteria into failing test cases (`npm test`).
4. **Implementation**: Fulfill the contract until all verification vectors achieve `[VERIFIED]` state.
<!-- SAGARITHM:END -->
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.

