@silverassist/agents-toolkit 2.5.0 → 2.6.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.
- package/README.md +23 -3
- package/bin/cli.js +6 -5
- package/package.json +1 -1
- package/src/index.js +6 -1
- package/templates/agents/AGENTS.codex.md +2 -0
- package/templates/agents/AGENTS.md +9 -5
- package/templates/shared/instructions/caching.instructions.md +37 -13
- package/templates/shared/instructions/tsdoc-standards.instructions.md +182 -0
- package/templates/shared/prompts/README.md +22 -10
- package/templates/shared/prompts/create-github-pr.prompt.md +47 -3
- package/templates/shared/prompts/finalize-github-pr.prompt.md +7 -1
- package/templates/shared/prompts/resolve-github-reviews.prompt.md +323 -0
- package/templates/shared/skills/README.md +21 -3
- package/templates/shared/skills/ai-seo-optimization/SKILL.md +11 -2
- package/templates/shared/skills/core-review/SKILL.md +251 -0
- package/templates/shared/skills/domain-driven-design/SKILL.md +8 -3
- package/templates/shared/skills/github-review-management/SKILL.md +215 -0
- package/templates/shared/skills/nextjs-caching/SKILL.md +100 -31
- package/templates/shared/skills/release-management/SKILL.md +25 -5
- package/templates/shared/skills/testing-patterns/SKILL.md +38 -0
- package/templates/shared/skills/tsdoc-standards/SKILL.md +225 -0
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: tsdoc-standards
|
|
3
|
+
description: Write and enforce TSDoc (not JSDoc) in TypeScript. Use when adding or reviewing doc comments on functions, components, interfaces, or file headers. Covers allowed tags, forbidden JSDoc patterns, and templates.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Silver Assist — TSDoc Standards
|
|
7
|
+
|
|
8
|
+
This skill is the deep reference for writing and reviewing documentation comments in
|
|
9
|
+
TypeScript. All doc comments follow the **[TSDoc](https://tsdoc.org/)** standard — **not
|
|
10
|
+
JSDoc**. The enforced, always-on rules live in `tsdoc-standards.instructions.md`
|
|
11
|
+
(`applyTo: "**/*.{ts,tsx}"`); this skill adds the *why*, expanded examples, and a review
|
|
12
|
+
checklist for on-demand use.
|
|
13
|
+
|
|
14
|
+
## When to Use
|
|
15
|
+
|
|
16
|
+
- Adding doc comments to functions, Server Actions, React components, hooks, or utilities
|
|
17
|
+
- Documenting interfaces, types, enums, or module/file headers
|
|
18
|
+
- Reviewing a PR and deciding whether a comment is TSDoc-correct
|
|
19
|
+
- Migrating an existing file from JSDoc (`{type}` braces, `@template`, `@module`) to TSDoc
|
|
20
|
+
- Answering "which tag do I use for X?" or "is `@fileoverview` allowed?"
|
|
21
|
+
|
|
22
|
+
## Why TSDoc, not JSDoc
|
|
23
|
+
|
|
24
|
+
TypeScript already carries the type information. JSDoc duplicates it in `{braces}`, which:
|
|
25
|
+
|
|
26
|
+
- **Drifts** — the `{string}` in the comment and the `: string` in the signature diverge over time.
|
|
27
|
+
- **Is redundant** — editors and `tsc` read the real types; the comment adds nothing.
|
|
28
|
+
- **Breaks API extractors** — tools like [API Extractor](https://api-extractor.com/) and the
|
|
29
|
+
TSDoc parser reject JSDoc-only tags (`@typedef`, `@callback`, `@fileoverview`).
|
|
30
|
+
|
|
31
|
+
TSDoc keeps prose in the comment and types in the code — one source of truth for each.
|
|
32
|
+
|
|
33
|
+
## Core Rules (with rationale)
|
|
34
|
+
|
|
35
|
+
### 1. No type annotations in `@param` / `@returns`
|
|
36
|
+
|
|
37
|
+
The type is in the signature; the comment describes *meaning*, not *type*.
|
|
38
|
+
|
|
39
|
+
```typescript
|
|
40
|
+
// ❌ JSDoc — the {string} duplicates the signature
|
|
41
|
+
/** @param {string} slug - Community slug */
|
|
42
|
+
|
|
43
|
+
// ✅ TSDoc — hyphen required after the name; no braces
|
|
44
|
+
/** @param slug - Community slug */
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### 2. `@typeParam` for generics (not `@template`)
|
|
48
|
+
|
|
49
|
+
```typescript
|
|
50
|
+
// ❌ @template is a JSDoc/Closure tag
|
|
51
|
+
/** @template T */
|
|
52
|
+
|
|
53
|
+
// ✅ TSDoc generic parameter
|
|
54
|
+
/** @typeParam T - The item shape returned by the fetcher */
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### 3. `@packageDocumentation` for file/module headers (not `@module`)
|
|
58
|
+
|
|
59
|
+
Place it in the **first** comment of the file. It marks module-level docs for extractors.
|
|
60
|
+
|
|
61
|
+
```typescript
|
|
62
|
+
/**
|
|
63
|
+
* @packageDocumentation
|
|
64
|
+
* CCDS geo-search utilities for state, city, and community lookups.
|
|
65
|
+
*/
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### 4. Document interface members inline (not `@property`)
|
|
69
|
+
|
|
70
|
+
Each member gets its own leading comment — it shows on hover for that specific field.
|
|
71
|
+
|
|
72
|
+
```typescript
|
|
73
|
+
interface Community {
|
|
74
|
+
/** The community name. */
|
|
75
|
+
name: string;
|
|
76
|
+
/** The city where the community is located. */
|
|
77
|
+
city: string;
|
|
78
|
+
/** @defaultValue `false` */
|
|
79
|
+
featured?: boolean;
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### 5. Overloaded functions — document each overload signature
|
|
84
|
+
|
|
85
|
+
For overloaded functions, place the TSDoc comment on **each overload signature individually**.
|
|
86
|
+
Do **not** place it on the implementation signature — tooling (editors, `tsc`, API extractors)
|
|
87
|
+
will not surface it to consumers, who only see the overload signatures.
|
|
88
|
+
|
|
89
|
+
```typescript
|
|
90
|
+
// ✅ TSDoc on each overload; implementation signature is undocumented
|
|
91
|
+
/**
|
|
92
|
+
* Fetches a community by its slug.
|
|
93
|
+
*
|
|
94
|
+
* @param slug - The community slug
|
|
95
|
+
* @returns The matching community, or `undefined`
|
|
96
|
+
*/
|
|
97
|
+
export function getCommunity(slug: string): Community | undefined;
|
|
98
|
+
/**
|
|
99
|
+
* Fetches a community by its numeric ID.
|
|
100
|
+
*
|
|
101
|
+
* @param id - The community ID
|
|
102
|
+
* @returns The matching community, or `undefined`
|
|
103
|
+
*/
|
|
104
|
+
export function getCommunity(id: number): Community | undefined;
|
|
105
|
+
export function getCommunity(key: string | number): Community | undefined {
|
|
106
|
+
// implementation
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Allowed Tags — quick reference
|
|
111
|
+
|
|
112
|
+
| Tag | Format | Notes |
|
|
113
|
+
|-----|--------|-------|
|
|
114
|
+
| `@param` | `@param name - Description` | Hyphen required; no type braces |
|
|
115
|
+
| `@returns` | `@returns Description` | No type braces |
|
|
116
|
+
| `@remarks` | Block | Extended description / side effects |
|
|
117
|
+
| `@example` | Block | Fenced code (` ```typescript `) |
|
|
118
|
+
| `@throws` | Block | Documented exceptions |
|
|
119
|
+
| `@see` | Block | Cross-reference or URL |
|
|
120
|
+
| `@deprecated` | Block | Add migration guidance |
|
|
121
|
+
| `@defaultValue` | Block | Default of a property |
|
|
122
|
+
| `@typeParam` | `@typeParam T - Description` | Generic parameter |
|
|
123
|
+
| `@packageDocumentation` | Modifier | First comment in the file |
|
|
124
|
+
| `{@link symbol}` | Inline | Hyperlink to a symbol |
|
|
125
|
+
|
|
126
|
+
> `@param` / `@returns` are **optional** — add them only when they add clarity (non-obvious
|
|
127
|
+
> params, complex return shapes). Never add them to interfaces, types, or constants.
|
|
128
|
+
|
|
129
|
+
## Templates
|
|
130
|
+
|
|
131
|
+
### Server Action
|
|
132
|
+
|
|
133
|
+
````typescript
|
|
134
|
+
/**
|
|
135
|
+
* Submits the contact form and sends a notification email.
|
|
136
|
+
*
|
|
137
|
+
* @remarks
|
|
138
|
+
* Validates server-side, creates a DB record, dispatches email.
|
|
139
|
+
*
|
|
140
|
+
* @param formData - Submitted form data from the contact page
|
|
141
|
+
*
|
|
142
|
+
* @throws When the email service is unavailable
|
|
143
|
+
*/
|
|
144
|
+
export async function submitContactForm(formData: FormData): Promise<void> {}
|
|
145
|
+
````
|
|
146
|
+
|
|
147
|
+
### React Component
|
|
148
|
+
|
|
149
|
+
````typescript
|
|
150
|
+
/**
|
|
151
|
+
* Renders a responsive community card with name and location.
|
|
152
|
+
*
|
|
153
|
+
* @returns The community card JSX element
|
|
154
|
+
*
|
|
155
|
+
* @example
|
|
156
|
+
* ```tsx
|
|
157
|
+
* <CommunityCard community={community} className="mt-4" />
|
|
158
|
+
* ```
|
|
159
|
+
*/
|
|
160
|
+
export function CommunityCard({ community, className }: CommunityCardProps) {
|
|
161
|
+
return <article className={className}>{community.name}</article>;
|
|
162
|
+
}
|
|
163
|
+
````
|
|
164
|
+
|
|
165
|
+
### Utility Function
|
|
166
|
+
|
|
167
|
+
````typescript
|
|
168
|
+
/**
|
|
169
|
+
* Formats a date string for display.
|
|
170
|
+
*
|
|
171
|
+
* @param dateString - ISO 8601 date string
|
|
172
|
+
* @returns Human-readable date (e.g., "January 15, 2025")
|
|
173
|
+
*
|
|
174
|
+
* @example
|
|
175
|
+
* ```typescript
|
|
176
|
+
* formatDate("2025-01-15"); // "January 15, 2025"
|
|
177
|
+
* ```
|
|
178
|
+
*/
|
|
179
|
+
export function formatDate(dateString: string): string {
|
|
180
|
+
return new Date(dateString).toLocaleDateString("en-US", { dateStyle: "long" });
|
|
181
|
+
}
|
|
182
|
+
````
|
|
183
|
+
|
|
184
|
+
### Generic Utility (`@typeParam`)
|
|
185
|
+
|
|
186
|
+
````typescript
|
|
187
|
+
/**
|
|
188
|
+
* Returns the first element matching the predicate, or `undefined`.
|
|
189
|
+
*
|
|
190
|
+
* @typeParam T - The element type of the array
|
|
191
|
+
* @param items - The array to search
|
|
192
|
+
* @param predicate - Returns `true` for the desired element
|
|
193
|
+
* @returns The first matching element, or `undefined` if none match
|
|
194
|
+
*/
|
|
195
|
+
export function findFirst<T>(items: T[], predicate: (item: T) => boolean): T | undefined {
|
|
196
|
+
return items.find(predicate);
|
|
197
|
+
}
|
|
198
|
+
````
|
|
199
|
+
|
|
200
|
+
## Forbidden Patterns → Fixes
|
|
201
|
+
|
|
202
|
+
| ❌ Forbidden (JSDoc) | ✅ TSDoc fix |
|
|
203
|
+
|----------------------|--------------|
|
|
204
|
+
| `@param {string} name` | `@param name` |
|
|
205
|
+
| `@returns {boolean} …` | `@returns …` |
|
|
206
|
+
| `@template T` | `@typeParam T` |
|
|
207
|
+
| `@module path/to/mod` | `@packageDocumentation` |
|
|
208
|
+
| `@fileoverview …` | `@packageDocumentation` |
|
|
209
|
+
| `@typedef {Object} X` | Define a TypeScript `interface`/`type` |
|
|
210
|
+
| `@callback X` | Define a TypeScript function type |
|
|
211
|
+
| `@type {X}` | Annotate the value: `const x: X = …` |
|
|
212
|
+
| `@property {T} name` | Inline `/** … */` on the interface member |
|
|
213
|
+
| `@function` / `@async` / `@class` / `@enum` | Remove — redundant with TypeScript |
|
|
214
|
+
|
|
215
|
+
## Review Checklist
|
|
216
|
+
|
|
217
|
+
When reviewing doc comments, confirm:
|
|
218
|
+
|
|
219
|
+
- [ ] No `{type}` braces in `@param` / `@returns`.
|
|
220
|
+
- [ ] `@param name - Description` uses the hyphen and matches the actual parameter name.
|
|
221
|
+
- [ ] Generics use `@typeParam`, not `@template`.
|
|
222
|
+
- [ ] File-level docs use `@packageDocumentation` in the first comment, not `@module` / `@fileoverview`.
|
|
223
|
+
- [ ] Interface/type members are documented inline, not via `@property`.
|
|
224
|
+
- [ ] No redundant `@function` / `@async` / `@class` / `@enum` / `@typedef` / `@callback` / `@type`.
|
|
225
|
+
- [ ] `@param` / `@returns` are present only where they add real clarity.
|