@plaited/development-skills 0.6.2 → 0.6.4

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.
@@ -1,57 +1,31 @@
1
- <!--
2
- RULE TEMPLATE - Distributed via scaffold-rules skill
3
- Variables: {{LINK:testing}}, {{#if development-skills}}
4
- -->
1
+ # Accuracy
5
2
 
6
- # Accuracy and Confidence Standards
3
+ **95% confidence threshold** - Report uncertainty rather than guess
7
4
 
8
- **Confidence Threshold**: 95% - Report uncertainty rather than guess
9
-
10
- ## Verification Protocol
11
-
12
- 1. **Verification First**: Before stating any specific implementation detail (function signature, file path, API schema), read the relevant file in real-time to verify accuracy.
13
-
14
- 2. **Handling Uncertainty**: If you cannot verify information or find contradictions between instructions and live code, you must NOT provide speculative answers.
15
- - **Action**: Clearly state you cannot answer with high confidence and explain the discrepancy.
16
- - Example: "I cannot confirm [detail] because my instructions indicate [X], but the current file shows [Y]. My knowledge may be outdated."
17
-
18
- 3. **Dynamic Exploration**:
19
- {{#if development-skills}}
20
- - **For TypeScript/JavaScript projects**: When @plaited/development-skills is installed, prefer LSP tools for type-aware verification:
21
- - Use `lsp-find` to search for symbols, types, and patterns across the workspace
22
- - Use `lsp-refs` to find all usages of a symbol
23
- - Use `lsp-hover` to verify type signatures
24
- - Use `lsp-analyze` for batch analysis of file structure
25
- {{/if}}
26
- - Use Read tool for direct file verification
27
- - Use Grep/Glob for content and pattern searches
28
- - Always prioritize live code over instructions
29
-
30
- 4. **Tool-Assisted Verification**: Use available tools to enhance verification accuracy:
31
- {{#if development-skills}}
32
- - **TypeScript LSP tools** (when available): Use for type-aware analysis of `.ts`, `.tsx`, `.js`, `.jsx` files
33
- - Available via `bunx @plaited/development-skills lsp-*` commands
34
- {{/if}}
35
- - **WebFetch**: Retrieve current documentation from authoritative sources (MDN Web Docs, WHATWG specs) when using web platform APIs
36
- - These tools complement (but do not replace) reading live code - always verify outputs against actual implementation
37
-
38
- ## Certainty Requirements
39
-
40
- You may only propose a specific change if you are **at least 95% certain** it is correct, based on direct comparison with current code.
5
+ **Verification first** - Read files before stating implementation details
6
+ *Verify:* Did you read the file before commenting on it?
41
7
 
42
8
  **When uncertain:**
43
- - Report the discrepancy clearly
44
- - State why you cannot confidently recommend a fix
45
- - Present the issue to the user for manual resolution
46
- - DO NOT invent solutions or infer changes
47
-
48
- ## For Agent-Specific Applications
49
-
50
- Agents should apply these standards to their specific domain:
51
-
52
- - **Documentation agents**: Only update TSDoc if parameter names/types match current code
53
- - **Architecture agents**: Verify referenced patterns exist in current codebase
54
- - **Code review agents**: Read files before commenting on implementation details
55
- - **Pattern agents**: Confirm examples reflect actual usage in codebase
56
-
57
- For verification in test contexts, see {{LINK:testing}}.
9
+ - State the discrepancy clearly
10
+ - Explain why you can't confidently recommend a fix
11
+ - Present issue to user for resolution
12
+ - Never invent solutions
13
+
14
+ **TypeScript verification** - Use LSP tools for type-aware analysis:
15
+ - `lsp-find` - Search symbols across workspace
16
+ - `lsp-refs` - Find all usages before modifying
17
+ - `lsp-hover` - Verify type signatures
18
+ - `lsp-analyze` - Batch analysis of file structure
19
+
20
+ **Dynamic exploration:**
21
+ - Read tool for direct file verification
22
+ - Grep/Glob for content and pattern searches
23
+ - Prioritize live code over cached knowledge
24
+
25
+ **Agent-specific applications:**
26
+ - Documentation: Only update TSDoc if types match current code
27
+ - Architecture: Verify patterns exist in codebase
28
+ - Code review: Read files before commenting
29
+ - Patterns: Confirm examples reflect actual usage
30
+
31
+ See .plaited/rules/testing.md for verification in test contexts.
@@ -0,0 +1,29 @@
1
+ # Bun APIs
2
+
3
+ **Prefer Bun over Node.js** when running in Bun environment.
4
+
5
+ **File system:**
6
+ - `Bun.file(path).exists()` not `fs.existsSync()`
7
+ - `Bun.file(path).text()` not `readFileSync()`
8
+ - `Bun.write(path, data)` not `writeFileSync()`
9
+ *Verify:* `grep 'from .node:fs' src/`
10
+ *Fix:* Replace with Bun.file/Bun.write
11
+
12
+ **Shell commands:**
13
+ - `Bun.$\`cmd\`` not `child_process.spawn()`
14
+ *Verify:* `grep 'child_process' src/`
15
+ *Fix:* Replace with Bun.$ template literal
16
+
17
+ **Path resolution:**
18
+ - `Bun.resolveSync()` for module resolution
19
+ - `import.meta.dir` for current directory
20
+ - Keep `node:path` for join/resolve/dirname
21
+ *Verify:* Check for `process.cwd()` misuse
22
+
23
+ **Executables:**
24
+ - `Bun.which(cmd)` to check if command exists
25
+ - `Bun.$\`bun add pkg\`` for package management
26
+
27
+ **When Node.js OK:** readline (interactive input), node:path utilities, APIs without Bun equivalents
28
+
29
+ **Docs:** https://bun.sh/docs
@@ -0,0 +1,43 @@
1
+ # Core Conventions
2
+
3
+ **Type over interface** - `type User = {` instead of `interface User {`
4
+ *Verify:* `lsp-find interface` or `grep 'interface [A-Z]' src/`
5
+ *Fix:* Replace `interface X {` with `type X = {`
6
+
7
+ **No any types** - Use `unknown` with type guards
8
+ *Verify:* `grep ': any' src/`
9
+ *Fix:* Replace `any` with `unknown`, add type guard
10
+
11
+ **PascalCase types** - `type UserConfig`, schemas get `Schema` suffix: `UserConfigSchema`
12
+ *Verify:* `lsp-find` for lowercase type names
13
+ *Fix:* Rename to PascalCase
14
+
15
+ **Arrow functions** - Prefer `const fn = () =>` over `function fn()`
16
+ *Verify:* `grep 'function \w' src/`
17
+ *Fix:* Convert to arrow function
18
+
19
+ **Object params >2 args** - `fn({ a, b, c }: { ... })` not `fn(a, b, c)`
20
+ *Exception:* CLI entry points take `args: string[]`
21
+ *Verify:* Review function signatures with `lsp-hover`
22
+
23
+ **Private fields** - Use `#field` (ES2022) not `private field` (TypeScript)
24
+ *Verify:* `grep 'private \w' src/`
25
+ *Fix:* Replace `private x` with `#x`
26
+
27
+ **JSON imports** - `import x from 'file.json' with { type: 'json' }`
28
+ *Verify:* `grep "from.*\.json['\"]" src/` (check for missing `with`)
29
+ *Fix:* Add `with { type: 'json' }`
30
+
31
+ **@ts-ignore needs description** - `// @ts-ignore - reason here`
32
+ *Verify:* `grep '@ts-ignore' src/` (check for missing comment)
33
+
34
+ **Short-circuit/ternary OK** - `condition && doSomething()` is acceptable
35
+
36
+ **Empty interface extending single** - `interface Custom extends Base {}` is OK for branded types
37
+
38
+ **Mermaid diagrams only** - No ASCII box-drawing in markdown
39
+ *Verify:* `grep '[┌│└─]' *.md`
40
+
41
+ **No @example in TSDoc** - Tests are living examples
42
+
43
+ **AgentSkills validation** - `bunx @plaited/development-skills validate-skill <path>`
@@ -1,41 +1,23 @@
1
- # Documentation Standards
1
+ # Documentation
2
2
 
3
- ## TSDoc Requirements
4
-
5
- Public APIs require comprehensive TSDoc documentation following these conventions:
6
-
7
- - **No `@example` sections** - Tests serve as living examples
8
- - **Use `@internal` marker** - Mark non-public APIs explicitly
9
- - **Always use `type`** - Prefer type aliases over interfaces
10
-
11
- ### TSDoc Template
3
+ **TSDoc required** for public APIs
12
4
 
5
+ **Template:**
13
6
  ```typescript
14
7
  /**
15
- * Brief description of what this does
8
+ * Brief description
16
9
  *
17
10
  * @remarks
18
- * Additional context, usage notes, or implementation details.
11
+ * Additional context
19
12
  *
20
- * @param options - Description of the parameter
21
- * @returns Description of return value
13
+ * @param options - Description
14
+ * @returns Description
22
15
  *
23
16
  * @public
24
17
  */
25
18
  ```
26
19
 
27
- ## Diagrams
28
-
29
- Use Mermaid diagrams only (not ASCII art):
30
-
31
- ```markdown
32
- \```mermaid
33
- flowchart TD
34
- A[Start] --> B[Process]
35
- B --> C[End]
36
- \```
37
- ```
38
-
39
- **Avoid**: ASCII box-drawing characters (`┌`, `│`, `└`, `─`, etc.)
40
-
41
- **Rationale:** Token efficiency, clearer semantic meaning, easier maintenance.
20
+ **No @example** - Tests are living examples
21
+ **Use @internal** - Mark non-public APIs
22
+ **Mermaid only** - No ASCII box-drawing diagrams
23
+ *Verify:* `grep '[┌│└─]' *.md`
@@ -0,0 +1,27 @@
1
+ # Module Organization
2
+
3
+ **No index.ts** - Never use index files, they create implicit magic
4
+ *Verify:* `find . -name 'index.ts'`
5
+ *Fix:* Rename to feature name: `feature/index.ts` → `feature.ts` at parent level
6
+
7
+ **Explicit .ts extensions** - `import { x } from './file.ts'` not `'./file'`
8
+ *Verify:* `grep "from '\./.*[^s]'" src/` (imports without .ts)
9
+ *Fix:* Add `.ts` extension
10
+
11
+ **Re-export at boundaries** - Parent `feature.ts` re-exports from `feature/feature.ts`
12
+ ```
13
+ src/
14
+ ├── acp/ # Feature module
15
+ │ └── acp.ts # Implementation
16
+ └── acp.ts # Re-exports public API
17
+ ```
18
+
19
+ **File organization within modules:**
20
+ - `feature.types.ts` - Type definitions only
21
+ - `feature.schemas.ts` - Zod schemas + `z.infer<>` types
22
+ - `feature.constants.ts` - Constants, error codes
23
+ - `feature.ts` - Main implementation
24
+
25
+ **Direct imports** - Import from specific files, not through re-exports within module
26
+ *Verify:* Check for circular imports
27
+ *Fix:* Import directly: `from './feature.types.ts'` not `from './feature.ts'`
@@ -1,200 +1,30 @@
1
1
  # Testing
2
2
 
3
- Use Bun's built-in test runner for unit and integration tests.
3
+ **Use test not it** - `test('description', ...)` instead of `it('...')`
4
+ *Verify:* `grep '\bit(' src/**/*.spec.ts`
5
+ *Fix:* Replace `it(` with `test(`
4
6
 
5
- ## Test Types
7
+ **No conditional assertions** - Never `if (x) expect(x.value)`
8
+ *Verify:* `grep 'if.*expect\|&&.*expect' src/**/*.spec.ts`
9
+ *Fix:* Assert condition first: `expect(x).toBeDefined(); expect(x.value)...`
6
10
 
7
- ### Unit/Integration Tests (`*.spec.ts`)
11
+ **Test both branches** - Try/catch, conditionals, fallbacks need both paths tested
12
+ *Verify:* Review test coverage for error paths
13
+ *Fix:* Add test for catch block, else branch, fallback case
8
14
 
9
- Standard Bun tests using `*.spec.ts` extension:
10
- - Run with `bun test` command
11
- - Used for testing business logic, utilities, and non-visual functionality
15
+ **Use real dependencies** - Prefer installed packages over mocks when testing module resolution
16
+ *Verify:* Review test imports for fake paths
17
+ *Fix:* Use actual package like `@modelcontextprotocol/sdk/client`
12
18
 
13
- ## Running Tests
19
+ **Organize with describe** - Group related tests in `describe('feature', () => {...})`
20
+ *Verify:* Check for flat test structure
21
+ *Fix:* Add describe blocks by category (happy path, edge cases, errors)
14
22
 
15
- ```bash
16
- # Run all unit tests
17
- bun test
23
+ **Coverage checklist** - Happy path, edge cases, error paths, real integrations
24
+ *Verify:* Review test file completeness
18
25
 
19
- # Run a specific spec test file
20
- bun test path/to/file.spec.ts
26
+ **Docker tests** - `*.docker.ts` for external APIs, run via docker-compose
27
+ *Verify:* Check if test needs API key or external service
28
+ *Fix:* Rename to `.docker.ts`, update CI gating
21
29
 
22
- # Run tests matching a pattern
23
- bun test pattern
24
- ```
25
-
26
- ## Test Style Conventions
27
-
28
- ### Use `test` Instead of `it`
29
-
30
- Use `test` instead of `it` in test files for consistency:
31
-
32
- ```typescript
33
- // ✅ Good
34
- test('should create ACP client correctly', () => {
35
- // ...
36
- })
37
-
38
- // ❌ Avoid
39
- it('should create ACP client correctly', () => {
40
- // ...
41
- })
42
- ```
43
-
44
- ## Anti-Patterns
45
-
46
- ### No Conditionals Around Assertions
47
-
48
- Never wrap assertions in conditionals. Tests should fail explicitly, not silently skip assertions.
49
-
50
- ```typescript
51
- // ❌ WRONG: Conditional assertion
52
- if (result) {
53
- expect(result.value).toBe(expected)
54
- }
55
-
56
- // ❌ WRONG: Optional chaining with assertion
57
- result?.value && expect(result.value).toBe(expected)
58
-
59
- // ✅ CORRECT: Assert the condition, then assert the value
60
- expect(result).toBeDefined()
61
- expect(result.value).toBe(expected)
62
-
63
- // ✅ CORRECT: Use type narrowing assertion
64
- expect(result).not.toBeNull()
65
- expect(result!.value).toBe(expected)
66
- ```
67
-
68
- If a value might not exist, the test should either:
69
- 1. Assert that it exists first, then check its value
70
- 2. Assert that it doesn't exist (if that's the expected behavior)
71
- 3. Restructure the test to ensure the value is always present
72
-
73
- ## Test Coverage Principles
74
-
75
- ### Expansion Checklist
76
-
77
- When writing tests, ensure coverage of:
78
-
79
- - [ ] **Happy path** - Expected normal usage
80
- - [ ] **Edge cases** - Empty strings, special characters, boundary values
81
- - [ ] **Fallback paths** - What happens when try/catch catches?
82
- - [ ] **Real dependencies** - Use installed packages (e.g., `@modelcontextprotocol/sdk`) not fake paths
83
- - [ ] **Category organization** - Group related tests in `describe` blocks
84
-
85
- ### Meaningful Test Coverage
86
-
87
- Tests should verify behavior, not just exercise code. Each test should answer: "What breaks if this test fails?"
88
-
89
- **Coverage priorities:**
90
- 1. **Happy path** - Normal expected usage
91
- 2. **Edge cases** - Boundary conditions, empty inputs, unusual formats
92
- 3. **Error paths** - Invalid inputs, missing dependencies, fallback behavior
93
- 4. **Real integrations** - Use actual installed packages when testing module resolution
94
-
95
- ### Use Real Dependencies
96
-
97
- When testing features that interact with packages or the file system, prefer real installed packages over mocked/fake paths:
98
-
99
- ```typescript
100
- // ✅ Good: Real scoped package with subpath exports
101
- test('resolves scoped package subpath', () => {
102
- const result = resolveFilePath('@modelcontextprotocol/sdk/client')
103
- expect(result).toContain('node_modules/@modelcontextprotocol/sdk')
104
- })
105
-
106
- // ✅ Good: Real package deep subpath
107
- test('resolves deep subpath with extension', () => {
108
- const result = resolveFilePath('@modelcontextprotocol/sdk/server/auth/middleware/bearerAuth.js')
109
- expect(result).toContain('bearerAuth')
110
- })
111
- ```
112
-
113
- ### Test Both Branches
114
-
115
- When code has conditional logic, try/catch, or fallbacks, test both paths:
116
-
117
- ```typescript
118
- describe('package resolution', () => {
119
- test('success: resolves existing package', () => {
120
- const result = resolveFilePath('typescript')
121
- expect(result).toContain('node_modules/typescript')
122
- })
123
-
124
- test('fallback: returns cwd path for non-existent package', () => {
125
- const result = resolveFilePath('nonexistent-package')
126
- expect(result).toBe(join(cwd, 'nonexistent-package'))
127
- })
128
- })
129
- ```
130
-
131
- ### Organize with Describe Blocks
132
-
133
- Group tests by category for better readability and failure diagnosis:
134
-
135
- ```typescript
136
- describe('resolveFilePath', () => {
137
- describe('absolute paths', () => {
138
- test('returns as-is', () => { /* ... */ })
139
- })
140
-
141
- describe('relative paths with extension', () => {
142
- test('resolves ./ paths', () => { /* ... */ })
143
- test('resolves ../ paths', () => { /* ... */ })
144
- })
145
-
146
- describe('scoped package specifiers', () => {
147
- test('resolves subpath exports', () => { /* ... */ })
148
- test('falls back for non-existent', () => { /* ... */ })
149
- })
150
- })
151
- ```
152
-
153
- ## Docker Integration Tests
154
-
155
- Tests that require external services or API keys can run in Docker containers for consistent, isolated execution.
156
-
157
- ### File Naming
158
-
159
- - **`*.docker.ts`**: Tests that run in Docker containers
160
- - These are excluded from `bun test` and run separately via Docker Compose
161
-
162
- ### Running Docker Tests
163
-
164
- ```bash
165
- # Run with Docker Compose (requires API key)
166
- ANTHROPIC_API_KEY=sk-... docker compose -f docker-compose.test.yml run --rm test
167
-
168
- # Or using an npm script if configured
169
- ANTHROPIC_API_KEY=sk-... bun run test:docker
170
- ```
171
-
172
- ### CI Workflow Pattern
173
-
174
- Docker tests can use path filtering to reduce API costs:
175
-
176
- ```yaml
177
- # .github/workflows/ci.yml
178
- jobs:
179
- changes:
180
- # Detects which paths changed
181
- steps:
182
- - uses: dorny/paths-filter@v3
183
- with:
184
- filters: |
185
- integration:
186
- - 'src/**'
187
-
188
- test-integration:
189
- needs: changes
190
- if: ${{ needs.changes.outputs.integration == 'true' }}
191
- # Only runs when src/ files change
192
- ```
193
-
194
- ### When to Use Docker Tests
195
-
196
- Use Docker for tests that:
197
- - Require external API calls (Anthropic, OpenAI, etc.)
198
- - Need specific environment configurations
199
- - Should be isolated from the local development environment
200
- - Are expensive to run and should be gated in CI
30
+ **Run:** `bun test` before commit
@@ -0,0 +1,40 @@
1
+ # Workflow
2
+
3
+ ## Git Commits
4
+
5
+ **Conventional commits** - `feat:`, `fix:`, `refactor:`, `docs:`, `chore:`, `test:`
6
+ **Multi-line messages** - Use for detailed context
7
+ **Never --no-verify** - Fix the issue, don't bypass hooks
8
+ *Verify:* Check git log format
9
+
10
+ ## GitHub CLI
11
+
12
+ **Use `gh` over WebFetch** - Better data access, auth, private repos
13
+
14
+ **PR evaluation** - Fetch ALL sources:
15
+ ```bash
16
+ # 1. Comments/reviews
17
+ gh pr view <n> --repo <owner>/<repo> --json title,body,comments,reviews,state
18
+
19
+ # 2. Security alerts
20
+ gh api repos/<owner>/<repo>/code-scanning/alerts
21
+
22
+ # 3. Inline comments
23
+ gh api repos/<owner>/<repo>/pulls/<n>/comments
24
+ ```
25
+
26
+ **PR checklist:**
27
+ - [ ] Human reviewer comments
28
+ - [ ] AI code review comments
29
+ - [ ] Security alerts (ReDoS, injection)
30
+ - [ ] Code quality comments
31
+ - [ ] Inline suggestions
32
+
33
+ **URL patterns:**
34
+ | URL | Command |
35
+ |-----|---------|
36
+ | `github.com/.../pull/<n>` | `gh pr view <n> --repo ...` |
37
+ | `github.com/.../issues/<n>` | `gh issue view <n> --repo ...` |
38
+ | `.../security/code-scanning/<id>` | `gh api .../code-scanning/alerts/<id>` |
39
+
40
+ **Review states:** `APPROVED`, `CHANGES_REQUESTED`, `COMMENTED`, `PENDING`
@@ -0,0 +1,47 @@
1
+ ---
2
+ name: code-documentation
3
+ description: TSDoc standards for TypeScript/JavaScript code. Automatically invoked when writing, reviewing, or editing any TSDoc comments, code documentation, or API documentation. (project)
4
+ license: ISC
5
+ compatibility: Requires bun
6
+ ---
7
+
8
+ # Code Documentation Skill
9
+
10
+ ## Purpose
11
+
12
+ This skill provides TSDoc format templates, type documentation guidelines, and maintenance workflows. Use this when:
13
+ - Writing or editing TSDoc comments for any function, type, or module
14
+ - Reviewing documentation quality
15
+ - Creating comprehensive API documentation
16
+ - Documenting complex type structures
17
+ - Cleaning up non-compliant comments (performance notes, timestamps, inline explanations)
18
+ - Synchronizing out-of-sync TSDoc with code changes
19
+ - Removing orphaned documentation for deleted code
20
+
21
+ **Key Standard**: No `@example` sections - tests and stories serve as living examples.
22
+
23
+ ## Quick Reference
24
+
25
+ - **Creating TSDoc**: See [workflow.md](references/workflow.md) for the generation workflow
26
+ - **Maintaining TSDoc**: See [maintenance.md](references/maintenance.md) for cleanup and sync guidelines
27
+
28
+ This skill contains detailed templates for:
29
+ - Public API Functions
30
+ - Internal Module Documentation
31
+ - Public and Internal Types
32
+ - Helper Functions
33
+ - Behavioral Programming Functions
34
+ - Special Annotations (Security, Performance, Deprecated)
35
+ - Type Documentation (Complex Objects, Unions, Functions, Utilities, Branded Types, etc.)
36
+
37
+ ## Navigation
38
+
39
+ - [workflow.md](references/workflow.md) - TSDoc generation workflow (4 phases)
40
+ - [maintenance.md](references/maintenance.md) - Comment policy, sync tasks, orphaned doc handling
41
+ - [public-api-templates.md](references/public-api-templates.md) - Templates for public-facing APIs
42
+ - [internal-templates.md](references/internal-templates.md) - Templates for internal code and modules
43
+ - [type-documentation.md](references/type-documentation.md) - Comprehensive type documentation templates
44
+
45
+ ## Related Skills
46
+
47
+ - **typescript-lsp**: Use for type verification and discovery during documentation workflow. Essential for Phase 1 (type analysis) and Phase 2 (usage discovery) of the TSDoc generation process. Run `lsp-hover` to verify signatures, `lsp-references` to find usages, and `lsp-symbols` to understand file structure.
@@ -0,0 +1,113 @@
1
+ # Internal Templates
2
+
3
+ ## Internal Module Documentation
4
+
5
+ ```typescript
6
+ /**
7
+ * @internal
8
+ * @module module-name
9
+ *
10
+ * Purpose: Why this module exists in the codebase
11
+ * Architecture: How it fits into the overall system design
12
+ * Dependencies: What this module depends on (be specific)
13
+ * Consumers: What parts of the system use this module
14
+ *
15
+ * Maintainer Notes:
16
+ * - Key implementation details and design decisions
17
+ * - Important invariants that must be maintained
18
+ * - Tricky aspects of the implementation
19
+ * - Performance-critical sections with complexity analysis
20
+ *
21
+ * Common modification scenarios:
22
+ * - When you might need to modify this module
23
+ * - How to extend functionality safely
24
+ * - What to watch out for when making changes
25
+ *
26
+ * Performance considerations:
27
+ * - Optimization strategies used
28
+ * - Memory management concerns
29
+ * - Computational complexity (Big-O notation)
30
+ *
31
+ * Known limitations:
32
+ * - Current constraints or technical debt
33
+ * - Planned improvements
34
+ * - Workarounds for known issues
35
+ */
36
+ ```
37
+
38
+ ## Internal Types
39
+
40
+ ```typescript
41
+ /**
42
+ * @internal
43
+ * What this type represents internally and why it exists.
44
+ * How it's used in the implementation.
45
+ *
46
+ * @property propName - Internal property purpose
47
+ *
48
+ * @remarks
49
+ * - Implementation-specific constraints
50
+ * - Why this structure was chosen
51
+ */
52
+ type InternalType = {
53
+ // Implementation-specific properties
54
+ }
55
+ ```
56
+
57
+ ## Internal Helper Functions
58
+
59
+ ```typescript
60
+ /**
61
+ * @internal
62
+ * Brief description of what this internal function does.
63
+ * Why it exists and how it's used within the module.
64
+ *
65
+ * @param paramName - Parameter purpose
66
+ * @returns Return value meaning
67
+ *
68
+ * @remarks
69
+ * - Algorithm details (e.g., "Fisher-Yates shuffle")
70
+ * - Complexity: O(n) where n is...
71
+ * - Why this approach was chosen
72
+ */
73
+ const internalHelper = () => { ... }
74
+ ```
75
+
76
+ ## Security-Sensitive Code
77
+
78
+ ```typescript
79
+ /**
80
+ * @internal
81
+ * SECURITY: This function handles [sensitive operation].
82
+ *
83
+ * Security considerations:
84
+ * - Input sanitization approach
85
+ * - XSS/injection prevention measures
86
+ * - Authentication/authorization requirements
87
+ */
88
+ ```
89
+
90
+ ## Performance-Critical Code
91
+
92
+ ```typescript
93
+ /**
94
+ * @internal
95
+ * PERFORMANCE: Hot path - called [frequency/context].
96
+ *
97
+ * Performance notes:
98
+ * - Optimization strategy (e.g., "minimal allocations")
99
+ * - Caching approach (e.g., "WeakMap cache")
100
+ * - Complexity: O(1) lookup after initial computation
101
+ */
102
+ ```
103
+
104
+ ## Required Elements for Internal Modules
105
+
106
+ ### All Internal Modules Must Include
107
+
108
+ - Purpose and architecture context
109
+ - Dependencies and consumers
110
+ - Maintainer notes
111
+ - Modification scenarios
112
+ - Performance considerations
113
+ - Known limitations