agentleFS
wachterjohanneswachterjohannes/symfony-skills/skills/make-entity/SKILL.md

make-entity

Skill4 starsChanged 2 months agoMITView on GitHub

Use when creating a Doctrine entity or adding fields and relations to one.

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Every entity gets a repository, and queries live there rather than in a controller or a service.

    line 37

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Doctrine entity

symfony console make:entity BlogPost \
    --field=title:string:100 \
    --field=body:text \
    --field=publishedAt \
    --field=price:decimal:10:2 \
    --relation=author:ManyToOne:User

Fields are name[:type[:length]][?], relations are name:type:target[?], and a trailing ? makes either nullable. Both options repeat, once per field. Leaving the type off falls back to the same guess the interactive mode makes, so --field=publishedAt becomes a datetime_immutable and --field=isActive a boolean.

Enums still need the interactive mode. Install the maker first if it is missing: symfony composer require --dev symfony/maker-bundle.

What to keep

Doctrine mapping goes in attributes — #[ORM\Entity], #[ORM\Column], #[ORM\ManyToOne] — never in YAML or XML. The maker does this; the point is not to undo it.

Dates are immutable. datetime_immutable and \DateTimeImmutable, not datetime, so a value handed to something else cannot be changed underneath you.

Every entity gets a repository, and queries live there rather than in a controller or a service. The maker generates one.

Where the entity ends and the domain begins

Validation constraints belong on the entity, not on the form that happens to edit it — attached to a form field they exist only inside that form.

Domain values that barely change are class constants on the entity (Post::STATUS_DRAFT), usable from Twig, from a query, and from PHP without touching the container.

Getters and setters are generated for you. Adding behaviour beyond them is fine; an entity that only carries data and has all its logic elsewhere is a choice, not a rule.

After changing the mapping

make:migration, then run it. Never doctrine:schema:update.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.