coding-standard-writer
Skill4 starsChanged 6 months agoMITView on GitHub
Write a coding standards document for a project using the coding styles inferred from provided file(s) or folder(s).
In this repository124 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .github/AGENTS.mdAGENTS.md
- .github/workflows/AGENTS.mdAGENTS.md
- .vscode/AGENTS.mdAGENTS.md
- .github/copilot-instructions.mdCopilot instructions
- agent-log-analysisSkill
- agent-mdSkill
- agent-md-writerSkill
- agent-skill-md-writerSkill
- agentskillsSkill
- agents-md-writerSkill
- ai-prompt-writerSkill
- ansibleSkill
- apache-airflow-apiSkill
- apache-airflow-dagsSkill
- astro-cliSkill
- astronomer-docsSkill
- awesome-copilotSkill
- brainstorm-agent-runsSkill
- brainstorm-github-prSkill
- brainstormSkill
- catSkill
- chrome-devtoolsSkill
- claude-docsSkill
- codeqlSkill
- code-reviewSkill
- code-tourSkill
- context-aware-opsSkill
- copilot-cliSkill
- copilot-docsSkill
- critical-thinkingSkill
- datadog-agentSkill
- datadog-apiSkill
- datadog-mcpSkill
- datadog-monitorsSkill
- datadog-pulumiSkill
- devcontainerSkill
- dictationSkill
- direnvSkill
- dockerfileSkill
- dockerSkill
- docs-reviewSkill
- docs-writerSkill
- dot-claudeSkill
- dotfilesSkill
- dot-githubSkill
- editorconfigSkill
- fact-writerSkill
- gdpr-compliantSkill
- gh-agent-taskSkill
- gh-apiSkill
- gh-aw-compileSkill
- gh-aw-firewall-debugSkill
- gh-aw-firewallSkill
- gh-aw-newSkill
- gh-awSkill
- gh-aw-troubleshootingSkill
- gh-codespaceSkill
- gh-issueSkill
- gh-modelsSkill
- The first 60 shown.
The file
Show its rules and text
We split this skill into the rules it gives an agent
26 rules. About 0 are common, 21 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈21
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 15
Ingest Targets: Read the contents of the target <file-path> or <folder-path>.
- Distinctive: line 19
Format Document: Use a "minimal" or "verbose" template structure to compose the guidelines.
- Very specific: line 20
Output Generation: Write the result to a new file (e.g., CONTRIBUTING.md, STYLE.md) or inject it into the README.md.
- Distinctive: line 25
Template Adaptation: Use "verbose" for comprehensive style guides and "minimal" for concise rule summaries.
- Distinctive: line 26
Contextual Insertion: When appending to README.md, locate the most logical insertion point (e.g., at the end or under a "Contributing" …
- Distinctive: line 30
When tasked with creating coding guidelines from existing code.
- Very specific: line 32
When generating CONTRIBUTING.md, STYLE.md, or STYLEGUIDE.md.
- Very specific: line 36
When the project already has an explicit, well-documented CONTRIBUTING.md or .editorconfig that should not be overwritten.
- Very specific: line 38
When generating general project documentation unrelated to coding style (use docs-writer).
- Distinctive: line 49
Read the source contents to infer formatting patterns.
- Distinctive: line 51
Write to the designated output location.
- Distinctive: line 55
If file styles are extremely chaotic, prompt the user to choose a baseline reference file before generating the standard.
- Distinctive: line 60
If requested, generate a companion test file to enforce the newly defined standards.
- Distinctive: line 84
Indentation: Use 4 spaces per indent (or tabs).
- Distinctive: line 86
Braces: Use the "K&R" style (opening brace on the same line) or the "Allman" style (opening brace on a new line).
- Distinctive: line 120
All contributions should follow these rules unless otherwise noted.
- Distinctive: line 125
Keep functions and methods small and focused.
- Distinctive: line 126
Avoid repeating logic; prefer shared helpers/utilities.
- Distinctive: line 127
Remove unused variables, imports, code paths, and files.
- Distinctive: line 131
Use descriptive names. Avoid abbreviations unless well-known.
- Distinctive: line 166
Keep comments up-to-date as code changes.
- Distinctive: line 180
Avoid silent failures; either return errors or log them appropriately.
- Distinctive: line 187
Write clear commit messages:
- Distinctive: line 195
Keep pull requests reasonably small.
- Distinctive: line 201
Write tests for new functionality.
- Distinctive: line 203
Prefer readable test cases over complex test abstraction.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Skill Name: coding-standard-writer
<!-- markdownlint-disable MD013 MD023 MD031 MD032 -->Dynamically generate a coding standards document based on the existing syntax, formatting, and conventions found in provided file(s) or folder(s).
Core Process
- Ingest Targets: Read the contents of the target
<file-path>or<folder-path>. - Analyze Syntax: Parse indentation, variable naming (
camelCase,snake_case), commenting styles, block nesting, and string quotation formats. - Identify Majority Rules: Tally occurrences of different styles; establish the majority as the standard.
- Handle Inconsistencies: Report formatting inconsistencies and optionally fix them only when explicitly requested by the user; always verify changes using project-specific linting tools.
- Format Document: Use a "minimal" or "verbose" template structure to compose the guidelines.
- Output Generation: Write the result to a new file (e.g.,
CONTRIBUTING.md,STYLE.md) or inject it into theREADME.md.
Core Principles
- Empirical Inference: Standards must be derived strictly from existing code, not assumed.
- Template Adaptation: Use "verbose" for comprehensive style guides and "minimal" for concise rule summaries.
- Contextual Insertion: When appending to
README.md, locate the most logical insertion point (e.g., at the end or under a "Contributing" heading).
When to Use
- When tasked with creating coding guidelines from existing code.
- To detect and fix formatting inconsistencies across multiple files.
- When generating
CONTRIBUTING.md,STYLE.md, orSTYLEGUIDE.md.
When Not to Use
- When the project already has an explicit, well-documented
CONTRIBUTING.mdor.editorconfigthat should not be overwritten. - To enforce rules that contradict the organization's global engineering standards.
- When generating general project documentation unrelated to coding style (use
docs-writer).
Common Pitfalls
- Ignoring Edge Cases: Establishing a "majority rule" based on a single small file, leading to a standard that conflicts with the rest of the massive codebase.
- Overwriting Existing Rules: Blindly generating a new
STYLE.mdthat overrides a carefully curated, existing style guide without asking the user. - Opinionated Hallucinations: Injecting Python conventions (like PEP 8) into a JavaScript project just because the LLM prefers them, rather than strictly empirical inference.
Quick Start
- Identify the reference file or folder.
- Read the source contents to infer formatting patterns.
- Generate the coding standard using a minimal or verbose markdown template.
- Write to the designated output location.
Diagnostics and Troubleshooting
- If file styles are extremely chaotic, prompt the user to choose a baseline reference file before generating the standard.
Best Practices
- Fetch external style guides as supplemental reference only when explicitly requested, and do not let them override the codebase's existing majority conventions.
- If requested, generate a companion test file to enforce the newly defined standards.
What to Avoid
- Overwriting existing documented standards without confirmation.
- Injecting subjective preferences that contradict the codebase's existing majority style.
Coding Standards Templates
"m", "minimal"
```markdown
## 1. Introduction
* **Purpose:** Briefly explain why the coding standards are being established (e.g., to improve code quality, maintainability, and team collaboration).
* **Scope:** Define which languages, projects, or modules this specification applies to.
## 2. Naming Conventions
* **Variables:** `camelCase`
* **Functions/Methods:** `PascalCase` or `camelCase`.
* **Classes/Structs:** `PascalCase`.
* **Constants:** `UPPER_SNAKE_CASE`.
## 3. Formatting and Style
* **Indentation:** Use 4 spaces per indent (or tabs).
* **Line Length:** Limit lines to a maximum of 80 or 120 characters.
* **Braces:** Use the "K&R" style (opening brace on the same line) or the "Allman" style (opening brace on a new line).
* **Blank Lines:** Specify how many blank lines to use for separating logical blocks of code.
## 4. Commenting
* **Docstrings/Function Comments:** Describe the function's purpose, parameters, and return values.
* **Inline Comments:** Explain complex or non-obvious logic.
* **File Headers:** Specify what information should be included in a file header, such as author, date, and file description.
## 5. Error Handling
* **General:** How to handle and log errors.
* **Specifics:** Which exception types to use, and what information to include in error messages.
## 6. Best Practices and Anti-Patterns
* **General:** List common anti-patterns to avoid (e.g., global variables, magic numbers).
* **Language-specific:** Specific recommendations based on the project's programming language.
## 7. Examples
* Provide a small code example demonstrating the correct application of the rules.
* Provide a small code example of an incorrect implementation and how to fix it.
## 8. Contribution and Enforcement
* Explain how the standards are to be enforced (e.g., via code reviews).
* Provide a guide for contributing to the standards document itself.
```"v", verbose"
```markdown
# Style Guide
This document defines the style and conventions used in this project.
All contributions should follow these rules unless otherwise noted.
## 1. General Code Style
- Favor clarity over brevity.
- Keep functions and methods small and focused.
- Avoid repeating logic; prefer shared helpers/utilities.
- Remove unused variables, imports, code paths, and files.
## 2. Naming Conventions
Use descriptive names. Avoid abbreviations unless well-known.
| Item | Convention | Example |
|-----------------|----------------------|--------------------|
| Variables | `lower_snake_case` | `buffer_size` |
| Functions | `lower_snake_case()` | `read_file()` |
| Constants | `UPPER_SNAKE_CASE` | `MAX_RETRIES` |
| Types/Structs | `PascalCase` | `FileHeader` |
| File Names | `lower_snake_case` | `file_reader.c` |
## 3. Formatting Rules
- Indentation: **4 spaces**
- Line length: **max 100 characters**
- Encoding: **UTF-8**, no BOM
- End files with a newline
### Braces (example in C, adjust for your language)
```c
if (condition) {
do_something();
} else {
do_something_else();
}
```
### Spacing
- One space after keywords: `if (x)`, not `if(x)`
- One blank line between top-level functions
## 4. Comments & Documentation
- Explain *why*, not *what*, unless intent is unclear.
- Keep comments up-to-date as code changes.
- Public functions should include a short description of purpose and parameters.
Recommended tags:
```text
TODO: follow-up work
FIXME: known incorrect behavior
NOTE: non-obvious design decision
```
## 5. Error Handling
- Handle error conditions explicitly.
- Avoid silent failures; either return errors or log them appropriately.
- Clean up resources (files, memory, handles) before returning on failure.
## 6. Commit & Review Practices
### Commits
- One logical change per commit.
- Write clear commit messages:
```text
Short summary (max ~50 chars)
Optional longer explanation of context and rationale.
```
### Reviews
- Keep pull requests reasonably small.
- Be respectful and constructive in review discussions.
- Address requested changes or explain if you disagree.
## 7. Tests
- Write tests for new functionality.
- Tests should be deterministic (no randomness without seeding).
- Prefer readable test cases over complex test abstraction.
## 8. Changes to This Guide
Style evolves.
Propose improvements by opening an issue or sending a patch updating this document.
```References
- C Style Guide
- C# Style Guide
- C++ Style Guide
- Go Style Guide
- Java Style Guide
- AngularJS App Style Guide
- jQuery Style Guide
- JavaScript Style Guide
- JSON Style Guide
- Kotlin Style Guide
- Markdown Style Guide
- Perl Style Guide
- PHP Style Guide
- Python Style Guide
- Ruby Style Guide
- Rust Style Guide
- Swift Style Guide
- TypeScript Style Guide
- Visual Basic Style Guide
- Shell Script Style Guide
- Git Usage Style Guide
- PowerShell Style Guide
- CSS
- Sass Style Guide
- HTML Style Guide
- Linux kernel Style Guide
- Node.js Style Guide
- SQL Style Guide
- Angular Style Guide
- Vue Style Guide
- Django Style Guide
- SystemVerilog Style Guide
Related Skills
- docs-writer: You MUST load this skill when writing or updating READMEs and Architectural Decision Records.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

