plugins/code-comments/skills/docstring-patterns/SKILL.md
# Docstring Patterns > Language-specific documentation comment syntax, conventions, and best practices. ## Knowledge Base ### The Documentation Comment Spectrum | Level | What to Document | Example | |-------|-----------------|---------| | Module/Package | Purpose, exports, usage overview | File header comment | | Class/Interface | Responsibility, lifecycle, usage | Class docstring | | Function/Method | Contract (inputs, outputs, errors) | Function docstring | | Parameter | Semantic meaning
npx skillsauth add hermeticormus/librecopy-claude-code plugins/code-comments/skills/docstring-patternsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Language-specific documentation comment syntax, conventions, and best practices.
| Level | What to Document | Example |
|-------|-----------------|---------|
| Module/Package | Purpose, exports, usage overview | File header comment |
| Class/Interface | Responsibility, lifecycle, usage | Class docstring |
| Function/Method | Contract (inputs, outputs, errors) | Function docstring |
| Parameter | Semantic meaning beyond the type | @param annotation |
| Return Value | What it represents, edge cases | @returns annotation |
| Inline | Why this specific implementation | // comment |
Always document:
Usually skip documentation for:
isEmpty, capitalize)@param name - The name (string) when the type signature already shows name: string. Say @param name - Display name shown in the sidebar, max 255 chars.TypeScript/JavaScript (JSDoc/TSDoc):
/** */ for documentation (not // or /* */)@param name - Description (TSDoc uses - after param name)@returns Description@throws {ErrorType} When condition@example with fenced code blocks@deprecated Use {@link newFunction} instead@see {@link RelatedFunction} for cross-references@since 1.2.0 for API versioning@internal to mark non-public APIsPython (Google style):
Args:, Returns:, Raises:, Example:Note: for important caveatsTodo: for documented technical debtRust (rustdoc):
/// for item documentation, //! for module documentation# Examples section are compiled as tests# Errors, # Panics, # Safety sections as applicable[backtick links] auto-resolve to items in scope# Safety section explaining invariantsGo (godoc):
// FunctionName does XExample test functions in _test.go files// Deprecated: Use NewFunction instead.Builder/Options pattern:
/**
* Creates a configured HTTP client instance.
*
* @param options - Client configuration. All fields are optional
* with sensible defaults.
* @returns A configured client ready to make requests.
*
* @example Basic usage
* ```ts
* const client = createClient({ apiKey: "sk_test_123" });
* ```
*
* @example Full configuration
* ```ts
* const client = createClient({
* apiKey: "sk_test_123",
* baseUrl: "https://api.staging.example.com",
* timeout: 5000,
* retries: 2,
* });
* ```
*/
Overloaded functions:
/**
* Fetches a resource by ID or by query.
*
* @param idOrQuery - Either a string ID for direct lookup,
* or a query object for filtered search.
*
* @example By ID
* ```ts
* const user = await fetch("usr_123");
* ```
*
* @example By query
* ```ts
* const users = await fetch({ role: "admin", active: true });
* ```
*/
@since tags so consumers know when a function was added.@deprecated Use X instead not just @deprecated./** Gets the name. */ getName(): string -- the function signature says everything.@param userId - The user ID -- this adds zero information. Say what it is used for.tools
# User Doc Patterns > Patterns for writing clear, accessible end-user documentation. ## Knowledge Base ### User Documentation vs Developer Documentation | User Docs | Developer Docs | |-----------|---------------| | Task-oriented ("How do I...") | Concept-oriented ("How does it work...") | | Plain language | Technical language | | Screenshots and visual aids | Code examples | | Step-by-step procedures | API references | | Feature names and UI labels | Function signatures and parameters | | A
tools
# Tutorial Structures > Pedagogical patterns and frameworks for creating effective technical tutorials. ## Knowledge Base ### The Tutorial Spectrum Tutorials exist on a spectrum between two extremes: | Recipe | Concept Guide | |--------|--------------| | "Do exactly this" | "Understand this idea" | | Step-by-step | Explanation-heavy | | Fast to complete | Deep understanding | | Low retention | High retention | The best tutorials blend both: steps for doing, explanations for understanding.
tools
# Tutorial Patterns ## Tutorial vs. How-to Guide: The Critical Distinction Before writing, identify which document is actually needed: | Tutorial | How-to Guide | |----------|-------------| | "Build a REST API in Node.js" | "Add JWT authentication to your Express API" | | For someone new to this | For someone who knows the domain | | Explains why each step is done | Steps are efficient, minimal explanation | | Has checkpoints, explores | Numbered steps, no detours | | Learner reaches a comple
tools
# Tech Blogging Patterns ## The Developer Reading Pattern Developers do not read technical posts linearly. They scan in this order: 1. Headline (is this relevant to me?) 2. Code blocks (is this real code I can use?) 3. Headers (what does this cover?) 4. First paragraph (what's the point?) 5. Key takeaways / conclusion (is it worth reading fully?) Design for scanning first, reading second. Put real code within the first 25% of the post. ## The Before/After Pattern The contrast between a pain