Explicit Configuration
Name
han-core:explicit-configuration
Description
When configuring services, APIs, or framework features, explicitly set all parameters rather than relying on defaults. Defaults vary across versions, environments, and frameworks.
Principle
What works with defaults in development may fail in production. Explicit configuration is documentation that runs.
Examples
Database connections:
- Set pool size, timeout, retry policy explicitly
- Don't rely on default connection string parsing
API calls:
- Set timeout, retry count, headers explicitly
- Don't assume default content-type
Framework config:
- Set port, environment, logging level explicitly
- Don't rely on framework auto-detection
Security settings:
- Never rely on default CORS, auth, or session config
- Always configure explicitly, even if the default is "secure"
Anti-Pattern
createServer() // relies on default port, middleware, error handling
Pattern
createServer({
port: config.PORT,
timeout: 30000,
cors: { origin: config.ALLOWED_ORIGINS }
})
When to Apply
- Any time you're initializing a service, client, or framework
- Any time you're configuring infrastructure (Docker, CI, cloud services)
- Any time the behavior difference between dev and production matters
1---2name: explicit-configuration3description: Prefer explicit configuration over framework defaults to prevent environment-dependent failures4---5
6# Explicit Configuration
7
8## Name
9han-core:explicit-configuration
10
11## Description
12
13When configuring services, APIs, or framework features, explicitly set all parameters rather than relying on defaults. Defaults vary across versions, environments, and frameworks.
14
15## Principle
16
17What works with defaults in development may fail in production. Explicit configuration is documentation that runs.
18
19## Examples
20
21**Database connections:**
22- Set pool size, timeout, retry policy explicitly
23- Don't rely on default connection string parsing
24
25**API calls:**
26- Set timeout, retry count, headers explicitly
27- Don't assume default content-type
28
29**Framework config:**
30- Set port, environment, logging level explicitly
31- Don't rely on framework auto-detection
32
33**Security settings:**
34- Never rely on default CORS, auth, or session config
35- Always configure explicitly, even if the default is "secure"
36
37## Anti-Pattern
38
39```
40createServer() // relies on default port, middleware, error handling
41```
42
43## Pattern
44
45```
46createServer({
47 port: config.PORT,
48 timeout: 30000,
49 cors: { origin: config.ALLOWED_ORIGINS }
50})
51```
52
53## When to Apply
54
55- Any time you're initializing a service, client, or framework
56- Any time you're configuring infrastructure (Docker, CI, cloud services)
57- Any time the behavior difference between dev and production matters