$npx -y skills add github/awesome-copilot --skill write-coding-standards-from-fileWrite a coding standards document for a project using the coding styles from the file(s) and/or folder(s) passed as arguments in the prompt.
| 1 | # Write Coding Standards From File |
| 2 | |
| 3 | Use the existing syntax of the file(s) to establish the standards and style guides for the project. If more than one file or a folder is passed, loop through each file or files in the folder, appending the file's data to temporary memory or a file, then when complete use temporary data as a single instance; as if it were the file name to base the standards and style guideline on. |
| 4 | |
| 5 | ## Rules and Configuration |
| 6 | |
| 7 | Below is a set of quasi-configuration `boolean` and `string[]` variables. Conditions for handling `true`, or other values for each variable are under the level two heading `## Variable and Parameter Configuration Conditions`. |
| 8 | |
| 9 | Parameters for the prompt have a text definition. There is one required parameter **`${fileName}`**, and several optional parameters **`${folderName}`**, **`${instructions}`**, and any **`[configVariableAsParameter]`**. |
| 10 | |
| 11 | ### Configuration Variables |
| 12 | |
| 13 | * addStandardsTest = false; |
| 14 | * addToREADME = false; |
| 15 | * addToREADMEInsertions = ["atBegin", "middle", "beforeEnd", "bestFitUsingContext"]; |
| 16 | - Default to **beforeEnd**. |
| 17 | * createNewFile = true; |
| 18 | * fetchStyleURL = true; |
| 19 | * findInconsistencies = true; |
| 20 | * fixInconsistencies = true; |
| 21 | * newFileName = ["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"]; |
| 22 | - For each file in `${newFileName}`, if file does not exist, use that file name and `break`, else continue to next file name of `${newFileName}`. |
| 23 | * outputSpecToPrompt = false; |
| 24 | * useTemplate = "verbose"; // or "v" |
| 25 | - Possible values are `[["v", "verbose"], ["m", "minimal"], ["b", "best fit"], ["custom"]]`. |
| 26 | - Selects one of the two example templates at the bottom of prompt file under the level two heading `## Coding Standards Templates`, or use another composition that is a better fit. |
| 27 | - If **custom**, then apply per request. |
| 28 | |
| 29 | ### Configuration Variables as Prompt Parameters |
| 30 | |
| 31 | If any of the variable names are passed to prompt as-is, or as a similar but clearly related text value, then override the default variable value with the value passed to prompt. |
| 32 | |
| 33 | ### Prompt Parameters |
| 34 | |
| 35 | * **fileName** = The name of the file that will be analyzed in terms of: indentation, variable naming, commenting, conditional procedures, functional procedures, and other syntax related data for the coding language of the file. |
| 36 | * folderName = The name of the folder that will be used to extract data from multiple files into one aggregated dataset that will be analyzed in terms of: indentation, variable naming, commenting, conditional procedures, functional procedures, and other syntax related data for the coding language of the files. |
| 37 | * instructions = Additional instructions, rules, and procedures that will be provided for unique cases. |
| 38 | * [configVariableAsParameter] = If passed will override the default state of the configuration variable. Example: |
| 39 | - useTemplate = If passed will override the configuration `${useTemplate}` default. Values are `[["v", "verbose"], ["m", "minimal"], ["b", "best fit"]]`. |
| 40 | |
| 41 | #### Required and Optional Parameters |
| 42 | |
| 43 | * **fileName** - required |
| 44 | * folderName - *optional* |
| 45 | * instructions - *optional* |
| 46 | * [configVariableAsParameter] - *optional* |
| 47 | |
| 48 | ## Variable and Parameter Configuration Conditions |
| 49 | |
| 50 | ### `${fileName}.length > 1 || ${folderName} != undefined` |
| 51 | |
| 52 | * If true, toggle `${fixInconsistencies}` to false. |
| 53 | |
| 54 | ### `${addToREADME} == true` |
| 55 | |
| 56 | * Insert the coding standards into the `README.md` instead of outputting to the prompt or creating a new file. |
| 57 | * If true, toggle both `${createNewFile}` and `${outputSpecToPrompt}` to false. |
| 58 | |
| 59 | ### `${addToREADMEInsertions} == "atBegin"` |
| 60 | |
| 61 | * If `${addToREADME}` is true, then insert the coding standards data at the **beginning** of the `README.md` file after the title. |
| 62 | |
| 63 | ### `${addToREADMEInsertions} == "middle"` |
| 64 | |
| 65 | * If `${addToREADME}` is true, then insert the coding standards data at the **middle** of the `README.md` file, changing the standards title heading to match that of the `README.md` composition. |
| 66 | |
| 67 | ### `${addToREADMEInsertions} == "beforeEnd"` |
| 68 | |
| 69 | * If `${addToREADME}` is true, then insert the coding standards data at the **end** of the `README.md` file, inserting a new line after the last character, then inserting the data on a new line. |
| 70 | |
| 71 | ### `${addToREADMEInsertions} == "bestFitUsingContext"` |
| 72 | |
| 73 | * If `${addToREADME}` is true, then insert the coding standards data at the **best fitting line** of the `README.md` file in regards to the context of the `README.md` composition and flow of data. |
| 74 | |
| 75 | ### `${addStandardsTest} == true` |
| 76 | |
| 77 | * Once the coding standards file is complete, write a test file to ensure the file or files passed to it adhere to the coding standards. |
| 78 | |
| 79 | ### `${createNewFile} == true` |
| 80 | |
| 81 | * Create |