Skip to content

Commit c618170

Browse files
raifdmuellerclaude
andcommitted
feat: add 11 Semantic Contracts to llms.txt (#372)
generate-llms-txt.js now reads contracts.json and appends all contracts after the anchor catalog. Each contract includes its template text and referenced anchors. LLMs consuming llms.txt now know about both building blocks (Anchors) and compositions (Contracts). Closes #372 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 693217f commit c618170

2 files changed

Lines changed: 149 additions & 0 deletions

File tree

scripts/generate-llms-txt.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,46 @@ function generateLlmsTxt() {
240240
lines.push('')
241241
}
242242

243+
// ─── Append Semantic Contracts ──────────────────────────────────────────────
244+
245+
const contractsPath = path.join(ROOT, 'website/public/data/contracts.json')
246+
try {
247+
const contracts = JSON.parse(fs.readFileSync(contractsPath, 'utf-8'))
248+
if (contracts.length > 0) {
249+
lines.push('')
250+
lines.push('# Semantic Contracts')
251+
lines.push('')
252+
lines.push(
253+
'Semantic Contracts compose existing anchors into project-specific conventions.'
254+
)
255+
lines.push(
256+
'Add them to your AGENTS.md or CLAUDE.md to define what your team means when using these terms.'
257+
)
258+
lines.push(
259+
'Select and download: https://llm-coding.github.io/Semantic-Anchors/#/contracts'
260+
)
261+
lines.push('')
262+
263+
for (const contract of contracts) {
264+
lines.push(`## ${contract.title}`)
265+
lines.push('')
266+
lines.push(contract.template)
267+
lines.push('')
268+
if (contract.anchors && contract.anchors.length > 0) {
269+
lines.push(`*Referenced anchors: ${contract.anchors.join(', ')}*`)
270+
lines.push('')
271+
}
272+
}
273+
274+
lines.push('---')
275+
console.warn(
276+
` Including ${contracts.length} Semantic Contracts in llms.txt`
277+
)
278+
}
279+
} catch {
280+
// contracts.json not found — skip
281+
}
282+
243283
const output = lines.join('\n')
244284
fs.writeFileSync(path.join(ROOT, 'website/public/llms.txt'), output, 'utf-8')
245285
const kb = Math.round(Buffer.byteLength(output, 'utf-8') / 1024)

website/public/llms.txt

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4492,3 +4492,112 @@ SWOT = **S**trengths / **W**eaknesses / **O**pportunities / **T**hreats
44924492
* Guiding team testing practices
44934493

44944494
---
4495+
4496+
4497+
# Semantic Contracts
4498+
4499+
Semantic Contracts compose existing anchors into project-specific conventions.
4500+
Add them to your AGENTS.md or CLAUDE.md to define what your team means when using these terms.
4501+
Select and download: https://llm-coding.github.io/Semantic-Anchors/#/contracts
4502+
4503+
## Specification
4504+
4505+
When we talk about a "specification" or "spec", we mean:
4506+
- Use Cases with Activity Diagrams (all paths, not just the happy path)
4507+
- Acceptance criteria in Gherkin format (Given/When/Then)
4508+
4509+
*Referenced anchors: gherkin, bdd-given-when-then*
4510+
4511+
## Requirements Discovery
4512+
4513+
Clarify requirements using the Socratic Method:
4514+
- Ask at most 3 questions at a time, challenge assumptions
4515+
- Use MECE to ensure questions cover all areas without overlap
4516+
- Keep asking until you fully understand the requirements
4517+
- Document as a PRD (problem, goals, personas, success criteria, scope)
4518+
4519+
*Referenced anchors: socratic-method, mece, prd*
4520+
4521+
## Architecture Documentation
4522+
4523+
Architecture documentation follows arc42 with all 12 sections.
4524+
- C4 diagrams (PlantUML) for visualization at four abstraction levels
4525+
- Every architecture decision documented as an ADR according to Nygard (Context, Decision, Status, Consequences)
4526+
- Each ADR includes a Pugh Matrix with 3-point scale (-1, 0, +1) evaluating alternatives against quality goals
4527+
4528+
*Referenced anchors: arc42, c4-diagrams, adr-according-to-nygard, pugh-matrix*
4529+
4530+
## Layer Boundaries
4531+
4532+
At every layer boundary:
4533+
- Expose only well-defined DTOs and contracts — never domain entities
4534+
- Use explicit mapping at every seam
4535+
- Apply Anti-Corruption Layers when integrating external systems
4536+
- Dependency direction points inward (DIP)
4537+
4538+
*Referenced anchors: clean-architecture, hexagonal-architecture, domain-driven-design, solid-dip, solid-isp*
4539+
4540+
## Backlog Management
4541+
4542+
Create EPICs and User Stories as GitHub issues from the specification.
4543+
- User Stories follow INVEST criteria (Independent, Negotiable, Valuable, Estimable, Small, Testable)
4544+
- Prioritize with MoSCoW (Must/Should/Could/Won't)
4545+
- Mark dependencies between issues
4546+
- Groom the backlog regularly as the project evolves
4547+
4548+
*Referenced anchors: invest, moscow*
4549+
4550+
## Implement Next
4551+
4552+
For each issue:
4553+
- Create a feature branch for the EPIC
4554+
- Select next issue from backlog (respect dependencies)
4555+
- Analyze and document analysis as a comment on the issue
4556+
- Implement using TDD (London or Chicago School as appropriate)
4557+
- Commit with Conventional Commits, reference issue number
4558+
- Check if spec or architecture docs need updating
4559+
- When EPIC is complete, create a Pull Request
4560+
4561+
*Referenced anchors: tdd-london-school, tdd-chicago-school, definition-of-done, conventional-commits*
4562+
4563+
## Code Quality
4564+
4565+
Our code follows:
4566+
- SOLID principles
4567+
- DRY, KISS
4568+
- Ubiquitous Language from Domain-Driven Design (same terms in code as in the specification)
4569+
4570+
*Referenced anchors: solid-principles, dry-principle, kiss-principle, domain-driven-design*
4571+
4572+
## Quality Review
4573+
4574+
Quality assurance follows three layers:
4575+
- Code review using Fagan Inspection (structured, systematic, with defined phases)
4576+
- Security review based on OWASP Top 10
4577+
- Architecture review using ATAM (scenario-based tradeoff analysis against quality goals)
4578+
- Use a different AI model or fresh session for reviews to avoid blind spots
4579+
4580+
*Referenced anchors: fagan-inspection, owasp-top-10, atam*
4581+
4582+
## Docs-as-Code
4583+
4584+
Documentation follows Docs-as-Code according to Ralf D. Müller:
4585+
- AsciiDoc as format, PlantUML for inline diagrams, built by docToolchain
4586+
- Version-controlled, peer-reviewed, and built automatically
4587+
- Plain English according to Strunk & White (or Gutes Deutsch nach Wolf Schneider)
4588+
4589+
*Referenced anchors: docs-as-code, plain-english-strunk-white, gutes-deutsch-wolf-schneider*
4590+
4591+
## Concise Response (TLDR)
4592+
4593+
Responses lead with the conclusion first (BLUF). Keep to essential points. No filler, no preamble. Use short sentences, active voice, and no unnecessary words (Strunk & White).
4594+
4595+
*Referenced anchors: bluf, plain-english-strunk-white*
4596+
4597+
## Simple Explanation (ELI5)
4598+
4599+
Explain complex concepts using simple language and everyday analogies. When the explanation feels hard to write, that reveals gaps in understanding — study those areas first (Feynman Technique).
4600+
4601+
*Referenced anchors: feynman-technique*
4602+
4603+
---

0 commit comments

Comments
 (0)