Skip to content

Commit a120525

Browse files
committed
added CLAUDE.md
1 parent 2128e66 commit a120525

File tree

1 file changed

+269
-0
lines changed

1 file changed

+269
-0
lines changed

CLAUDE.md

Lines changed: 269 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,269 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Project Overview
6+
7+
This is the official documentation repository for the Nette PHP framework ecosystem. It contains technical documentation for 31 packages across 16+ languages, written in Texy markup format and published at nette.org, doc.nette.org, latte.nette.org, tester.nette.org, and tracy.nette.org.
8+
9+
## CRITICAL: Language Version Rules
10+
11+
**⚠️ MOST IMPORTANT: All edits and changes MUST ONLY be made to `/cs/` and `/en/` language versions!**
12+
13+
### Strict Synchronization Requirements
14+
15+
1. **Edit only `/cs/` and `/en/` versions** - Never directly edit other language variants (de, fr, es, ru, etc.)
16+
2. **Perfect line alignment** - `/cs/` and `/en/` must have identical line counts and structure
17+
- Same information must be on the same line number in both versions
18+
- Example: Line 14 in `application/en/presenters.texy` corresponds to line 14 in `application/cs/presenters.texy`
19+
- Both files must have exactly the same number of lines (e.g., both have 510 lines)
20+
3. **Same file sets** - `/cs/` and `/en/` must contain exactly the same `.texy` files
21+
4. **Automatic translation** - Other language variants (de, fr, es, etc.) are translated automatically from `/en/` or `/cs/` using DeepL
22+
5. **Verification** - Use `php verifyLineAlignment.php` to check line synchronization across language versions
23+
24+
### Why This Matters
25+
26+
The translation system relies on line-by-line correspondence between `/cs/` and `/en/`. When these versions are perfectly aligned:
27+
- Automated translation tools can map content accurately
28+
- Changes propagate correctly to all 16+ language variants
29+
- Documentation consistency is maintained across all languages
30+
31+
**Before any edit:**
32+
- Check that both `/cs/` and `/en/` files exist
33+
- Ensure line counts match: `wc -l package/en/file.texy package/cs/file.texy`
34+
- Make parallel changes to maintain synchronization
35+
36+
## Documentation Structure
37+
38+
Documentation is organized by package, language, and article:
39+
40+
```
41+
<package>/
42+
├── en/ # English version (primary language)
43+
├── cs/ # Czech version
44+
├── de/, fr/, ... # Other language variants
45+
├── files/ # Shared images and assets
46+
└── meta.json # Package metadata (version, repo, composer name)
47+
```
48+
49+
### Complete Package Inventory (31 packages, 233 files in /en)
50+
51+
**Nette Framework:** (subdomain https://doc.nette.org)
52+
- `application/` - MVC framework, presenters, routing, components
53+
- `assets/` - Asset management and Vite integration
54+
- `bootstrap/` - Application initialization and configuration
55+
- `caching/` - Caching mechanisms
56+
- `component-model/` - Component system and lifecycle
57+
- `database/` - Database access layer, Explorer, transactions (subdomain https://doc.nette.org)
58+
- `dependency-injection/` - DI container, autowiring, services
59+
- `forms/` - Form creation, validation, rendering
60+
- `http/` - HTTP request/response, sessions, URLs
61+
- `mail/` - Email sending
62+
- `neon/` - NEON format parser
63+
- `nette/` - Main documentation hub, glossary, installation
64+
- `php-generator/` - PHP code generation
65+
- `robot-loader/` - Automatic class loader
66+
- `safe-stream/` - Safe stream handling
67+
- `security/` - Authentication, authorization, passwords
68+
- `schema/` - Schema validation and generation
69+
- `utils/` - Arrays, strings, filesystem, validation, datetime
70+
71+
**Key Projects from Nette Ecosystem:**
72+
- `ai/` - Nette AI (subdomain https://ai.nette.org)
73+
- `latte/` - Templating engine v3.0+ with `/cookbook/` subdirectory (only package with nested structure) (subdomain https://latte.nette.org)
74+
- `tracy/` - Debugger, dumper, extensions (subdomain https://tracy.nette.org)
75+
- `tester/` - Testing framework with assertions and TestCase (subdomain https://tester.nette.org)
76+
77+
**Supporting:** (subdomain https://doc.nette.org)
78+
- `best-practices/` - Development patterns and recipes
79+
- `code-checker/` - Code quality checker tool
80+
- `contributing/` - Contribution guidelines and documentation standards
81+
- `migrations/` - version upgrades
82+
- `quickstart/` - Getting started tutorial
83+
- `www/` - Website content, logo, license, packages (subdomain https://nette.org)
84+
85+
**Others:**
86+
- `texy/` - Texy markup language processor (The project is not directly part of Nette, it is only located on the subdomain https://texy.nette.org)
87+
- `dibi/` - Dibi database abstraction layer (The project is not directly part of Nette, it is only located on the subdomain https://dibi.nette.org)
88+
89+
**Structure notes:**
90+
- All packages include `@home.texy` (entry point) and `@meta.texy` (metadata)
91+
- Most packages include `@left-menu.texy` or `@menu.texy` for navigation
92+
93+
**Branch structure:**
94+
- `master` - Current documentation (latest versions)
95+
- `doc-3.x` - Version 3.x documentation
96+
- `doc-2.x` - Legacy 2.x documentation
97+
98+
## File Format
99+
100+
Documentation uses **Texy markup** (`.texy` files), a custom markup language for structured content. Files contain headings, paragraphs, and code blocks parsed by the utilities in the root directory.
101+
102+
## Texy Documentation Modifiers
103+
104+
Use these modifiers when documenting API elements in `.texy` files:
105+
106+
**Methods** - use `[method]` modifier:
107+
```texy
108+
static fromBlank(int $width, int $height, ?ImageColor $color=null): Image .[method]
109+
-----------------------------------------------------------------------------------
110+
Creates a new true color image of the given dimensions. The default color is black.
111+
```
112+
113+
**Latte filters** - use `[filter]` modifier:
114+
```texy
115+
batch(int $length, mixed $item): array .[filter]
116+
------------------------------------------------
117+
Filter that simplifies outputting linear data in table form.
118+
```
119+
120+
**New features** - use `{data-version:X.Y}` modifier with version number:
121+
```texy
122+
New great feature .{data-version:3.1}
123+
-------------------------------------
124+
Description of the feature.
125+
```
126+
127+
**Deprecated items** - use `[deprecated]` modifier (without version number):
128+
```texy
129+
static rgb(int $red, int $green, int $blue, int $transparency=0): array .[method][deprecated]
130+
---------------------------------------------------------------------------------------------
131+
This function has been replaced by the `ImageColor` class.
132+
```
133+
134+
**Combined modifiers** (e.g., new filter):
135+
```texy
136+
accept .[filter]{data-version:3.1}
137+
----------------------------------
138+
Filter used during migration from Latte 3.0 to confirm behavior change acceptance.
139+
```
140+
141+
## Headings and Anchors
142+
143+
All headings automatically generate URL anchors based on their text. This allows linking directly to any section.
144+
145+
**Automatic anchors:**
146+
- Heading "Installing Claude Code" → anchor `#installing-claude-code`
147+
- Heading "What's Next" → anchor `#what-s-next`
148+
149+
**Linking to sections:**
150+
```texy
151+
See [installation guide |getting-started#installing-claude-code] for details.
152+
```
153+
154+
**Custom anchors** - use `.{#anchor-name}` modifier when you need a specific anchor:
155+
```texy
156+
Installing Claude Code .{#Installing}
157+
===============
158+
```
159+
160+
This is useful when:
161+
- The automatic anchor would be too long or unclear
162+
- You want a stable anchor that won't change if you rename the heading
163+
- You need to match an existing link from another page
164+
165+
## Documentation Guidelines
166+
167+
Follow Nette's documentation standards:
168+
- Start with simple concepts, progress to advanced topics
169+
- Test all code examples for accuracy
170+
- Use clear, concise language
171+
- Minimal use of highlighting and special formatting
172+
- Adhere to [Coding Standard] in code examples
173+
174+
English is the primary language. Use DeepL Translator for translations, which will be reviewed by contributors.
175+
176+
## Writing Style
177+
178+
Nette documentation is known for its **friendly, approachable language** that remains **technically precise**. This style is a core part of the Nette brand and must be maintained across all documentation.
179+
180+
### Key Principles
181+
182+
1. **Friendly and approachable** – Write as if explaining to a colleague, not writing a technical manual
183+
2. **Completely understandable** – No assumed knowledge; explain every concept when first introduced
184+
3. **Technically accurate** – Use precise terminology and correct examples
185+
4. **Only brief where clarity allows** – Never sacrifice understanding for brevity
186+
187+
### Good vs Bad Examples
188+
189+
**Good example:**
190+
> MCP Inspector allows AI to look directly at your application – to see what services you have registered, what tables are in your database, and what routes lead where. Without this, the AI would have to guess based on patterns it learned during training.
191+
192+
**Bad example:**
193+
> MCP Inspector provides runtime introspection via DI container, database schema, and router inspection tools.
194+
195+
The good example explains what the tool does and why it matters. The bad example is technically correct but assumes the reader already understands the concepts.
196+
197+
### Tone Guidelines
198+
199+
- Use "you" and "your" to address the reader directly
200+
- Use "we" when walking through steps together ("Let's start by...")
201+
- Explain the "why" not just the "what"
202+
- Use concrete examples instead of abstract descriptions
203+
- Anticipate questions and answer them proactively
204+
- Avoid jargon; when technical terms are necessary, explain them
205+
206+
### Structure Guidelines
207+
208+
- Start each page with a `.[perex]` or `<div class=perex>` (for multiple paragraphs) summary that explains what the reader will learn
209+
- Use clear, descriptive headings that tell the reader what each section contains
210+
- Break complex topics into digestible sections
211+
- Use code examples liberally – they're often clearer than prose
212+
- End sections with "What's Next" links when appropriate
213+
214+
## Common Tasks
215+
216+
**Adding a new documentation page:**
217+
1. **CRITICAL:** Create `.texy` file in BOTH `/en/` AND `/cs/` directories
218+
2. Ensure both files have the same structure and line count
219+
3. Follow existing structure (headings, code blocks, paragraphs)
220+
4. Add code examples with proper syntax highlighting
221+
5. Verify line alignment: `wc -l package/en/file.texy package/cs/file.texy`
222+
8. Run code-checker before committing
223+
224+
**Editing existing documentation:**
225+
1. **CRITICAL:** Edit ONLY `/cs/` and `/en/` versions - never edit de, fr, es, ru, etc.
226+
2. Make parallel changes to both `/cs/` and `/en/` files
227+
3. Maintain identical line counts - add/remove lines in both files simultaneously
228+
4. Keep the same information on the same line numbers
229+
6. Other language variants will be updated automatically by the translation system
230+
231+
### Example: Correct Way to Edit Documentation
232+
233+
**❌ WRONG - Editing only one language:**
234+
```bash
235+
# Don't do this!
236+
vim application/en/presenters.texy
237+
# Edit only English version
238+
# Save and commit
239+
```
240+
241+
**✅ CORRECT - Editing both synchronized versions:**
242+
```bash
243+
# Check current line counts
244+
wc -l application/en/presenters.texy application/cs/presenters.texy
245+
# Output: 510 application/en/presenters.texy
246+
# 510 application/cs/presenters.texy
247+
248+
# Edit both files in parallel
249+
vim application/en/presenters.texy application/cs/presenters.texy
250+
251+
# After editing, verify line counts still match
252+
wc -l application/en/presenters.texy application/cs/presenters.texy
253+
# Output should still be: 510 510
254+
```
255+
256+
**Example of line-by-line correspondence:**
257+
```
258+
application/en/presenters.texy:
259+
Line 1: Presenters
260+
Line 14: [We already know...
261+
Line 510: (last line)
262+
263+
application/cs/presenters.texy:
264+
Line 1: Presentery
265+
Line 14: [Už víme...
266+
Line 510: (last line)
267+
```
268+
269+
Both files have identical structure, same number of lines, same information on corresponding lines - only the language differs.

0 commit comments

Comments
 (0)