|
| 1 | +# Agent.md |
| 2 | + |
| 3 | +Guidelines for AI assistants that create or update documentation in this repository. |
| 4 | + |
| 5 | +## Scope and Intent |
| 6 | + |
| 7 | +- Repository: `dynamsoft-docs/web-twain-docs` |
| 8 | +- Product: Dynamic Web TWAIN documentation |
| 9 | +- Primary goal: produce accurate, consistent Markdown docs that match existing repo conventions. |
| 10 | +- Keep changes focused. Do not mix docs updates with local tooling/script changes unless explicitly requested. |
| 11 | + |
| 12 | +## Branching and PR Base |
| 13 | + |
| 14 | +- For normal docs work, branch from `preview` unless a different base is explicitly requested. |
| 15 | +- Keep each PR focused on one topic (for example: one FAQ issue, one API clarification, one guide update). |
| 16 | +- Avoid unrelated edits, formatting-only churn, and broad timestamp sweeps. |
| 17 | + |
| 18 | +## File Placement |
| 19 | + |
| 20 | +- FAQ pages live in `_articles/faq/`. |
| 21 | +- General guides live in `_articles/general-usage/` or `_articles/extended-usage/`. |
| 22 | +- API reference pages live in `_articles/info/api/`. |
| 23 | +- When adding a new FAQ, also update `_articles/faq/index.md`. |
| 24 | + |
| 25 | +## Frontmatter Rules |
| 26 | + |
| 27 | +Use existing files in the same folder as the source of truth. |
| 28 | + |
| 29 | +### FAQ page template |
| 30 | + |
| 31 | +```yaml |
| 32 | +--- |
| 33 | +layout: default-layout |
| 34 | +noTitleIndex: true |
| 35 | +needAutoGenerateSidebar: true |
| 36 | +title: <question> |
| 37 | +keywords: Dynamic Web TWAIN, <topic keywords> |
| 38 | +breadcrumbText: <same as title> |
| 39 | +description: <same as title, or concise variant> |
| 40 | +date: YYYY-MM-DD HH:mm:ss +0800 |
| 41 | +last_modified: YYYY-MM-DD HH:mm:ss +0800 |
| 42 | +--- |
| 43 | +``` |
| 44 | + |
| 45 | +### Non-FAQ docs template (common) |
| 46 | + |
| 47 | +```yaml |
| 48 | +--- |
| 49 | +layout: default-layout |
| 50 | +needAutoGenerateSidebar: true |
| 51 | +title: <page title> |
| 52 | +keywords: Dynamic Web TWAIN, <topic keywords> |
| 53 | +breadcrumbText: <short breadcrumb label> |
| 54 | +description: <concise summary> |
| 55 | +--- |
| 56 | +``` |
| 57 | + |
| 58 | +Notes: |
| 59 | +- `noTitleIndex` is common for FAQ and selected index-style pages; match nearby files. |
| 60 | +- If updating an existing FAQ, update `last_modified` to current edit time and keep the existing date format. |
| 61 | +- Keep timezone format consistent with the target file (many files use `+0800`; some newer files use `-08:00`). |
| 62 | + |
| 63 | +## FAQ Content Pattern |
| 64 | + |
| 65 | +For `_articles/faq/*.md`, match this structure: |
| 66 | + |
| 67 | +1. Category H1 (for example `# Addon`, `# Security`, `# Capture/Image Source`) |
| 68 | +2. Question H2 (`## ...?`) |
| 69 | +3. Direct answer first |
| 70 | +4. Steps or code sample if applicable |
| 71 | +5. Optional notes (`> [!NOTE]`) and related links |
| 72 | + |
| 73 | +Keep answers practical and implementation-oriented. |
| 74 | + |
| 75 | +## Writing Style |
| 76 | + |
| 77 | +- Be concise, technical, and specific. |
| 78 | +- Prefer product terminology already used in repo: |
| 79 | + - `DWTObject` |
| 80 | + - `LoadImage()` / `LoadImageEx()` |
| 81 | + - `SetReaderOptions()` |
| 82 | + - `OnPostLoad` |
| 83 | +- Do not introduce unsupported behavior claims. |
| 84 | +- Do not mention internal tickets, private case history, or customer-identifying details in public docs. |
| 85 | + |
| 86 | +## Linking and API References |
| 87 | + |
| 88 | +- Use internal absolute doc links like: |
| 89 | + - `/_articles/info/api/WebTwain_IO.md#loadimageex` |
| 90 | +- Link API names to canonical API pages when mentioning methods/events. |
| 91 | +- Prefer existing anchor patterns used in nearby docs. |
| 92 | +- Keep external links to official pages only when necessary. |
| 93 | + |
| 94 | +## Code Snippet Rules |
| 95 | + |
| 96 | +- Use fenced code blocks with language tags (typically `javascript`, `html`, `bash`). |
| 97 | +- Keep snippets minimal but runnable. |
| 98 | +- Reuse existing coding style from surrounding docs: |
| 99 | + - 4-space indentation in JS snippets is common. |
| 100 | + - `DWTObject` naming is preferred in examples. |
| 101 | + |
| 102 | +## Safety and Accuracy Checks |
| 103 | + |
| 104 | +Before submitting changes: |
| 105 | + |
| 106 | +1. Verify every method/event name against `_articles/info/api/`. |
| 107 | +2. Verify error code/value statements against docs or validated support guidance. |
| 108 | +3. Ensure links resolve and anchors are valid. |
| 109 | +4. Ensure new FAQ is added to `_articles/faq/index.md` in the correct section. |
| 110 | +5. Ensure git diff includes only intended docs files. |
| 111 | + |
| 112 | +## Do Not Do |
| 113 | + |
| 114 | +- Do not edit local development scripts (`scripts/*.sh`, local-only files) for a docs-only task unless asked. |
| 115 | +- Do not reformat large unrelated sections. |
| 116 | +- Do not rename files casually; preserve existing URL paths. |
| 117 | +- Do not add AI/meta commentary into user-facing docs. |
0 commit comments