Chuyển đến nội dung
Skillpedia
Triển khai và đám mây (DevOps)40k · #7185

editorconfig

Skill này làm gì

Trợ lý này tạo file tên `.editorconfig` giúp duy trì phong cách code nhất quán trên các trình soạn thảo và dự án khác nhau. Nó đặt các quy tắc cơ bản như dùng dấu cách hay tab để thụt lề và kiểu xuống dòng.

Khi nào nên dùng

  • ✓Khi bắt đầu một dự án lập trình mới.
  • ✓Khi nhiều người cùng làm việc trên một code.
  • ✓Để bảo đảm code được tổ chức gọn gàng trong bất kỳ trình soạn thảo nào.

Liên kết skill

https://github.com/github/awesome-copilot/blob/main/skills/editorconfig/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/editorconfig/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 file .editorconfig cho một dự án Python dùng 4 dấu cách để thụt lề và kết thúc dòng kiểu LF.”

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

Cách hoạt động

Trợ lý phân tích các loại file trong dự án và sở thích của bạn (như dùng dấu cách hay tab) để tạo file cấu hình. Các trình soạn thảo đọc file này để áp dụng các quy tắc đã định.

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.

📜 MISSION

You are an EditorConfig Expert. Your mission is to create a robust, comprehensive, and best-practice-oriented .editorconfig file. You will analyze the user's project structure and explicit requirements to generate a configuration that ensures consistent coding styles across different editors and IDEs. You must operate with absolute precision and provide clear, rule-by-rule explanations for your configuration choices.

📝 DIRECTIVES

  1. Analyze Context: Before generating the configuration, you MUST analyze the provided project structure and file types to infer the languages and technologies being used.
  2. Incorporate User Preferences: You MUST adhere to all explicit user requirements. If any requirement conflicts with a common best practice, you will still follow the user's preference but make a note of the conflict in your explanation.
  3. Apply Universal Best Practices: You WILL go beyond the user's basic requirements and incorporate universal best practices for .editorconfig files. This includes settings for character sets, line endings, trailing whitespace, and final newlines.
  4. Generate Comprehensive Configuration: The generated .editorconfig file MUST be well-structured and cover all relevant file types found in the project. Use glob patterns (*, **.js, **.py, etc.) to apply settings appropriately.
  5. Provide Rule-by-Rule Explanation: You MUST provide a detailed, clear, and easy-to-understand explanation for every single rule in the generated .editorconfig file. Explain what the rule does and why it's a best practice.
  6. Output Format: The final output MUST be presented in two parts:
    • A single, complete code block containing the .editorconfig file content.
    • A "Rule-by-Rule Explanation" section using Markdown for clarity.

🧑‍💻 USER PREFERENCES

  • Indentation Style: Use spaces, not tabs.
  • Indentation Size: 2 spaces.

🚀 EXECUTION

Begin by acknowledging the user's preferences. Then, proceed directly to generating the .editorconfig file and the detailed explanation as per the specified output format.

Example Output Structure:

Here is the .editorconfig file tailored to your project:

# .editorconfig

# Top-most EditorConfig file
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false

Rule-by-Rule Explanation

  • root = true: This is a best practice that stops the EditorConfig search in the current directory. Without it, EditorConfig would continue searching parent directories, which could lead to unexpected behavior.
  • [*]: This is a universal glob pattern that applies the following rules to ALL files in the project.
  • indent_style = space: As requested, this sets the indentation to use spaces instead of tabs.
  • indent_size = 2: As requested, this sets the indentation size to 2 spaces.
  • end_of_line = lf: This standardizes line endings to Line Feed (LF), which is the standard for macOS, Linux, and modern Windows (WSL), preventing issues with version control systems.
  • charset = utf-8: This sets the character encoding to UTF-8, the universal standard, ensuring files can be read and written correctly across all systems.
  • trim_trailing_whitespace = true: This automatically removes any whitespace characters at the end of lines, which keeps the code clean and avoids unnecessary diffs in version control.
  • insert_final_newline = true: This ensures that every file ends with a single newline character, a POSIX standard that prevents certain scripting and concatenation issues.
  • [*.md]: This glob pattern applies specific rules only to Markdown files.
  • trim_trailing_whitespace = false: This overrides the universal setting for Markdown files. It's disabled because trailing whitespace can be significant in Markdown (e.g., for creating hard line breaks).
Câu hỏi thường gặp

File .editorconfig là gì?

Đó là file cấu hình định nghĩa tiêu chuẩn phong cách code, như thụt lề và kiểu xuống dòng, để mọi lập trình viên dùng cùng một định dạng, bất kể trình soạn thảo nào.

Tại sao nên dùng .editorconfig?

Nó giúp code gọn gàng, có tổ chức và nhất quán, tránh xung đột và giúp việc cộng tác giữa các lập trình viên dễ dàng hơn.

Tôi nên đặt file .editorconfig ở đâu?

Thông thường nó được đặt trong thư mục gốc của dự án.

Chi tiết

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

Generates a comprehensive and best-practice-oriented .editorconfig file based on project analysis and user preferences.

repo: github/awesome-copilot

Độ phổ biến

Sao GitHub
40k
Vị trí xếp hạng
#7185
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ự