Skip to content
Back to skills

Coding Conventions

ASecurity

Coding conventions and documentation standards across Python, TypeScript/JavaScript, and C#/.NET codebases. Use when: (1) writing new code files or functions, (2) reviewing code for style and documentation compliance, (3) adding file headers or docstrings, (4) creating new tools that need inventory registration, (5) refactoring code that exceeds complexity thresholds, (6) setting up module structure. Covers file headers, function documentation, naming conventions, and tool inventory integration.

  • 5 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added June 6, 2026
developmentjavascripttypescriptpythongojavac#bashrefactoringapidocumentation

Works with

  • cli
  • api

Security analysis

A100/100

Pro scans all 14 files and shows the line behind each finding

Scanned June 6, 2026

npx -y skills add richfrem/Project_Sanctuary --skill coding-conventions --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Coding Conventions?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Coding Conventions
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/richfrem-coding-conventions/badge)](https://www.skillsdirectory.com/skills/richfrem-coding-conventions)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: coding-conventions
description: >
  Coding conventions and documentation standards across Python,
  TypeScript/JavaScript, and C#/.NET codebases. Use when: (1) writing new code files or
  functions, (2) reviewing code for style and documentation compliance, (3) adding file
  headers or docstrings, (4) creating new tools that need inventory registration,
  (5) refactoring code that exceeds complexity thresholds, (6) setting up module structure.
  Covers file headers, function documentation, naming conventions, and tool inventory integration.
---

# Coding Conventions

## Dual-Layer Documentation

Every non-trivial code element needs two layers:
- **External comment/header** — scannable description above the definition
- **Internal docstring** — detailed docs inside the definition

## File Headers

Every source file starts with a header describing its purpose.

### Python Files

```python
#!/usr/bin/env python3
"""
Script Name
=====================================

Purpose:
    What the script does and its role in the system.

Layer: Investigate / Codify / Curate / Retrieve

Usage:
    python script.py [args]

Related:
    - related_script.py
"""
```

For CLI tools in `plugins/`, use the extended format with Usage Examples, CLI Arguments,
Key Functions, and Script Dependencies sections. See `references/header_templates.md`
for the full gold-standard template.

### TypeScript/JavaScript Files

```javascript
/**
 * path/to/file.js
 * ================
 *
 * Purpose:
 *   Component responsibility and role in the system.
 *
 * Key Functions/Classes:
 *   - functionName() - Brief description
 */
```

### C#/.NET Files

```csharp
// path/to/File.cs
// Purpose: Class responsibility.
// Layer: Service / Data access / API controller.
// Used by: Consuming services.
```

## Function Documentation

### Python — Google-style docstrings with type hints

```python
def process_data(xml_path: str, fmt: str = 'markdown') -> Dict[str, Any]:
    """
    Converts Oracle Forms XML to the specified format.

    Args:
        xml_path: Absolute path to the XML file.
        fmt: Target format ('markdown', 'json').

    Returns:
        Dictionary with converted data and metadata.

    Raises:
        FileNotFoundError: If xml_path does not exist.
    """
```

### TypeScript — JSDoc with `@param`, `@returns`, `@throws`

```typescript
/**
 * Fetches RCC data and updates component state.
 *
 * @param rccId - Unique identifier for the RCC record
 * @returns Promise resolving to RCC data object
 * @throws {ApiError} If the API request fails
 */
async function fetchRCCData(rccId: string): Promise<RCCData> {}
```

### C# — XML doc comments

```csharp
/// <summary>
/// Retrieves RCC details by ID.
/// </summary>
/// <param name="rccId">Unique identifier.</param>
/// <returns>RCC entity with related data.</returns>
public async Task<RCC> GetRCCDetailsAsync(int rccId) {}
```

## Naming Conventions

| Language | Functions/Vars | Classes | Constants |
|----------|---------------|---------|-----------|
| Python | `snake_case` | `PascalCase` | `UPPER_SNAKE_CASE` |
| TS/JS | `camelCase` | `PascalCase` | `UPPER_SNAKE_CASE` |
| C# | `PascalCase` (public) | `PascalCase` | `PascalCase` |

C# private fields use `_camelCase` prefix.

## Code Quality Thresholds

- **50+ lines** in a function → extract helpers
- **3+ nesting levels** → refactor
- **Comments** explain *why*, not *what*
- **TODO format**: `// TODO(#123): description`

## Module Organization (Python)

```
module/
├── __init__.py       # Exports
├── models.py         # Data models / DTOs
├── services.py       # Business logic
├── repositories.py   # Data access
├── utils.py          # Helpers
└── constants.py      # Constants and enums
```

## Tool Inventory Integration

All Python scripts in `plugins/` **must** be registered in `plugins/tool_inventory.json`.

After creating or modifying a tool:
```bash
python plugins/tool-inventory/scripts/manage_tool_inventory.py add --path "plugins/path/to/script.py"
python plugins/tool-inventory/scripts/manage_tool_inventory.py audit
```

The extended Python header's `Purpose:` section is auto-extracted for the RLM cache and tool inventory.

### Pre-Commit Checklist
- [ ] File has proper header
- [ ] Script registered in `plugins/tool_inventory.json`
- [ ] `manage_tool_inventory.py audit` shows 0 untracked scripts

## Manifest Schema (ADR 097)

For `.agent/learning/` manifests, use the simple schema:
```json
{
    "title": "Bundle Name",
    "description": "Purpose of the bundle.",
    "files": [
        {"path": "path/to/file.md", "note": "Brief description"}
    ]
}
```

Files in this skill

  • SKILL.md4.6 KB
  • references/DEPENDENCY_MANAGEMENT.md5.3 KB
  • references/SECRETS_CONFIGURATION.md2.7 KB
  • references/UIUX_styling_guidelines_and_guidance.md4.6 KB
  • references/acceptance-criteria.md501 B
  • references/context-spiral-protocol.md2.1 KB
  • references/file-namespace-and-class-naming-conventions.md5.3 KB
  • references/header_templates.md2.9 KB
  • references/namespace-standardization.md3.5 KB
  • references/parent-project-folder-structure-overview.md2.6 KB
  • references/project-folder-structure-guidance.md4.4 KB
  • references/recent-updates-and-conventions.md4 KB
  • references/shared-block-component-pattern.md3.1 KB
  • references/std_workflow_definition.md2.1 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…