Skip to content
Skills Library
Programming · Writing

document-code

/document-code

Apply Google Style documentation standards to Python, Go, TypeScript, and Terraform code. Use when writing or reviewing code that needs docstrings/comments/JSDoc, when asked to "document this code", "add docstrings", "follow Google Style", or when improving code documentation quality. Supports Python docstrings, Go comments, TypeScript JSDoc, and Terraform variable/output descriptions. Enforces consistent, professional documentation standards.

Licence
MIT
Last repository change
22.10.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
5
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 22.10.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Apply Google Style documentation standards to Python, Go, TypeScript, and Terraform code. Use when writing or reviewing code that needs docstrings/comments/JSDoc, when asked to "document this code", "add docstrings", "follow Google Style", or when improving code documentation quality. Supports Python docstrings, Go comments, TypeScript JSDoc, and Terraform variable/output descriptions. Enforces consistent, professional documentation standards.

Triggers from the description

document this codeadd docstringsfollow Google Style
Original author description

Apply Google Style documentation standards to Python, Go, TypeScript, and Terraform code. Use when writing or reviewing code that needs docstrings/comments/JSDoc, when asked to "document this code", "add docstrings", "follow Google Style", or when improving code documentation quality. Supports Python docstrings, Go comments, TypeScript JSDoc, and Terraform variable/output descriptions. Enforces consistent, professional documentation standards.

How it works

  1. When to Apply This Skill
  2. Core Principles
  3. Workflow
  4. Documentation Coverage
  5. Special Cases
  6. Output Format
  7. Avoid
  8. Resources
  9. Quality Standards
Original SKILL.md headings · 394 lines, 1,485 words
SKILL.md preview
---
name: document-code
description: Apply Google Style documentation standards to Python, Go, TypeScript, and Terraform code. Use when writing or reviewing code that needs docstrings/comments/JSDoc, when asked to "document this code", "add docstrings", "follow Google Style", or when improving code documentation quality. Supports Python docstrings, Go comments, TypeScript JSDoc, and Terraform variable/output descriptions. Enforces consistent, professional documentation standards.
---

# Code Documentation Standards

Apply Google Style documentation standards to Python (docstrings), Go (comments), TypeScript (JSDoc), and Terraform (descriptions). Ensures consistent, professional, and comprehensive code documentation across multiple languages.

## When to Apply This Skill

Use this skill when:

- Writing new functions, classes, or packages
- Reviewing code for documentation quality
- User requests "document this code" or "add docstrings"
- User mentions "Google Style" or documentation standards
- Refactoring code that lacks proper documentation
- Creating code examples that should be well-documented

## Core Principles

1. **Clarity**: Documentation should be immediately understandable
2. **Completeness**: Document all public APIs, parameters, returns, exceptions
3. **Consistency**: Follow language-specific Google Style conventions
4. **Conciseness**: Be thorough but avoid redundancy
5. **Examples**: Include usage examples for complex functionality

## Workflow

### 1. Detect Language

Identify the programming language:

- **Python**: Look for `.py` files, `def`, `class` keywords, type hints
- **Go**: Look for `.go` files, `func`, `type`, `package` keywords
- **TypeScript**: Look for `.ts` / `.tsx` files, `interface`, `type`, `export`, `import` keywords
- **Terraform**: Look for `.tf` files, `resource`, `variable`, `module` keywords

### 2. Apply Appropriate Standard

Read the corresponding reference file:

- **Python**: Read `references/python_google_style.md` for complete docstring standards
- **Go**: Read `references/go_google_style.md` for complete comment standards
- **TypeScript**: Read `references/typescript_google_style.md` for complete JSDoc standards
- **Terraform**: Read `references/terraform_style.md` for complete description standards

### 3. Document Code Elements

Apply documentation to all appropriate code elements:

**Python**:

- Module-level docstrings
- Class docstrings
- Method/function docstrings
- Important variables/constants

**Go**:

- Package comments
- Type comments
- Function comments
- Important constants/variables

**TypeScript**:

- `@fileoverview` JSDoc (file-level)
- Interface and type alias JSDoc
- Class and constructor JSDoc
- Method and function JSDoc
- Exported constants and enums

**Terraform**:

- Variable descriptions
- Output descriptions
- Resource comments
- Module descriptions

### 4. Quality Checks

Before finalizing, verify:

- All public APIs are documented
- Parameters and returns are described
- Exceptions/errors are documented
- Examples are provided for complex functions
- Formatting follows Google Style exactly
- No redundant or obvious documentation

### 5. Provide Feedback

When reviewing code:

