AgentSkillsCN

onboard

将该代理接入 Trinity 平台。创建所需文件、配置 Git、部署至 Trinity,并安装 Trinity 技能以实现持续管理。

SKILL.md
--- frontmatter
name: onboard
description: Onboard this agent to Trinity platform. Creates required files, sets up git, deploys to Trinity, and installs Trinity skills for ongoing management.
disable-model-invocation: false
user-invocable: true
allowed-tools: Read, Write, Edit, Bash, Glob, Grep, mcp__trinity__list_agents, mcp__trinity__create_agent, mcp__trinity__get_agent, mcp__trinity__start_agent
metadata:
  version: "1.0"
  created: 2025-02-05
  author: Ability.ai

Trinity Onboarding

Zero-friction onboarding to deploy any Claude Code agent to the Trinity platform.

What This Skill Does

  1. Discovery - Identify agent name, check existing Trinity files
  2. Compatibility Analysis - Generate report of current state vs requirements
  3. User Confirmation - Present report, ask to proceed
  4. Create Required Files - template.yaml, .gitignore, .env.example, .mcp.json.template
  5. Git Setup - Initialize git if needed, commit, push
  6. Deploy to Trinity - Call MCP tool to deploy agent
  7. Install Trinity Skills - Copy skills from skill-library to agent
  8. Completion Report - Show what was done, next steps

Phase 1: Discovery

Gather information about the current agent:

bash
# Get agent name from template.yaml or directory
AGENT_NAME=$(grep "^name:" template.yaml 2>/dev/null | cut -d: -f2 | tr -d ' ' || basename "$(pwd)")
echo "Agent name: $AGENT_NAME"

# Check what already exists
ls -la template.yaml .mcp.json.template .env.example .gitignore 2>/dev/null
ls -la .claude/skills/ 2>/dev/null
ls -la CLAUDE.md 2>/dev/null

# Check git status
git status 2>/dev/null || echo "Not a git repository"
git remote -v 2>/dev/null

Phase 2: Compatibility Analysis

Check current state against Trinity requirements:

Required Files Checklist

FilePurposeStatus
template.yamlAgent metadata for TrinityCheck exists
CLAUDE.mdAgent instructionsCheck exists
.mcp.json.templateMCP config with placeholdersCheck exists
.env.exampleDocument required env varsCheck exists
.gitignoreSecurity exclusionsCheck has required entries

Required .gitignore Entries

code
.mcp.json
.env
*.pem
*.key
.claude/projects/
.claude/statsig/
.claude/todos/
.claude/debug/
content/
session-files/

Security Check

  • No .mcp.json committed (should use .mcp.json.template)
  • No .env committed
  • No hardcoded API keys in tracked files

Phase 3: User Confirmation

Present findings and ask to proceed:

code
## Trinity Onboarding Analysis

### Agent: [agent-name]
### Directory: [current path]

### Current State
| Item | Status |
|------|--------|
| template.yaml | [EXISTS/MISSING] |
| CLAUDE.md | [EXISTS/MISSING] |
| .mcp.json.template | [EXISTS/MISSING] |
| .env.example | [EXISTS/MISSING] |
| .gitignore | [COMPLETE/INCOMPLETE/MISSING] |
| Git repository | [INITIALIZED/NOT INITIALIZED] |
| Remote origin | [SET/NOT SET] |

### Actions Required
1. [List of files to create/update]
2. [Git operations needed]
3. [Deployment steps]

### Ready to proceed?
This will:
- Create/update configuration files
- Initialize git if needed
- Deploy agent to Trinity
- Install Trinity management skills

Proceed? [Y/n]

Phase 4: Create Required Files

4a. Create template.yaml (if missing)

yaml
name: [agent-name-lowercase]
display_name: [Agent Display Name]
description: |
  [Description from CLAUDE.md or directory purpose]
resources:
  cpu: "2"
  memory: "4g"
credentials:
  mcp_servers: {}
  env_file: []

4b. Create/Update .gitignore

Ensure all required exclusions are present. Add missing entries:

gitignore
# Credentials - never commit
.mcp.json
.env
*.pem
*.key

# Claude Code internals
.claude/projects/
.claude/statsig/
.claude/todos/
.claude/debug/

# Runtime/generated
content/
session-files/

4c. Create .env.example (if missing)

code
# Environment variables for [agent-name]
# Copy to .env and fill in values
# NEVER commit .env to version control!

# Trinity API Key (get from Trinity dashboard)
TRINITY_API_KEY=your-trinity-api-key

# Add other required credentials below

4d. Create .mcp.json.template (if missing)

If .mcp.json exists, convert it:

  1. Read .mcp.json
  2. Replace credential values with ${VAR_NAME} placeholders
  3. Write to .mcp.json.template
  4. Add variables to .env.example

If no .mcp.json, create minimal template:

