Skip to content

Commit 0e9b5b8

Browse files
authored
Merge pull request #373 from raifdmueller/feat/llms-txt-contracts
feat: add Semantic Contracts to llms.txt
2 parents 693217f + 2753aac commit 0e9b5b8

4 files changed

Lines changed: 157 additions & 2 deletions

File tree

scripts/generate-llms-txt.js

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,50 @@ 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 define what a term means in your project — either by'
254+
)
255+
lines.push(
256+
'composing established anchors or by providing custom definitions that only'
257+
)
258+
lines.push('exist within your team.')
259+
lines.push(
260+
'Add them to your AGENTS.md or CLAUDE.md.'
261+
)
262+
lines.push(
263+
'Select and download: https://llm-coding.github.io/Semantic-Anchors/#/contracts'
264+
)
265+
lines.push('')
266+
267+
for (const contract of contracts) {
268+
lines.push(`## ${contract.title}`)
269+
lines.push('')
270+
lines.push(contract.template)
271+
lines.push('')
272+
if (contract.anchors && contract.anchors.length > 0) {
273+
lines.push(`*Referenced anchors: ${contract.anchors.join(', ')}*`)
274+
lines.push('')
275+
}
276+
}
277+
278+
lines.push('---')
279+
console.warn(
280+
` Including ${contracts.length} Semantic Contracts in llms.txt`
281+
)
282+
}
283+
} catch {
284+
// contracts.json not found — skip
285+
}
286+
243287
const output = lines.join('\n')
244288
fs.writeFileSync(path.join(ROOT, 'website/public/llms.txt'), output, 'utf-8')
245289
const kb = Math.round(Buffer.byteLength(output, 'utf-8') / 1024)

website/public/llms.txt

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

website/src/translations/de.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"nav.more": "Mehr",
1515
"nav.contracts": "Contracts",
1616
"contracts.title": "Semantic Contracts",
17-
"contracts.explanation": "Semantic Anchors referenzieren öffentliches Wissen, das LLMs bereits kennen. Aber die Konventionen, Templates und Definitionen deines Teams? Dafür braucht es Semantic Contracts. Ein Contract kombiniert etablierte Anker zu projektspezifischen Konventionen — wähle die passenden aus und lade sie für deine AGENTS.md oder CLAUDE.md herunter.",
17+
"contracts.explanation": "Semantic Anchors referenzieren öffentliches Wissen, das LLMs bereits kennen. Aber die Konventionen, Templates und Definitionen deines Teams? Dafür braucht es Semantic Contracts. Ein Contract definiert, was ein Begriff in deinem Projekt bedeutet — entweder durch Komposition etablierter Anker oder durch eigene Definitionen, die nur in deinem Team existieren. Wähle die passenden aus und lade sie für deine AGENTS.md oder CLAUDE.md herunter.",
1818
"contracts.linkedinLink": "Lies die ganze Geschichte hinter Semantic Contracts auf LinkedIn \u2192",
1919
"contracts.download": "semantic-contracts.md herunterladen",
2020
"contracts.selectAll": "Alle auswählen",

website/src/translations/en.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"nav.more": "More",
1515
"nav.contracts": "Contracts",
1616
"contracts.title": "Semantic Contracts",
17-
"contracts.explanation": "Semantic Anchors reference public knowledge that LLMs already understand. But your team's conventions, templates, and definitions? Those need Semantic Contracts. A contract composes established anchors into project-specific conventions — select the ones that fit your team and download them for your AGENTS.md or CLAUDE.md.",
17+
"contracts.explanation": "Semantic Anchors reference public knowledge that LLMs already understand. But your team's conventions, templates, and definitions? Those need Semantic Contracts. A contract defines what a term means in your project — either by composing established anchors or by providing custom definitions that only exist within your team. Select the ones that fit and download them for your AGENTS.md or CLAUDE.md.",
1818
"contracts.linkedinLink": "Read the full story behind Semantic Contracts on LinkedIn \u2192",
1919
"contracts.download": "Download semantic-contracts.md",
2020
"contracts.selectAll": "Select all",

0 commit comments

Comments
 (0)