# 一貫性のあるコーディングスタイル

[![](https://img.shields.io/badge/Lv3-Mature_Best_Practice-brightgreen)](https://github.com/orgs/AI-Native-Development/projects/1/)

## Description

一貫性のあるコーディングスタイルは、ソフトウェア開発において非常に重要です。それはコードの可読性を向上させるだけでなく、GitHub Copilot からのより良い提案にもつながります。インデント、タブ、命名規則、コメントの書き方、言語固有の省略方法など、コーディングスタイルの領域は多岐にわたります。一様なコーディングスタイルとパターンに従うことで、開発者は優れたコーディング慣行に従いやすくなります。

### Example

以下は、明確な関数名を使用し、コードベースのパターンに従う良い例です（snake\_case を使用）:

```python
def calculate_area(length, width):
    return length * width
```

これと一貫性のないコーディングスタイルを比較してみてください。一貫性が無いコードの場合、GitHub Copilot から以下のような存在しない関数の提案をもらうことに繋がる可能性があります。

```python
def calcSomething(l, w):
    area = calcArea(l, w)
    # <Code goes here>
```

## Exercise

* **エクササイズ 1**: 記述的で一貫性のある命名規則を使用して関数を書く練習をします。
* **エクササイズ 2**: コードスニペットを分析し、コーディングスタイルの非一貫性を特定します。必要な調整をします。
* **エクササイズ 3**: GitHub Copilot を使用して小さなプロジェクトを作成し、異なるコーディングスタイルへの反応を観察します。

## Checklist for Further Learning

* 一貫性のあるコーディングスタイルは、コードベースの可読性と保守性にどう影響しますか?
* チームやプロジェクト内でコーディング基準を強制するために、どのようなコミュニケーションが必要ですか?
* GitHub Copilot は、コーディングのベストプラクティスをどのように支援しますか? どのような行動を促進または抑制しますか?


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ai-native-development.gitbook.io/docs/ja/design-patterns/consistent-coding-style.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
