codeforge-dev 1.7.0 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/.devcontainer/.env +4 -6
  2. package/.devcontainer/.env.example +29 -0
  3. package/.devcontainer/.gitignore +8 -0
  4. package/.devcontainer/.secrets.example +12 -0
  5. package/.devcontainer/CHANGELOG.md +130 -0
  6. package/.devcontainer/CLAUDE.md +56 -19
  7. package/.devcontainer/README.md +111 -56
  8. package/.devcontainer/config/{main-system-prompt.md → defaults/main-system-prompt.md} +72 -0
  9. package/.devcontainer/config/file-manifest.json +20 -0
  10. package/.devcontainer/devcontainer.json +20 -0
  11. package/.devcontainer/docs/configuration-reference.md +90 -0
  12. package/.devcontainer/docs/keybindings.md +100 -0
  13. package/.devcontainer/docs/optional-features.md +129 -0
  14. package/.devcontainer/docs/plugins.md +154 -0
  15. package/.devcontainer/docs/troubleshooting.md +128 -0
  16. package/.devcontainer/features/agent-browser/install.sh +6 -0
  17. package/.devcontainer/features/ast-grep/install.sh +6 -0
  18. package/.devcontainer/features/biome/README.md +27 -0
  19. package/.devcontainer/features/biome/install.sh +6 -0
  20. package/.devcontainer/features/ccburn/install.sh +6 -0
  21. package/.devcontainer/features/ccstatusline/devcontainer-feature.json +5 -0
  22. package/.devcontainer/features/ccstatusline/install.sh +7 -0
  23. package/.devcontainer/features/ccusage/install.sh +6 -0
  24. package/.devcontainer/features/claude-monitor/install.sh +6 -0
  25. package/.devcontainer/features/dprint/README.md +30 -0
  26. package/.devcontainer/features/dprint/devcontainer-feature.json +18 -0
  27. package/.devcontainer/features/dprint/install.sh +131 -0
  28. package/.devcontainer/features/hadolint/README.md +35 -0
  29. package/.devcontainer/features/hadolint/devcontainer-feature.json +13 -0
  30. package/.devcontainer/features/hadolint/install.sh +86 -0
  31. package/.devcontainer/features/lsp-servers/devcontainer-feature.json +5 -0
  32. package/.devcontainer/features/lsp-servers/install.sh +7 -0
  33. package/.devcontainer/features/mcp-qdrant/devcontainer-feature.json +5 -0
  34. package/.devcontainer/features/mcp-qdrant/install.sh +13 -6
  35. package/.devcontainer/features/mcp-reasoner/devcontainer-feature.json +5 -0
  36. package/.devcontainer/features/mcp-reasoner/install.sh +8 -1
  37. package/.devcontainer/features/notify-hook/devcontainer-feature.json +5 -0
  38. package/.devcontainer/features/notify-hook/install.sh +7 -0
  39. package/.devcontainer/features/ruff/README.md +26 -0
  40. package/.devcontainer/features/ruff/devcontainer-feature.json +21 -0
  41. package/.devcontainer/features/ruff/install.sh +74 -0
  42. package/.devcontainer/features/shellcheck/README.md +38 -0
  43. package/.devcontainer/features/shellcheck/devcontainer-feature.json +13 -0
  44. package/.devcontainer/features/shellcheck/install.sh +24 -0
  45. package/.devcontainer/features/shfmt/README.md +37 -0
  46. package/.devcontainer/features/shfmt/devcontainer-feature.json +13 -0
  47. package/.devcontainer/features/shfmt/install.sh +85 -0
  48. package/.devcontainer/features/splitrail/devcontainer-feature.json +5 -0
  49. package/.devcontainer/features/splitrail/install.sh +7 -0
  50. package/.devcontainer/features/tmux/install.sh +8 -0
  51. package/.devcontainer/features/tree-sitter/install.sh +6 -0
  52. package/.devcontainer/plugins/devs-marketplace/.claude-plugin/marketplace.json +3 -10
  53. package/.devcontainer/plugins/devs-marketplace/plugins/auto-formatter/.claude-plugin/plugin.json +1 -1
  54. package/.devcontainer/plugins/devs-marketplace/plugins/auto-formatter/scripts/__pycache__/format-on-stop.cpython-314.pyc +0 -0
  55. package/.devcontainer/plugins/devs-marketplace/plugins/auto-formatter/scripts/format-on-stop.py +114 -9
  56. package/.devcontainer/plugins/devs-marketplace/plugins/auto-linter/.claude-plugin/plugin.json +1 -1
  57. package/.devcontainer/plugins/devs-marketplace/plugins/auto-linter/hooks/hooks.json +4 -5
  58. package/.devcontainer/plugins/devs-marketplace/plugins/auto-linter/scripts/__pycache__/lint-file.cpython-314.pyc +0 -0
  59. package/.devcontainer/plugins/devs-marketplace/plugins/auto-linter/scripts/lint-file.py +478 -76
  60. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/.claude-plugin/plugin.json +1 -1
  61. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/AGENT-REDIRECTION.md +226 -0
  62. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/architect.md +17 -0
  63. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/bash-exec.md +4 -4
  64. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/claude-guide.md +14 -23
  65. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/debug-logs.md +2 -0
  66. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/dependency-analyst.md +2 -0
  67. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/doc-writer.md +13 -0
  68. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/explorer.md +2 -0
  69. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/generalist.md +10 -1
  70. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/migrator.md +6 -0
  71. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/refactorer.md +4 -0
  72. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/spec-writer.md +36 -23
  73. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/statusline-config.md +3 -3
  74. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/test-writer.md +3 -0
  75. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/hooks/hooks.json +39 -0
  76. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/__pycache__/advisory-test-runner.cpython-314.pyc +0 -0
  77. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/__pycache__/collect-edited-files.cpython-314.pyc +0 -0
  78. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/__pycache__/commit-reminder.cpython-314.pyc +0 -0
  79. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/__pycache__/git-state-injector.cpython-314.pyc +0 -0
  80. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/__pycache__/redirect-builtin-agents.cpython-314.pyc +0 -0
  81. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/__pycache__/ticket-linker.cpython-314.pyc +0 -0
  82. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/__pycache__/todo-harvester.cpython-314.pyc +0 -0
  83. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/advisory-test-runner.py +174 -0
  84. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/collect-edited-files.py +8 -6
  85. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/commit-reminder.py +90 -0
  86. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/git-state-injector.py +114 -0
  87. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/skill-suggester.py +61 -0
  88. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/ticket-linker.py +137 -0
  89. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/todo-harvester.py +130 -0
  90. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/api-design/SKILL.md +224 -0
  91. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/api-design/references/error-handling.md +166 -0
  92. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/api-design/references/rest-conventions.md +215 -0
  93. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/ast-grep-patterns/SKILL.md +211 -0
  94. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/ast-grep-patterns/references/language-patterns.md +327 -0
  95. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/dependency-management/SKILL.md +134 -0
  96. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/dependency-management/references/ecosystem-commands.md +264 -0
  97. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/dependency-management/references/license-compliance.md +80 -0
  98. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/documentation-patterns/SKILL.md +153 -0
  99. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/documentation-patterns/references/api-doc-templates.md +221 -0
  100. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/documentation-patterns/references/docstring-formats.md +296 -0
  101. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/migration-patterns/SKILL.md +150 -0
  102. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/migration-patterns/references/javascript-migrations.md +179 -0
  103. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/migration-patterns/references/python-migrations.md +141 -0
  104. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/specification-writing/SKILL.md +32 -0
  105. package/.devcontainer/plugins/devs-marketplace/plugins/dangerous-command-blocker/scripts/__pycache__/block-dangerous.cpython-314.pyc +0 -0
  106. package/.devcontainer/plugins/devs-marketplace/plugins/notify-hook/hooks/hooks.json +1 -1
  107. package/.devcontainer/plugins/devs-marketplace/plugins/protected-files-guard/scripts/__pycache__/guard-protected.cpython-314.pyc +0 -0
  108. package/.devcontainer/scripts/check-setup.sh +72 -0
  109. package/.devcontainer/scripts/setup-aliases.sh +43 -3
  110. package/.devcontainer/scripts/setup-auth.sh +74 -0
  111. package/.devcontainer/scripts/setup-config.sh +112 -22
  112. package/.devcontainer/scripts/setup-update-claude.sh +8 -0
  113. package/.devcontainer/scripts/setup.sh +46 -13
  114. package/README.md +23 -190
  115. package/package.json +1 -1
  116. package/setup.js +245 -71
  117. package/.devcontainer/features/claude-code/README.md +0 -498
  118. package/.devcontainer/features/claude-code/config/settings.json +0 -72
  119. package/.devcontainer/features/claude-code/config/system-prompt.md +0 -118
  120. package/.devcontainer/features/claude-code/config/world-building-sp.md +0 -1432
  121. package/.devcontainer/features/claude-code/devcontainer-feature.json +0 -42
  122. package/.devcontainer/features/claude-code/install.sh +0 -466
  123. package/.devcontainer/plugins/devs-marketplace/plugins/planning-reminder/.claude-plugin/plugin.json +0 -7
  124. package/.devcontainer/plugins/devs-marketplace/plugins/planning-reminder/hooks/hooks.json +0 -17
  125. package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/.claude-plugin/plugin.json +0 -6
  126. package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/config/planning-instructions.md +0 -14
  127. package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/functional-conjuring-map.md +0 -989
  128. package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/hooks/hooks.json +0 -33
  129. package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/scripts/__pycache__/post-enhance-task.cpython-314.pyc +0 -0
  130. package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/scripts/enhance-planning.py +0 -71
  131. package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/scripts/enhancers/enhance-plan.sh +0 -68
  132. package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/scripts/enhancers/enhance-task.sh +0 -120
  133. package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/scripts/post-enhance-plan.py +0 -133
  134. package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/scripts/post-enhance-task.py +0 -253
  135. /package/.devcontainer/config/{keybindings.json → defaults/keybindings.json} +0 -0
  136. /package/.devcontainer/config/{settings.json → defaults/settings.json} +0 -0