json
{
  "mcpServers": {
    "trinity": {
      "command": "npx",
      "args": ["-y", "mcp-remote", "https://trinity.abilityai.dev/mcp"],
      "env": {
        "TRINITY_API_KEY": "${TRINITY_API_KEY}"
      }
    }
  }
}

Phase 5: Git Setup

5a. Initialize Git (if needed)

bash
if [ ! -d .git ]; then
  git init
  echo "Git repository initialized"
fi

5b. Create Initial Commit

bash
# Stage Trinity configuration files
git add template.yaml .gitignore .env.example

# Stage .mcp.json.template if exists
[ -f .mcp.json.template ] && git add .mcp.json.template

# Stage CLAUDE.md and skills
git add CLAUDE.md .claude/skills/ .claude/agents/ 2>/dev/null

# Commit
git commit -m "Trinity onboarding: Configure agent for Trinity platform"

5c. Set Up Remote (if not set)

If no remote origin, inform user:

code
Git remote not configured. To complete deployment:

1. Create a GitHub repository for this agent
2. Add the remote:
   git remote add origin https://github.com/YOUR-ORG/[agent-name].git
3. Push:
   git push -u origin main
4. Re-run /trinity-onboard:onboard to complete deployment

5d. Push Changes

bash
git push origin $(git branch --show-current)

Phase 6: Deploy to Trinity

Use Trinity MCP tools to deploy the agent:

6a. Check if Agent Exists

code
mcp__trinity__list_agents()

Look for agent with matching name.

6b. Create or Update Agent

If agent doesn't exist:

code
mcp__trinity__create_agent(
  name: "[agent-name]",
  template: "github:[org]/[repo]"
)

6c. Start Agent

code
mcp__trinity__start_agent(name: "[agent-name]")

6d. Verify Deployment

code
mcp__trinity__get_agent(name: "[agent-name]")

Confirm status is "running".


Phase 7: Install Trinity Skills

Copy Trinity management skills to the agent's skill directory:

Skills to Install

SkillPurpose
trinity-syncSynchronize with remote
trinity-remoteExecute on remote
trinity-schedulesManage scheduled tasks
trinity-compatibilityAudit agent structure

Installation

The skills are bundled with this plugin at ../../skill-library/trinity/.

Copy to agent's .claude/skills/:

bash
# Create skills directory if needed
mkdir -p .claude/skills

# Copy Trinity skills
SKILL_LIB="[plugin-path]/../../skill-library/trinity"
cp -r "$SKILL_LIB/trinity-sync" .claude/skills/
cp -r "$SKILL_LIB/trinity-remote" .claude/skills/
cp -r "$SKILL_LIB/trinity-schedules" .claude/skills/
cp -r "$SKILL_LIB/trinity-compatibility" .claude/skills/

Commit Skills

bash
git add .claude/skills/trinity-*
git commit -m "Add Trinity management skills"
git push origin $(git branch --show-current)

Phase 8: Completion Report

code
## Trinity Onboarding Complete!

### Agent Deployed
- **Name**: [agent-name]
- **Platform**: Trinity (https://trinity.abilityai.dev)
- **Status**: Running

### Files Created/Updated
- [x] template.yaml
- [x] .gitignore
- [x] .env.example
- [x] .mcp.json.template

### Skills Installed
- [x] /trinity-sync - Synchronize with remote
- [x] /trinity-remote - Execute tasks remotely
- [x] /trinity-schedules - Manage scheduled tasks
- [x] /trinity-compatibility - Audit agent structure

### Next Steps

1. **Configure credentials** in Trinity dashboard
   Visit: https://trinity.abilityai.dev/agents/[agent-name]/credentials

2. **Test remote execution**
   /trinity-remote exec "Hello from the cloud!"

3. **Set up a schedule** (optional)
   /trinity-schedules schedule procedure-my-task "0 9 * * *"

4. **Check sync status**
   /trinity-sync status

### Quick Reference

| Command | Description |
|---------|-------------|
| `/trinity-sync status` | Check sync status |
| `/trinity-sync push` | Push local changes to remote |
| `/trinity-remote exec <prompt>` | Run on remote |
| `/trinity-schedules status` | View scheduled tasks |

Error Handling

ErrorResolution
No CLAUDE.mdCreate minimal CLAUDE.md with agent description
Git push failedCheck remote permissions, resolve conflicts
Agent creation failedVerify Trinity API key, check agent name uniqueness
MCP tools not availableEnsure Trinity MCP server is connected

Idempotency

This skill is safe to run multiple times:

  • Existing files are only updated if needed
  • Git commits are skipped if no changes
  • Agent deployment updates existing agent
  • Skills are overwritten with latest versions

See Also

After onboarding, use these skills for ongoing management:

  • /trinity-sync - Synchronize local and remote
  • /trinity-remote - Remote execution
  • /trinity-schedules - Scheduled tasks
  • /trinity-compatibility - Audit agent structure