/repo-documentation:write-coding-standards-from-file fileName=<path> [folderName=<path>] [instructions=<text>] [configVariable=value]from repo-documentation
Analyzes existing file or folder style to infer coding conventions and generate a standards document (CODING_STANDARDS.md, CONTRIBUTING.md, or README.md). Detects inconsistencies in indentation, naming, commenting, and syntax patterns.
Ships in repo-documentation. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Analyze one file or a folder of files, infer the majority syntax and style conventions, optionally compare them with language style references, and output or write a project coding standards document.
Use $ARGUMENTS to resolve the required fileName, optional folderName, optional instructions, and any configuration override passed as [configVariableAsParameter]. If multiple files or folderName are supplied, aggregate their style observations into one temporary dataset before writing standards.
| Parameter | Required | Meaning |
|---|---|---|
fileName | Yes | File analyzed for indentation, variable naming, commenting, conditional procedures, functional procedures, and syntax style. |
folderName | No | Folder whose files are aggregated and analyzed as one dataset. |
instructions | No | Extra rules, procedures, or unique-case guidance. |
[configVariableAsParameter] | No | Override a default such as useTemplate, addToREADME, createNewFile, or newFileName. |
| Variable | Default | Rule |
|---|---|---|
addStandardsTest | false | When true, write a test file that checks whether the analyzed files adhere to the generated standards. |
addToREADME | false | When true, insert standards into README.md and set createNewFile=false, outputSpecToPrompt=false. |
addToREADMEInsertions | ["atBegin", "middle", "beforeEnd", "bestFitUsingContext"] | Default to beforeEnd; controls where standards are inserted in README.md. |
createNewFile | true | Create a standards file and set outputSpecToPrompt=false, addToREADME=false. |
fetchStyleURL | true | Fetch the relevant language style URL from the reference list when a language can be identified. |
findInconsistencies | true | Count indentation, line-break, comment, conditional/function nesting, and quote-wrapper patterns; record minority deviations. |
fixInconsistencies | true | Edit low-count categories to match the majority when safe; set to false when more than one file or folderName is used. |
newFileName | candidate list | Use the first missing name from CONTRIBUTING.md, STYLE.md, CODE_OF_CONDUCT.md, CODING_STANDARDS.md, DEVELOPING.md, CONTRIBUTION_GUIDE.md, GUIDELINES.md, PROJECT_STANDARDS.md, BEST_PRACTICES.md, HACKING.md. |
outputSpecToPrompt | false | Return standards in the response and set createNewFile=false, addToREADME=false. |
useTemplate | "verbose" or "v" | Accept [ ["v", "verbose"], ["m", "minimal"], ["b", "best fit"], ["custom"] ]; custom uses the supplied instructions or template. |
| Condition | Action |
|---|---|
| `${fileName}.length > 1 | |
${addToREADME} == true | Insert into README.md; disable createNewFile and outputSpecToPrompt. |
${addToREADMEInsertions} == "atBegin" | Insert after the title in README.md. |
${addToREADMEInsertions} == "middle" | Insert near the middle and adapt the standards heading to the README composition. |
${addToREADMEInsertions} == "beforeEnd" | Insert at the end after a new line. |
${addToREADMEInsertions} == "bestFitUsingContext" | Insert at the best fitting line based on README context and flow. |
${addStandardsTest} == true | Write a standards adherence test after the standards file is complete. |
${createNewFile} == true | Create a file from newFileName; disable README insertion and prompt-only output. |
${fetchStyleURL} == true | For the detected language, fetch the relevant URL from ### Fetch Links style references. |
${findInconsistencies} == true | Categorize syntax patterns, count majority/minority forms, and store inconsistencies. |
${fixInconsistencies} == true | Fix minority syntax categories using stored inconsistency evidence. |
typeof ${newFileName} == "string" | Create exactly that file. |
typeof ${newFileName} != "string" | Iterate the candidate list and use the first file that does not exist, then break. |
${outputSpecToPrompt} == true | Return the standards instead of writing a file or README update. |
| `${useTemplate} == "v" | |
| `${useTemplate} == "m" | |
| `${useTemplate} == "b" | |
| `${useTemplate} == "custom" |
Keep these original configuration labels recognizable when translating older requests: boolean, string[], string, object, quasi-configuration, as-is, and/or, or, top-level, well-known, line-breaks, ${fileName}, ${folderName}, ${instructions}, ${addToREADME}, ${createNewFile}, ${fixInconsistencies}, ${newFileName}, ${outputSpecToPrompt}, ${useTemplate}, ${fileName} == [<Language> Style Guide], #fetch ${item}, and #fetch (URL). The template selectors may appear as [ ["v", "verbose"], ["m", "minimal"], ["b", "best fit"] ], [["v", "verbose"], ["m", "minimal"], ["b", "best fit"]], "m", "minimal", "v", verbose", ### "m", "minimal", ### "v", "verbose", ## Coding Standards Templates, and ## Variable and Parameter Configuration Conditions in source material.
When demonstrating spacing or braces, include examples such as if (x), not if(x), and sample calls like do_something and do_something_else only as illustrative placeholders.
| Section | Infer from source |
|---|---|
| Introduction | Purpose, scope, language, package, and project context. |
| Naming conventions | Variables such as camelCase or lower_snake_case, functions/methods, classes/structs, constants like UPPER_SNAKE_CASE, and file naming. |
| Formatting and style | Indentation, line length, braces such as K&R or Allman, blank lines, UTF-8/no BOM, final newline. |
| Comments and documentation | Docstrings, inline comments, file headers, TODO, FIXME, and NOTE practices. |
| Error handling | Exception types, returned errors, logging expectations, cleanup requirements. |
| Best practices and anti-patterns | Global variables, magic numbers, repetition, unused code, and language-specific rules. |
| Examples | One correct and one corrected bad example when useful. |
| Contribution and enforcement | Code review expectations, tests, and guide maintenance. |
When fetchStyleURL is true, use only the relevant language or ecosystem links:
| Language or ecosystem | URL |
|---|---|
| C Style Guide | https://users.ece.cmu.edu/~eno/coding/CCodingStandard.html |
| C# Style Guide | https://learn.microsoft.com/en-us/dotnet/csharp/fundamentals/coding-style/coding-conventions |
| C++ Style Guide | https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines |
| Go Style Guide | https://github.com/golang-standards/project-layout |
| Java Style Guide | https://coderanch.com/wiki/718799/Style |
| AngularJS App Style Guide | https://github.com/mgechev/angularjs-style-guide |
| jQuery Style Guide | https://contribute.jquery.org/style-guide/js/ |
| JavaScript Style Guide | https://www.w3schools.com/js/js_conventions.asp |
| JSON Style Guide | https://google.github.io/styleguide/jsoncstyleguide.xml |
| Kotlin Style Guide | https://kotlinlang.org/docs/coding-conventions.html |
| Markdown Style Guide | https://cirosantilli.com/markdown-style-guide/ |
| Perl Style Guide | https://perldoc.perl.org/perlstyle |
| PHP Style Guide | https://phptherightway.com/ |
| Python Style Guide | https://peps.python.org/pep-0008/ |
| Ruby Style Guide | https://rubystyle.guide/ |
| Rust Style Guide | https://github.com/rust-lang/rust/tree/HEAD/src/doc/style-guide/src |
| Swift Style Guide | https://www.swift.org/documentation/api-design-guidelines/ |
| TypeScript Style Guide | https://www.typescriptlang.org/docs/handbook/declaration-files/do-s-and-don-ts.html |
| Visual Basic Style Guide | https://en.wikibooks.org/wiki/Visual_Basic/Coding_Standards |
| Shell Script Style Guide | https://google.github.io/styleguide/shellguide.html |
| Git Usage Style Guide | https://github.com/agis/git-style-guide |
| PowerShell Style Guide | https://github.com/PoshCode/PowerShellPracticeAndStyle |
| CSS | https://cssguidelin.es/ |
| Sass Style Guide | https://sass-guidelin.es/ |
| HTML Style Guide | https://github.com/marcobiedermann/html-style-guide |
| Linux kernel Style Guide | https://www.kernel.org/doc/html/latest/process/coding-style.html |
| Node.js Style Guide | https://github.com/felixge/node-style-guide |
| SQL Style Guide | https://www.sqlstyle.guide/ |
| Angular Style Guide | https://angular.dev/style-guide |
| Vue Style Guide | https://vuejs.org/style-guide/rules-strongly-recommended.html |
| Django Style Guide | https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/coding-style/ |
| SystemVerilog Style Guide | https://github.com/lowRISC/style-guides/blob/master/VerilogCodingStyle.md |
Use for small projects or when useTemplate is "m" or "minimal".
## 1. Introduction
* **Purpose:** Briefly explain why the coding standards are being established.
* **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 K&R or Allman style.
* **Blank Lines:** Specify separation between logical blocks.
## 4. Commenting
* **Docstrings/Function Comments:** Describe purpose, parameters, and return values.
* **Inline Comments:** Explain complex or non-obvious logic.
* **File Headers:** Specify author, date, and file description if the project uses them.
## 5. Error Handling
* **General:** How to handle and log errors.
* **Specifics:** Which exception types to use and what to include in error messages.
## 6. Best Practices and Anti-Patterns
* **General:** Avoid global variables and magic numbers.
* **Language-specific:** Add project-specific recommendations.
## 7. Examples
* Provide correct and incorrect examples.
## 8. Contribution and Enforcement
* Explain review and enforcement.
Use for larger projects, or when useTemplate is "v" or "verbose".
# 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
| 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
## 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.
- Tags: `TODO: follow-up work`, `FIXME: known incorrect behavior`, `NOTE: non-obvious design decision`.
## 5. Error Handling
- Handle error conditions explicitly.
- Avoid silent failures.
- Clean up resources before returning on failure.
## 6. Commit & Review Practices
- One logical change per commit.
- Write clear commit messages.
- Keep pull requests reasonably small.
## 7. Tests
- Write tests for new functionality.
- Tests should be deterministic.
- Prefer readable test cases over complex test abstraction.
## 8. Changes to This Guide
Style evolves. Propose improvements by updating this document.
## Coding standards result
**Status:** created file | updated README.md | output only | blocked
**Source:** `<fileName or folderName>`
**Template:** minimal | verbose | best fit | custom
### Style evidence
| Category | Majority pattern | Exceptions |
| --- | --- | --- |
| Indentation | <tabs/2/4 spaces> | <files or none> |
| Naming | <observed conventions> | <exceptions or none> |
| Comments | <docstring/comment style> | <exceptions or none> |
| Error handling | <observed approach> | <exceptions or none> |
### Artifact
- `<CONTRIBUTING.md or STYLE.md or CODE_OF_CONDUCT.md or CODING_STANDARDS.md or DEVELOPING.md or CONTRIBUTION_GUIDE.md or GUIDELINES.md or PROJECT_STANDARDS.md or BEST_PRACTICES.md or HACKING.md or README.md>`
### Inconsistencies
- <fixed or reported inconsistency>
### Validation
- `fetchStyleURL`: true | false, <URL or not applicable>
- `findInconsistencies`: true | false
- `fixInconsistencies`: true | false
fileName is present or folderName provides a real file set to analyze.fixInconsistencies is disabled for multi-file or folder analysis unless the user explicitly accepts edits.addToREADME, createNewFile, and outputSpecToPrompt precedence.newFileName uses the first missing candidate or the exact string supplied by the user.instructions.What SKILL.md sets; muted values are Claude Code's defaults
15 skills in this plugin
/add-educational-commentsAdd educational comments to existing code files while preserving encoding, line endings, indentation, syntax, and build correctness. Use this skill when the user asks to annotate a file for learning, add teaching comments, explain code inline, adjust comment detail or repetitiveness, or use Line Number Referencing./comment-code-generate-a-tutorialTransform a Python script into a polished beginner-friendly project by refactoring code, adding instructional comments, and generating a complete README.md tutorial. Use this skill when asked to explain, comment, clean up, teach, or turn a Python script into a tutorial project./convert-plaintext-to-mdConvert plaintext or generic text documentation into well-structured Markdown while preserving source content and applying explicit instructions, documented options, or a converted guide file. Use when asked to convert a file to Markdown, finalize Markdown formatting, apply header patterns, use a guide document, or target GitHub, StackOverflow, VS Code, GitLab, or CommonMark rendering./create-agentsmdCreate a high-quality AGENTS.md file for a repository by inspecting project structure, workflows, commands, tests, and conventions. Use this skill when the user asks to create, update, or improve AGENTS.md, add coding-agent instructions, document repo setup for agents, or follow the agents.md format./create-llmsCreate a new repository-root llms.txt file from repository structure and documentation according to the llms.txt specification. Use when users ask to create llms.txt, generate LLM navigation, document repository structure for LLMs, or add an llms.txt compliant with https://llmstxt.org/./create-readmeCreate or improve a concise, appealing, project-specific README.md with a clear overview, setup, usage, and practical examples. Use this skill when the user asks to generate, refresh, polish, rewrite, or make a repository README more useful for GitHub readers.npx claudepluginhub gbb-acelerators/awesome-harness-primitives --plugin repo-documentationOther plugins' skills for the same job