canva-policy-guardrails
Implement Canva Connect API lint rules, policy enforcement, and automated guardrails. Use when setting up code quality rules for Canva integrations, implementing pre-commit hooks, or configuring CI policy checks. Trigger with phrases like "canva policy", "canva lint", "canva guardrails", "canva best practices check", "canva eslint".
What this skill does
# Canva Policy & Guardrails
## Overview
Automated policy enforcement for Canva Connect API integrations — prevent token leaks, enforce rate limit handling, require error handling, and validate OAuth configuration.
## ESLint Rules
### No Hardcoded Credentials
```javascript
// eslint-rules/no-canva-credentials.js
module.exports = {
meta: {
type: 'problem',
docs: { description: 'Disallow hardcoded Canva OAuth credentials' },
},
create(context) {
return {
Literal(node) {
if (typeof node.value !== 'string') return;
const val = node.value;
// Canva client IDs start with "OCA"
if (/^OCA[A-Za-z0-9]{10,}/.test(val)) {
context.report({ node, message: 'Hardcoded Canva client ID detected. Use environment variable.' });
}
// Canva access tokens start with "cnvat_"
if (/^cnvat_[A-Za-z0-9]{20,}/.test(val)) {
context.report({ node, message: 'Hardcoded Canva access token detected. Use environment variable.' });
}
},
};
},
};
```
### Require Rate Limit Handling
```javascript
// eslint-rules/require-canva-retry.js
module.exports = {
meta: {
type: 'suggestion',
docs: { description: 'Canva API calls should handle 429 responses' },
},
create(context) {
return {
CallExpression(node) {
// Check for fetch calls to api.canva.com
if (node.callee.name === 'fetch' &&
node.arguments[0]?.value?.includes('api.canva.com')) {
// Check if parent is try-catch or has .catch()
const parent = node.parent;
if (parent.type !== 'AwaitExpression' ||
parent.parent?.type !== 'TryStatement') {
context.report({
node,
message: 'Canva API calls should be wrapped in try-catch with 429 handling',
});
}
}
},
};
},
};
```
## Pre-Commit Hooks
```yaml
# .pre-commit-config.yaml
repos:
- repo: local
hooks:
- id: canva-no-tokens
name: Check for Canva tokens
entry: bash -c 'git diff --cached --name-only | xargs grep -lE "(cnvat_|OCA[A-Z0-9]{10})" 2>/dev/null && echo "ERROR: Canva credentials found" && exit 1 || exit 0'
language: system
pass_filenames: false
- id: canva-no-raw-urls
name: Check for hardcoded Canva API URLs
entry: bash -c 'git diff --cached --name-only | xargs grep -lE "api\.canva\.com/rest/v1" --include="*.ts" --include="*.js" 2>/dev/null | while read f; do grep -n "api\.canva\.com" "$f" | grep -v "const.*BASE\|const.*URL\|import\|from\|//" && echo "WARNING: Direct Canva URL in $f — use client wrapper" && exit 1; done; exit 0'
language: system
pass_filenames: false
```
## CI Policy Checks
```yaml
# .github/workflows/canva-policy.yml
name: Canva Policy Check
on: [push, pull_request]
jobs:
policy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check for hardcoded credentials
run: |
if grep -rE "(cnvat_[a-zA-Z0-9]{20,}|OCA[A-Z0-9]{10,})" \
--include="*.ts" --include="*.js" --include="*.json" \
--exclude-dir=node_modules .; then
echo "ERROR: Hardcoded Canva credentials found"
exit 1
fi
- name: Check for unhandled API calls
run: |
# Warn if raw fetch to Canva without error handling
DIRECT_CALLS=$(grep -rn "fetch.*api\.canva\.com" \
--include="*.ts" --include="*.js" \
--exclude="*client.ts" --exclude="*test*" \
. 2>/dev/null | wc -l)
if [ "$DIRECT_CALLS" -gt 0 ]; then
echo "WARNING: $DIRECT_CALLS direct Canva API calls found outside client wrapper"
grep -rn "fetch.*api\.canva\.com" --include="*.ts" --include="*.js" \
--exclude="*client.ts" --exclude="*test*" .
fi
- name: Validate .env.example
run: |
if [ -f .env.example ]; then
for var in CANVA_CLIENT_ID CANVA_CLIENT_SECRET CANVA_REDIRECT_URI; do
if ! grep -q "^${var}=" .env.example; then
echo "WARNING: ${var} missing from .env.example"
fi
done
fi
```
## Runtime Guardrails
```typescript
// Prevent dangerous operations and enforce patterns at runtime
class CanvaGuardrails {
// Block requests without proper authorization header
static validateRequest(init: RequestInit): void {
const authHeader = (init.headers as Record<string, string>)?.['Authorization'];
if (!authHeader || !authHeader.startsWith('Bearer ')) {
throw new Error('Canva API call missing Bearer token');
}
}
// Enforce token is not expired before making call
static validateToken(expiresAt: number): void {
if (Date.now() > expiresAt) {
throw new Error('Canva access token expired — refresh before calling');
}
}
// Block sensitive operations based on environment
static validateEnvironment(operation: string): void {
const blocked = ['deleteAsset', 'deleteFolder'];
if (process.env.NODE_ENV !== 'production' && blocked.includes(operation)) {
// Allow in dev for testing
return;
}
// In production, require explicit confirmation
if (process.env.NODE_ENV === 'production' && blocked.includes(operation)) {
console.warn(`[guardrail] Destructive operation: ${operation}`);
}
}
// Rate limit self-check — don't send if we know we'll get 429
static checkRateLimit(
endpoint: string,
tracker: Map<string, { count: number; resetAt: number }>
): void {
const window = tracker.get(endpoint);
if (window && window.count <= 0 && Date.now() < window.resetAt) {
const waitMs = window.resetAt - Date.now();
throw new Error(`Rate limit exhausted for ${endpoint}. Wait ${(waitMs / 1000).toFixed(0)}s`);
}
}
}
```
## Error Handling
| Issue | Cause | Solution |
|-------|-------|----------|
| ESLint rule not firing | Wrong config path | Check plugin registration |
| Pre-commit skipped | `--no-verify` used | Enforce in CI |
| False positive on "OCA" | String matches pattern | Narrow regex or add allowlist |
| Guardrail blocks valid op | Too strict | Add environment-based exceptions |
## Resources
- [ESLint Plugin Development](https://eslint.org/docs/latest/extend/plugins)
- [Pre-commit Framework](https://pre-commit.com/)
- [Canva Scopes](https://www.canva.dev/docs/connect/appendix/scopes/)
## Next Steps
For architecture blueprints, see `canva-architecture-variants`.
Related in Backend & APIs
jfrog
IncludedInteract with the JFrog Platform via the JFrog CLI and REST/GraphQL APIs. Use this skill when the user wants to manage Artifactory repositories, upload or download artifacts, manage builds, configure permissions, manage users and groups, work with access tokens, configure JFrog CLI servers, search artifacts, manage properties, set up replication, manage JFrog Projects, run security audits or scans, look up CVE details, query exposures scan results from JFrog Advanced Security, manage release bundles and lifecycle operations, aggregate or export platform data, or perform any JFrog Platform administration task. Also use when the user mentions jf, jfrog, artifactory, xray, distribution, evidence, apptrust, onemodel, graphql, workers, mission control, curation, advanced security, exposures, or any JFrog product name.
cupynumeric-migration-readiness
IncludedPre-migration readiness assessor for porting NumPy to cuPyNumeric. Use BEFORE substantial porting work begins when the user asks whether code will scale on GPU, whether they should migrate to cuPyNumeric, which NumPy patterns transfer cleanly, what must be refactored before porting, or mentions pre-port assessment, scaling analysis, or refactor planning. Inspect the user's source code, look up NumPy usage, cross-reference the cuPyNumeric API support manifest, and distinguish distributed-scaling-friendly patterns from blockers such as unsupported APIs, scalar synchronization, host round-trips, Python/object-heavy control flow, shape/data-dependent branching, and in-place mutation hazards. Produce a verdict of READY, LIGHT REFACTOR, SIGNIFICANT REFACTOR, or NOT RECOMMENDED, with concrete refactor pointers.
alibabacloud-data-agent-skill
IncludedInvoke Alibaba Cloud Apsara Data Agent for Analytics via CLI to perform natural language-driven data analysis on enterprise databases. Data Agent for Analytics is an intelligent data analysis agent developed by Alibaba Cloud Database team for enterprise users. It automatically completes requirement analysis, data understanding, analysis insights, and report generation based on natural language descriptions. This tool supports: discovering data resources (instances/databases/tables) managed in DMS, initiating query or deep analysis sessions, real-time progress tracking, and retrieving analysis conclusions and generated reports. Use this Skill when users need to query databases, analyze data trends, generate data reports, ask questions in natural language, or mention "Data Agent", "data analysis", "database query", "SQL analysis", "data insights".
token-optimizer
IncludedReduce OpenClaw token usage and API costs through smart model routing, heartbeat optimization, budget tracking, and native 2026.2.15 features (session pruning, bootstrap size limits, cache TTL alignment). Use when token costs are high, API rate limits are being hit, or hosting multiple agents at scale. The 4 executable scripts (context_optimizer, model_router, heartbeat_optimizer, token_tracker) are local-only — no network requests, no subprocess calls, no system modifications. Reference files (PROVIDERS.md, config-patches.json) document optional multi-provider strategies that require external API keys and network access if you choose to use them. See SECURITY.md for full breakdown.
resend-cli
IncludedUse this skill when the task is specifically about operating Resend from an AI agent, terminal session, or CI job via the official resend CLI: installing/authenticating the CLI, sending/listing/updating/cancelling emails, batch sends, domains and DNS, webhooks and local listeners, inbound receiving, contacts, topics, segments, broadcasts, templates, API keys, profiles, or debugging Resend CLI/API failures. Trigger on mentions of Resend CLI, `resend`, `resend doctor`, `resend emails send`, `resend domains`, `resend webhooks listen`, `resend emails receiving`, or agent-friendly terminal automation.
alibabacloud-odps-maxframe-coding
IncludedUse this skill for MaxFrame SDK development and documentation navigation on Alibaba Cloud MaxCompute (ODPS). Helps answer MaxFrame API, concept, official example, and supported pandas API questions; create data processing programs; read/write MaxCompute tables; debug jobs (remote or local); and build custom DPE runtime images. Trigger when users mention MaxFrame, MaxCompute with MaxFrame, ODPS table processing, DPE runtime, MaxFrame docs/examples, DataFrame/Tensor operations, or GPU runtime setup. Works for both English and Chinese queries about Alibaba Cloud data processing with MaxFrame.