Not loaded · from tec-knowledge-base
When working on any payment-related code, ADR-007 guards, BFF payment routes, or Pi SDK integration — enforce C-76 ADR-007, payment invariants, and Mode 1/Mode 2 decision logic.
Claude Code won't load this skill
It ships in tec-knowledge-base at skills/, but Claude Code only loads skills/<name>/SKILL.md and folders listed under skills in plugin.json. Installing the plugin doesn't add it.
All payment changes require this skill. ADR-007 + C-76 + C-71 Financial Integrity.
User clicks Pay
↓
isHubNavigation() || !window.Pi || !piReady
├── TRUE → Mode 1: redirectToHubPayment() → /hub?pay=1&...
└── FALSE → Mode 2: createPaymentRecord() → createU2APayment()
Mode 1 URL format (LOCKED — ADR-007):
/hub?pay=1&amount=X&memo=Y&product_id=Z&return_url=APP_URL&source=ecommerce
⚠️ return_url must be APP_URL (home) NOT /shop or /orders (404s)
Mode 2 sequence (C-76 backend-first):
1. createPaymentRecord() → POST /api/bff/payment/create → gateway
2. window.Pi.createPayment() ← Pi SDK
3. onReadyForServerApproval → POST /api/bff/payment/approve
4. onReadyForServerCompletion → POST /api/bff/payment/complete
5. POST /api/bff/orders ← create order after payment confirmed
1. Payment cannot complete without approval
2. Order not created until payment approved
3. Wallet balance NEVER goes negative
4. Every financial action has audit trail (ActorContext required)
5. Terminal states are FINAL: completed / failed / cancelled
→ No transitions FROM these states (409 Conflict if attempted)
6. Pi amounts: DECIMAL(20,8) in DB, string in API responses
→ NEVER convert to JS Number internally
7. Idempotency key required on all payment gateway calls
// CORRECT — Gateway headers
const gwHeaders: Record<string, string> = {
'Content-Type': 'application/json',
Authorization: `Bearer ${token}`,
'Idempotency-Key': crypto.randomUUID(),
};
// Only send x-internal-key if actually SET
// Empty string causes Gateway 401 (NEW-B pattern)
if (process.env.INTERNAL_SECRET) {
gwHeaders['x-internal-key'] = process.env.INTERNAL_SECRET;
}
// Gateway URL — always include NEXT_PUBLIC fallback
const GW = process.env.API_GATEWAY_URL
?? process.env.NEXT_PUBLIC_API_GATEWAY_URL ?? '';
// getUserId — check all Hub SSO cookie formats
const u = JSON.parse(decodeURIComponent(cookie));
return u?.id ?? u?.sub ?? u?.piId ?? '';
// CSRF — only reject when cookie IS present but header mismatches
if (csrfCookie && csrfCookie !== csrfHeader) → 403
// Missing cookie = ok (cross-domain SSO)
{
"userId": "<from tec_user cookie — never from body>",
"amount": 1.5,
"currency": "PI",
"payment_method": "pi",
"metadata": { "source": "ecommerce", "product_id": "..." }
}
// memo is NOT accepted at gateway level
// memo is Pi SDK client-side only
tec-ecommerce:
src/app/page.tsx → handleBuy
src/app/product/[id]/page.tsx → handleBuy
src/app/store/[id]/page.tsx → handleBuy
src/components/shop/CartDrawer.tsx → handleCheckout
tec-commerce: payment handler
tec-assets: payment handler
tec-app: /hub?pay=1 (hub owns payment modal)
// ALWAYS mock /api/.../payment/create FIRST
const mockCreateSuccess = () =>
vi.spyOn(globalThis, 'fetch').mockImplementation(async (url) => {
if (String(url).includes('payment/create'))
return { ok: true, json: async () => ({ data: { id: 'internal-id' }}) } as Response;
// ... approve, complete
});
// Payment tests → RESOLVE not REJECT
// createU2APayment always resolves: { status, success, message? }
| ID | Issue | Status |
|---|---|---|
| NEW-B | INTERNAL_SECRET missing on Railway | ⚠️ OPS ONLY |
| NEW-A | Railway URLs removed from client bundle | ✅ CLOSED |
# Fix NEW-B (one-time ops task)
node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"
# Set INTERNAL_SECRET on: tec-api-gateway, tec-auth-service,
# tec-payment-service, tec-commerce-service
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
Claude Code refuses to install this plugin
.claude-plugin/plugin.json: commands: Invalid input, agents.0: Invalid string: must start with "./", agents.0: Invalid string: must end with ".md", agents.1: Invalid string: must start with "./", agents.1: Invalid string: must end with ".md", agents.2: Invalid string: must start with "./", agents.2: Invalid string: must end with ".md", skills: Invalid input, author: Invalid input: expected object, received string
.claude-plugin/plugin.json: commands: Invalid input, agents.0: Invalid string: must start with "./", agents.0: Invalid string: must end with ".md", agents.1: Invalid string: must start with "./", agents.1: Invalid string: must end with ".md", agents.2: Invalid string: must start with "./", agents.2: Invalid string: must end with ".md", skills: Invalid input, author: Invalid input: expected object, received string
Checked against Claude Code 2.1.332's install rules. The listing below is what the repository ships; Claude Code cannot install it as published.
16 skills in this plugin
/bff-patternsWhen writing or modifying any BFF route (/api/bff/*) in any TEC app — enforce BFF-first rule, createHandler pattern, auth cookie reading, CSRF protection, and proper gateway proxying./charter-advisorWhen working on any app within the TEC ecosystem — before modifying code, architecture, or CLAUDE.md — load the app's Institutional Charter (C-100→C-115 infra apps + C-124→C-131 user-layer apps) to understand its engineering authority, security model, and P0/P1/P2 gaps./community-marketingWhen building or growing the TEC community on Pi Network channels (Pi Chat, Pi Forum, Telegram, Discord) — apply community-first growth, ambassador programs, and trust-building frameworks./content-strategyWhen creating content for TEC platform — blog posts, social content, Pi community updates, developer docs, or onboarding materials — apply Pi-native content frameworks and audience segmentation./knowledge-orchestratorWhen working on any TEC platform task — automatically load the right knowledge documents, route to the correct specialist skill, and enforce platform invariants before any action./mcp-orchestratorWhen using MCP tools to check platform health, CI status, deployments, or Railway services — apply TEC-specific query patterns and interpret results through the platform knowledge lens.