How to create DSL like Plugin("org.insilico") {name="anything" property1= "somevalue"} inside Custom Task?

I wanted to create a DSL of the following type

task feature(type: Feature){

       url =""
       property = value

i am already familiar with extensions in Gradle and Custom Tasks, Can anyone please Guide me through this, as i am new to this Plugin Development?

I’m assuming the Plugin refer to is not a Gradle plugin, but something of your own. I am also going to take the convention of using lower-case plugin for my example

class FeaturePlugin {
   String url
   String prop  

class Feature extends DefaultTask {

    void plugin(String pluginId, @DelegatesTo(FeaturePlugin) Closure configurator) {
        Closure cfg = configurator.clone()
        cfg.delegate = maybeCreate(pluginId)
        cfg.resolveStrategy = Closure.DELEGATE_FIRST

    void plugin(String pluginId, Action<FeaturePlugin> configurator) {

    private FeaturePlugin maybeCreate( String pluginId ) {
       // You need to decide what you are going to do to return a FeaturePlugin

Yes, this is helpful.