- Point out missing documentation
- Suggest improvements to existing docs
- Provide corrected examples
- Explain why certain documentation is important

## Documentation Coverage

### Python - What to Document

**Always Document**:

- Public modules (module-level docstring)
- Public classes (class docstring)
- Public methods and functions (method docstring)
- `__init__` methods (explain parameters)

**Consider Documenting**:

- Complex private functions (with leading underscore)
- Non-obvious class attributes
- Module-level constants

**Don't Document**:

- Self-explanatory code (e.g., simple getters/setters)
- Override methods that just call super() without changes
- Trivial one-liner functions with obvious behavior

### Go - What to Document

**Always Document**:

- Package (package comment before package declaration)
- Exported types (structs, interfaces)
- Exported functions and methods
- Exported constants and variables

**Consider Documenting**:

- Complex unexported functions
- Non-obvious implementation details
- Important internal structures

**Don't Document**:

- Trivial getters/setters
- Self-explanatory code
- Override methods without new behavior

### TypeScript - What to Document

**Always Document**:

- All exported functions, classes, interfaces, type aliases, and enums
- Constructor parameters when using parameter properties (via `@param`)
- Class properties that are not self-evident from their names
- Thrown errors (`@throws`)
- Non-trivial return values (`@returns`)

**Consider Documenting**:

- Complex private methods (use `//` inline comments, not JSDoc)
- Non-obvious type constraints or invariants
- Performance characteristics of algorithms
- Side effects of functions

**Don't Document**:

- Trivial getters/setters where the name is fully self-explanatory
- Override methods that purely delegate to `super` without changes
- Implementation details already obvious from types and code

### Terraform - What to Document

**Always Document**:

- All variables (description field)
- All outputs (description field)
- Module purpose (README.md)
- Complex resources (inline comments)

**Consider Documenting**:

- Data sources with complex filters
- Non-obvious resource dependencies
- Conditional resource creation logic

**Don't Document**:

- Self-explanatory variable names
- Simple pass-through outputs
- Standard resource configurations

## Special Cases

### Python Type Hints

When using type hints, docstrings can be more concise:

```python
def add(a: int, b: int) -> int:
    """Add two integers.

    Args:
        a: First integer.
        b: Second integer.

    Returns:
        The sum of a and b.
    """
    return a + b
```

Type information is already in the signature, so Args and Returns can be brief.

### Go Error Returns

Always document what errors a function can return:

```go
// ReadConfig reads and parses the configuration file.
//
// Returns an error if the file cannot be read or contains invalid YAML.
func ReadConfig(path string) (*Config, error) {
    // implementation
}
```

### TypeScript JSDoc and Type Hints

With TypeScript, types are enforced by the compiler so JSDoc should focus on
_semantics_, not re-stating types. Use `@param`, `@returns`, and `@throws`:

````ts
/**
 * Fetches user profile data from the remote API.
 *
 * @param userId - Unique identifier for the user (UUID or numeric ID).
 * @returns Promise resolving to the user's profile.
 * @throws {HttpError} On non-2xx HTTP responses.
 * @throws {TimeoutError} If the request exceeds the configured timeout.
 *
 * @example
 * ```ts
 * const profile = await fetchUserProfile('user-123');
 * console.log(profile.displayName);
 * ```
 */
export async function fetchUserProfile(userId: string): Promise<UserProfile> {
  // implementation
}
````

Named exports only – never `export default`. File-level `@fileoverview` when
the module's purpose is not obvious from its name.

#### TypeScript-specific rules (Google Style)

**File structure** — sections separated by exactly one blank line, in this order:

1. Copyright/license JSDoc (if required)
2. `@fileoverview` JSDoc (if needed)
3. Imports
4. Implementation

**JSDoc placement** — always _before_ decorators, with no blank line between
the JSDoc and the decorator:

```ts
/** Root application module. */
@NgModule({declarations: [AppComponent]})
export class AppModule {}
```

**What to skip** — do not re-state types in `@param`/`@returns`; the compiler
enforces them. Document _semantics_, constraints, and edge cases instead.

**Interfaces vs type aliases** — use `interface` for object shapes; use `type`
for unions, intersections, and mapped types.

**Naming quick-reference**:

| Category | Convention | Example |
|---|---|---|
| Class / Interface / Enum | `UpperCamelCase` | `UserService` |
| Function / method / variable | `lowerCamelCase` | `fetchUser()` |
| Module-level constant | `CONSTANT_CASE` | `MAX_RETRIES` |
| Observable (convention) | `lowerCamelCase$` | `user$` |

> For the complete reference — generator functions, getters/setters, decorators,
> import styles, enum documentation — read `references/typescript_google_style.md`.

