Skip to content

Commit 5fbd489

Browse files
yunbowclaude
andcommitted
style(docs): markdownlintエラーを一括修正
- MD025: セクション見出し(# N.)をH2(##)に降格(多重H1の解消) - MD040: コードブロックに言語識別子を追加(python/bash/text/yaml等) - MD036: 哲学的引用をブロッククォートに、ラベルをH3見出しに変換 - MD022/MD032/MD031/MD004等: 空行・リストスタイルを自動修正 Co-Authored-By: Claude <assistant> <noreply@anthropic.com>
1 parent 1d4c543 commit 5fbd489

51 files changed

Lines changed: 692 additions & 430 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

01_philosophy/anti-patterns.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
$NOTE
2+
23
# Anti-Patterns
34

45
This defines repeatedly observed "do not do this" patterns.

01_philosophy/mental-models.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
$NOTE
2+
23
# Mental Models
34

45
This defines the thinking patterns behind design decisions.
@@ -8,7 +9,7 @@ These are not concrete rules, but the "way of thinking" from which rules emerge.
89

910
## 1. Constraints Breed Creativity
1011

11-
**"Fewer choices lead to faster and better decisions."**
12+
> *"Fewer choices lead to faster and better decisions."*
1213
1314
"Faster" here means reduced decision fatigue and shorter code review cycles. When the framework constrains choices (e.g., "use Literal types over plain strings," "no bare `except`"), developers spend zero time debating the approach and reviewers can focus on logic rather than style. This compounds across a team — eliminating 10 micro-decisions per PR across 50 PRs/week saves meaningful cognitive load.
1415

@@ -22,7 +23,7 @@ These are not concrete rules, but the "way of thinking" from which rules emerge.
2223

2324
## 2. Code is Read More Than Written
2425

25-
**"Write code that the future reader (including yourself 3 months later) can understand as quickly as possible."**
26+
> *"Write code that the future reader (including yourself 3 months later) can understand as quickly as possible."*
2627
2728
- Write code where intent is clear, rather than optimizing for brevity or shortness
2829
- Consistency in naming conventions directly impacts searchability and refactoring ease
@@ -34,9 +35,9 @@ These are not concrete rules, but the "way of thinking" from which rules emerge.
3435

3536
## 3. Validate at Boundaries
3637

37-
**"Trust the internals, but validate strictly at the points of contact with the outside."**
38+
> *"Trust the internals, but validate strictly at the points of contact with the outside."*
3839
39-
```
40+
```text
4041
External Input ──[Pydantic]──> Route Handler ──[Type Hints]──> Service Layer ──[ORM]──> DB
4142
^ Guard here ^ Protected by types here
4243
```
@@ -49,7 +50,7 @@ External Input ──[Pydantic]──> Route Handler ──[Type Hints]──> S
4950

5051
## 4. Design for Failure
5152

52-
**"Don't write code that assumes things work. Design with the assumption that things break."**
53+
> *"Don't write code that assumes things work. Design with the assumption that things break."*
5354
5455
- All external communication can fail (timeouts, rate limits, service outages)
5556
- Use types and explicit result patterns to prevent forgetting error handling (e.g., `Result[T, E]` or custom exception hierarchies)
@@ -62,9 +63,9 @@ External Input ──[Pydantic]──> Route Handler ──[Type Hints]──> S
6263

6364
## 5. Layered Architecture
6465

65-
**"If the data flow is consistent, most bugs disappear."**
66+
> *"If the data flow is consistent, most bugs disappear."*
6667
67-
```
68+
```text
6869
Route Handlers / CLI Commands (entry points)
6970
|
7071
Service Layer (business logic / orchestration)
@@ -84,7 +85,7 @@ Route Handlers / CLI Commands (entry points)
8485

8586
## 6. Rule of Three (Timing of Abstraction)
8687

87-
**"Premature abstraction leads to wrong abstraction."**
88+
> *"Premature abstraction leads to wrong abstraction."*
8889
8990
| Occurrences | Action |
9091
|-------------|--------|
@@ -100,7 +101,7 @@ Route Handlers / CLI Commands (entry points)
100101

101102
## 7. Make the Implicit Explicit
102103

103-
**"Implicit agreements become bugs the moment the team changes."**
104+
> *"Implicit agreements become bugs the moment the team changes."*
104105
105106
- Make side effects clear through naming (`fetch_user()` = has side effects, `calculate_price()` = pure)
106107
- Always include a reason with `# noqa` or `type: ignore`

01_philosophy/principles.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
$NOTE
2+
23
# Design Principles
34

45
This document defines the fundamental principles that underpin all projects.
@@ -10,15 +11,15 @@ It articulates the "why" behind our guidelines and serves as the ultimate refere
1011

1112
All design decisions are made in this order of priority.
1213

13-
```
14+
```text
1415
1. Correctness — Guarantee correct behavior through types and validation
1516
2. Observability — Ensure the running state can be observed and traced
1617
3. Pragmatism — Achieve goals with the minimum necessary complexity
1718
```
1819

1920
### 1. Correctness
2021

21-
**"Eliminate runtime errors by catching them during static analysis (mypy/pyright)."**
22+
> *"Eliminate runtime errors by catching them during static analysis (mypy/pyright)."*
2223
2324
- Type hints catch errors via static analysis (mypy/pyright) before code reaches production
2425
- Security is built into the architecture, not bolted on after the fact
@@ -27,7 +28,7 @@ All design decisions are made in this order of priority.
2728
2829
### 2. Observability
2930

30-
**"Understand what is happening in production without redeploying."**
31+
> *"Understand what is happening in production without redeploying."*
3132
3233
- Assign a Trace ID to every request and propagate it across layers
3334
- Automatically mask PII. Never expose secrets in logs
@@ -37,7 +38,7 @@ All design decisions are made in this order of priority.
3738
3839
### 3. Pragmatism
3940

40-
**"Don't build it until you need it. When you need it, build it the simplest way possible."**
41+
> *"Don't build it until you need it. When you need it, build it the simplest way possible."*
4142
4243
- Copy-paste is not evil. Don't abstract until duplication appears in 3 places. The number 3 is deliberate: with 1 occurrence you have no pattern; with 2 you see similarity but may be misled by coincidence; with 3 you have enough evidence to extract a correct, stable abstraction. Abstracting at 2 often produces the *wrong* abstraction because you lack sufficient examples to identify the true commonality
4344
- Convention over Configuration
@@ -66,7 +67,7 @@ All design decisions are made in this order of priority.
6667

6768
## Security Philosophy: Zero Trust
6869

69-
**"Trust no input. Every user is a potential attacker."**
70+
> *"Trust no input. Every user is a potential attacker."*
7071
7172
1. **API Layer**: Pydantic validation, CORS, rate limiting
7273
2. **Auth Layer**: Session/token validation, IDOR checks (always verify ownership for resource access)
@@ -79,7 +80,7 @@ Apply the principle of least privilege to everything (DB users, API scopes, feat
7980

8081
## Approach to Errors
8182

82-
**"Don't try to prevent every failure — detect, contain, and communicate them."**
83+
> *"Don't try to prevent every failure — detect, contain, and communicate them."*
8384
8485
- Errors fall into 3 categories: System (unexpected), Application (expected), User (input mistakes)
8586
- Do not leak internal error details to the client (return sanitized messages)
@@ -90,7 +91,7 @@ Apply the principle of least privilege to everything (DB users, API scopes, feat
9091

9192
## API Design Philosophy
9293

93-
**"Constraints create consistency, and consistency creates speed."**
94+
> *"Constraints create consistency, and consistency creates speed."*
9495
9596
- Consistent response schemas using Pydantic models
9697
- Pydantic models serve as the Single Source of Truth for data shapes

02_decision-criteria/abstraction.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
$NOTE
2+
23
# Decision Criteria for Generalization and Abstraction
34

45
Criteria for deciding whether to "extract" or "leave as-is" when you find code duplication.
@@ -7,7 +8,7 @@ Criteria for deciding whether to "extract" or "leave as-is" when you find code d
78

89
## Fundamental Principle
910

10-
**"Premature abstraction leads to wrong abstraction."**
11+
> *"Premature abstraction leads to wrong abstraction."*
1112
1213
Abstraction increases the cost of understanding. It only has value when "enough reuse" exists — meaning 3+ call sites with genuinely identical logic, not just superficially similar code. Two similar-looking functions that evolve independently don't justify abstraction.
1314

02_decision-criteria/architecture.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
$NOTE
2+
23
# Architecture Decision Criteria
34

45
Defines the selection criteria for sync vs async, API design, data access patterns, dependency injection, and project structure.
@@ -143,7 +144,7 @@ Defines the selection criteria for sync vs async, API design, data access patter
143144

144145
### Test Target Priority
145146

146-
```
147+
```text
147148
1. Authentication/authorization (sessions, IDOR) <- Highest: a flaw here means full data breach
148149
2. Payment processing <- Financial loss is immediate and concrete
149150
3. DB operations + API endpoints <- Data corruption is hard to reverse

02_decision-criteria/error-strategy.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
$NOTE
2+
23
# Error Strategy Decision Criteria
34

45
Defines error handling policies, retry decisions, and how to communicate errors to users.
@@ -7,7 +8,7 @@ Defines error handling policies, retry decisions, and how to communicate errors
78

89
## Fundamental Principle
910

10-
**"Don't try to prevent all failures — detect, contain, and communicate them."**
11+
> *"Don't try to prevent all failures — detect, contain, and communicate them."*
1112
1213
---
1314

@@ -23,7 +24,7 @@ Defines error handling policies, retry decisions, and how to communicate errors
2324

2425
The boundary between System and Application errors: "Could the developer have predicted it?" means — is this error a known, enumerable case in the domain logic? If yes (e.g., "user not found", "insufficient balance"), it's an Application error that should be handled with a specific code path. If no (e.g., database connection dropped, OOM), it's a System error that gets generic handling.
2526

26-
```
27+
```text
2728
Error Occurs
2829
|
2930
+-- Is this a known, enumerable domain case?
@@ -51,7 +52,7 @@ Error Occurs
5152

5253
### Retry Implementation Criteria
5354

54-
```
55+
```text
5556
Should we retry?
5657
|
5758
+-- Is the status code 5xx?
@@ -155,7 +156,7 @@ class AuthorizationError(AppError):
155156

156157
### Service Method Checklist
157158

158-
```
159+
```text
159160
- Use the service layer for all business logic
160161
- Authentication check via dependency injection
161162
- Resource ownership check (IDOR prevention)

02_decision-criteria/security-vs-ux.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
$NOTE
2+
23
# Balancing Security and UX
34

45
Criteria for judging the appropriate balance by considering the impact of security measures on user experience.
@@ -7,7 +8,7 @@ Criteria for judging the appropriate balance by considering the impact of securi
78

89
## Fundamental Principle
910

10-
**"Security is enabled by default. When relaxing it for UX reasons, make the risks explicit before deciding."**
11+
> *"Security is enabled by default. When relaxing it for UX reasons, make the risks explicit before deciding."*
1112
1213
---
1314

@@ -52,7 +53,7 @@ Criteria for judging the appropriate balance by considering the impact of securi
5253

5354
### UX When Rate Limit Is Exceeded
5455

55-
```
56+
```text
5657
Limit Exceeded
5758
|
5859
+-- Return Retry-After header
@@ -74,7 +75,7 @@ Limit Exceeded
7475

7576
### Suspicious Login Detection Flow
7677

77-
```
78+
```text
7879
Login Attempt
7980
|
8081
+-- First-time login? -> No alert (accept)
@@ -131,7 +132,7 @@ Login Attempt
131132

132133
## 6. Decision Tree When in Doubt
133134

134-
```
135+
```text
135136
Want to relax a security measure
136137
|
137138
+-- Can the user not complete their operation without relaxation?

02_decision-criteria/technology-selection.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
$NOTE
2+
23
# Decision Criteria for Technology Selection
34

45
A decision framework for introducing new technologies, libraries, and tools.
@@ -22,6 +23,7 @@ Weight definitions: **High** = can veto adoption on its own. **Medium** = weigh
2223
### De Facto Standard Identification
2324

2425
A library qualifies as "de facto standard" when it meets 2+ of:
26+
2527
- Referenced in the framework's official documentation (e.g., FastAPI docs mention it)
2628
- 10x+ GitHub stars compared to the next alternative
2729
- Used by the framework's own tutorials or starter templates

0 commit comments

Comments
 (0)