This file contains CRITICAL instructions that MUST be followed in ALL interactions with the Simple OAuth 2.1 module ecosystem. These instructions OVERRIDE any default behavior and take precedence over global instructions.
Before taking ANY action (commits, PRs, file creation, etc.), verify: ✅ Does this violate any instruction below? ✅ Am I about to attribute AI involvement anywhere? ✅ Am I creating unnecessary files? ✅ Am I doing more than requested? ✅ Am I following the project's strict coding standards?
- NEVER EVER attribute any code, message, or any other part of the repo, or associated metadata, was generated by an AI
- This includes:
- Git commits (no "Generated with Claude", no "Co-Authored-By: Claude", etc.)
- GitHub issue descriptions
- GitHub PRs
- Code comments
- Documentation
- ANY metadata that gets committed to the repository
- NO DDEV REFERENCES: Never add ddev-specific paths, commands, or references to the module codebase. The module must remain environment-agnostic and work in any Drupal installation
- NO EXCEPTIONS - These rules apply to ALL content that becomes part of the repository
- NEVER create files unless they're absolutely necessary for achieving the specific goal
- ALWAYS prefer editing an existing file to creating a new one
- NEVER proactively create documentation files (*.md) or README files
- Only create documentation files if explicitly requested by the user
- When in doubt, ask before creating any new file
- Do what has been asked; nothing more, nothing less
- Do not add "helpful" extras unless specifically requested
- Do not anticipate future needs
- Stay focused on the immediate task
This project is a 6-module OAuth 2.1 compliance ecosystem:
simple_oauth_21- Umbrella coordination module with compliance dashboard
simple_oauth_device_flow- RFC 8628 Device Authorization Grantsimple_oauth_pkce- RFC 7636 PKCE implementationsimple_oauth_native_apps- RFC 8252 OAuth for Native Appssimple_oauth_client_registration- RFC 7591 Dynamic Client Registrationsimple_oauth_server_metadata- RFC 8414/9728 Server/Resource Metadata
- ALWAYS use
declare(strict_types=1);at the top of all PHP files - ALWAYS use
finalkeyword for classes unless inheritance is specifically required - ALWAYS use typed properties with visibility declaration (e.g.,
private OAuth21ComplianceService $complianceService;) - ALWAYS provide comprehensive PHPDoc comments for all classes, methods, and properties
- Follow Drupal coding standards with PSR-4 autoloading
- Controllers:
src/Controller/ - Services:
src/Service/ - Forms:
src/Form/ - Plugins:
src/Plugin/ - Traits:
src/Trait/ - Tests:
tests/src/(Functional/Kernel/Unit)
- Module info:
{module_name}.info.yml - Services:
{module_name}.services.yml - Routing:
{module_name}.routing.yml - Install config:
config/install/ - Schema:
config/schema/
- Read existing code to understand patterns and conventions
- Ensure changes align with OAuth RFC implementations
- Verify module interdependencies are maintained
- Check that compliance service integration is preserved
- Update corresponding schema files in
config/schema/ - Ensure configuration forms have proper validation
- Maintain consistency with existing configuration patterns
- Follow existing route naming conventions:
simple_oauth_21.* - Use appropriate access controls and permissions
- Document public API endpoints vs administrative interfaces
- Unit tests for isolated components and services
- Kernel tests for integration with minimal Drupal bootstrap
- Functional tests for complete user workflows
- Test files must follow naming:
{ClassName}Test.php
- Never expose client secrets in plain text
- Always validate PKCE challenges when implemented
- Implement proper redirect URI validation
- Follow RFC security considerations for each implemented standard
- Use dependency injection for all services
- Sanitize all user inputs through appropriate Drupal APIs
- Follow Drupal's access control patterns
- Never bypass Drupal's security layers
- All sub-modules MUST depend on
simple_oauth_21(umbrella module) - All modules MUST depend on
simple_oauth(core OAuth implementation) - Additional dependencies must be justified and documented
- Integrate with
OAuth21ComplianceServicefor compliance reporting - Use existing service patterns for consistency
- Maintain service discovery compatibility
- All public methods require comprehensive PHPDoc
- Include
@paramand@returnannotations with types - Document thrown exceptions with
@throws - Include usage examples for complex services
- Document all configuration options in schema files
- Provide clear descriptions for administrative forms
- Include validation rules and default values
- NEVER use environment-specific paths (no DDEV, no localhost references)
- Use relative paths within the module structure
- Reference other Drupal modules through proper dependency injection
- All file paths in documentation must be relative to module root
cd /var/www/html && vendor/bin/phpunit web/modules/contrib/simple_oauth/tests web/modules/contrib/simple_oauth/modules && cd -