To register your plugin, put a file in a folder relative to your Drupal module root: src/Plugin/$plugin_type/Example.php
Drupaldocs Annotations-based plugins
https://www.drupal.org/node/1882526
Context
Use Context system for actions (core -> d8rules)
https://www.drupal.org/node/2011038
Engine
Entity
Tests
More
Plug-ins
derivative
Create or delete any URL alias
Create or delete a content's URL alias (node_path_alias) -> derivative
discovery
StaticDiscovery
StaticDiscovery allows for direct registration of plugins within the discovery class itself. A protected variable ($definitions) in the class holds all plugin definitions that are registered with it through the public method setDefinition(). Any plugin defined through this method can then be invoked as outlined in the plugin manager documentation.
HookDiscovery
The HookDiscovery class allows Drupal's hook_component_info()/hook_component_info_alter() pattern to be used for plugin discovery. With this discovery, the plugin manager will invoke info hooks to retrieve a list of available plugins.
AnnotatedClassDiscovery
The AnnotatedClassDiscovery class uses name of the annotations that contains the plugin definition, e.g., @Plugin, @EntityType, in plugin docblocks to discover plugins, minimizing memory usage during the discovery phase. The AnnotatedClassDiscovery class takes an argument in its constructor, $subdir, which specifies the sub-directory/sub-namespace for this plugin type. The AnnotatedClassDiscovery class scans PSR-0 classes inside those sub-directories of Plugin folders to find plugins.
YamlDiscovery
YamlDiscovery allows plugins to de be defined in yaml files. Drupal core uses this for local tasks and local actions.
https://www.drupal.org/node/1638040
Traits
example
https://www.drupal.org/node/2079611
"Traits are simply compiler-assistet copy/paste (Rasmus Lerdorf)