Provide effective context to Claude for Symfony development with relevant files, patterns, and constraints
This skill inherits all available tools. When active, it can use any tool Claude has access to.
When asking Claude for help with Symfony, provide:
Provide:
- The entity file
- Related entities (if relationships involved)
- The repository if custom queries
- Current migration state
Provide:
- Entity with API Platform attributes
- Custom providers/processors if any
- Relevant filters
- Expected request/response format
Provide:
- Test file
- Code being tested
- Factory files
- Error output
I have a Symfony 7 app with API Platform 4. I need to add a filter
that searches across multiple fields (title, description, author name).
Here's my entity:
[paste entity code]
Current filters work for single fields. How do I create a custom
filter that does OR search across these fields?
How do I search in API Platform?
When I run bin/console doctrine:migrations:migrate, I get:
[Error message with full stack trace]
My entity is:
[entity code]
My migration is:
[migration code]
The Messenger worker crashes with this error in var/log/dev.log:
[2024-01-15 10:30:00] messenger.ERROR: Error thrown while handling message...
My message handler:
[handler code]
My message:
[message code]
This endpoint needs to handle 1000 requests/second. Currently it's slow
because of N+1 queries. Here's the code:
[code]
I need to add a new field to the API response without breaking existing
clients. Current response format:
[JSON example]
Our codebase uses CQRS pattern. Here's an example command handler:
[example code]
I need to add a new feature following the same pattern.
Our project structure:
src/
├── Domain/ # Entities, Value Objects
├── Application/ # Commands, Queries, Handlers
└── Infrastructure/ # Controllers, Repositories
We follow hexagonal architecture. How should I structure a new
feature for user notifications?
config/packages/messenger.yaml:
[current config]
I need to add a second transport for high-priority messages.
Symfony 6.4 LTS project. Can I use MapRequestPayload attribute?
Or is that only in 7.x?
PHP 8.2, Symfony 7.1. I want to use readonly classes for my DTOs.
API Platform 3.2. I see examples using "operations" but my version
uses "collectionOperations". Which syntax should I use?
# Bad: dumping entire project
Here's my entire src/ directory...
[thousands of lines]
# Bad: no context
Why doesn't my query work?
# Bad: referring to unseen code
The UserService I showed you earlier...
[But it wasn't shown]
## Context
- Symfony version: X.Y
- PHP version: 8.X
- Relevant bundles: [list]
## What I'm Trying to Do
[Clear description of goal]
## Current Code
[Relevant files only]
## What's Happening
[Error message or unexpected behavior]
## What I've Tried
[Previous attempts if any]
## Constraints
[Performance, compatibility, patterns to follow]