You are working on the Faraday repository, a Ruby HTTP client library with a middleware-based architecture. Before making any code changes or suggestions, you must read and follow the comprehensive guidelines in .ai/guidelines.md.
Always reference .ai/guidelines.md for:
- Code style and structure conventions
- Middleware implementation patterns
- Adapter development guidelines
- Testing requirements with RSpec
- Documentation standards (YARD)
- Contribution workflow
As a Claude AI agent, you are responsible for:
- Reading
.ai/guidelines.mdbefore every contribution - Following all Faraday-specific conventions outlined there
- Proposing updates to
.ai/guidelines.mdwhen you identify:- New code patterns not yet documented
- Changes to existing conventions
- Improved practices that should become standard
- Inconsistencies between the guidelines and actual codebase
- Middleware Architecture: All middleware inherit from
Faraday::Middlewareand use hooks (on_request,on_complete,on_error) - Adapter Pattern: Adapters extend
Faraday::MiddlewareRegistryand implementcall,build_connection, etc. - Registry System: Both middleware and adapters register themselves with unique keys
- Testing: Use RSpec with shared examples, stubs instead of real network calls
- Documentation: YARD comments for all public APIs
- Do not provide generic Ruby or RSpec advice—focus on Faraday-specific patterns
- Do not suggest changes that violate established conventions without first proposing guideline updates
- Do not implement middleware or adapters without checking existing patterns in the codebase
- Main guidelines:
.ai/guidelines.md - Contributing guide:
.github/CONTRIBUTING.md - Example middleware:
lib/faraday/request/json.rb - Example adapter:
lib/faraday/adapter/test.rb - Middleware base:
lib/faraday/middleware.rb
Remember: Keep .ai/guidelines.md current. If you notice any drift between documentation and reality, propose updates to maintain accuracy.