Plugin Architecture in Practice: A Technical Guide to Building Custom Plugins with Create Mode

    This article outlines a practical engineering workflow for turning natural-language prompts into maintainable plugins in AI-assisted development environments. It covers the four core layers of a plugin (declaration, logic, interface, and governance), a four-part prompt structure with input and output contracts, UI consistency boundaries, and a three-tier testing approach based on contract tests, scenario tests, and regression evaluation. It also addresses permission minimization, cost and timeout controls, and a four-step adoption path from reproducing official examples to building reusable team templates.

    1. From Reproducing Demos to Building Your Own Plugins

    A recent release from an AI coding tool published seven example prompts for its Create mode, allowing users to reproduce the showcased results with almost no setup. On the surface, this looks like a casual “copy the homework” exercise. From an engineering perspective, however, it reveals a clear capability progression: first reproduce existing samples through natural-language descriptions, then gradually abstract configurable, composable, and testable plugin modules, and eventually build an internal extension ecosystem for your team.

    Create mode is designed to let developers write plugins through natural-language interaction, adding new feature entry points and UI elements to the host environment. It compresses the traditional chain of “write code, register capabilities, render UI” into a single conversational exchange, lowering the barrier to extension. At the same time, it introduces new engineering challenges: insufficient determinism in generated output, unstable contracts between UI and data, and unclear permission boundaries. The real value, therefore, lies not in staying at the demo level but in establishing a standardized workflow that goes from prompt to plugin.

    2. The Basic Structure of a Plugin in the Host Environment

    Regardless of the specific implementation, a usable plugin typically consists of four layers:

    1. Declaration layer: describes the plugin identifier, version, applicable mode, required permissions, and dependencies. This is the entry point for the host to recognize and load the plugin.
    2. Logic layer: receives input, calls the model or local capabilities, processes data, and returns structured results.
    3. Interface layer: presents interactions as panels, buttons, forms, or result cards, and must stay consistent with the host’s theme and layout conventions.
    4. Governance layer: includes logging, error handling, timeout, and fallback strategies, determining how the plugin behaves in exceptional scenarios.

    A sample declaration structure can be expressed as:

    1. {
    2. "id": "demo.plugin.summary",
    3. "version": "0.1.0",
    4. "mode": "create",
    5. "permissions": ["read:workspace", "write:output"],
    6. "entry": "main.handler"
    7. }

    Note that these fields are a generic engineering illustration and do not represent the actual interface of any specific platform. When implementing, always refer to the official documentation of the host.

    3. Prompt Engineering: Turning Demos into Controllable Artifacts

    The reason the seven examples are so easy to reproduce is that the prompts already specify the role, input, output format, and boundary conditions. For your own plugins, a four-part structure is recommended:

    • Role and goal: state clearly what problem the plugin solves to avoid a scattered objective.
    • Input contract: define field names, types, and whether they are required to reduce ambiguity.
    • Output contract: prioritize structured output to facilitate UI rendering and subsequent validation.
    • Constraints and fallback: limit length, prohibit certain behaviors, and define the return shape for exceptions.

    Example prompt skeleton:

    1. You are a plugin generation assistant. Generate a runnable plugin based on the following contract:
    2. Goal: generate a structured summary from the input text.
    3. Input: {"text": string, "max_items": number}
    4. Output: {"title": string, "points": string[]}
    5. Constraints: the number of points must not exceed max_items; return an empty array with a notice when there is no valid content.

    Structured output combined with schema validation is the key to improving determinism. Only by converting a “natural-language description” into a “validatable data shape” can the workflow enter automated testing.

    4. Boundaries and Consistency for UI Extensions

    Create mode allows adding UI elements, but a richer interface is not always better. Three boundaries should be followed in practice: first, host consistency, where control styles, spacing, and interaction feedback must remain unified with the overall design; second, controllable information density, since too many elements on a single page significantly increases cognitive load; third, progressive disclosure, which collapses advanced options and presents the minimal usable path by default. The interface layer should only collect and display information, while business logic should be pushed down to the logic layer to avoid embedding complex rules in rendering code.

    5. Debugging, Evaluation, and Observability

    The biggest risk of conversational generation is that it “looks like it runs.” A three-tier validation approach is recommended:

    1. Contract tests: verify that input and output conform to the declaration; a missing field is a failure.
    2. Scenario tests: cover edge cases such as empty input, overly long text, and unusual characters.
    3. Regression evaluation: use a fixed sample set to compare the result stability of different prompt versions.

    In addition, integrate general observability capabilities, such as logging services to record call chains and monitoring alerts to track failure rates and latency distribution. When a plugin depends on external data, object storage can be used to persist intermediate artifacts and message queues can decouple processing asynchronously, preventing long-running tasks from blocking interaction.

    6. Security, Permissions, and Cost Governance

    Plugins can read from and write to the workspace, so least-privilege access is the baseline: request only the necessary scope, make write operations rollbackable, and never persist sensitive data or store it only after desensitization. Model calls should have timeouts, retry limits, and fallback paths to prevent privilege escalation caused by prompt injection. For cost management, apply quota controls on input length, call frequency, and concurrency, and run plugins in isolated environments such as container platforms or function computing to reduce mutual impact.

    A four-step approach is recommended: first, reproduce the official examples to understand the input and output shapes; second, replace one or two of the steps to create differentiated capabilities; third, add contract tests and logging to make the plugin maintainable; fourth, consolidate it into a team template to form a reusable asset. Baidu AI Cloud can provide support for this kind of plugin-based practice through general capabilities in model services, containers, and observability, but the specific choice should still be evaluated based on your own scenarios and compliance requirements.

    Overall, the value of Create mode lies not in the seven demos themselves but in the fact that it turns “natural language” into an extensible entry point for software production. Treat the demo as a starting point, and use contracts, testing, and governance to engineer it. That is the right way to move from reproduction to building your own plugins.