### Complex Algorithms

For complex logic, add inline comments AND comprehensive function documentation:

```python
def dijkstra(graph: Graph, start: Node) -> dict[Node, float]:
    """Find shortest paths using Dijkstra's algorithm.

    Implements Dijkstra's single-source shortest path algorithm
    using a priority queue for O((V + E) log V) complexity.

    Args:
        graph: Weighted graph with non-negative edge weights.
        start: Starting node for path calculations.

    Returns:
        Dictionary mapping each node to its shortest distance from start.
        Unreachable nodes are not included in the result.

    Raises:
        ValueError: If graph contains negative edge weights.

    Example:
        >>> graph = Graph()
        >>> graph.add_edge("A", "B", 4)
        >>> graph.add_edge("A", "C", 2)
        >>> distances = dijkstra(graph, "A")
        >>> distances["B"]
        4
    """
    # Implementation with inline comments for complex parts
```

## Output Format

When adding documentation to code:

1. **Present the documented code** with proper formatting
2. **Explain what was added** if the changes are significant
3. **Highlight any decisions** made about what to document or not document

## Avoid

- Generic or placeholder documentation ("This function does stuff")
- Redundant documentation that just repeats the code ("This adds a and b")
- Over-documentation of obvious code
- Inconsistent formatting within the same file
- Missing critical information (parameters, exceptions, edge cases)
- Documentation that becomes outdated as code changes

## Resources

### references/python_google_style.md

Complete Python docstring standard with:

- Module, class, and function docstring formats
- Args, Returns, Raises, Yields sections
- Type hint integration
- Examples for common patterns
- Edge cases and best practices

### references/go_google_style.md

Complete Go comment standard with:

- Package comment format
- Function and method comment format
- Type comment format
- Documentation for errors
- Examples for common patterns
- godoc integration notes

### references/typescript_google_style.md

Complete TypeScript JSDoc standard with:

- File structure and `@fileoverview` format
- Class, interface, and type alias JSDoc
- Function, method, and async function JSDoc
- Generator function documentation
- Enum documentation and naming conventions
- Import/export rules (named exports only, no `export default`)
- Naming conventions table (UpperCamelCase, lowerCamelCase, CONSTANT_CASE)
- What to document vs. what to skip
- Decorator placement rules
- Complete annotated example

### references/terraform_style.md

Complete Terraform documentation standard with:

- Variable description format
- Output description format
- Module documentation structure
- Inline comments for complex resources
- Examples for common patterns
- terraform-docs integration

## Quality Standards

All code documentation must:

- Start with a concise one-line summary
- Use proper grammar and punctuation
- Follow language-specific formatting (indentation, delimiters)
- Include examples for non-trivial public APIs
- Document all parameters, returns, and errors/exceptions
- Be maintained when code changes
Files in this package (5)
  • SKILL.md 11 KB
  • references/go_google_style.md 15 KB
  • references/python_google_style.md 15 KB
  • references/terraform_style.md 17 KB
  • references/typescript_google_style.md 17 KB

Versions

RepositoryScoreLicence
This page · jjmartres/ai-coding-agents100MIT
JamieMason/syncpack100MIT
codeaholicguy/ai-devkit90Apache-2.0
hoblin/claude-ruby-marketplace84MIT

Database snapshot: 13.11.2026 · package version ab5de2c582ef (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100code-documentation
    Guide for writing effective code documentation, including docstrings, JSDoc, dartdoc, and implementation comments. Use this skill when writing new code, adding features, or improving existing documentation in Dart, Python, or TypeScript to ensure clarity and maintainability.
  • 100documentation
    In-code documentation, folder READMEs, code comments. Use when: "document this", "add JSDoc", "write a README", "explain this code", or writing README.md/JSDoc.
  • 100documentation-generation
    Generates project documentation including READMEs, docstrings (JSDoc, JavaDoc, Python docstrings), OpenAPI prose, and CI/CD doc pipelines. Use when asked to generate docs, write docstrings, automate documentation, or create README files.
  • 100documentation
    Generate docstrings, JSDoc, API docs, and README updates that reflect current code. Use when: docs, docstring, JSDoc, README, API docs, document this, add documentation.
  • 100python-code-style
    Python code style, linting, formatting, naming conventions, and documentation standards. Use when writing new code, reviewing style, configuring linters, writing docstrings, or establishing project standards.
  • 100jsdoc
    Use this skill to automatically write or fix JSDoc comments for JavaScript/TypeScript code. It handles requests to document code at any scope: a single function, all functions in a file, or just the new and changed functions in a pull request.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.