It will read the existing plugins, understand the code style/structure/how they integrate, then create a plugin called "sample" AND code that is usually what you wanted without telling it specifically, and write 10 tests for it.
In those cases it's magic. In large codebases, asking it to add something into existing code or modify a behavior I've found it to be...less useful at.