|
| 1 | +# Repository Guidelines |
| 2 | + |
| 3 | +## Project Structure |
| 4 | + |
| 5 | +- `docs/`: VitePress course site content. |
| 6 | +- `docs/.vitepress/`: site configuration and theme overrides. |
| 7 | +- `docs/public/`: static assets copied to the final site. |
| 8 | +- `docs/en/`: English translation stubs (mirror of Chinese structure). |
| 9 | +- `code/`: runnable Python experiments aligned with chapters. |
| 10 | +- `scripts/`: repo maintenance scripts such as sitemap, verification, and asset optimization. |
| 11 | +- `.github/workflows/`: deployment workflow for GitHub Pages. |
| 12 | + |
| 13 | +## Commands |
| 14 | + |
| 15 | +```bash |
| 16 | +npm install |
| 17 | +npm run dev # dev server with asset optimization |
| 18 | +npm run dev:fast # dev server skipping asset optimization (~5s startup) |
| 19 | +npm run build |
| 20 | +npm run preview |
| 21 | +npm run verify |
| 22 | +npm run assets:optimize |
| 23 | +``` |
| 24 | + |
| 25 | +## Editing Rules |
| 26 | + |
| 27 | +- Keep changes scoped. Do not rewrite unrelated docs or config. |
| 28 | +- Prefer adding new course material under `docs/` and updating sidebar/nav in `docs/.vitepress/config.mjs`. |
| 29 | +- Run `npm run verify` before pushing if you touched config, theme, or build scripts. |
| 30 | +- When adding/moving/renaming pages, update both Chinese and English sidebars if applicable. |
| 31 | + |
| 32 | +## TikZ → SVG Workflow |
| 33 | + |
| 34 | +For academic-style diagrams with proper LaTeX math rendering: |
| 35 | + |
| 36 | +1. Write the diagram as a `standalone` TikZ document (see `docs/preface/images/actor-critic.tex` for style reference) |
| 37 | +2. Compile: `xelatex <file>.tex && pdf2svg <file>.pdf <file>.svg` |
| 38 | +3. Keep both `.tex` (source) and `.svg` (output) in the same `images/` directory |
| 39 | +4. Reference the `.svg` from markdown with `<img src="./images/<name>.svg">` |
| 40 | + |
| 41 | +Style: rounded-corner boxes (`draw=black!70, fill=black!3`), Stealth arrows, Songti SC font, `$...$` for math. |
| 42 | + |
| 43 | +## Writing Conventions |
| 44 | + |
| 45 | +- Write docs as tutorial and lecture material, not as terse reference notes. |
| 46 | +- **Direct and concise**: No guiding filler like "用...做解释会更直观". Present the example or formula directly. |
| 47 | +- **No redundancy**: Avoid saying the same thing twice in different words. |
| 48 | +- **No vague qualifiers**: Replace metaphors ("相当于...") and hedging ("由于...") with precise causal statements. |
| 49 | +- **Follow the causal line**: Do not circle around the same point with "first summarize, then restate, then contrast". Write in the order the idea actually changes: new capability or setting appears → it changes the training/problem object → this enables or forces a new formulation. |
| 50 | +- When opening a new concept, prefer the pattern "有了新的 X,系统会 Y,于是可以/必须 Z". Avoid unnecessary callbacks to previous chapters unless they are needed for the next sentence. |
| 51 | +- Avoid slogan-like summary phrases such as "一问一答一打分", "骨架始终未变", "系统地扩展", or "完全不涉及". State the concrete mechanism instead. |
| 52 | +- Avoid AI-like error lists. Instead of listing many parallel mistakes ("query 太宽、没比价、库存错、参数错"), describe the process and show how an early wrong state propagates into later actions. |
| 53 | +- Prefer Chinese terms in Chinese prose. Use "一段回答" instead of "completion", "奖励" instead of "reward", "动作掩码" instead of "action mask", "逐步记录/逐步优势" instead of "step-level record/advantage". Keep English only when it is a standard acronym or the local chapter title requires it, and explain it in Chinese. |
| 54 | +- Match the narrative style of Chapter 3.1 and 3.2: conversational, patient, and problem-driven. |
| 55 | +- Open sections by connecting to what the learner already knows, then name the new problem the section solves. |
| 56 | +- Use concrete scenes before abstractions: examples like CartPole, multi-armed bandits, LLM generation, game tasks, and everyday choices should make the concept feel necessary. |
| 57 | +- Prefer a guided lecture voice. Use phrases like "Let's start with the intuition", "Look at it from another angle", "What this step means is…", "The real issue is…", while keeping the tone serious and precise. |
| 58 | +- Maintain textbook prose for course material. Avoid chatty, assistant-like, slogan-like, or casual internet phrasing; write as a polished Chinese textbook chapter. |
| 59 | +- Ensure every conceptual step has a textbook-style transition. Do not jump directly from a definition to a formula, term, algorithm, or conclusion; explain why the next idea is needed before introducing it. |
| 60 | +- Avoid encyclopedia-style exposition that only lists definitions. Definitions should appear after motivation and should be followed by interpretation. |
| 61 | +- Keep formulas close to their meaning: explain every important symbol, then restate the formula in plain English. |
| 62 | +- Avoid the "不是……而是……" / "not A, but B" contrast pattern. It makes the prose feel indirect. State the positive claim directly, then explain the reason. |
| 63 | +- Let paragraphs flow from question to answer. Good sections often follow this rhythm: familiar example → confusion or tension → formal tool → worked example → takeaway. |
| 64 | +- Use bold sparingly to mark conceptual pivots, not decoration. |
| 65 | +- Explain ideas progressively: intuition first, then formal definitions, then code or practice. |
| 66 | +- Prefer learner-facing prose in Chinese, with concrete examples, small derivations, and explicit transitions. |
| 67 | +- When introducing formulas or algorithms, state what problem they solve before showing the notation. |
| 68 | +- Keep paragraphs teachable and paced for reading aloud or self-study. |
| 69 | +- Use short sections and explicit headings. |
| 70 | +- Use kebab-case for paths under `docs/`. |
| 71 | +- Prefer directory-based routes with `index.md`. |
| 72 | + |
| 73 | +## Commit Style |
| 74 | + |
| 75 | +- Use Conventional Commits such as `feat:`, `fix:`, `docs:`, `chore:`. |
0 commit comments