@ketecode/loom 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +516 -2
- package/agents/accessibility-reviewer/AGENT.md +70 -0
- package/agents/accessibility-reviewer/evals/triggers.json +15 -0
- package/agents/agent-evaluator/AGENT.md +74 -0
- package/agents/agent-evaluator/evals/triggers.json +15 -0
- package/agents/architect/AGENT.md +82 -0
- package/agents/architect/evals/triggers.json +17 -0
- package/agents/billing-reviewer/AGENT.md +68 -0
- package/agents/billing-reviewer/evals/triggers.json +16 -0
- package/agents/code-reviewer/AGENT.md +51 -0
- package/agents/code-reviewer/evals/triggers.json +14 -0
- package/agents/code-simplifier/AGENT.md +74 -0
- package/agents/code-simplifier/evals/triggers.json +15 -0
- package/agents/cpp-build-resolver/AGENT.md +73 -0
- package/agents/cpp-build-resolver/evals/triggers.json +16 -0
- package/agents/cpp-reviewer/AGENT.md +59 -0
- package/agents/cpp-reviewer/evals/triggers.json +16 -0
- package/agents/csharp-build-resolver/AGENT.md +84 -0
- package/agents/csharp-build-resolver/evals/triggers.json +17 -0
- package/agents/csharp-reviewer/AGENT.md +88 -0
- package/agents/csharp-reviewer/evals/triggers.json +17 -0
- package/agents/dart-build-resolver/AGENT.md +80 -0
- package/agents/dart-build-resolver/evals/triggers.json +17 -0
- package/agents/dart-reviewer/AGENT.md +66 -0
- package/agents/dart-reviewer/evals/triggers.json +17 -0
- package/agents/database-reviewer/AGENT.md +72 -0
- package/agents/database-reviewer/evals/triggers.json +16 -0
- package/agents/django-reviewer/AGENT.md +61 -0
- package/agents/django-reviewer/evals/triggers.json +15 -0
- package/agents/doc-updater/AGENT.md +92 -0
- package/agents/doc-updater/evals/triggers.json +14 -0
- package/agents/e2e-runner/AGENT.md +88 -0
- package/agents/e2e-runner/evals/triggers.json +16 -0
- package/agents/fastapi-reviewer/AGENT.md +63 -0
- package/agents/fastapi-reviewer/evals/triggers.json +15 -0
- package/agents/flutter-reviewer/AGENT.md +70 -0
- package/agents/flutter-reviewer/evals/triggers.json +15 -0
- package/agents/fsharp-build-resolver/AGENT.md +81 -0
- package/agents/fsharp-build-resolver/evals/triggers.json +15 -0
- package/agents/fsharp-reviewer/AGENT.md +77 -0
- package/agents/fsharp-reviewer/evals/triggers.json +15 -0
- package/agents/go-build-resolver/AGENT.md +85 -0
- package/agents/go-build-resolver/evals/triggers.json +16 -0
- package/agents/go-reviewer/AGENT.md +66 -0
- package/agents/go-reviewer/evals/triggers.json +16 -0
- package/agents/healthcare-reviewer/AGENT.md +65 -0
- package/agents/healthcare-reviewer/evals/triggers.json +16 -0
- package/agents/i18n-reviewer/AGENT.md +64 -0
- package/agents/i18n-reviewer/evals/triggers.json +16 -0
- package/agents/infra-reviewer/AGENT.md +93 -0
- package/agents/infra-reviewer/evals/triggers.json +15 -0
- package/agents/java-build-resolver/AGENT.md +82 -0
- package/agents/java-build-resolver/evals/triggers.json +16 -0
- package/agents/java-reviewer/AGENT.md +64 -0
- package/agents/java-reviewer/evals/triggers.json +16 -0
- package/agents/kotlin-build-resolver/AGENT.md +89 -0
- package/agents/kotlin-build-resolver/evals/triggers.json +16 -0
- package/agents/kotlin-reviewer/AGENT.md +75 -0
- package/agents/kotlin-reviewer/evals/triggers.json +16 -0
- package/agents/mle-reviewer/AGENT.md +68 -0
- package/agents/mle-reviewer/evals/triggers.json +16 -0
- package/agents/network-config-reviewer/AGENT.md +68 -0
- package/agents/network-config-reviewer/evals/triggers.json +17 -0
- package/agents/payments-reviewer/AGENT.md +64 -0
- package/agents/payments-reviewer/evals/triggers.json +16 -0
- package/agents/performance-optimizer/AGENT.md +86 -0
- package/agents/performance-optimizer/evals/triggers.json +16 -0
- package/agents/perl-build-resolver/AGENT.md +84 -0
- package/agents/perl-build-resolver/evals/triggers.json +15 -0
- package/agents/perl-reviewer/AGENT.md +77 -0
- package/agents/perl-reviewer/evals/triggers.json +15 -0
- package/agents/php-build-resolver/AGENT.md +88 -0
- package/agents/php-build-resolver/evals/triggers.json +16 -0
- package/agents/php-reviewer/AGENT.md +61 -0
- package/agents/php-reviewer/evals/triggers.json +15 -0
- package/agents/planner/AGENT.md +75 -0
- package/agents/planner/evals/triggers.json +17 -0
- package/agents/pr-test-analyzer/AGENT.md +82 -0
- package/agents/pr-test-analyzer/evals/triggers.json +16 -0
- package/agents/python-build-resolver/AGENT.md +87 -0
- package/agents/python-build-resolver/evals/triggers.json +16 -0
- package/agents/python-reviewer/AGENT.md +63 -0
- package/agents/python-reviewer/evals/triggers.json +15 -0
- package/agents/rag-reviewer/AGENT.md +71 -0
- package/agents/rag-reviewer/evals/triggers.json +16 -0
- package/agents/react-reviewer/AGENT.md +70 -0
- package/agents/react-reviewer/evals/triggers.json +16 -0
- package/agents/refactor-cleaner/AGENT.md +82 -0
- package/agents/refactor-cleaner/evals/triggers.json +16 -0
- package/agents/ruby-build-resolver/AGENT.md +93 -0
- package/agents/ruby-build-resolver/evals/triggers.json +16 -0
- package/agents/ruby-reviewer/AGENT.md +62 -0
- package/agents/ruby-reviewer/evals/triggers.json +16 -0
- package/agents/rust-build-resolver/AGENT.md +98 -0
- package/agents/rust-build-resolver/evals/triggers.json +16 -0
- package/agents/rust-reviewer/AGENT.md +78 -0
- package/agents/rust-reviewer/evals/triggers.json +15 -0
- package/agents/security-reviewer/AGENT.md +84 -0
- package/agents/security-reviewer/evals/triggers.json +16 -0
- package/agents/silent-failure-hunter/AGENT.md +66 -0
- package/agents/silent-failure-hunter/evals/triggers.json +16 -0
- package/agents/solidity-reviewer/AGENT.md +70 -0
- package/agents/solidity-reviewer/evals/triggers.json +16 -0
- package/agents/swift-build-resolver/AGENT.md +85 -0
- package/agents/swift-build-resolver/evals/triggers.json +15 -0
- package/agents/swift-reviewer/AGENT.md +75 -0
- package/agents/swift-reviewer/evals/triggers.json +15 -0
- package/agents/typescript-build-resolver/AGENT.md +76 -0
- package/agents/typescript-build-resolver/evals/triggers.json +15 -0
- package/agents/typescript-reviewer/AGENT.md +76 -0
- package/agents/typescript-reviewer/evals/triggers.json +15 -0
- package/agents/vue-reviewer/AGENT.md +75 -0
- package/agents/vue-reviewer/evals/triggers.json +15 -0
- package/bin/kete-loom.js +683 -0
- package/commands/aside.md +19 -0
- package/commands/build-fix.md +26 -0
- package/commands/campaign.md +19 -0
- package/commands/changelog.md +36 -0
- package/commands/checkpoint.md +26 -0
- package/commands/codemap.md +25 -0
- package/commands/commit.md +26 -0
- package/commands/deps-audit.md +32 -0
- package/commands/epic-decompose.md +21 -0
- package/commands/explain.md +37 -0
- package/commands/feature-dev.md +22 -0
- package/commands/hookify.md +23 -0
- package/commands/i18n-check.md +39 -0
- package/commands/issue-sync.md +22 -0
- package/commands/jira.md +19 -0
- package/commands/learn.md +23 -0
- package/commands/loom.md +21 -0
- package/commands/loop.md +20 -0
- package/commands/model-route.md +27 -0
- package/commands/onboard.md +35 -0
- package/commands/orchestrate.md +21 -0
- package/commands/plan-feature.md +36 -0
- package/commands/postmortem.md +42 -0
- package/commands/pr-describe.md +39 -0
- package/commands/pr.md +22 -0
- package/commands/prd.md +41 -0
- package/commands/project-init.md +21 -0
- package/commands/refactor-clean.md +24 -0
- package/commands/resume-session.md +22 -0
- package/commands/review.md +35 -0
- package/commands/save-session.md +37 -0
- package/commands/security-scan.md +32 -0
- package/commands/sessions.md +21 -0
- package/commands/skill-create.md +21 -0
- package/commands/tdd.md +36 -0
- package/commands/test-coverage.md +24 -0
- package/commands/threat-model.md +36 -0
- package/commands/update-docs.md +25 -0
- package/commands/verify.md +21 -0
- package/hooks/block-dangerous-commands/HOOK.md +30 -0
- package/hooks/block-dangerous-commands/cases.json +50 -0
- package/hooks/block-dangerous-commands/hook.js +75 -0
- package/hooks/block-no-verify/HOOK.md +25 -0
- package/hooks/block-no-verify/cases.json +30 -0
- package/hooks/block-no-verify/hook.js +43 -0
- package/hooks/format-on-edit/HOOK.md +24 -0
- package/hooks/format-on-edit/hook.js +89 -0
- package/hooks/guard-secrets/HOOK.md +19 -0
- package/hooks/guard-secrets/cases.json +110 -0
- package/hooks/guard-secrets/hook.js +44 -0
- package/hooks/load-session-context/HOOK.md +20 -0
- package/hooks/load-session-context/hook.js +56 -0
- package/hooks/protect-files/HOOK.md +24 -0
- package/hooks/protect-files/cases.json +27 -0
- package/hooks/protect-files/hook.js +39 -0
- package/hooks/run.js +132 -0
- package/mcp/atlassian.json +11 -0
- package/mcp/chrome-devtools.json +18 -0
- package/mcp/cloudflare.json +11 -0
- package/mcp/context7.json +11 -0
- package/mcp/fetch.json +17 -0
- package/mcp/figma.json +11 -0
- package/mcp/git.json +17 -0
- package/mcp/github.json +11 -0
- package/mcp/linear.json +11 -0
- package/mcp/memory.json +18 -0
- package/mcp/notion.json +11 -0
- package/mcp/playwright.json +18 -0
- package/mcp/sentry.json +11 -0
- package/mcp/stripe.json +11 -0
- package/mcp/supabase.json +11 -0
- package/mcp/time.json +17 -0
- package/package.json +59 -4
- package/profiles.json +165 -0
- package/rules/common.md +21 -0
- package/rules/cpp.md +29 -0
- package/rules/csharp.md +25 -0
- package/rules/dart.md +29 -0
- package/rules/fsharp.md +28 -0
- package/rules/git.md +26 -0
- package/rules/go.md +29 -0
- package/rules/java.md +29 -0
- package/rules/kotlin.md +27 -0
- package/rules/perl.md +26 -0
- package/rules/php.md +28 -0
- package/rules/python.md +30 -0
- package/rules/ruby.md +27 -0
- package/rules/rust.md +26 -0
- package/rules/security.md +29 -0
- package/rules/swift.md +28 -0
- package/rules/testing.md +25 -0
- package/rules/typescript.md +29 -0
- package/schemas/skill-frontmatter.schema.json +52 -0
- package/scripts/lib/audit.js +96 -0
- package/scripts/lib/frontmatter.js +65 -0
- package/scripts/lib/hooks-install.js +292 -0
- package/scripts/lib/i18n.js +51 -0
- package/scripts/lib/inventory.js +85 -0
- package/scripts/lib/lint.js +158 -0
- package/scripts/lib/mcp-install.js +284 -0
- package/scripts/lib/profiles.js +128 -0
- package/scripts/lib/render.js +86 -0
- package/scripts/lib/rules-install.js +118 -0
- package/scripts/lib/skills.js +86 -0
- package/scripts/lib/targets.js +113 -0
- package/skills/accounting-api-integration/SKILL.md +81 -0
- package/skills/accounting-api-integration/evals/triggers.json +17 -0
- package/skills/accounting-api-integration/references/quickbooks.md +48 -0
- package/skills/accounting-api-integration/references/xero.md +45 -0
- package/skills/agent-harness-design/SKILL.md +125 -0
- package/skills/agent-harness-design/evals/triggers.json +21 -0
- package/skills/ai-media-generation/SKILL.md +89 -0
- package/skills/ai-media-generation/evals/triggers.json +16 -0
- package/skills/ai-media-generation/references/job-pipeline.md +76 -0
- package/skills/angular-patterns/SKILL.md +122 -0
- package/skills/angular-patterns/evals/triggers.json +16 -0
- package/skills/api-design/SKILL.md +96 -0
- package/skills/api-design/evals/triggers.json +18 -0
- package/skills/api-design/references/conventions.md +133 -0
- package/skills/architecture-decision-records/SKILL.md +98 -0
- package/skills/architecture-decision-records/evals/triggers.json +17 -0
- package/skills/article-writing/SKILL.md +108 -0
- package/skills/article-writing/evals/triggers.json +16 -0
- package/skills/aspnet-core-patterns/SKILL.md +149 -0
- package/skills/aspnet-core-patterns/evals/triggers.json +16 -0
- package/skills/auth-patterns/SKILL.md +104 -0
- package/skills/auth-patterns/evals/triggers.json +17 -0
- package/skills/auth-patterns/references/oauth-oidc.md +64 -0
- package/skills/autonomous-loops/SKILL.md +99 -0
- package/skills/autonomous-loops/evals/triggers.json +14 -0
- package/skills/aws-patterns/SKILL.md +91 -0
- package/skills/aws-patterns/evals/triggers.json +16 -0
- package/skills/azure-patterns/SKILL.md +86 -0
- package/skills/azure-patterns/evals/triggers.json +16 -0
- package/skills/benchmark-methodology/SKILL.md +88 -0
- package/skills/benchmark-methodology/evals/triggers.json +16 -0
- package/skills/benchmark-methodology/references/language-harnesses.md +130 -0
- package/skills/bgp-diagnostics/SKILL.md +84 -0
- package/skills/bgp-diagnostics/evals/triggers.json +18 -0
- package/skills/bgp-diagnostics/references/bgp-reference.md +81 -0
- package/skills/bioinformatics-workflows/SKILL.md +108 -0
- package/skills/bioinformatics-workflows/evals/triggers.json +16 -0
- package/skills/bioinformatics-workflows/references/commands.md +71 -0
- package/skills/bioinformatics-workflows/references/formats.md +24 -0
- package/skills/bioinformatics-workflows/references/workflow-managers.md +107 -0
- package/skills/brand-voice/SKILL.md +112 -0
- package/skills/brand-voice/evals/triggers.json +16 -0
- package/skills/browser-qa/SKILL.md +99 -0
- package/skills/browser-qa/evals/triggers.json +16 -0
- package/skills/bun-runtime/SKILL.md +93 -0
- package/skills/bun-runtime/evals/triggers.json +16 -0
- package/skills/cisco-ios-config/SKILL.md +101 -0
- package/skills/cisco-ios-config/evals/triggers.json +18 -0
- package/skills/cisco-ios-config/references/verification.md +63 -0
- package/skills/clickhouse-patterns/SKILL.md +101 -0
- package/skills/clickhouse-patterns/evals/triggers.json +18 -0
- package/skills/clickhouse-patterns/references/engines-and-views.md +138 -0
- package/skills/clinical-decision-support/SKILL.md +90 -0
- package/skills/clinical-decision-support/evals/triggers.json +16 -0
- package/skills/clinical-decision-support/references/cds-hooks.md +76 -0
- package/skills/clinical-decision-support/references/regulatory-boundaries.md +37 -0
- package/skills/code-tour/SKILL.md +97 -0
- package/skills/code-tour/evals/triggers.json +14 -0
- package/skills/codebase-onboarding/SKILL.md +112 -0
- package/skills/codebase-onboarding/evals/triggers.json +14 -0
- package/skills/cold-outreach-sequences/SKILL.md +90 -0
- package/skills/cold-outreach-sequences/evals/triggers.json +16 -0
- package/skills/content-repurposing/SKILL.md +82 -0
- package/skills/content-repurposing/evals/triggers.json +16 -0
- package/skills/context-budget/SKILL.md +84 -0
- package/skills/context-budget/evals/triggers.json +14 -0
- package/skills/conventional-commits/SKILL.md +144 -0
- package/skills/conventional-commits/evals/triggers.json +16 -0
- package/skills/cpp-patterns/SKILL.md +129 -0
- package/skills/cpp-patterns/evals/triggers.json +16 -0
- package/skills/cpp-patterns/references/cmake-and-tooling.md +88 -0
- package/skills/cpp-patterns/references/undefined-behaviour.md +75 -0
- package/skills/cpp-testing/SKILL.md +131 -0
- package/skills/cpp-testing/evals/triggers.json +16 -0
- package/skills/csharp-patterns/SKILL.md +110 -0
- package/skills/csharp-patterns/evals/triggers.json +17 -0
- package/skills/csharp-patterns/references/analyzers.md +59 -0
- package/skills/csharp-testing/SKILL.md +85 -0
- package/skills/csharp-testing/evals/triggers.json +17 -0
- package/skills/csharp-testing/references/integration-tests.md +77 -0
- package/skills/css-architecture/SKILL.md +143 -0
- package/skills/css-architecture/evals/triggers.json +16 -0
- package/skills/customs-trade-compliance/SKILL.md +95 -0
- package/skills/customs-trade-compliance/evals/triggers.json +16 -0
- package/skills/customs-trade-compliance/references/incoterms-2020.md +42 -0
- package/skills/dart-patterns/SKILL.md +157 -0
- package/skills/dart-patterns/evals/triggers.json +18 -0
- package/skills/dart-testing/SKILL.md +164 -0
- package/skills/dart-testing/evals/triggers.json +18 -0
- package/skills/data-analysis-notebooks/SKILL.md +113 -0
- package/skills/data-analysis-notebooks/evals/triggers.json +16 -0
- package/skills/data-analysis-notebooks/references/dataframe-pitfalls.md +49 -0
- package/skills/data-analysis-notebooks/references/statistics-pitfalls.md +24 -0
- package/skills/data-pipelines/SKILL.md +90 -0
- package/skills/data-pipelines/evals/triggers.json +16 -0
- package/skills/data-pipelines/references/orchestrators.md +64 -0
- package/skills/database-migrations/SKILL.md +102 -0
- package/skills/database-migrations/evals/triggers.json +16 -0
- package/skills/database-migrations/references/recipes.md +98 -0
- package/skills/database-migrations/references/tools.md +21 -0
- package/skills/dbt-patterns/SKILL.md +96 -0
- package/skills/dbt-patterns/evals/triggers.json +16 -0
- package/skills/dbt-patterns/references/yaml-examples.md +114 -0
- package/skills/deep-research/SKILL.md +107 -0
- package/skills/deep-research/evals/triggers.json +14 -0
- package/skills/dependency-audit/SKILL.md +103 -0
- package/skills/dependency-audit/evals/triggers.json +16 -0
- package/skills/dependency-audit/references/tools.md +124 -0
- package/skills/deployment-strategies/SKILL.md +108 -0
- package/skills/deployment-strategies/evals/triggers.json +16 -0
- package/skills/django-patterns/SKILL.md +123 -0
- package/skills/django-patterns/evals/triggers.json +16 -0
- package/skills/docker-patterns/SKILL.md +132 -0
- package/skills/docker-patterns/evals/triggers.json +16 -0
- package/skills/docker-patterns/references/dockerfiles.md +105 -0
- package/skills/e2e-testing-playwright/SKILL.md +94 -0
- package/skills/e2e-testing-playwright/evals/triggers.json +16 -0
- package/skills/e2e-testing-playwright/references/config-and-ci.md +129 -0
- package/skills/ef-core-patterns/SKILL.md +117 -0
- package/skills/ef-core-patterns/evals/triggers.json +16 -0
- package/skills/email-deliverability/SKILL.md +99 -0
- package/skills/email-deliverability/evals/triggers.json +17 -0
- package/skills/email-deliverability/references/dns-records.md +85 -0
- package/skills/error-handling-patterns/SKILL.md +112 -0
- package/skills/error-handling-patterns/evals/triggers.json +18 -0
- package/skills/error-handling-patterns/references/language-idioms.md +49 -0
- package/skills/estimation-and-scoping/SKILL.md +97 -0
- package/skills/estimation-and-scoping/evals/triggers.json +14 -0
- package/skills/evm-dapp-integration/SKILL.md +73 -0
- package/skills/evm-dapp-integration/evals/triggers.json +16 -0
- package/skills/fastapi-patterns/SKILL.md +127 -0
- package/skills/fastapi-patterns/evals/triggers.json +16 -0
- package/skills/ffmpeg-media-processing/SKILL.md +94 -0
- package/skills/ffmpeg-media-processing/evals/triggers.json +16 -0
- package/skills/ffmpeg-media-processing/references/recipes.md +112 -0
- package/skills/fhir-integration/SKILL.md +81 -0
- package/skills/fhir-integration/evals/triggers.json +16 -0
- package/skills/fhir-integration/references/search-and-bundles.md +73 -0
- package/skills/fhir-integration/references/smart-on-fhir.md +50 -0
- package/skills/flask-patterns/SKILL.md +132 -0
- package/skills/flask-patterns/evals/triggers.json +16 -0
- package/skills/flutter-patterns/SKILL.md +99 -0
- package/skills/flutter-patterns/evals/triggers.json +16 -0
- package/skills/flutterwave-integration/SKILL.md +75 -0
- package/skills/flutterwave-integration/evals/triggers.json +16 -0
- package/skills/flutterwave-integration/references/api.md +73 -0
- package/skills/flutterwave-integration/references/webhooks.md +49 -0
- package/skills/fsharp-patterns/SKILL.md +133 -0
- package/skills/fsharp-patterns/evals/triggers.json +16 -0
- package/skills/fsharp-testing/SKILL.md +136 -0
- package/skills/fsharp-testing/evals/triggers.json +16 -0
- package/skills/gcp-patterns/SKILL.md +86 -0
- package/skills/gcp-patterns/evals/triggers.json +16 -0
- package/skills/git-workflow/SKILL.md +114 -0
- package/skills/git-workflow/evals/triggers.json +16 -0
- package/skills/github-actions-ci/SKILL.md +117 -0
- package/skills/github-actions-ci/evals/triggers.json +16 -0
- package/skills/github-api-automation/SKILL.md +101 -0
- package/skills/github-api-automation/evals/triggers.json +17 -0
- package/skills/go-patterns/SKILL.md +118 -0
- package/skills/go-patterns/evals/triggers.json +17 -0
- package/skills/go-patterns/references/concurrency.md +162 -0
- package/skills/go-testing/SKILL.md +154 -0
- package/skills/go-testing/evals/triggers.json +17 -0
- package/skills/hexagonal-architecture/SKILL.md +89 -0
- package/skills/hexagonal-architecture/evals/triggers.json +17 -0
- package/skills/hipaa-compliance/SKILL.md +91 -0
- package/skills/hipaa-compliance/evals/triggers.json +18 -0
- package/skills/hipaa-compliance/references/safeguards.md +68 -0
- package/skills/hl7v2-integration/SKILL.md +69 -0
- package/skills/hl7v2-integration/evals/triggers.json +16 -0
- package/skills/hl7v2-integration/references/messages-and-ack.md +78 -0
- package/skills/homelab-network-setup/SKILL.md +125 -0
- package/skills/homelab-network-setup/evals/triggers.json +18 -0
- package/skills/homelab-network-setup/references/firewall-and-dns.md +45 -0
- package/skills/homelab-network-setup/references/wireguard.md +72 -0
- package/skills/hubtel-integration/SKILL.md +77 -0
- package/skills/hubtel-integration/evals/triggers.json +16 -0
- package/skills/hubtel-integration/references/api.md +92 -0
- package/skills/i18n-localization/SKILL.md +114 -0
- package/skills/i18n-localization/evals/triggers.json +16 -0
- package/skills/i18n-localization/references/libraries.md +52 -0
- package/skills/incident-postmortem/SKILL.md +118 -0
- package/skills/incident-postmortem/evals/triggers.json +14 -0
- package/skills/inventory-demand-planning/SKILL.md +89 -0
- package/skills/inventory-demand-planning/evals/triggers.json +16 -0
- package/skills/inventory-demand-planning/references/formulas.md +62 -0
- package/skills/investor-materials/SKILL.md +127 -0
- package/skills/investor-materials/evals/triggers.json +16 -0
- package/skills/investor-materials/references/templates.md +74 -0
- package/skills/invoicing-and-tax/SKILL.md +84 -0
- package/skills/invoicing-and-tax/evals/triggers.json +17 -0
- package/skills/invoicing-and-tax/references/e-invoicing.md +24 -0
- package/skills/invoicing-and-tax/references/invoice-fields.md +38 -0
- package/skills/invoicing-and-tax/references/rounding.md +26 -0
- package/skills/java-patterns/SKILL.md +141 -0
- package/skills/java-patterns/evals/triggers.json +17 -0
- package/skills/java-testing/SKILL.md +142 -0
- package/skills/java-testing/evals/triggers.json +16 -0
- package/skills/jetpack-compose-patterns/SKILL.md +88 -0
- package/skills/jetpack-compose-patterns/evals/triggers.json +16 -0
- package/skills/jira-integration/SKILL.md +92 -0
- package/skills/jira-integration/evals/triggers.json +17 -0
- package/skills/jpa-hibernate/SKILL.md +92 -0
- package/skills/jpa-hibernate/evals/triggers.json +18 -0
- package/skills/jpa-hibernate/references/mapping.md +99 -0
- package/skills/kotlin-multiplatform/SKILL.md +97 -0
- package/skills/kotlin-multiplatform/evals/triggers.json +16 -0
- package/skills/kotlin-patterns/SKILL.md +128 -0
- package/skills/kotlin-patterns/evals/triggers.json +16 -0
- package/skills/kotlin-testing/SKILL.md +117 -0
- package/skills/kotlin-testing/evals/triggers.json +16 -0
- package/skills/ktor-patterns/SKILL.md +135 -0
- package/skills/ktor-patterns/evals/triggers.json +18 -0
- package/skills/kubernetes-patterns/SKILL.md +106 -0
- package/skills/kubernetes-patterns/evals/triggers.json +16 -0
- package/skills/kubernetes-patterns/references/manifests.md +115 -0
- package/skills/laravel-patterns/SKILL.md +136 -0
- package/skills/laravel-patterns/evals/triggers.json +16 -0
- package/skills/linear-integration/SKILL.md +98 -0
- package/skills/linear-integration/evals/triggers.json +17 -0
- package/skills/literature-review/SKILL.md +109 -0
- package/skills/literature-review/evals/triggers.json +16 -0
- package/skills/literature-review/references/appraisal.md +41 -0
- package/skills/literature-review/references/search-sources.md +39 -0
- package/skills/llm-app-patterns/SKILL.md +97 -0
- package/skills/llm-app-patterns/evals/triggers.json +17 -0
- package/skills/llm-evals/SKILL.md +98 -0
- package/skills/llm-evals/evals/triggers.json +16 -0
- package/skills/llm-evals/references/graders.md +66 -0
- package/skills/logistics-exception-management/SKILL.md +90 -0
- package/skills/logistics-exception-management/evals/triggers.json +16 -0
- package/skills/manim-animations/SKILL.md +106 -0
- package/skills/manim-animations/evals/triggers.json +16 -0
- package/skills/market-research/SKILL.md +117 -0
- package/skills/market-research/evals/triggers.json +16 -0
- package/skills/marketing-campaign/SKILL.md +111 -0
- package/skills/marketing-campaign/evals/triggers.json +16 -0
- package/skills/mcp-server-patterns/SKILL.md +127 -0
- package/skills/mcp-server-patterns/evals/triggers.json +18 -0
- package/skills/mcp-server-patterns/references/protocol-notes.md +68 -0
- package/skills/metrics-dashboards/SKILL.md +113 -0
- package/skills/metrics-dashboards/evals/triggers.json +16 -0
- package/skills/ml-experiment-workflow/SKILL.md +125 -0
- package/skills/ml-experiment-workflow/evals/triggers.json +16 -0
- package/skills/mongodb-patterns/SKILL.md +115 -0
- package/skills/mongodb-patterns/evals/triggers.json +18 -0
- package/skills/mongodb-patterns/references/indexes-and-aggregation.md +94 -0
- package/skills/mpesa-daraja-integration/SKILL.md +70 -0
- package/skills/mpesa-daraja-integration/evals/triggers.json +16 -0
- package/skills/mpesa-daraja-integration/references/api.md +103 -0
- package/skills/mpesa-daraja-integration/references/callbacks.md +74 -0
- package/skills/mtn-momo-integration/SKILL.md +66 -0
- package/skills/mtn-momo-integration/evals/triggers.json +16 -0
- package/skills/mtn-momo-integration/references/api.md +153 -0
- package/skills/mtn-momo-integration/references/callbacks.md +92 -0
- package/skills/mtn-momo-integration/references/sandbox-and-go-live.md +51 -0
- package/skills/mtn-momo-integration/scripts/sandbox-setup.js +79 -0
- package/skills/mysql-patterns/SKILL.md +96 -0
- package/skills/mysql-patterns/evals/triggers.json +16 -0
- package/skills/mysql-patterns/references/explain.md +34 -0
- package/skills/mysql-patterns/references/online-ddl.md +41 -0
- package/skills/nestjs-patterns/SKILL.md +114 -0
- package/skills/nestjs-patterns/evals/triggers.json +16 -0
- package/skills/nestjs-patterns/references/testing.md +68 -0
- package/skills/network-automation/SKILL.md +107 -0
- package/skills/network-automation/evals/triggers.json +18 -0
- package/skills/network-automation/references/tool-snippets.md +153 -0
- package/skills/network-troubleshooting/SKILL.md +152 -0
- package/skills/network-troubleshooting/evals/triggers.json +18 -0
- package/skills/network-troubleshooting/references/commands.md +33 -0
- package/skills/nextjs-patterns/SKILL.md +150 -0
- package/skills/nextjs-patterns/evals/triggers.json +18 -0
- package/skills/nextjs-patterns/references/caching.md +87 -0
- package/skills/node-backend-patterns/SKILL.md +103 -0
- package/skills/node-backend-patterns/evals/triggers.json +16 -0
- package/skills/node-backend-patterns/references/templates.md +122 -0
- package/skills/nuxt-patterns/SKILL.md +103 -0
- package/skills/nuxt-patterns/evals/triggers.json +16 -0
- package/skills/parallel-agent-orchestration/SKILL.md +106 -0
- package/skills/parallel-agent-orchestration/evals/triggers.json +14 -0
- package/skills/paystack-integration/SKILL.md +59 -0
- package/skills/paystack-integration/evals/triggers.json +14 -0
- package/skills/paystack-integration/references/api.md +73 -0
- package/skills/paystack-integration/references/mobile-money.md +50 -0
- package/skills/paystack-integration/references/webhooks.md +80 -0
- package/skills/pci-dss-scope/SKILL.md +103 -0
- package/skills/pci-dss-scope/evals/triggers.json +18 -0
- package/skills/pci-dss-scope/references/saq-and-data.md +36 -0
- package/skills/perl-patterns/SKILL.md +135 -0
- package/skills/perl-patterns/evals/triggers.json +18 -0
- package/skills/perl-testing/SKILL.md +126 -0
- package/skills/perl-testing/evals/triggers.json +17 -0
- package/skills/php-patterns/SKILL.md +116 -0
- package/skills/php-patterns/evals/triggers.json +16 -0
- package/skills/php-testing/SKILL.md +123 -0
- package/skills/php-testing/evals/triggers.json +16 -0
- package/skills/postgres-patterns/SKILL.md +103 -0
- package/skills/postgres-patterns/evals/triggers.json +17 -0
- package/skills/postgres-patterns/references/explain.md +59 -0
- package/skills/postgres-patterns/references/locks.md +53 -0
- package/skills/prd-writing/SKILL.md +124 -0
- package/skills/prd-writing/evals/triggers.json +15 -0
- package/skills/prisma-patterns/SKILL.md +83 -0
- package/skills/prisma-patterns/evals/triggers.json +18 -0
- package/skills/prisma-patterns/references/prisma-8.md +46 -0
- package/skills/prisma-patterns/references/workflow.md +50 -0
- package/skills/privacy-compliance/SKILL.md +121 -0
- package/skills/privacy-compliance/evals/triggers.json +18 -0
- package/skills/privacy-compliance/references/jurisdictions.md +51 -0
- package/skills/production-scheduling/SKILL.md +98 -0
- package/skills/production-scheduling/evals/triggers.json +16 -0
- package/skills/prompt-engineering/SKILL.md +92 -0
- package/skills/prompt-engineering/evals/triggers.json +16 -0
- package/skills/python-patterns/SKILL.md +107 -0
- package/skills/python-patterns/evals/triggers.json +16 -0
- package/skills/python-patterns/references/tooling.md +101 -0
- package/skills/python-testing/SKILL.md +126 -0
- package/skills/python-testing/evals/triggers.json +16 -0
- package/skills/python-testing/references/mocking.md +71 -0
- package/skills/pytorch-patterns/SKILL.md +139 -0
- package/skills/pytorch-patterns/evals/triggers.json +16 -0
- package/skills/pytorch-patterns/references/debugging.md +39 -0
- package/skills/quarkus-patterns/SKILL.md +93 -0
- package/skills/quarkus-patterns/evals/triggers.json +18 -0
- package/skills/rag-pipeline-patterns/SKILL.md +117 -0
- package/skills/rag-pipeline-patterns/evals/triggers.json +18 -0
- package/skills/rag-pipeline-patterns/references/evaluation.md +37 -0
- package/skills/rag-pipeline-patterns/references/retrieval-recipes.md +78 -0
- package/skills/rails-patterns/SKILL.md +132 -0
- package/skills/rails-patterns/evals/triggers.json +16 -0
- package/skills/react-native-patterns/SKILL.md +101 -0
- package/skills/react-native-patterns/evals/triggers.json +16 -0
- package/skills/react-patterns/SKILL.md +140 -0
- package/skills/react-patterns/evals/triggers.json +18 -0
- package/skills/react-performance/SKILL.md +107 -0
- package/skills/react-performance/evals/triggers.json +18 -0
- package/skills/redis-patterns/SKILL.md +109 -0
- package/skills/redis-patterns/evals/triggers.json +18 -0
- package/skills/redis-patterns/references/operations.md +61 -0
- package/skills/refactoring-safely/SKILL.md +107 -0
- package/skills/refactoring-safely/evals/triggers.json +17 -0
- package/skills/release-management/SKILL.md +141 -0
- package/skills/release-management/evals/triggers.json +16 -0
- package/skills/remotion-video/SKILL.md +91 -0
- package/skills/remotion-video/evals/triggers.json +16 -0
- package/skills/remotion-video/references/lambda.md +66 -0
- package/skills/returns-reverse-logistics/SKILL.md +97 -0
- package/skills/returns-reverse-logistics/evals/triggers.json +16 -0
- package/skills/ruby-patterns/SKILL.md +127 -0
- package/skills/ruby-patterns/evals/triggers.json +18 -0
- package/skills/ruby-testing/SKILL.md +113 -0
- package/skills/ruby-testing/evals/triggers.json +18 -0
- package/skills/runbook-writing/SKILL.md +101 -0
- package/skills/runbook-writing/evals/triggers.json +14 -0
- package/skills/rust-patterns/SKILL.md +118 -0
- package/skills/rust-patterns/evals/triggers.json +16 -0
- package/skills/rust-patterns/references/cargo-and-clippy.md +105 -0
- package/skills/rust-patterns/references/errors-and-traits.md +97 -0
- package/skills/rust-testing/SKILL.md +148 -0
- package/skills/rust-testing/evals/triggers.json +16 -0
- package/skills/rust-testing/references/fakes-proptest-async.md +113 -0
- package/skills/search-first/SKILL.md +73 -0
- package/skills/search-first/evals/triggers.json +14 -0
- package/skills/security-review/SKILL.md +58 -0
- package/skills/security-review/evals/triggers.json +14 -0
- package/skills/security-review/references/checklist.md +54 -0
- package/skills/security-review/scripts/scan-secrets.js +79 -0
- package/skills/seo-audit/SKILL.md +111 -0
- package/skills/seo-audit/evals/triggers.json +16 -0
- package/skills/seo-audit/references/checks.md +65 -0
- package/skills/session-handoff/SKILL.md +101 -0
- package/skills/session-handoff/evals/triggers.json +14 -0
- package/skills/skill-authoring/SKILL.md +87 -0
- package/skills/skill-authoring/evals/triggers.json +14 -0
- package/skills/skill-authoring/references/frontmatter.md +40 -0
- package/skills/slack-app-integration/SKILL.md +108 -0
- package/skills/slack-app-integration/evals/triggers.json +17 -0
- package/skills/smart-contract-security/SKILL.md +110 -0
- package/skills/smart-contract-security/evals/triggers.json +16 -0
- package/skills/smart-contract-security/references/vulnerability-checklist.md +79 -0
- package/skills/social-media-publishing/SKILL.md +84 -0
- package/skills/social-media-publishing/evals/triggers.json +17 -0
- package/skills/social-media-publishing/references/platform-apis.md +116 -0
- package/skills/solidity-patterns/SKILL.md +95 -0
- package/skills/solidity-patterns/evals/triggers.json +16 -0
- package/skills/spring-boot-patterns/SKILL.md +128 -0
- package/skills/spring-boot-patterns/evals/triggers.json +18 -0
- package/skills/spring-boot-patterns/references/testing.md +72 -0
- package/skills/stripe-integration/SKILL.md +69 -0
- package/skills/stripe-integration/evals/triggers.json +16 -0
- package/skills/stripe-integration/references/api.md +71 -0
- package/skills/stripe-integration/references/billing.md +58 -0
- package/skills/stripe-integration/references/webhooks.md +76 -0
- package/skills/subscription-billing-ops/SKILL.md +118 -0
- package/skills/subscription-billing-ops/evals/triggers.json +17 -0
- package/skills/subscription-billing-ops/references/proration.md +47 -0
- package/skills/subscription-billing-ops/references/revenue-metrics.md +38 -0
- package/skills/svelte-patterns/SKILL.md +122 -0
- package/skills/svelte-patterns/evals/triggers.json +16 -0
- package/skills/swift-patterns/SKILL.md +113 -0
- package/skills/swift-patterns/evals/triggers.json +16 -0
- package/skills/swift-patterns/references/concurrency-migration.md +40 -0
- package/skills/swift-testing/SKILL.md +121 -0
- package/skills/swift-testing/evals/triggers.json +16 -0
- package/skills/swift-testing/references/swift-testing-cheatsheet.md +81 -0
- package/skills/swiftui-patterns/SKILL.md +102 -0
- package/skills/swiftui-patterns/evals/triggers.json +16 -0
- package/skills/tdd-workflow/SKILL.md +67 -0
- package/skills/tdd-workflow/evals/triggers.json +14 -0
- package/skills/technical-writing/SKILL.md +95 -0
- package/skills/technical-writing/evals/triggers.json +14 -0
- package/skills/terraform-patterns/SKILL.md +122 -0
- package/skills/terraform-patterns/evals/triggers.json +16 -0
- package/skills/terraform-patterns/references/backends.md +67 -0
- package/skills/test-coverage-improvement/SKILL.md +107 -0
- package/skills/test-coverage-improvement/evals/triggers.json +16 -0
- package/skills/threat-modeling/SKILL.md +113 -0
- package/skills/threat-modeling/evals/triggers.json +16 -0
- package/skills/typescript-patterns/SKILL.md +122 -0
- package/skills/typescript-patterns/evals/triggers.json +16 -0
- package/skills/typescript-testing/SKILL.md +101 -0
- package/skills/typescript-testing/evals/triggers.json +16 -0
- package/skills/verification-loop/SKILL.md +70 -0
- package/skills/verification-loop/evals/triggers.json +14 -0
- package/skills/verification-loop/scripts/detect-checks.js +102 -0
- package/skills/vite-patterns/SKILL.md +117 -0
- package/skills/vite-patterns/evals/triggers.json +16 -0
- package/skills/vue-patterns/SKILL.md +104 -0
- package/skills/vue-patterns/evals/triggers.json +16 -0
- package/skills/web-accessibility/SKILL.md +119 -0
- package/skills/web-accessibility/evals/triggers.json +16 -0
- package/skills/web-performance/SKILL.md +107 -0
- package/skills/web-performance/evals/triggers.json +16 -0
- package/skills/web-scraping/SKILL.md +80 -0
- package/skills/web-scraping/evals/triggers.json +16 -0
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: smart-contract-security
|
|
3
|
+
description: Security audit procedure for Solidity and EVM smart contracts that maps the system's funds, roles and trust assumptions, then hunts reentrancy (including cross-function and read-only), broken access control, price oracle and flash-loan manipulation, rounding and precision loss in share maths, front-running and MEV exposure, signature replay across chains and nonces, and proxy upgrade risks, backed by Slither static analysis plus Foundry, Echidna or Medusa fuzzing and invariant tests, ending in a severity-rated report with a clear professional-audit boundary. Use when auditing a protocol or token contract before deployment, investigating a suspected exploit path, writing invariant tests to break a contract, or deciding whether code is ready for an external audit.
|
|
4
|
+
license: MIT
|
|
5
|
+
compatibility: Any Agent Skills host. Needs Foundry (forge) or Hardhat to build and test; Slither (Python 3.10+) for static analysis; Echidna or Medusa optional for property fuzzing.
|
|
6
|
+
metadata:
|
|
7
|
+
kete-loom/version: "0.1.0"
|
|
8
|
+
kete-loom/category: security
|
|
9
|
+
kete-loom/risk: runs-commands
|
|
10
|
+
kete-loom/requires: "forge, slither"
|
|
11
|
+
kete-loom/owner: "Kete-org"
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# Smart contract security
|
|
15
|
+
|
|
16
|
+
Find the ways a contract loses or locks funds, prove each with a failing test, and say plainly what the review did not cover. Exploits are permanent and public, so a finding without a reproduction is a lead, not a conclusion.
|
|
17
|
+
|
|
18
|
+
## What this skill is not
|
|
19
|
+
|
|
20
|
+
- **Not a professional audit.** It is a structured internal review. Any contract that will hold meaningful user funds, mint a token with market value, or bridge assets needs at least one independent audit by a qualified firm, and ideally a bug bounty, before mainnet. Say so in every report.
|
|
21
|
+
- Not financial, legal or token-regulation advice.
|
|
22
|
+
- Not a guarantee: no finding list proves the absence of bugs.
|
|
23
|
+
|
|
24
|
+
## 1. Scope and threat model
|
|
25
|
+
|
|
26
|
+
1. Pin the exact commit, compiler version and the list of in-scope files. Build it (`forge build` or `npx hardhat compile`); if it doesn't compile, stop and ask.
|
|
27
|
+
2. Write down, before reading code in depth:
|
|
28
|
+
- **Assets**: what the contracts hold (ETH, tokens, NFTs, accounting balances) and where the totals live.
|
|
29
|
+
- **Actors and roles**: users, admins, keepers, oracles, bridges, other protocols; what each can do.
|
|
30
|
+
- **Trust assumptions**: which external contracts and tokens are trusted, which price feeds, and what a malicious or upgraded dependency could do.
|
|
31
|
+
- **Invariants**: statements that must always hold (solvency, `totalShares` matches the sum of balances, only role X changes parameter Y).
|
|
32
|
+
3. Map every external and public function that moves value or changes privileged state. Run `slither . --print human-summary` and `--print function-summary` to get the inventory.
|
|
33
|
+
|
|
34
|
+
## 2. Automated pass
|
|
35
|
+
|
|
36
|
+
1. `slither .` from the project root (filter out `lib/` or `node_modules` per the Slither wiki). Triage every high and medium detector result: true positive, false positive with reason, or needs a test.
|
|
37
|
+
2. For proxies, `slither-check-upgradeability` against the old and new implementation, plus the OpenZeppelin Upgrades plugin's validation.
|
|
38
|
+
3. Existing tests: `forge test -vvv` and `forge coverage`. Note functions with no test of their revert paths.
|
|
39
|
+
|
|
40
|
+
Tool output is a starting point. Never report a detector result as a finding without reading the code path.
|
|
41
|
+
|
|
42
|
+
## 3. Manual review, in this order
|
|
43
|
+
|
|
44
|
+
Work through `references/vulnerability-checklist.md`. The headline classes:
|
|
45
|
+
|
|
46
|
+
1. **Reentrancy**: external calls (ETH sends, token transfers, hooks in ERC-721/1155/777 receivers, arbitrary `call`) before state is updated; cross-function and cross-contract reentrancy that `nonReentrant` on one function doesn't cover; read-only reentrancy where another protocol reads a stale view mid-call.
|
|
47
|
+
2. **Access control**: unguarded privileged functions, unprotected or re-callable initializers, uninitialized implementation contracts, role admin misconfiguration, `tx.origin` auth, missing two-step ownership transfer.
|
|
48
|
+
3. **Oracle and price manipulation**: spot prices from an AMM pool's reserves or `balanceOf`, which a flash loan can move within one transaction; Chainlink answers used without checking staleness (`updatedAt`), round completeness and sequencer uptime on L2s; donation attacks on share-price vaults (ERC-4626 inflation).
|
|
49
|
+
4. **Integer and rounding**: rounding in the user's favour on deposit/withdraw or mint/redeem, division before multiplication, precision loss with low-decimal tokens, `unchecked` blocks, unsafe downcasts (`uint128(x)` silently truncates; use `SafeCast`).
|
|
50
|
+
5. **Front-running and MEV**: missing slippage limits (`minAmountOut`) and deadlines on swaps, commit-reveal missing where order matters, approval race conditions, sandwichable liquidations or auctions.
|
|
51
|
+
6. **Signature replay**: signatures without a nonce, without `block.chainid` and contract address in the EIP-712 domain, reusable after cancel, malleable (use OZ `ECDSA`, not raw `ecrecover`), or `ecrecover` returning `address(0)` accepted as a valid signer.
|
|
52
|
+
7. **Upgrade risks**: storage layout collisions between versions, missing `_authorizeUpgrade` guard, selector clashes in proxies, upgrade keys held by a single EOA, no timelock.
|
|
53
|
+
8. **Token integration**: fee-on-transfer and rebasing tokens, tokens that return `false` instead of reverting (use `SafeERC20`), tokens with blocklists or pausable transfers, 6 vs 18 decimals.
|
|
54
|
+
9. **Denial of service and griefing**: unbounded loops, push payments to contracts that revert, dust positions that block liquidation.
|
|
55
|
+
|
|
56
|
+
## 4. Prove it
|
|
57
|
+
|
|
58
|
+
For every candidate finding, write a Foundry test that demonstrates it (an exploit test that passes when the bug exists), or a fuzz/invariant test that breaks:
|
|
59
|
+
|
|
60
|
+
- Fuzz: functions taking `uint256 amount` with `bound()` to realistic ranges.
|
|
61
|
+
- Invariant: a handler contract that calls the system's functions in random order, with `invariant_` functions asserting the invariants from step 1 (`[invariant] runs` and `depth` in `foundry.toml`).
|
|
62
|
+
- Fork tests (`forge test --fork-url $RPC_URL`) for oracle and integration issues against real pool state.
|
|
63
|
+
- Echidna or Medusa for longer property campaigns when the invariants are numerous.
|
|
64
|
+
|
|
65
|
+
Findings you couldn't reproduce are reported as "unconfirmed", with the reasoning.
|
|
66
|
+
|
|
67
|
+
## Severity
|
|
68
|
+
|
|
69
|
+
| Severity | Meaning |
|
|
70
|
+
|---|---|
|
|
71
|
+
| Critical | Direct theft or permanent freezing of user funds, or takeover of admin/upgrade, by an unprivileged attacker |
|
|
72
|
+
| High | Loss of funds under realistic conditions, or protocol insolvency |
|
|
73
|
+
| Medium | Loss of yield, temporary freezing, or a privileged role able to harm users beyond the documented trust model |
|
|
74
|
+
| Low | Hardening, best-practice deviations with no direct loss path |
|
|
75
|
+
| Info | Gas, style, documentation |
|
|
76
|
+
|
|
77
|
+
## Stop and ask the user
|
|
78
|
+
|
|
79
|
+
- If you find a critical issue in a contract that is already deployed with funds: stop the review, tell the user immediately, and recommend they contact a security firm or an emergency response group and follow responsible disclosure. Do not publish details, open public issues, or run the exploit on mainnet.
|
|
80
|
+
- Before running anything against a live network other than read-only fork tests.
|
|
81
|
+
- If scope, the trust model or intended admin powers are unclear.
|
|
82
|
+
|
|
83
|
+
## Never
|
|
84
|
+
|
|
85
|
+
- Never broadcast transactions, use real private keys, or test exploits on mainnet or public testnets against contracts you don't own.
|
|
86
|
+
- Never mark a contract "secure", "safe" or "audited". Say "no issues found in the reviewed scope".
|
|
87
|
+
- Never drop the professional-audit recommendation for contracts that will hold funds.
|
|
88
|
+
|
|
89
|
+
## Report format
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
## Smart contract review: <repo>@<commit>
|
|
93
|
+
Scope: <files>, solc <version>. Out of scope: <...>
|
|
94
|
+
Threat model: assets, roles, trust assumptions, invariants (short)
|
|
95
|
+
|
|
96
|
+
### Findings
|
|
97
|
+
1. [Critical] Vault.sol:142 — <title>
|
|
98
|
+
Class: reentrancy | access control | oracle | rounding | MEV | signature | upgrade | token | DoS
|
|
99
|
+
Impact: <who loses what, under what conditions>
|
|
100
|
+
Proof: test/exploits/<Name>.t.sol (passes = bug present) | unconfirmed: <why>
|
|
101
|
+
Fix: <smallest change that removes the root cause>
|
|
102
|
+
|
|
103
|
+
### Tooling
|
|
104
|
+
Slither: <n> results triaged (<n> true positives). Fuzz/invariant: <runs, depth, results>. Coverage: <%>.
|
|
105
|
+
|
|
106
|
+
### Not covered
|
|
107
|
+
<economic design, off-chain components, dependencies, anything skipped>
|
|
108
|
+
|
|
109
|
+
This is an internal review, not a professional audit. Contracts that will hold user funds need an independent audit before mainnet.
|
|
110
|
+
```
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"should_trigger": [
|
|
3
|
+
"Audit our lending protocol contracts for oracle manipulation and reentrancy before launch",
|
|
4
|
+
"Can a flash loan drain our ERC-4626 vault through a share price inflation attack?",
|
|
5
|
+
"Write Foundry invariant tests that try to break the solvency of our staking contract",
|
|
6
|
+
"Our permit-based meta-transaction signatures don't include a nonce, is that exploitable and how bad is it?",
|
|
7
|
+
"Is our DEX router code ready for an external audit? Run Slither and do a security pass first"
|
|
8
|
+
],
|
|
9
|
+
"should_not_trigger": [
|
|
10
|
+
"Write an ERC-20 token contract with a capped supply and an owner-only mint using Foundry",
|
|
11
|
+
"Show the token balance with the right decimals in our wagmi frontend and send an approve transaction",
|
|
12
|
+
"Review my last commit for security vulnerabilities in the login flow",
|
|
13
|
+
"Check our npm dependencies for known CVEs and abandoned packages",
|
|
14
|
+
"Explain how proof of stake consensus works on Ethereum"
|
|
15
|
+
]
|
|
16
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# Smart contract vulnerability checklist
|
|
2
|
+
|
|
3
|
+
Read this during the manual review step. Each item is a question; answer it for every in-scope contract and note the line you checked.
|
|
4
|
+
|
|
5
|
+
## Reentrancy
|
|
6
|
+
|
|
7
|
+
- Does any function make an external call (`call`, `transfer`/`send`, token `transfer`/`transferFrom`, `safeTransferFrom` on ERC-721/1155 which calls `onERC721Received`/`onERC1155Received`, ERC-777 hooks, a callback into a user-supplied address) before it finishes writing state?
|
|
8
|
+
- Are all functions sharing the same state protected together (cross-function reentrancy), not just the one that makes the call?
|
|
9
|
+
- Can another contract read a view function (price, share value, balance) while this contract is mid-call with inconsistent state (read-only reentrancy)?
|
|
10
|
+
- Is `nonReentrant` present where needed and absent from functions that must call each other internally?
|
|
11
|
+
|
|
12
|
+
## Access control
|
|
13
|
+
|
|
14
|
+
- Is every function that mints, burns, pauses, sets parameters, moves treasury funds, or upgrades guarded by a modifier or explicit check?
|
|
15
|
+
- Can `initialize` be called by anyone, called twice, or front-run after deployment? Is `_disableInitializers()` in the implementation constructor?
|
|
16
|
+
- Does `_authorizeUpgrade` have access control (UUPS)?
|
|
17
|
+
- Are `AccessControl` role admins set correctly (who can grant `DEFAULT_ADMIN_ROLE`)?
|
|
18
|
+
- Is ownership transfer two-step (`Ownable2Step`)? Is renouncing ownership possible by accident?
|
|
19
|
+
- Any use of `tx.origin` for authorization?
|
|
20
|
+
- Are admin powers documented and bounded (fee caps, timelocks)?
|
|
21
|
+
|
|
22
|
+
## Oracles and price manipulation
|
|
23
|
+
|
|
24
|
+
- Is any price derived from AMM reserves, `balanceOf(address(this))`, or a single-block value that a flash loan can move?
|
|
25
|
+
- For Chainlink `latestRoundData`: are `answer > 0`, `updatedAt` freshness against the feed's heartbeat, and (on L2s) the sequencer uptime feed checked? Are feed decimals read, not assumed?
|
|
26
|
+
- Are TWAP windows long enough for the liquidity involved?
|
|
27
|
+
- ERC-4626 or share vaults: can the first depositor inflate the share price by donating assets (virtual shares/offset, minimum deposit, or dead shares)?
|
|
28
|
+
|
|
29
|
+
## Integer maths and rounding
|
|
30
|
+
|
|
31
|
+
- Does every conversion round against the user and in favour of the protocol (deposit rounds shares down, withdraw rounds shares up)?
|
|
32
|
+
- Any division before multiplication? Use `Math.mulDiv` for `a * b / c` with large values.
|
|
33
|
+
- Any `unchecked` block without a proven bound?
|
|
34
|
+
- Any downcast (`uint128(x)`, `int256(x)`) without `SafeCast`?
|
|
35
|
+
- Do calculations handle tokens with 6, 8 and 18 decimals, and zero amounts?
|
|
36
|
+
|
|
37
|
+
## Front-running and MEV
|
|
38
|
+
|
|
39
|
+
- Do swaps, deposits into AMM positions, and liquidations take a `minAmountOut`/`maxAmountIn` and a `deadline` from the caller?
|
|
40
|
+
- Can an observer of the mempool profit by inserting a transaction before or after (sandwich, back-running oracle updates)?
|
|
41
|
+
- Are approvals set with `forceApprove` or increase/decrease patterns rather than overwriting non-zero allowances?
|
|
42
|
+
- Would commit-reveal or a batch auction be needed for fairness (games, NFT mints, auctions)?
|
|
43
|
+
|
|
44
|
+
## Signatures
|
|
45
|
+
|
|
46
|
+
- Does the signed message include a nonce that's consumed, an expiry, `block.chainid`, and the verifying contract (EIP-712 domain separator, rebuilt if the chain ID changes)?
|
|
47
|
+
- Is `ECDSA.recover` (or `SignatureChecker` for smart-contract wallets via ERC-1271) used instead of raw `ecrecover`, and is a `address(0)` signer rejected?
|
|
48
|
+
- Can the same signature be used on another function, another contract, or after cancellation?
|
|
49
|
+
- `permit` (EIP-2612) calls: is a front-run `permit` (which makes the second call revert) handled so it can't grief the user?
|
|
50
|
+
|
|
51
|
+
## Upgrades and proxies
|
|
52
|
+
|
|
53
|
+
- Compare storage layouts between versions: no reordered, removed or retyped variables; namespaced storage (ERC-7201) or gaps used consistently.
|
|
54
|
+
- Do inherited contracts change order between versions?
|
|
55
|
+
- Any function selector in the implementation clashing with the proxy's admin functions (transparent proxy)?
|
|
56
|
+
- Who holds the upgrade key? Is there a timelock so users can exit before an upgrade?
|
|
57
|
+
- Does any new `reinitializer(n)` use the right version number?
|
|
58
|
+
|
|
59
|
+
## Token integration
|
|
60
|
+
|
|
61
|
+
- Fee-on-transfer: is the received amount measured by balance difference?
|
|
62
|
+
- Rebasing tokens: do stored balances drift from actual balances?
|
|
63
|
+
- Tokens that return `false` or no value: is `SafeERC20` used?
|
|
64
|
+
- Tokens with blocklists, pause, or upgradeable logic (USDC, USDT): can a blocked address freeze the whole system?
|
|
65
|
+
- ERC-777 or tokens with hooks: reentrancy on transfer.
|
|
66
|
+
|
|
67
|
+
## Denial of service and griefing
|
|
68
|
+
|
|
69
|
+
- Loops over arrays users can grow (holders, orders, positions)?
|
|
70
|
+
- Push payments where one reverting recipient blocks everyone?
|
|
71
|
+
- Can dust positions, tiny orders or zero-amount calls block liquidation, settlement or withdrawal queues?
|
|
72
|
+
- Does anything depend on `address(this).balance` equalling an internal counter (forced ETH via `selfdestruct` from another contract or coinbase still works)?
|
|
73
|
+
|
|
74
|
+
## Miscellaneous
|
|
75
|
+
|
|
76
|
+
- `delegatecall` to user-influenced addresses or to libraries with storage.
|
|
77
|
+
- Randomness from `block.timestamp`, `blockhash` or `block.prevrandao` for anything valuable (use Chainlink VRF or commit-reveal).
|
|
78
|
+
- Hard-coded addresses that differ per chain.
|
|
79
|
+
- Events missing for parameter changes, so monitoring can't see an admin action.
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: social-media-publishing
|
|
3
|
+
description: Posts text, images and video to X, LinkedIn, Facebook Pages and Instagram through their official APIs, covering OAuth app setup and token refresh, the scopes each platform needs, media upload flows, rate and publishing limits, queued scheduling with retries, and per-platform length and formatting rules. Use when building or fixing code that publishes or schedules social posts programmatically, a post or media upload call fails with a 401, 403 or rate-limit error, or one message must be formatted correctly for several networks.
|
|
4
|
+
license: MIT
|
|
5
|
+
compatibility: Any Agent Skills host. Live calls need network access to api.x.com, api.linkedin.com and graph.facebook.com, and developer apps the user owns on each platform. Examples are plain HTTP; the rules apply to any SDK.
|
|
6
|
+
metadata:
|
|
7
|
+
kete-loom/version: "0.1.0"
|
|
8
|
+
kete-loom/category: integrations
|
|
9
|
+
kete-loom/risk: network
|
|
10
|
+
kete-loom/owner: "Kete-org"
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Social media publishing
|
|
14
|
+
|
|
15
|
+
Publish to social networks through official APIs only, with tokens stored safely, media uploaded the way each platform expects, every post idempotent, and failures retried without double-posting.
|
|
16
|
+
|
|
17
|
+
## Ground rules
|
|
18
|
+
|
|
19
|
+
1. **Official APIs only.** No browser automation, scraped endpoints or shared passwords; they break platform terms and get accounts banned.
|
|
20
|
+
2. **The user owns the developer apps.** Each platform needs an app the user registers and, for some scopes, gets approved (LinkedIn's Community Management API for company pages, Meta App Review for Page and Instagram publishing). **Stop and ask the user** for app IDs and which accounts to post as; never invent them.
|
|
21
|
+
3. **Tokens are secrets.** Store access and refresh tokens encrypted server-side, per connected account, with their expiry and granted scopes. Never log them or send them to the browser.
|
|
22
|
+
4. **Request the least scope** that the feature needs (table below).
|
|
23
|
+
5. **Media first, then the post.** Every platform uploads or registers media in a separate step and returns an ID or container that the post references. Wait until processing finishes before posting.
|
|
24
|
+
6. **Idempotent posting.** Write a `scheduled_posts` row (account, platform, body, media, `publish_at`, status) before calling the API; mark `publishing` with a conditional update, store the returned post ID, and never retry a call that may have succeeded without first checking whether the post exists.
|
|
25
|
+
7. **Respect rate limits.** Read the platform's rate-limit headers or usage endpoint, back off on `429`, and spread scheduled posts instead of firing them all at the top of the hour.
|
|
26
|
+
8. **Read the current docs.** These APIs, their access tiers and pricing change often. Check the version and limits in the official docs before stating them; details in `references/platform-apis.md`.
|
|
27
|
+
|
|
28
|
+
## Platform map
|
|
29
|
+
|
|
30
|
+
| Platform | Auth | Post endpoint | Media | Scopes / permissions |
|
|
31
|
+
|---|---|---|---|---|
|
|
32
|
+
| X | OAuth 2.0 with PKCE, user context | `POST https://api.x.com/2/tweets` | `POST /2/media/upload/initialize`, `/{id}/append`, `/{id}/finalize`, then poll status | `tweet.read`, `tweet.write`, `users.read`, `media.write`, `offline.access` for refresh |
|
|
33
|
+
| LinkedIn | OAuth 2.0 three-legged | `POST https://api.linkedin.com/rest/posts` with `Linkedin-Version: YYYYMM` and `X-Restli-Protocol-Version: 2.0.0` | `POST /rest/images?action=initializeUpload`, PUT bytes to `uploadUrl`, use the `urn:li:image:...` | `w_member_social` (member), `w_organization_social` (company page; member needs the ADMINISTRATOR, CONTENT_ADMIN or DIRECT_SPONSORED_CONTENT_POSTER page role) |
|
|
34
|
+
| Facebook Page | Facebook Login, Page access token | `POST /{page-id}/feed` (text, link) or `/{page-id}/photos`, `/{page-id}/videos` | in the same call by URL or upload | `pages_manage_posts`, `pages_manage_engagement`, `pages_read_engagement`, `pages_read_user_engagement`; add `publish_video` for video |
|
|
35
|
+
| Instagram (professional account) | Instagram Login or Facebook Login | `POST /{ig-user-id}/media` creates a container, then `POST /{ig-user-id}/media_publish` | media fetched by Meta from a public `image_url` / `video_url` | `instagram_business_basic` + `instagram_business_content_publish` (Instagram Login), or `instagram_basic` + `instagram_content_publish` + `pages_read_engagement` (Facebook Login) |
|
|
36
|
+
|
|
37
|
+
## Build steps
|
|
38
|
+
|
|
39
|
+
1. **Connect accounts.** Implement the OAuth authorization-code flow per platform with a `state` value checked on return (and PKCE for X). Save tokens, expiry, scopes and the account's ID or URN (`urn:li:person:...` from LinkedIn's OpenID `userinfo` `sub`, `urn:li:organization:...` for pages, the Page ID, the IG user ID).
|
|
40
|
+
2. **Refresh before expiry.** A job refreshes tokens ahead of `expires_at`. When refresh fails (revoked, password changed, scope removed), mark the account `needs_reconnect` and tell the user; do not keep retrying.
|
|
41
|
+
3. **Format per platform** using the rules below. Validate length and media count before queueing, not at publish time.
|
|
42
|
+
4. **Upload media.** X: chunked upload (keep chunks at or under 5 MB), then poll status until `processing_info.state` is `succeeded`. LinkedIn: `initializeUpload`, PUT the file, wait until the image or video is `AVAILABLE`. Instagram: host the file at a public HTTPS URL, create the container, poll `status_code` until `FINISHED` (about once a minute, at most 5 minutes) before `media_publish`.
|
|
43
|
+
5. **Publish** from a worker that picks due rows, claims them with `UPDATE ... SET status='publishing' WHERE id=? AND status='scheduled'`, calls the API, then stores the platform post ID and URL.
|
|
44
|
+
6. **Handle errors** by class: `401` refresh once then mark reconnect; `403` missing scope, role or tier (do not retry); `429` back off using the reset header; `5xx` or timeout check whether the post exists, then retry with backoff. Record the platform's error body.
|
|
45
|
+
7. **Scheduling.** Store `publish_at` in UTC with the user's time zone for display. Native scheduling exists on some platforms (Facebook Pages accept `published=false` with `scheduled_publish_time`, 10 minutes to 30 days ahead), but a single queue of your own keeps behaviour the same everywhere.
|
|
46
|
+
|
|
47
|
+
## Formatting differences
|
|
48
|
+
|
|
49
|
+
| | X | LinkedIn | Facebook Page | Instagram |
|
|
50
|
+
|---|---|---|---|---|
|
|
51
|
+
| Text length | 280 weighted characters (emoji and CJK count as 2); any URL counts as 23 | 3,000 characters | long posts allowed; first lines show before "See more" | caption up to 2,200 characters |
|
|
52
|
+
| Links | inline, shortened by t.co | inline; link preview via article content | link preview from the `link` field | not clickable in captions |
|
|
53
|
+
| Hashtags | 1 or 2 (style choice) | a few at the end (style choice) | sparing | at most 30 per caption |
|
|
54
|
+
| Mentions | `@handle` in text | `@` + `[Name]` + `(urn)` mention syntax in the commentary; name must match | Page tags need IDs | `@handle` in caption, at most 20 |
|
|
55
|
+
| Media | up to 4 media IDs per post | images, video, documents, multi-image | photos, video | required: image, video, reel, or carousel of up to 10 |
|
|
56
|
+
|
|
57
|
+
Confirm current limits in each platform's docs before enforcing them in code.
|
|
58
|
+
|
|
59
|
+
## Stop and ask the user
|
|
60
|
+
|
|
61
|
+
- Which accounts and pages to post as, and who approved posting on their behalf.
|
|
62
|
+
- Before applying for elevated access or a paid API tier.
|
|
63
|
+
- Before posting anything live during development: use a test account, private visibility, or draft state where the platform offers one.
|
|
64
|
+
- Before deleting or editing published posts in bulk.
|
|
65
|
+
|
|
66
|
+
## Never
|
|
67
|
+
|
|
68
|
+
- Post the same text to every network unchanged when it breaks a platform's length or mention rules.
|
|
69
|
+
- Automate likes, follows, replies or DMs at scale; platform rules forbid most of it.
|
|
70
|
+
- Store tokens in the client, or share one token across customers.
|
|
71
|
+
- Retry a publish blindly after a timeout.
|
|
72
|
+
|
|
73
|
+
## Report format
|
|
74
|
+
|
|
75
|
+
When reviewing or finishing an integration, report:
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
Platforms: ... Accounts: member / page / IG professional
|
|
79
|
+
Auth: flow, scopes granted, refresh handled yes|no
|
|
80
|
+
Media: upload path and processing wait per platform
|
|
81
|
+
Queue: idempotent claim yes|no, retry policy, timezone handling
|
|
82
|
+
Gaps: ... (each with the fix)
|
|
83
|
+
Needs user action: app review, tier, page roles
|
|
84
|
+
```
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"should_trigger": [
|
|
3
|
+
"Build a scheduler that posts to our LinkedIn company page and X account from our CMS",
|
|
4
|
+
"LinkedIn rest/posts returns 403 ACCESS_DENIED when I post as our organization",
|
|
5
|
+
"How do I upload a video to X with the v2 media upload endpoints and attach it to a post?",
|
|
6
|
+
"Instagram media_publish fails because the container status is still IN_PROGRESS",
|
|
7
|
+
"Our social posting worker sometimes publishes the same Facebook Page post twice after a timeout",
|
|
8
|
+
"Which OAuth scopes do I need to let users connect their X and LinkedIn accounts for posting?"
|
|
9
|
+
],
|
|
10
|
+
"should_not_trigger": [
|
|
11
|
+
"Turn this 40-minute conference talk into a LinkedIn post, an X thread and a newsletter",
|
|
12
|
+
"Write a voice and tone guide for how our brand sounds on social",
|
|
13
|
+
"Our marketing emails fail DMARC, fix the DNS records",
|
|
14
|
+
"Plan a six-week launch campaign with a budget split across paid social and email",
|
|
15
|
+
"Write a three-touch outbound email sequence to VPs of engineering"
|
|
16
|
+
]
|
|
17
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# Platform API shapes
|
|
2
|
+
|
|
3
|
+
Request shapes for the common publish paths. Check each platform's docs for the current API version, access tier and limits before relying on these.
|
|
4
|
+
|
|
5
|
+
## X (docs.x.com)
|
|
6
|
+
|
|
7
|
+
Auth: OAuth 2.0 authorization code with PKCE, user-context token in `Authorization: Bearer`. `POST /2/tweets` accepts only user-context tokens (OAuth 2.0 user token with `tweet.read`, `users.read`, `tweet.write`, or OAuth 1.0a user token); app-only tokens cannot post. Without `offline.access` the token lasts two hours and no refresh token is issued.
|
|
8
|
+
|
|
9
|
+
Chunked media upload:
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
POST https://api.x.com/2/media/upload/initialize
|
|
13
|
+
{ "media_type": "video/mp4", "total_bytes": 10485760, "media_category": "tweet_video" }
|
|
14
|
+
-> { "data": { "id": "<media_id>", ... } }
|
|
15
|
+
|
|
16
|
+
POST https://api.x.com/2/media/upload/<media_id>/append (multipart: segment_index, media)
|
|
17
|
+
POST https://api.x.com/2/media/upload/<media_id>/finalize
|
|
18
|
+
GET https://api.x.com/2/media/upload?command=STATUS&media_id=<media_id>
|
|
19
|
+
repeat after processing_info.check_after_secs until state is "succeeded"
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
- Do not send `command=INIT|APPEND|FINALIZE` to `POST /2/media/upload`; that is the previous protocol.
|
|
23
|
+
- Keep each chunk at or under 5 MB (the server maximum is 8 MB). `media_category` values include `tweet_image`, `tweet_gif`, `tweet_video`, `amplify_video`, `dm_image`, `dm_gif`, `dm_video`, `subtitles`. Status states are `pending`, `in_progress`, `succeeded`, `failed`. Size and duration limits depend on the user's account type.
|
|
24
|
+
|
|
25
|
+
Create the post:
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
POST https://api.x.com/2/tweets
|
|
29
|
+
{ "text": "Shipping today", "media": { "media_ids": ["<media_id>"] } }
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
`media_ids` takes 1 to 4 IDs.
|
|
33
|
+
|
|
34
|
+
Threads: post the first, then each next post with `"reply": { "in_reply_to_tweet_id": "<previous id>" }`.
|
|
35
|
+
|
|
36
|
+
Access tiers and pricing change; confirm in the developer console which endpoints and volumes the user's plan includes.
|
|
37
|
+
|
|
38
|
+
## LinkedIn (learn.microsoft.com/linkedin)
|
|
39
|
+
|
|
40
|
+
Every versioned call sends `Linkedin-Version: YYYYMM` and `X-Restli-Protocol-Version: 2.0.0`. Versions are released monthly and supported for at least one year before sunset; a sunset or missing version returns an error, so keep the header current.
|
|
41
|
+
|
|
42
|
+
Image:
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
POST https://api.linkedin.com/rest/images?action=initializeUpload
|
|
46
|
+
{ "initializeUploadRequest": { "owner": "urn:li:organization:123" } }
|
|
47
|
+
-> { "value": { "uploadUrl": "https://www.linkedin.com/dms-uploads/...", "image": "urn:li:image:C4E..." } }
|
|
48
|
+
|
|
49
|
+
PUT <uploadUrl> (raw bytes, Authorization header)
|
|
50
|
+
GET https://api.linkedin.com/rest/images/urn:li:image:C4E... until status is AVAILABLE
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Video: `POST /rest/videos?action=initializeUpload` with `owner` and `fileSizeBytes` returns `uploadInstructions` (one upload URL per 4 MB byte range) and an `uploadToken`. PUT each part and keep the `ETag` response header, then `POST /rest/videos?action=finalizeUpload` with `video`, `uploadToken` and `uploadedPartIds` (the ETags, in part order). Poll `GET /rest/videos/{urn}` until status is `AVAILABLE`.
|
|
54
|
+
|
|
55
|
+
Post:
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
POST https://api.linkedin.com/rest/posts
|
|
59
|
+
{
|
|
60
|
+
"author": "urn:li:organization:123",
|
|
61
|
+
"commentary": "Text of the post",
|
|
62
|
+
"visibility": "PUBLIC",
|
|
63
|
+
"distribution": { "feedDistribution": "MAIN_FEED", "targetEntities": [], "thirdPartyDistributionChannels": [] },
|
|
64
|
+
"content": { "media": { "id": "urn:li:image:C4E...", "altText": "Describe the image" } },
|
|
65
|
+
"lifecycleState": "PUBLISHED",
|
|
66
|
+
"isReshareDisabledByAuthor": false
|
|
67
|
+
}
|
|
68
|
+
-> 201, post URN in the x-restli-id response header
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
- Member posts: `w_member_social`, author `urn:li:person:<sub from /v2/userinfo>`.
|
|
72
|
+
- Company posts: `w_organization_social`, and the member must hold the ADMINISTRATOR, CONTENT_ADMIN or DIRECT_SPONSORED_CONTENT_POSTER role on the page.
|
|
73
|
+
- LinkedIn Help gives 3,000 characters as the post limit; the API returns `FIELD_LENGTH_TOO_LONG` when `commentary` is over its maximum. `commentary` uses LinkedIn's "little text" format: escape the reserved characters `| { } @ [ ] ( ) < > # \ * _ ~` with a backslash whenever they are plain text rather than mention or hashtag syntax. Mentions are `@[Name](urn:li:organization:123)`; the name must match the entity's name.
|
|
74
|
+
- `ugcPosts` is legacy (the Posts API replaces it); use `/rest/posts`.
|
|
75
|
+
|
|
76
|
+
## Facebook Page (developers.facebook.com, Graph API)
|
|
77
|
+
|
|
78
|
+
Use a Page access token for a Page the user manages. Facebook Login requests `pages_manage_engagement`, `pages_manage_posts`, `pages_read_engagement` and `pages_read_user_engagement`, plus `publish_video` for video.
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
POST https://graph.facebook.com/<version>/<page-id>/feed
|
|
82
|
+
message=...&link=https://...
|
|
83
|
+
POST https://graph.facebook.com/<version>/<page-id>/photos
|
|
84
|
+
url=https://.../image.jpg&caption=...
|
|
85
|
+
Scheduled: add published=false&scheduled_publish_time=<unix time> (10 minutes to 30 days from the request)
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Pin a Graph API version in the URL (`v<major>.0`) and upgrade before Meta retires it.
|
|
89
|
+
|
|
90
|
+
## Instagram professional account
|
|
91
|
+
|
|
92
|
+
```
|
|
93
|
+
POST https://graph.facebook.com/<version>/<ig-user-id>/media (Facebook Login)
|
|
94
|
+
POST https://graph.instagram.com/<version>/<ig-user-id>/media (Instagram Login)
|
|
95
|
+
image_url=https://public.example.com/a.jpg&caption=...
|
|
96
|
+
or media_type=REELS&video_url=...
|
|
97
|
+
or media_type=CAROUSEL with children=<up to 10 container ids>
|
|
98
|
+
-> { "id": "<container id>" }
|
|
99
|
+
|
|
100
|
+
GET .../<container id>?fields=status_code IN_PROGRESS -> FINISHED (or ERROR; EXPIRED if not published within 24 hours)
|
|
101
|
+
POST .../<ig-user-id>/media_publish creation_id=<container id>
|
|
102
|
+
GET .../<ig-user-id>/content_publishing_limit current usage against the 24-hour cap
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
- Media must be at a publicly reachable HTTPS URL; Meta fetches it.
|
|
106
|
+
- There is a rolling 24-hour cap on API-published posts per account (carousels count as one). Meta's pages have stated different numbers over time; read `content_publishing_limit` instead of hard-coding it.
|
|
107
|
+
- The API requires an Instagram professional (business or creator) account; personal accounts are not supported.
|
|
108
|
+
- Captions: at most 2,200 characters, 30 hashtags and 20 @ tags.
|
|
109
|
+
- Permissions: `instagram_business_basic` and `instagram_business_content_publish` (Instagram Login, `graph.instagram.com`), or `instagram_basic`, `instagram_content_publish` and `pages_read_engagement` (Facebook Login, `graph.facebook.com`).
|
|
110
|
+
|
|
111
|
+
## Sources
|
|
112
|
+
|
|
113
|
+
- X chunked upload: https://docs.x.com/x-api/media/quickstart/media-upload-chunked . Create post: https://docs.x.com/x-api/posts/create-post . Scopes: https://docs.x.com/fundamentals/authentication/oauth-2-0/authorization-code . Character counting: https://docs.x.com/fundamentals/counting-characters
|
|
114
|
+
- LinkedIn Posts API: https://learn.microsoft.com/en-us/linkedin/marketing/community-management/shares/posts-api . little text: https://learn.microsoft.com/en-us/linkedin/marketing/community-management/shares/little-text-format . Videos: https://learn.microsoft.com/en-us/linkedin/marketing/community-management/shares/videos-api . Versioning: https://learn.microsoft.com/en-us/linkedin/marketing/versioning . Post length: https://www.linkedin.com/help/linkedin/answer/a528176
|
|
115
|
+
- Facebook Pages posts: https://developers.facebook.com/docs/pages-api/posts
|
|
116
|
+
- Instagram publishing: https://developers.facebook.com/docs/instagram-platform/content-publishing . Media reference (caption limits): https://developers.facebook.com/docs/instagram-platform/instagram-graph-api/reference/ig-user/media
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: solidity-patterns
|
|
3
|
+
description: Writes Solidity contracts for Ethereum and other EVM chains the safe way, applying checks-effects-interactions ordering, Ownable2Step or AccessControl roles, OpenZeppelin Contracts instead of hand-rolled tokens, a deliberate choice between immutable and UUPS or transparent proxy deployments with ERC-7201 namespaced storage, events for every state change, custom errors and basic gas hygiene, inside a Foundry or Hardhat project with tests. Use when creating or extending a smart contract, adding an ERC-20, ERC-721 or ERC-1155 token, deciding whether a contract should be upgradeable, or setting up a new Foundry or Hardhat workspace.
|
|
4
|
+
license: MIT
|
|
5
|
+
compatibility: Any Agent Skills host. Needs Foundry (forge) or Hardhat with Node.js to compile and test. Examples target Solidity 0.8.x and OpenZeppelin Contracts 5.x.
|
|
6
|
+
metadata:
|
|
7
|
+
kete-loom/version: "0.1.0"
|
|
8
|
+
kete-loom/category: security
|
|
9
|
+
kete-loom/risk: runs-commands
|
|
10
|
+
kete-loom/requires: "forge"
|
|
11
|
+
kete-loom/owner: "Kete-org"
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# Solidity patterns
|
|
15
|
+
|
|
16
|
+
Write contracts that are boring on purpose: audited building blocks, state updated before any external call, every privileged function guarded, every change logged by an event, and tests that try to break it. Deployed code is public and usually permanent, so a bug is a loss, not a ticket. This is engineering guidance, not financial or legal advice.
|
|
17
|
+
|
|
18
|
+
## Ground rules
|
|
19
|
+
|
|
20
|
+
1. **Pin the compiler.** `pragma solidity 0.8.x;` with an exact version in `foundry.toml` (`solc_version`) or `hardhat.config` (`solidity.version`). 0.8 reverts on overflow by default; `unchecked { }` only where you proved the bound in a comment.
|
|
21
|
+
2. **Use OpenZeppelin Contracts** (`@openzeppelin/contracts`, or `@openzeppelin/contracts-upgradeable` for proxies) for tokens, access control, `ReentrancyGuard`, `SafeERC20`, `ECDSA`, `EIP712`. Never copy-paste or re-implement an ERC standard. Pin the library version.
|
|
22
|
+
3. **Checks-effects-interactions.** Validate inputs (checks), write storage (effects), then call other contracts or send ETH (interactions). Add `nonReentrant` on functions that make external calls and touch balances anyway.
|
|
23
|
+
4. **Guard every privileged function** (`mint`, `pause`, `setFee`, `withdraw`, `upgradeTo...`, initializers). Default to `Ownable2Step` for a single admin or `AccessControl` for several roles; the owner should be a multisig or timelock in production, not a laptop key.
|
|
24
|
+
5. **Events for every state change** an off-chain system or user cares about: transfers, role grants, parameter changes, upgrades, pauses. Index the fields people filter on (addresses, IDs), at most three indexed.
|
|
25
|
+
6. **Custom errors** (`error InsufficientBalance(uint256 have, uint256 want);` with `revert InsufficientBalance(...)`) instead of revert strings.
|
|
26
|
+
7. **Pull over push** for payouts: record what each address is owed and let it `withdraw()`; never loop over an unbounded array sending ETH.
|
|
27
|
+
8. **No `tx.origin` for auth**, no `block.timestamp` or `blockhash` as randomness, no `selfdestruct`, no `delegatecall` to an address a user can influence.
|
|
28
|
+
|
|
29
|
+
## Project layout
|
|
30
|
+
|
|
31
|
+
Foundry (preferred for new work): `forge init`, then
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
src/ contracts
|
|
35
|
+
test/ *.t.sol tests (forge-std Test), fuzz and invariant tests
|
|
36
|
+
script/ *.s.sol deploy scripts (forge script)
|
|
37
|
+
lib/ dependencies (forge install OpenZeppelin/openzeppelin-contracts)
|
|
38
|
+
foundry.toml solc_version, optimizer, remappings, [fuzz] runs
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Hardhat: `contracts/`, `test/`, `ignition/modules/` or `scripts/`, `hardhat.config.ts`, dependencies from npm. Follow whichever the repo already uses; don't mix both without reason.
|
|
42
|
+
|
|
43
|
+
Keys and RPC URLs come from environment variables or an encrypted keystore (`cast wallet import`), never from committed files.
|
|
44
|
+
|
|
45
|
+
## Steps for a new or changed contract
|
|
46
|
+
|
|
47
|
+
1. **Write the spec first** in the contract's NatSpec: who can call each external function, what invariants must hold (for example "sum of balances == totalSupply", "only owner can mint"), and what happens on failure.
|
|
48
|
+
2. **Pick the building block.** Token: inherit `ERC20`, `ERC721` or `ERC1155` and add only what's needed (`ERC20Permit`, `ERC20Votes`, `Pausable`). Do not override `transfer` or `_update` hooks unless the spec needs it, and then call `super`.
|
|
49
|
+
3. **Decide on upgradeability** using the table below. Write the answer and the reason at the top of the contract.
|
|
50
|
+
4. **Write the contract** following the ground rules. Mark functions `external` when not called internally, state `immutable` or `constant` where possible, and visibility on everything.
|
|
51
|
+
5. **Handle tokens defensively.** Use `SafeERC20` (`safeTransfer`, `safeTransferFrom`, `forceApprove`) for arbitrary ERC-20s. For deposits, measure the balance before and after if fee-on-transfer tokens are possible, or document that they're unsupported.
|
|
52
|
+
6. **Test**: unit tests for each function and each revert, a test per access-controlled function proving a stranger is rejected, fuzz tests on amount inputs, and invariant tests for the spec's invariants (`forge test`, `[invariant]` in `foundry.toml`). Fork tests (`--fork-url`) when integrating live protocols.
|
|
53
|
+
7. **Static analysis**: run `slither .` and fix or justify every finding. For the full audit procedure use the `smart-contract-security` skill.
|
|
54
|
+
8. **Deploy** to a local node (`anvil`) and a testnet first with the same script you'll use on mainnet; verify the source on the block explorer.
|
|
55
|
+
|
|
56
|
+
## Upgradeability: decide deliberately
|
|
57
|
+
|
|
58
|
+
| Option | Choose when | Costs |
|
|
59
|
+
|---|---|---|
|
|
60
|
+
| Immutable contract | Logic is small, well tested, and trust minimisation matters | Bugs need a migration to a new address |
|
|
61
|
+
| UUPS proxy (`UUPSUpgradeable`) | You need upgrades and want them cheap; upgrade logic lives in the implementation | Forgetting `_authorizeUpgrade` access control, or shipping an implementation without it, can brick or hand over the proxy |
|
|
62
|
+
| Transparent proxy (`TransparentUpgradeableProxy`) | You want the admin path separated from user calls | Extra deploy cost; in OZ 5.x the proxy deploys its own `ProxyAdmin` owned by `initialOwner` |
|
|
63
|
+
|
|
64
|
+
Rules for any proxy:
|
|
65
|
+
|
|
66
|
+
- No constructor logic; use an `initialize` function with the `initializer` modifier, call every parent `__X_init`, and call `_disableInitializers()` in the implementation's constructor.
|
|
67
|
+
- Use ERC-7201 namespaced storage (the OZ 5.x upgradeable contracts do) or append-only layouts; never reorder, remove or change the type of an existing state variable.
|
|
68
|
+
- Check every upgrade with the OpenZeppelin Upgrades plugin (`@openzeppelin/hardhat-upgrades` or `openzeppelin-foundry-upgrades`) before deploying it.
|
|
69
|
+
- Put upgrades behind a multisig and, where users hold funds, a timelock so they can exit.
|
|
70
|
+
|
|
71
|
+
## Gas basics (after correctness)
|
|
72
|
+
|
|
73
|
+
- Cache storage reads in memory inside loops; pack small types that are read together into one slot.
|
|
74
|
+
- `calldata` instead of `memory` for read-only external array and struct arguments.
|
|
75
|
+
- `immutable`/`constant` for values fixed at deploy.
|
|
76
|
+
- Avoid unbounded loops over user-growable arrays; they become a denial of service once gas exceeds the block limit.
|
|
77
|
+
- Measure with `forge test --gas-report` or `forge snapshot` before and after; never trade a safety check for gas.
|
|
78
|
+
|
|
79
|
+
## Stop and ask the user
|
|
80
|
+
|
|
81
|
+
- Before deploying or broadcasting anything to a mainnet, or to any network with real funds; confirm the network, chain ID and deployer address.
|
|
82
|
+
- Who should own admin roles in production (EOA, multisig, timelock, or renounced).
|
|
83
|
+
- Whether the contract should be upgradeable at all, when the spec doesn't say.
|
|
84
|
+
- Before writing token economics, fees or anything that holds user funds and will launch without a professional audit; recommend one.
|
|
85
|
+
|
|
86
|
+
## Never
|
|
87
|
+
|
|
88
|
+
- Never put private keys, mnemonics or RPC keys in source, tests or scripts.
|
|
89
|
+
- Never write a custom ERC-20/721 from scratch, a custom signature scheme, or inline assembly to save gas without a written reason and tests.
|
|
90
|
+
- Never leave an initializer unprotected or an implementation contract uninitialized.
|
|
91
|
+
- Never claim a contract is secure; say what was tested and what wasn't.
|
|
92
|
+
|
|
93
|
+
## Before you finish
|
|
94
|
+
|
|
95
|
+
Report: compiler version, libraries and versions, upgradeability choice and why, roles and who holds them, events emitted, test and fuzz results (`forge test` output summary), Slither results, and what still needs an external audit.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"should_trigger": [
|
|
3
|
+
"Write an ERC-20 token contract with a capped supply and an owner-only mint using Foundry",
|
|
4
|
+
"Should our staking vault contract be upgradeable with UUPS or deployed immutable?",
|
|
5
|
+
"Set up a new Foundry project with OpenZeppelin and a basic NFT contract",
|
|
6
|
+
"Add a withdraw function to my Solidity escrow contract that follows checks-effects-interactions",
|
|
7
|
+
"Refactor this Solidity contract to use custom errors and emit events when the fee changes"
|
|
8
|
+
],
|
|
9
|
+
"should_not_trigger": [
|
|
10
|
+
"Audit our lending protocol contracts for oracle manipulation and reentrancy before launch",
|
|
11
|
+
"Connect MetaMask to our React app with viem and show the user's USDC balance",
|
|
12
|
+
"Review the Solidity diff in this PR for missing access control and storage collisions",
|
|
13
|
+
"Integrate Stripe subscriptions into the billing page",
|
|
14
|
+
"Write a Rust program that parses a CSV of transactions"
|
|
15
|
+
]
|
|
16
|
+
}
|