How to document learnings in specification-specific locations with proper format
This skill defines how to document learnings discovered during implementation, focusing on specification-specific insights.
Usage Type: EDUCATIONAL - Learn when and how to document learnings effectively.
Document learnings when:
Location: specifications/[NN-spec-name]/LEARNINGS.md
What to Document:
Examples:
## Critical Implementation Details
- Auth token validates BEFORE rate limiter (prevents token leakage)
- DB pool: exactly 20 connections (downstream service limit)
- Cache TTL: 5 minutes for user data, 1 hour for static content
## Common Failures and Fixes
- DNS resolution timeout → Retry with exponential backoff (3 attempts)
- Empty response body → Check for 204 status before parsing JSON
- Connection pool exhausted → Added connection timeout of 10s
## Testing Insights
- Integration tests require test HTTP server on localhost:8080
- Mock Stripe API for payment tests (use test keys)
- DNS tests need real network access (skip in offline mode)
✅ Good Format:
→ for cause-effect❌ Bad Format:
Specification-Specific (LEARNINGS.md):
# Learnings: [Specification Name]
## Critical Implementation Details
- [Detail 1]
- [Detail 2]
## Common Failures and Fixes
- [Issue] → [Solution]
- [Issue] → [Solution]
## Testing Insights
- [Insight 1]
- [Insight 2]
## Dependencies and Interactions
- [Component A] depends on [Component B]
- [Integration point with System X]
## Future Considerations
- [Improvement idea]
- [Technical debt to address]
Scenario: Building HTTP client, discovered DNS caching improves performance
Document in: specifications/02-http-client/LEARNINGS.md
## Critical Implementation Details
- DNS resolver uses LRU cache with 300s TTL → reduces resolution time by 80%
- Cache size: 100 entries (sufficient for typical usage patterns)
- Cache invalidation on network error → prevents stale DNS entries
## Testing Insights
- DNS cache tests require mocking system time (use tokio::time::pause)
- Integration tests validate cache hit/miss with real DNS queries
- Performance tests show 5ms cache hit vs 150ms cache miss
Scenario: Implementing payment processing with Stripe API
Specification-Specific (specifications/03-payment/LEARNINGS.md):
## Critical Implementation Details
- Stripe webhook signature verification required (prevents replay attacks)
- Idempotency keys: use transaction_id + timestamp → prevents duplicate charges
- Refund window: 180 days per Stripe policy → validate before refund attempts
## Dependencies and Interactions
- Payment service depends on user-service for account validation
- Webhook endpoint must be publicly accessible (configured in Stripe dashboard)
- Database must support transactions for payment + order update atomicity
When you document a learning during implementation:
Task completed:
- Files changed: [list]
- What implemented: [description]
- Language(s): [Rust/TypeScript/Python]
- Learnings documented: Yes, in specifications/02-http-client/LEARNINGS.md
Key learnings:
- DNS caching with LRU improves performance by 80%
- Cache size 100 entries, 300s TTL optimal for our use case
- Cache invalidation on network error prevents stale entries
Ready for Main Agent verification.
❌ Don't:
✅ Do:
Learnings Location:
specifications/[spec]/LEARNINGS.md
Format:
→ for cause-effectKey Principles:
Version: 2.0 - Last Updated: 2026-02-27