@@ -0,0 +1,80 @@
1
+ # License Compliance Reference
2
+
3
+ ## License Classification
4
+
5
+ | Category | Licenses | SPDX IDs | Obligations |
6
+ |----------|----------|----------|-------------|
7
+ | **Permissive** | MIT, BSD 2-Clause, BSD 3-Clause, Apache 2.0, ISC, Unlicense, CC0, Zlib | `MIT`, `BSD-2-Clause`, `BSD-3-Clause`, `Apache-2.0`, `ISC`, `Unlicense`, `CC0-1.0`, `Zlib` | Attribution in LICENSE file. Minimal restrictions. |
8
+ | **Weak Copyleft** | LGPL 2.1, LGPL 3.0, MPL 2.0, EPL 2.0 | `LGPL-2.1-only`, `LGPL-3.0-only`, `MPL-2.0`, `EPL-2.0` | Modifications to the library itself must be shared. Using as a dependency is fine. |
9
+ | **Strong Copyleft** | GPL 2.0, GPL 3.0, AGPL 3.0 | `GPL-2.0-only`, `GPL-3.0-only`, `AGPL-3.0-only` | Derivative works must use the same license. AGPL extends to network use. |
10
+ | **Non-Commercial** | CC BY-NC, various | `CC-BY-NC-4.0` | Cannot use in commercial products. |
11
+ | **Unknown / Custom** | Proprietary, no license, custom terms | — | Requires legal review. No license = all rights reserved by default. |
12
+
13
+ ---
14
+
15
+ ## Commercial Usage Implications
16
+
17
+ ### Permissive Licenses (Low Risk)
18
+
19
+ Safe for all use cases including proprietary/commercial software. Main obligation is preserving copyright notices and license text, typically in a NOTICES or LICENSE file.
20
+
21
+ Apache 2.0 additionally includes a patent grant — it protects users from patent claims by contributors.
22
+
23
+ ### Weak Copyleft (Medium Risk)
24
+
25
+ Safe when used as a **library dependency** without modification. If you modify the library's source code, those modifications must be released under the same license. Dynamic linking is generally safe; static linking may trigger copyleft depending on the license.
26
+
27
+ **MPL 2.0** is file-level copyleft — only modified files need to be shared, not the entire project.
28
+
29
+ ### Strong Copyleft (High Risk)
30
+
31
+ **GPL**: Any software that links to or includes GPL code may be considered a derivative work, requiring the entire project to be released under GPL. This is incompatible with proprietary/closed-source distribution.
32
+
33
+ **AGPL**: Same as GPL, but also triggered by providing the software as a network service (SaaS). If users interact with AGPL code over a network, you must provide source code access.
34
+
35
+ **Impact on SaaS**: AGPL is the highest-risk license for SaaS products. A single AGPL dependency can require releasing your entire service's source code.
36
+
37
+ ### No License / Unknown
38
+
39
+ Code without a license defaults to **all rights reserved**. You have no legal right to use, modify, or distribute it. Flag these for immediate review and either:
40
+ - Contact the author to request a license
41
+ - Replace the dependency with a licensed alternative
42
+
43
+ ---
44
+
45
+ ## Common License Conflicts
46
+
47
+ | Combination | Compatible? | Notes |
48
+ |-------------|-------------|-------|
49
+ | MIT + Apache-2.0 | Yes | Both permissive, no conflict |
50
+ | MIT + GPL-3.0 | One-way | GPL project can include MIT code; MIT project cannot include GPL code without becoming GPL |
51
+ | Apache-2.0 + GPL-2.0 | No | Patent clause conflict. Apache-2.0 is compatible with GPL-3.0 but not GPL-2.0 |
52
+ | LGPL + Proprietary | Yes (with care) | Use as a library via dynamic linking. Do not modify LGPL source in your codebase |
53
+ | GPL + Proprietary | No | Cannot combine in a single distributed work |
54
+ | AGPL + SaaS | Problematic | Network use triggers source disclosure |
55
+ | Any + Unlicensed | No | No license = no permission to use |
56
+
57
+ ---
58
+
59
+ ## Recommended Actions by Risk Level
60
+
61
+ | Risk Level | Action |
62
+ |-----------|--------|
63
+ | **Permissive only** | No action needed. Ensure LICENSE/NOTICES file includes all attributions. |
64
+ | **Weak copyleft present** | Verify the dependency is used as a library without source modifications. Document in compliance notes. |
65
+ | **Strong copyleft present** | Escalate to legal/management. Evaluate whether the dependency can be replaced. Document the dependency chain. |
66
+ | **AGPL in SaaS context** | Treat as critical. Either replace the dependency or prepare for source disclosure. |
67
+ | **Unknown/missing license** | Block the dependency. Do not use code without explicit license grants. |
68
+ | **License changed in update** | Check license changes before upgrading — some packages have changed from permissive to restrictive between versions. |
69
+
70
+ ---
71
+
72
+ ## Detection Patterns
73
+
74
+ Search for license information in this order:
75
+ 1. `LICENSE`, `LICENSE.md`, `LICENSE.txt` in the package root
76
+ 2. `license` field in `package.json` (Node.js)
77
+ 3. `license` field in `Cargo.toml` (Rust)
78
+ 4. `License` classifier in `pyproject.toml` or `setup.py` (Python)
79
+ 5. SPDX identifier in source file headers
80
+ 6. Package registry metadata (npm registry, PyPI, crates.io)
@@ -0,0 +1,153 @@
1
+ ---
2
+ name: documentation-patterns
3
+ description: >-
4
+ This skill should be used when the user asks to "write a README",
5
+ "write documentation", "add docstrings", "add JSDoc", "document the API",
6
+ "create architecture docs", "documentation template", "update the docs",
7
+ or discusses docstring formats, README structure, API documentation,
8
+ inline comments, or technical writing patterns.
9
+ version: 0.1.0
10
+ ---
11
+
12
+ # Documentation Patterns
13
+
14
+ ## Mental Model
15
+
16
+ Documentation has **audiences**. README for new users, API docs for integrators, architecture docs for maintainers, inline docs for contributors. Wrong audience = wrong documentation. Before writing, identify who will read it and what they need to accomplish.
17
+
18
+ **Key principles:**
19
+ - **Accuracy over completeness.** Inaccurate documentation is worse than missing documentation. Only document behavior verified by reading code. Mark uncertainty with `TODO: verify`.
20
+ - **Audience determines format.** A README walks someone through getting started. An API reference lists every parameter with types. An architecture doc explains why decisions were made. Don't mix formats.
21
+ - **Code is the source of truth.** Never copy code into documentation — reference file paths instead. Copied snippets rot as soon as the source changes.
22
+ - **Concise, specific, active voice.** "Returns a list of users" not "A list of users is returned by this function." Cut filler words entirely.
23
+ - **Show, don't tell.** A working example communicates more than three paragraphs of explanation.
24
+
25
+ ---
26
+
27
+ ## Documentation Types and Audiences
28
+
29
+ | Type | Audience | Purpose | Format |
30
+ |------|----------|---------|--------|
31
+ | **README** | New users, evaluators | What is this? How do I use it? | Markdown, top-level |
32
+ | **API Reference** | Integrators, consumers | Every endpoint/function with types and examples | Markdown or OpenAPI |
33
+ | **Architecture** | Maintainers, new team members | How the system works and why | Markdown with diagrams |
34
+ | **Inline (docstrings)** | Contributors, IDE users | What this function does, parameters, returns | Language-specific format |
35
+ | **Changelog** | Users, upgraders | What changed between versions | Markdown, keep-a-changelog format |
36
+ | **Configuration** | Operators, deployers | All config options with types and defaults | Markdown table or .env.example |
37
+
38
+ ---
39
+
40
+ ## README Structure
41
+
42
+ Answer five questions, in order:
43
+
44
+ ### 1. What is this?
45
+
46
+ One paragraph. Project name, what it does, who it is for. No jargon. If someone reads only this paragraph, they should know whether to keep reading.
47
+
48
+ ### 2. How do I install it?
49
+
50
+ Prerequisites (with exact versions), installation steps, environment setup. Copy-pasteable commands.
51
+
52
+ ### 3. How do I use it?
53
+
54
+ Quick start example. Show the simplest possible usage that produces a visible result. Include the expected output.
55
+
56
+ ### 4. How do I configure it?
57
+
58
+ Table of configuration options: name, type, required/optional, default, description. Environment variables, config files, CLI flags.
59
+
60
+ ### 5. How do I contribute?
61
+
62
+ Development setup, how to run tests, how to submit changes. Link to CONTRIBUTING.md for details.
63
+
64
+ ---
65
+
66
+ ## Sizing Rules
67
+
68
+ Documentation files consumed by AI tools (CLAUDE.md, specs, architecture docs) should be **≤200 lines** each. Split large documents by concern. Each file should be independently useful.
69
+
70
+ For human-facing docs (README, API reference), there is no hard limit, but prefer shorter docs that link to detailed sub-pages over monolithic documents.
71
+
72
+ ---
73
+
74
+ ## Style Principles
75
+
76
+ 1. **Concise** — "To configure..." not "In order to configure...". Cut "basically", "simply", "just", "actually".
77
+ 2. **Specific** — Use exact types, values, and names. "`api_key` (string, required)" not "pass a key."
78
+ 3. **Accurate** — Document only verified behavior. Mark uncertainty with `TODO: verify`.
79
+ 4. **Active voice** — "The function returns a list" not "A list is returned."
80
+ 5. **Show, don't tell** — Code examples over prose explanations.
81
+ 6. **Consistent** — Match the project's existing documentation style for tense, format, and conventions.
82
+ 7. **Audience-appropriate** — README uses everyday language. API docs use technical precision. Architecture docs explain rationale.
83
+
84
+ ---
85
+
86
+ ## Inline Documentation Strategy
87
+
88
+ ### When to Document
89
+
90
+ Document every **public** function, class, and module. Skip private/internal helpers unless their behavior is non-obvious.
91
+
92
+ Priority order:
93
+ 1. Public API functions and methods
94
+ 2. Class/module-level docstrings
95
+ 3. Complex algorithms (inline comments explaining *why*)
96
+ 4. Configuration and constants with non-obvious values
97
+
98
+ ### Style Detection
99
+
100
+ Before adding docstrings, check which style the project already uses:
101
+
102
+ ```
103
+ # Python — look for existing patterns
104
+ Grep: """ → Google-style or NumPy-style
105
+ Grep: :param → Sphinx/reStructuredText
106
+ Grep: Parameters\n---------- → NumPy-style
107
+
108
+ # JavaScript/TypeScript
109
+ Grep: @param → JSDoc/TSDoc
110
+ Grep: @returns → JSDoc/TSDoc
111
+
112
+ # Go
113
+ Grep: ^// [A-Z].*function → godoc convention
114
+
115
+ # Rust
116
+ Grep: /// → rustdoc
117
+ Grep: //! → module-level rustdoc
118
+ ```
119
+
120
+ Follow the existing style. If no docstrings exist, use the language's recommended default.
121
+
122
+ ---
123
+
124
+ ## Verification
125
+
126
+ Before finalizing documentation:
127
+
128
+ 1. **Every command is correct** — Try running install commands, API examples, and code snippets against the actual project.
129
+ 2. **Every path exists** — Reference only files that actually exist in the codebase.
130
+ 3. **Every parameter matches the code** — Check function signatures against the documented parameters.
131
+ 4. **Links work** — Verify internal references and external URLs.
132
+ 5. **Version numbers are current** — Check package versions in install commands.
133
+
134
+ ---
135
+
136
+ ## Ambiguity Policy
137
+
138
+ | Ambiguity | Default |
139
+ |-----------|---------|
140
+ | **Audience not specified** | Write for the most common audience for the doc type (README → new users, docstrings → contributors) |
141
+ | **Scope not specified** | Document the public API surface; skip internals |
142
+ | **Format not specified** | Follow existing project conventions; fall back to language defaults |
143
+ | **Level of detail** | Include parameters, return values, and one example per function |
144
+ | **Behavior uncertain** | Mark with `TODO: verify — [specific question]` rather than guessing |
145
+
146
+ ---
147
+
148
+ ## Reference Files
149
+
150
+ | File | Contents |
151
+ |------|----------|
152
+ | [Docstring Formats](references/docstring-formats.md) | Complete templates for Python (Google, NumPy, Sphinx), TypeScript/JavaScript (JSDoc, TSDoc), Go (godoc), and Rust (rustdoc) with detection patterns |
153
+ | [API Doc Templates](references/api-doc-templates.md) | REST endpoint documentation template, request/response examples, parameter tables, error documentation, OpenAPI annotation patterns, and Mermaid diagram quick reference |
@@ -0,0 +1,221 @@
1
+ # API Documentation Templates
2
+
3
+ ## REST Endpoint Documentation
4
+
5
+ Use this template for each API endpoint:
6
+
7
+ ### Template
8
+
9
+ ```markdown
10
+ ## [Method] [Path]
11
+
12
+ [One-sentence description of what this endpoint does.]
13
+
14
+ ### Request
15
+
16
+ **URL Parameters:**
17
+
18
+ | Name | Type | Required | Description |
19
+ |------|------|----------|-------------|
20
+ | `id` | string | Yes | The resource identifier |
21
+
22
+ **Query Parameters:**
23
+
24
+ | Name | Type | Required | Default | Description |
25
+ |------|------|----------|---------|-------------|
26
+ | `limit` | integer | No | 20 | Maximum results to return (1-100) |
27
+ | `cursor` | string | No | — | Pagination cursor from previous response |
28
+
29
+ **Request Body:**
30
+
31
+ | Field | Type | Required | Description | Constraints |
32
+ |-------|------|----------|-------------|-------------|
33
+ | `name` | string | Yes | Display name | 1-100 characters |
34
+ | `email` | string | Yes | Email address | Valid email format |
35
+
36
+ **Example Request:**
37
+
38
+ \```bash
39
+ curl -X POST https://api.example.com/v1/users \
40
+ -H "Authorization: Bearer sk-abc123" \
41
+ -H "Content-Type: application/json" \
42
+ -d '{
43
+ "name": "Jane Doe",
44
+ "email": "jane@example.com"
45
+ }'
46
+ \```
47
+
48
+ ### Response
49
+
50
+ **Success (201 Created):**
51
+
52
+ \```json
53
+ {
54
+ "id": "usr_abc123",
55
+ "name": "Jane Doe",
56
+ "email": "jane@example.com",
57
+ "created_at": "2024-01-15T10:30:00Z"
58
+ }
59
+ \```
60
+
61
+ **Error Responses:**
62
+
63
+ | Status | Type | When |
64
+ |--------|------|------|
65
+ | 400 | validation-error | Invalid request body |
66
+ | 401 | authentication-required | Missing or expired token |
67
+ | 409 | resource-conflict | Email already registered |
68
+ | 429 | rate-limit-exceeded | Too many requests |
69
+ ```
70
+
71
+ ---
72
+
73
+ ## Parameter Table Format
74
+
75
+ Always include these columns for parameters:
76
+
77
+ | Column | Purpose |
78
+ |--------|---------|
79
+ | **Name** | Parameter name as it appears in code |
80
+ | **Type** | Data type (string, integer, boolean, array, object) |
81
+ | **Required** | Yes / No |
82
+ | **Default** | Default value if optional (— if none) |
83
+ | **Description** | What this parameter does |
84
+ | **Constraints** | Validation rules (min/max, regex, enum values) |
85
+
86
+ ### Example
87
+
88
+ | Name | Type | Required | Default | Description | Constraints |
89
+ |------|------|----------|---------|-------------|-------------|
90
+ | `page_size` | integer | No | 20 | Results per page | 1–100 |
91
+ | `status` | string | No | — | Filter by status | `active`, `inactive`, `pending` |
92
+ | `created_after` | string | No | — | Filter by creation date | ISO 8601 format |
93
+
94
+ ---
95
+
96
+ ## Request / Response Examples
97
+
98
+ ### curl
99
+
100
+ ```bash
101
+ curl -X GET "https://api.example.com/v1/users?status=active&limit=10" \
102
+ -H "Authorization: Bearer sk-abc123" \
103
+ -H "Accept: application/json"
104
+ ```
105
+
106
+ ### httpie
107
+
108
+ ```bash
109
+ http GET https://api.example.com/v1/users \
110
+ status==active limit==10 \
111
+ Authorization:"Bearer sk-abc123"
112
+ ```
113
+
114
+ ### Python (requests)
115
+
116
+ ```python
117
+ import requests
118
+
119
+ response = requests.get(
120
+ "https://api.example.com/v1/users",
121
+ params={"status": "active", "limit": 10},
122
+ headers={"Authorization": "Bearer sk-abc123"},
123
+ )
124
+ data = response.json()
125
+ ```
126
+
127
+ ---
128
+
129
+ ## Error Response Documentation
130
+
131
+ Document every error code an endpoint can return:
132
+
133
+ ```markdown
134
+ ### Errors
135
+
136
+ | Status | Error Type | Description | Example Detail |
137
+ |--------|-----------|-------------|---------------|
138
+ | 400 | `validation-error` | Request body is malformed | "Missing required field: 'name'" |
139
+ | 401 | `authentication-required` | Token missing or expired | "Access token has expired" |
140
+ | 403 | `insufficient-permissions` | Valid token, wrong scope | "Requires 'admin' scope" |
141
+ | 404 | `resource-not-found` | Resource doesn't exist | "No user with ID 'usr_999'" |
142
+ | 409 | `resource-conflict` | Duplicate or state conflict | "Email already registered" |
143
+ | 422 | `unprocessable-entity` | Valid syntax, invalid data | "Age must be positive" |
144
+ | 429 | `rate-limit-exceeded` | Too many requests | "Retry after 30 seconds" |
145
+ ```
146
+
147
+ ---
148
+
149
+ ## OpenAPI / Swagger Annotations
150
+
151
+ ### Python (FastAPI)
152
+
153
+ ```python
154
+ @router.post(
155
+ "/users",
156
+ response_model=UserResponse,
157
+ status_code=201,
158
+ summary="Create a new user",
159
+ description="Registers a new user account with the provided details.",
160
+ responses={
161
+ 409: {"description": "Email already registered"},
162
+ 422: {"description": "Validation error"},
163
+ },
164
+ )
165
+ async def create_user(user: UserCreate) -> UserResponse:
166
+ ```
167
+
168
+ ### TypeScript (NestJS / Swagger)
169
+
170
+ ```typescript
171
+ @ApiOperation({ summary: 'Create a new user' })
172
+ @ApiResponse({ status: 201, description: 'User created', type: UserResponse })
173
+ @ApiResponse({ status: 409, description: 'Email already registered' })
174
+ @Post('users')
175
+ async createUser(@Body() dto: CreateUserDto): Promise<UserResponse> {
176
+ ```
177
+
178
+ ---
179
+
180
+ ## Mermaid Diagram Quick Reference
181
+
182
+ ### Sequence Diagram
183
+
184
+ ```mermaid
185
+ sequenceDiagram
186
+ participant C as Client
187
+ participant A as API
188
+ participant D as Database
189
+ C->>A: POST /users
190
+ A->>D: INSERT user
191
+ D-->>A: user record
192
+ A-->>C: 201 Created
193
+ ```
194
+
195
+ ### Flowchart
196
+
197
+ ```mermaid
198
+ flowchart TD
199
+ A[Request] --> B{Authenticated?}
200
+ B -->|No| C[401 Unauthorized]
201
+ B -->|Yes| D{Valid Input?}
202
+ D -->|No| E[422 Validation Error]
203
+ D -->|Yes| F[Process Request]
204
+ F --> G[200 OK]
205
+ ```
206
+
207
+ ### Entity Relationship
208
+
209
+ ```mermaid
210
+ erDiagram
211
+ USER ||--o{ ORDER : places
212
+ ORDER ||--|{ LINE_ITEM : contains
213
+ PRODUCT ||--o{ LINE_ITEM : "ordered in"
214
+ ```
215
+
216
+ ### Tips
217
+
218
+ - Keep diagrams **under 10 nodes**. Split complex flows into multiple diagrams.
219
+ - Use descriptive labels on arrows (not just `-->` but `-->|description|`).
220
+ - Mermaid renders in GitHub, VS Code preview, and most documentation platforms.
221
+ - For architecture diagrams, prefer `flowchart` over `graph` (flowchart is the newer syntax).