Chuyển đến nội dung
Skillpedia
Viết lách40k · #7482

write-coding-standards-from-file

Skill này làm gì

Công cụ này tạo một tài liệu tiêu chuẩn lập trình cho dự án. Nó phân tích một tệp mã có sẵn để thiết lập các quy tắc phong cách và hướng dẫn cho dự án.

Khi nào nên dùng

  • ✓Khi bắt đầu một dự án mới và muốn định nghĩa hướng dẫn phong cách.
  • ✓Khi bạn muốn cả nhóm tuân theo cùng một quy tắc viết mã.
  • ✓Khi bạn cần ghi lại các thực hành lập trình tốt nhất cho dự án.

Liên kết skill

https://github.com/github/awesome-copilot/blob/main/skills/write-coding-standards-from-file/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/github/awesome-copilot/blob/main/skills/write-coding-standards-from-file/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Tạo hướng dẫn phong cách lập trình dựa trên tệp “my_code.py”.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Công cụ đọc tệp mã bạn cung cấp. Nó xác định phong cách viết mã đang dùng (như thụt đầu dòng và tên biến), rồi tạo tài liệu với các quy tắc này để người khác làm theo.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

Write Coding Standards From File

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.

Rules and Configuration

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.

Parameters for the prompt have a text definition. There is one required parameter ${fileName}, and several optional parameters ${folderName}, ${instructions}, and any [configVariableAsParameter].

Configuration Variables

  • addStandardsTest = false;
  • addToREADME = false;
  • addToREADMEInsertions = ["atBegin", "middle", "beforeEnd", "bestFitUsingContext"];
    • Default to beforeEnd.
  • createNewFile = true;
  • fetchStyleURL = true;
  • findInconsistencies = true;
  • fixInconsistencies = true;
  • 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"];
    • For each file in ${newFileName}, if file does not exist, use that file name and break, else continue to next file name of ${newFileName}.
  • outputSpecToPrompt = false;
  • useTemplate = "verbose"; // or "v"
    • Possible values are [["v", "verbose"], ["m", "minimal"], ["b", "best fit"], ["custom"]].
    • 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.
    • If custom, then apply per request.

Configuration Variables as Prompt Parameters

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.

Prompt Parameters

  • 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.
  • 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.
  • instructions = Additional instructions, rules, and procedures that will be provided for unique cases.
  • [configVariableAsParameter] = If passed will override the default state of the configuration variable. Example:
    • useTemplate = If passed will override the configuration ${useTemplate} default. Values are [["v", "verbose"], ["m", "minimal"], ["b", "best fit"]].

Required and Optional Parameters

  • fileName - required
  • folderName - optional
  • instructions - optional
  • [configVariableAsParameter] - optional

Variable and Parameter Configuration Conditions

${fileName}.length > 1 || ${folderName} != undefined

  • If true, toggle ${fixInconsistencies} to false.

${addToREADME} == true

  • Insert the coding standards into the README.md instead of outputting to the prompt or creating a new file.
  • If true, toggle both ${createNewFile} and ${outputSpecToPrompt} to false.

${addToREADMEInsertions} == "atBegin"

  • If ${addToREADME} is true, then insert the coding standards data at the beginning of the README.md file after the title.

${addToREADMEInsertions} == "middle"

  • 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.

${addToREADMEInsertions} == "beforeEnd"

  • 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.

${addToREADMEInsertions} == "bestFitUsingContext"

…

Câu hỏi thường gặp

Nếu tôi cung cấp nhiều tệp thì sao?

Nếu bạn cung cấp nhiều tệp hoặc một thư mục, công cụ sẽ kết hợp thông tin từ tất cả để tạo một bộ tiêu chuẩn duy nhất.

Tôi có thể thêm hướng dẫn riêng không?

Có, bạn có thể thêm hướng dẫn bổ sung cho các trường hợp cụ thể, như quy ước đặt tên hoặc quy tắc định dạng riêng.

Công cụ có sửa các vấn đề nó tìm thấy không?

Có, nếu được cấu hình, công cụ có thể phát hiện các điểm không nhất quán trong mã và sửa để tuân theo tiêu chuẩn đã định.

Chi tiết

Mô tả gốc của tác giả

Write 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.

repo: github/awesome-copilot

Độ phổ biến

Sao GitHub
40k
Vị trí xếp hạng
#7482
Giấy phép
MIT
Cập nhật
15/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự