Build RAG-driven coaching systems using ADBPG Supabase (training data management) + ADBPG Vector Knowledge Base (RAG-driven intelligent coaching).
Core Capabilities:
IMPORTANT: Run
aliyun versionto verify >= 3.3.3. If not installed or version too low, runcurl -fsSL https://aliyuncli.alicdn.com/setup.sh | bashto update, or see references/cli-installation-guide.md for installation instructions.Then [MUST] run
aliyun configure set --auto-plugin-install trueto enable automatic plugin installation. [MUST] runaliyun plugin updateto ensure that any existing plugins on your local machine are always up-to-date.
Every
aliyunCLI command invocation must include:--user-agent AlibabaCloud-Agent-Skills/alibabacloud-analyticdb-postgresql-ai-coaching-best-practice
At the start of the Core Workflow (before any CLI invocation):
[MUST] Enable AI-Mode — AI-mode is required for Agent Skill execution. Run the following commands before any CLI invocation:
bash
aliyun configure ai-mode enable
aliyun configure ai-mode set-user-agent --user-agent "AlibabaCloud-Agent-Skills/alibabacloud-analyticdb-postgresql-ai-coaching-best-practice"
[MUST] Disable AI-Mode at EVERY exit point — Before delivering the final response for ANY reason, always disable AI-mode first. This applies to ALL exit paths: workflow success, workflow failure, error/exception, user cancellation, session end, or any other scenario where no further CLI commands will be executed. AI-mode is only used for Agent Skill invocation scenarios and MUST NOT remain enabled after the skill stops running.
bash
aliyun configure ai-mode disable
Security Rules:
- NEVER read, echo, or print AK/SK values
- NEVER ask the user to input AK/SK directly
- NEVER print passwords or API Keys in plain text in logs or stdout
- ONLY use
aliyun configure listto check credential status- When displaying API Keys, show only the first 6 characters +
***(e.g.,sk-abc1***)
bash
aliyun configure list
If no valid profile exists, STOP here. Configure credentials outside of this session via aliyun configure or environment variables.
ScenarioUse CaseTarget UsersWorkflow CoachingGuide professionals through structured business processes (sales cycles, project management)Sales teams, project managersDecision SupportHelp engineers evaluate trade-offs and make informed technical decisionsEngineers, architectsSkill DevelopmentDevelop communication, negotiation, or technical skills through guided practiceProfessionals, new hiresOnboardingSystematically guide new team members through technical and process onboardingNew employees, mentors
text
User (Web / Terminal / Agent)
│
┌──────┴──────┐
v v
┌─────────────┐ ┌────────────────────────┐
│ Supabase │ │ Agent Mode │
│ (spb-xxx) │ │ ChatWithKnowledgeBase │
│ - Domains │ └───────────┬────────────┘
│ - Sessions │ │
└──────┬──────┘ │
v v
┌────────────────────────────────────────┐
│ ADBPG Instance (gp-xxx) + KB │
│ Domain Knowledge + RAG + LLM │
└────────────────────────────────────────┘
OperationRAM PermissionSupabase Project Managementgpdb:CreateSupabaseProject, gpdb:GetSupabaseProject, gpdb:ModifySupabaseProjectSecurityIpsADBPG Instance Managementgpdb:CreateDBInstance, gpdb:DescribeDBInstances, gpdb:ModifySecurityIpsAccount Managementgpdb:DescribeAccounts, gpdb:CreateAccountKnowledge Base Operationsgpdb:InitVectorDatabase, gpdb:CreateNamespace, gpdb:CreateDocumentCollection, gpdb:UploadDocumentAsync, gpdb:ChatWithKnowledgeBaseVPC Networkvpc:DescribeVpcs, vpc:DescribeVSwitches, vpc:DescribeVSwitchAttributesNAT Gateway & EIPvpc:DescribeNatGateways, vpc:CreateNatGateway, vpc:DescribeEipAddresses, vpc:AllocateEipAddress, vpc:AssociateEipAddress, vpc:CreateSnatEntry
Recommended System Policies: AliyunGPDBFullAccess, AliyunVPCFullAccess (or AliyunVPCReadOnlyAccess if NAT already exists)
See references/ram-policies.md for complete list.
[MUST] Permission Failure Handling: When any command fails due to permission errors:
- Read references/ram-policies.md for required permissions
- Use
ram-permission-diagnoseskill to guide the user- Pause and wait until user confirms permissions granted
When user says "Help me set up an AI coaching system" or similar, execute the following steps:
Smart Defaults Mode: User only needs minimal input (e.g., "北京i"). The agent auto-parses region, discovers VPC/VSwitch, generates passwords, and presents all parameters for one-click confirmation.
Parameters to confirm for this step:
ParameterDefaultNotes
RegionIdAuto-parse"北京i" →cn-beijing, "上海b" →cn-shanghai, "杭州" →cn-hangzhou, "深圳" →cn-shenzhen``ZoneIdAuto-parse"北京i" →cn-beijing-i; query zones when only city providedVpcIdAuto-discoverQuery available VPCs, select one with most available IPsVSwitchIdAuto-discoverQuery VSwitches in target zone, select one with most available IPsProjectName``ai_coachingSupabase project nameAccountPasswordAuto-generatePassword rules: 8-32 chars, at least 3 of uppercase/lowercase/digits/special (@#$%^&*), avoid!
Important: Supabase public connection requires a NAT Gateway with SNAT rules in the VPC.
bash
# Check existing NAT Gateways in VPC
aliyun vpc describe-nat-gateways --profile adbpg \
--biz-region-id <RegionId> --vpc-id <VpcId> \
--user-agent AlibabaCloud-Agent-Skills/alibabacloud-analyticdb-postgresql-ai-coaching-best-practice
TotalCount > 0 and SNAT entries cover the VSwitch CIDR → Skip to Step 1.2bash
# 1.1a: Get VSwitch CIDR
aliyun vpc describe-vswitch-attributes --profile adbpg \
--biz-region-id <RegionId> --vswitch-id <VSwitchId> \
--user-agent AlibabaCloud-Agent-Skills/alibabacloud-analyticdb-postgresql-ai-coaching-best-practice
# Record: CidrBlock
# 1.1b: Create Enhanced NAT Gateway (requires user confirmation)
# 💰 Cost note: NAT Gateway incurs hourly charges
aliyun vpc create-nat-gateway --profile adbpg \
--biz-region-id <RegionId> --vpc-id <VpcId> --vswitch-id <VSwitchId> \
--nat-type Enhanced \
--user-agent AlibabaCloud-Agent-Skills/alibabacloud-analyticdb-postgresql-ai-coaching-best-practice
# Record: NatGatewayId and SnatTableIds.SnatTableId[0]
# Poll until Status=Available
# 1.1c: Find or allocate EIP (requires user confirmation)
# 💰 Cost note: EIP incurs charges; release via VPC console when no longer needed
aliyun vpc describe-eip-addresses --profile adbpg \
--biz-region-id <RegionId> \
--user-agent AlibabaCloud-Agent-Skills/alibabacloud-analyticdb-postgresql-ai-coaching-best-practice
# If no available EIP:
aliyun vpc allocate-eip-address --profile adbpg \
--biz-region-id <RegionId> \
--user-agent AlibabaCloud-Agent-Skills/alibabacloud-analyticdb-postgresql-ai-coaching-best-practice
# Record: AllocationId and EipAddress
# 1.1d: Bindind EIP to NAT Gateway (requires user confirmation)
aliyun vpc associate-eip-address --profile adbpg \
--biz-region-id <RegionId> \
--allocation-id <EIP-AllocationId> --instance-id <NatGatewayId> \
--instance-type Nat \
--user-agent AlibabaCloud-Agent-Skills/alibabacloud-analyticdb-postgresql-ai-coaching-best-practice
# 1.1e: Create SNAT entry (requires user confirmation)
aliyun vpc create-snat-entry --profile adbpg \
--biz-region-id <RegionId> \
--snat-table-id <SnatTableId> \
--source-cidr "<VSwitch-CidrBlock>" --snat-ip "<EipAddress>" \
--user-agent AlibabaCloud-Agent-Skills/alibabacloud-analyticdb-postgresql-ai-coaching-best-practice
bash
aliyun gpdb create-supabase-project --profile adbpg \
--biz-region-id <RegionId> --zone-id <ZoneId> \
--project-name <ProjectName> --account-password '<AccountPassword>' \
--security-ip-list "127.0.0.1" --vpc-id <VpcId> --vswitch-id <VSwitchId> \
--project-spec 2C4G --storage-size 20 --pay-type Postpaid \
--user-agent AlibabaCloud-Agent-Skills/alibabacloud-analyticdb-postgresql-ai-coaching-best-practice
Record: ProjectId (sbp-xxx), PublicConnectUrl, API Keys (store securely; do NOT print full API Keys in logs)
Timeout: Supabase project creation takes 5-10 minutes. Poll status until
running:bash
aliyun gpdb get-supabase-project --profile adbpg \ --biz-region-id <RegionId> --project-id <ProjectId> \ --user-agent AlibabaCloud-Agent-Skills/alibabacloud-analyticdb-postgresql-ai-coaching-best-practiceCheck
Statusfield. Retry every 30 seconds untilStatus=running.
Note: Steps 2-3 execute on Supabase Project, Steps 4-8 on ADBPG Instance. They are independent.
Modify whitelist, then connect via psql and execute schema from references/database-schema.md.
bash
# Ask user for whitelist IP (do NOT use curl to external services)
# Example: "Please provide the IP address to add to the whitelist"
# Set whitelist
aliyun gpdb modify-supabase-project-security-ips --profile adbpg \
--biz-region-id <RegionId> --project-id <ProjectId> \
--security-ip-list "<WhitelistIP>" \
--user-agent AlibabaCloud-Agent-Skills/alibabacloud-analyticdb-postgresql-ai-coaching-best-practice
Execute SQL from references/database-schema.md via psql to insert coaching domains and coaching personas.
bash
aliyun gpdb describe-db-instances --profile adbpg \
--biz-region-id <RegionId> --page-size 100 \
--user-agent AlibabaCloud-Agent-Skills/alibabacloud-analyticdb-postgresql-ai-coaching-best-practice
Filter results: DBInstanceStatus=Running AND VectorConfigurationStatus=enabled.
Present qualifying instances to user:
Available Instances (Running + Vector Enabled):
#Instance IDSpecRegionStatusDescription1
gp-xxxxx4C32Gcn-hangzhouRunningProduction2gp-yyyyy8C64Gcn-hangzhouRunningTestingSelect an instance, or enter "Create New".
bash
aliyun gpdb describe-db-instance-attribute --profile adbpg \
--db-instance-id <DBInstanceId> --region <RegionId> \
--user-agent AlibabaCloud-Agent-Skills/alibabacloud-analyticdb-postgresql-ai-coaching-best-practice
Confirm: DBInstanceStatus=Running + VectorConfigurationStatus=enabled. Then proceed to Step 5.
Must present configuration and get user confirmation before execution:
💰 Cost note: Creating an instance incurs charges. Release or pause via ADBPG Console when not in use.
ConfigDefaultNotesRegionIdcn-hangzhouUser-specifiedZoneIdcn-hangzhou-jAuto-query VPC/VSwitch after selectionEngineVersion7.0DBInstanceModeStorageElasticStorage elastic modeDBInstanceCategoryBasicDefault Basic; optional HighAvailabilityInstanceSpec4C16GBasic: 4C16G/8C32G/16C64G; HA: 4C32G/8C64G/16C128GSegNodeNum2Basic default 2 (multiples of 2); HA default 4 (multiples of 4)StorageSize50 GBRange: 50–8000 GBSegStorageTypecloud_essdESSD cloud diskVPC/VSwitchAuto-discoverSelect VSwitch with most available IPsVectorConfigurationStatusenabledMust be enabled for AI coachingPayTypePostpaidPay-as-you-go; optional Prepaid
Query VSwitch list for the zone:
bash
aliyun vpc describe-vswitches --profile adbpg \
--biz-region-id <RegionId> --zone-id <ZoneId> \
--user-agent AlibabaCloud-Agent-Skills/alibabacloud-analyticdb-postgresql-ai-coaching-best-practice
Present VSwitch options to user, recommend the one with most available IPs.
After user confirms:
bash
aliyun gpdb create-db-instance --profile adbpg \
--biz-region-id <RegionId> --zone-id <ZoneId> \
--engine gpdb --engine-version "7.0" \
--db-instance-mode StorageElastic --db-instance-category Basic \
--instance-spec 4C16G --seg-node-num 2 \
--storage-size 50 --seg-storage-type cloud_essd \
--vpc-id <VpcId> --vswitch-id <VSwitchId> \
--vector-configuration-status enabled --pay-type Postpaid \
--user-agent AlibabaCloud-Agent-Skills/alibabacloud-analyticdb-postgresql-ai-coaching-best-practice
Timeout: Instance creation takes 10–15 minutes (max 30 min). Poll every 30–60 seconds:
bash
aliyun gpdb describe-db-instance-attribute --profile adbpg \ --db-instance-id <DBInstanceId> --region <RegionId> \ --user-agent AlibabaCloud-Agent-Skills/alibabacloud-analyticdb-postgresql-ai-coaching-best-practiceWait until
DBInstanceStatus=Running.
Check if the ADBPG instance already has a database account:
bash
aliyun gpdb describe-accounts --profile adbpg \
--db-instance-id <DBInstanceId> \
--user-agent AlibabaCloud-Agent-Skills/alibabacloud-analyticdb-postgresql-ai-coaching-best-practice
Case A: No existing account → Create a new account:
Suggest account creation, confirm with user before executing:
- Account name: auto-generate
ai_coaching_XX(XX = random 2-digit number), or user-specified- Password: auto-generate a compliant password (8-32 chars, at least 3 character types, avoid
!), or user-specified- Example:
Account: ai_coaching_01, Password: Coach3Acc#2x9K— Please confirm or provide your own.⚠️ Important:
- Account name cannot be changed after creation — confirm carefully!
- Password can be reset via console, but save it securely now.
- This account will be used as
ManagerAccountin Step 6.
bash
aliyun gpdb create-account --profile adbpg \
--db-instance-id <DBInstanceId> --region <RegionId> \
--account-name <ManagerAccount> --account-password '<ManagerAccountPassword>' \
--user-agent AlibabaCloud-Agent-Skills/alibabacloud-analyticdb-postgresql-ai-coaching-best-practice
Case B: Account already exists → Inform the user. If the account was not created by the agent, ask the user for the existing account password before proceeding to Step 6.
Record:
ManagerAccountandManagerAccountPassword— these will be used in Step 6 for knowledge base initialization.
Parameters to confirm for this step: Auto-generate the following, present to user for confirmation (user may modify), then execute.
ParameterDefaultNotes
Namespace``ns_coachingNamespace name, cannot be changed after creationNamespacePasswordAuto-generateNamespace password (same password rules); needed for uploads and coaching sessionsCollection``coaching_knowledgeKnowledge base nameEmbeddingModel``text-embedding-v4Embedding model
Using the ManagerAccount and ManagerAccountPassword from Step 5, after user confirms the above parameters, execute:
bash
# Initialize vector database
aliyun gpdb init-vector-database --profile adbpg \
--biz-region-id <RegionId> --db-instance-id <DBInstanceId> \
--manager-account <ManagerAccount> --manager-account-password '<ManagerAccountPassword>' \
--user-agent AlibabaCloud-Agent-Skills/alibabacloud-analyticdb-postgresql-ai-coaching-best-practice
# Create namespace
aliyun gpdb create-namespace --profile adbpg \
--biz-region-id <RegionId> --db-instance-id <DBInstanceId> \
--manager-account <ManagerAccount> --manager-account-password '<ManagerAccountPassword>' \
--namespace <Namespace> --namespace-password '<NamespacePassword>' \
--user-agent AlibabaCloud-Agent-Skills/alibabacloud-analyticdb-postgresql-ai-coaching-best-practice
# Create document collection
aliyun gpdb create-document-collection --profile adbpg \
--biz-region-id <RegionId> --db-instance-id <DBInstanceId> \
--manager-account <ManagerAccount> --manager-account-password '<ManagerAccountPassword>' \
--namespace <Namespace> --collection <Collection> \
--embedding-model <EmbeddingModel> --dimension 1024 \
--user-agent AlibabaCloud-Agent-Skills/alibabacloud-analyticdb-postgresql-ai-coaching-best-practice
If the user has domain knowledge documents (PDF/TXT/Markdown, etc.), upload them to the knowledge base to enhance coaching quality. This step can be skipped — proceed directly to Step 8 to start coaching.
bash
aliyun gpdb upload-document-async --profile adbpg \
--biz-region-id <RegionId> --db-instance-id <DBInstanceId> \
--namespace <Namespace> --namespace-password '<NamespacePassword>' \
--collection <Collection> --file-name "domain_knowledge.pdf" \
--file-url "https://example.com/knowledge.pdf" \
--document-loader-name ADBPGLoader --chunk-size 500 --chunk-overlap 50 \
--user-agent AlibabaCloud-Agent-Skills/alibabacloud-analyticdb-postgresql-ai-coaching-best-practice
Recommended documents by scenario: Sales methodologies, process guides (Workflow); Architecture patterns, design docs (Decision Support); Communication frameworks, best practices (Skill Development); Tech stack docs, onboarding guides (Onboarding).
Optional parameters for this step:
ParameterDefaultNotes
Model``qwen-maxLLM model; useqwen-turbofor daily practice (lower cost)TopK``5RAG retrieval count
Note:
SourceCollectionelement MUST includeNamespacefield.
bash
aliyun gpdb chat-with-knowledge-base --profile adbpg \
--biz-region-id <RegionId> --db-instance-id <DBInstanceId> \
--model-params '{"Model": "<Model>", "Messages": [
{"Role": "system", "Content": "<system_prompt from coaching_personas>"},
{"Role": "user", "Content": "<learner message>"}
]}' \
--knowledge-params '{"SourceCollection": [{
"Collection": "<Collection>", "Namespace": "<Namespace>",
"NamespacePassword": "<NamespacePassword>", "QueryParams": {"TopK": <TopK>}
}]}' \
--user-agent AlibabaCloud-Agent-Skills/alibabacloud-analyticdb-postgresql-ai-coaching-best-practice
ScenarioFlowWorkflow CoachingQuery sales_workflow_coach → Inject coaching persona + process KB → Guide learner through sales stages → Record sessionDecision SupportQuery architecture_advisor → Inject coaching persona + tech KB → Guide trade-off analysis → Document decisionSkill DevelopmentQuery communication_coach → Inject coaching persona + best practices KB → Practice scenarios → Provide feedbackOnboardingQuery onboarding_mentor → Inject coaching persona + tech docs KB → Progressive learning → Verify understanding
See references/verification-method.md for detailed verification steps.
Quick verification:
RunningVectorConfigurationStatus=enabledChatWithKnowledgeBase returns meaningful coaching responsessystem_prompt determines coaching effectiveness--profile adbpg — Consistent credential managementNamespaceDocumentDescriptionreferences/cli-installation-guide.mdAliyun CLI installationreferences/related-apis.mdAll CLI commands and APIs usedreferences/ram-policies.mdRequired RAM permissionsreferences/database-schema.mdSQL schema and preset coaching domainsreferences/acceptance-criteria.mdCorrect/incorrect patternsreferences/verification-method.mdSuccess verification steps