AgentSkillsCN

template-constructor

按照正确的YAML结构构建并搭建Machina代理模板与连接器,然后通过MCP进行安装。当用户提出“创建模板”“搭建代理”“初始化模板”“构建新连接器”“安装模板”“验证模板”“分析模板”“追踪代理”或“配置机密”等需求时,可使用此功能。它将模板创建、验证、安装、分析、追踪以及机密配置等功能整合为一项单一技能。

SKILL.md
--- frontmatter
name: template-constructor
description: Construct and scaffold Machina agent-templates and connectors with correct YAML structure, then install them via MCP. Use when users ask to "create a template", "scaffold an agent", "init template", "build a new connector", "install template", "validate template", "analyze template", "trace agent", or "configure secrets". Combines template creation, validation, installation, analysis, tracing, and secret configuration into a single skill.

Template Constructor

End-to-end skill for building, validating, and deploying Machina templates. Covers the full lifecycle: scaffold -> validate -> install -> analyze -> trace -> configure secrets.

Available Commands

CommandDescriptionReference
init-templateScaffold new template project from scratchinit-template.md
create-templateGenerate individual YAML components (agent, workflow, prompt, mapping)create-template.md
validate-templateCheck YAML files against correct patterns before installationvalidate-template.md
install-templateImport templates via MCP (local or Git)install-template.md
analyze-templateAnalyze template structure, dependencies, secretsanalyze-template.md
trace-agentTrace agent execution chain with variable propagationtrace-agent.md
configure-secretsConfigure vault secrets for connectorsconfigure-secrets.md

Quick Workflow

code
1. init-template    → Scaffold project structure
2. create-template  → Add YAML components
3. validate-template → Check syntax before deploy
4. install-template  → Deploy via MCP
5. configure-secrets → Set up credentials
6. analyze-template  → Verify installation
7. trace-agent       → Debug execution flow

Command Dispatch

When the user triggers this skill, determine which command they need:

User SaysCommand
"init template", "scaffold template", "new template project"Read init-template.md
"create agent", "create workflow", "scaffold YAML"Read create-template.md
"validate", "check YAML", "verify template"Read validate-template.md
"install", "import", "deploy template"Read install-template.md
"analyze", "what's in this template", "overview"Read analyze-template.md
"trace", "execution chain", "variable flow", "debug agent"Read trace-agent.md
"secrets", "credentials", "configure API key"Read configure-secrets.md

Load the appropriate reference file based on the user's intent, then follow its instructions.

MCP Server Selection

Ask the user which environment to target. The MCP server prefix follows the pattern mcp__<environment>__:

EnvironmentMCP Server Prefix
Local devmcp__docker-localhost__

Additional environments (staging, production) depend on the project's MCP configuration. Check available MCP servers in the current session.

SDK Skill Registration

After installing a template, optionally register it as a skill in the SDK for discoverability:

python
create_skill(
    name="template-name",
    config={
        "title": "Template Title",
        "description": "What it does",
        "template_path": "agent-templates/template-name",
        "agents": ["template-name-executor"],
        "workflows": ["template-name-main-workflow"],
        "connectors": ["machina-ai"],
        "secrets": ["TEMP_CONTEXT_VARIABLE_SDK_OPENAI_API_KEY"]
    }
)

Template Repository Layout

Templates live in repositories with this structure:

code
<repo-root>/
├── agent-templates/    # Reusable agent patterns
│   └── <template-name>/
└── connectors/         # External service integrations
    └── <connector-name>/

When installing via MCP, the project_path must point to the template directory inside the container (e.g., /app/<repo-name>/agent-templates/<template-name>).

Key Constraints

  • Connector .py files: No helper functions outside command functions. Each function must be self-contained.
  • Expression syntax: Always use $.get('field') — never ${field} or $field
  • Prompt files: Use prompts: array (not prompt:) with instruction: (not messages:)
  • Connector YAML: Use filetype: (not type:) and filename: (not script:)
  • Install order: connectors -> prompts -> mappings -> workflows -> agents