The Nine Articles of Development
Specification-Driven Development (SDD)
_Skils-Code - test
I. Library-First Principle: Každá funkce musí začít jako samostatná knihovna. Žádný kód se nepíše přímo do aplikace, dokud není abstrahován do znovupoužitelné komponenty.
II. CLI Interface Mandate: Každá knihovna musí mít CLI rozhraní (stdin/stdout/JSON), což zajišťuje testovatelnost a pozorovatelnost.
III. Test-First Imperative: Žádný kód před testy (TDD). Testy musí být schváleny uživatelem a musí selhat (Red phase) před samotnou implementací.
IV. Integration Testing: Důraz na testy kontraktů a komunikaci mezi službami (vychází z šablon Spec-Kitu).
V. Observability: Vše musí být dohledatelné přes textové I/O; povinné strukturované logování.
VI. Versioning & Breaking Changes: Důsledné sémantické verzování a správa zpětné kompatibility.
VII. Simplicity (Minimal Project Structure): Maximálně 3 projekty pro počáteční implementaci; žádné "future-proofing" (nadbytečné plánování do budoucna).
VIII. Anti-Abstraction (Framework Trust): Používání funkcí frameworku přímo bez vytváření zbytečných obalů (wrappery).
IX. Integration-First Testing: Preference reálných prostředí (databáze, služby) před mockováním (předstíráním).
### The Nine Articles of Development
The constitution defines nine articles that shape every aspect of the development process:
#### Article I: Library-First Principle
Every feature must begin as a standalone library—no exceptions. This forces modular design from the start: ```text
Every feature in Specify MUST begin its existence as a standalone library.
No feature shall be implemented directly within application code without
first being abstracted into a reusable library component.
```
This principle ensures that specifications generate modular, reusable code rather than monolithic applications. When the LLM generates an implementation plan, it must structure features as libraries with clear boundaries and minimal dependencies.
#### Article II: CLI Interface Mandate
Every library must expose its functionality through a command-line interface:
```text
All CLI interfaces MUST:
- Accept text as input (via stdin, arguments, or files)
- Produce text as output (via stdout)
- Support JSON format for structured data exchange
```
This enforces observability and testability. The LLM cannot hide functionality inside opaque classes—everything must be accessible and verifiable through text-based interfaces.
#### Article III: Test-First Imperative
The most transformative article—no code before tests:
```text
This is NON-NEGOTIABLE: All implementation MUST follow strict Test-Driven Development.
No implementation code shall be written before:
1. Unit tests are written
2. Tests are validated and approved by the user
3. Tests are confirmed to FAIL (Red phase)
```
This completely inverts traditional AI code generation. Instead of generating code and hoping it works, the LLM must first generate comprehensive tests that define behavior, get them approved, and only then generate implementation.
#### Articles VII & VIII: Simplicity and Anti-Abstraction
These paired articles combat over-engineering:
```text
Section 7.3: Minimal Project Structure
- Maximum 3 projects for initial implementation
- Additional projects require documented justification
Section 8.1: Framework Trust
- Use framework features directly rather than wrapping them
```
When an LLM might naturally create elaborate abstractions, these articles force it to justify every layer of complexity. The implementation plan template's "Phase -1 Gates" directly enforce these principles.
#### Simplicity Gate (Article VII)
- [ ] Using ≤3 projects?
- [ ] No future-proofing?
#### Anti-Abstraction Gate (Article VIII)
- [ ] Using framework directly?
- [ ] Single model representation?
#### Integration-First Gate (Article IX)
- [ ] Contracts defined?
- [ ] Contract tests written?
```
#### Article IX: Integration-First Testing
Prioritizes real-world testing over isolated unit tests:
```text
Tests MUST use realistic environments:
- Prefer real databases over mocks
- Use actual service instances over stubs
- Contract tests mandatory before implementation
```
This ensures generated code works in practice, not just in theory.
### Constitutional Enforcement Through Templates
The implementation plan template operationalizes these articles through concrete checkpoints:
```markdown
### Phase -1: Pre-Implementation Gates
These gates act as compile-time checks for architectural principles. The LLM cannot proceed without either passing the gates or documenting justified exceptions in the "Complexity Tracking" section.
Žádné komentáře:
Okomentovat