Логотип Cairo Contract Authoring

Cairo Contract Authoring

Організація
keep-starknet-strange
cairo-contract-authoring

Написання смартконтрактів на Cairo для Starknet. Активується за запитами «написати контракт», «створити контракт», «реалізувати це на Cairo», «додати сховище/події/інтерфейс», «скомпонувати компоненти». Допомагає зі структурою, практиками безпеки та з’єднанням компонентів.

Add to TypingMind

Огляд

Видавецьkeep-starknet-strange
Репозиторійstarknet-agentic
Назва навичкиcairo-contract-authoring
Зірки
81
Форки
26
Файли в пакеті
6
ЛіцензіяApache-2.0
Посилання
  • Інструкції у форматі Markdown

    Файл SKILL.md, який модель завантажує за потреби, тож токени витрачаються лише тоді, коли запит справді відповідає навичці.

  • Працює з будь-якою LLM

    Навички ШІ — це звичайний Markdown, а не код для певного постачальника, тому вони працюють із GPT, Claude, Gemini, Grok або локальною моделлю.

  • Файлів у комплекті: 6

    Скрипти, шаблони й довідкові матеріали, які модель може читати під час роботи. Файли доступні лише для читання й ніколи не виконуються.

  • Відкритий вихідний код

    Видавець на GitHub: keep-starknet-strange. Перед установленням перегляньте вихідні файли навички.

Встановлення

Установіть навичку ШІ Cairo Contract Authoring у TypingMind, щоб використовувати її з будь-якою LLM, або додайте її до іншого агента, що читає SKILL.md.

1

Встановити в TypingMind

TypingMind встановлює навичку безпосередньо з її папки на GitHub — читає SKILL.md, збирає файли ресурсів у пакет і зберігає результат локально.

  1. Відкрийте застосунок і перейдіть до розділу «Плагіни» → «Навички».
  2. Виберіть «Встановити з GitHub».
  3. Вставте наведений нижче URL папки навички та підтвердьте встановлення.
    https://github.com/keep-starknet-strange/starknet-agentic/tree/main/skills/cairo-contract-authoring
  4. Увімкніть навичку в кожному чаті, де хочете її використовувати.
Плагіни → Навички → Додати навичку → За URL GitHub, потім вставте URL папки й натисніть «Продовжити».
2

Встановити в іншому агенті

Будь-який агент, що підтримує формат Agent Skills, може використовувати цю навичку — скопіюйте папку до каталогу навичок цього агента.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/keep-starknet-strange/starknet-agentic.git /tmp/starknet-agentic
mkdir -p .claude/skills
cp -r /tmp/starknet-agentic/skills/cairo-contract-authoring .claude/skills/cairo-contract-authoring
Після копіювання перезапустіть Claude Code, щоб завантажити нову навичку.

Використовуйте навичку в TypingMind

Увімкніть навичку Cairo Contract Authoring в будь-якому чаті TypingMind, і далі модель усе зробить сама. Назва й опис навички містяться в системному промпті, а щойно надходить відповідний запит, модель самостійно завантажує повні інструкції — вам не потрібно викликати навичку вручну, і до фактичного використання вона не витрачає токенів.

Модель самостійно завантажує навичку Cairo Contract Authoring, щойно надходить відповідний запит.

Працює з будь-якою моделлю ШІ

Навички ШІ — це звичайні інструкції у форматі Markdown, а не код для певного постачальника, тому навичка Cairo Contract Authoring не прив’язана до моделі, для якої її створено. Установіть її один раз у TypingMind і використовуйте з GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama або локальною моделлю, яку ви запускаєте самостійно, — усе з вашими власними ключами API.

  • Завантажується лише за потреби

    Системний промпт містить лише назву й опис. Інструкції завантажуються за першого відповідного запиту, тож поки навичка не потрібна, токени на її інструкції не витрачаються.

  • Змінюйте моделі під час чату

    Оскільки навичка — це інструкції, а не код, зміна моделі не порушує її роботу: наступна модель читає той самий файл SKILL.md.

Інструкції навички

Це вміст файлу SKILL.md, який завантажує модель. Прочитайте його перед установленням — навичка містить інструкції, яких дотримуватиметься ваша модель.

Cairo/Starknet Contract Authoring

You are a Cairo contract authoring assistant. Your job is to understand what the user wants to build, load the right references, implement correct and secure code, verify it compiles, and hand off to testing/auditing.

When to Use

  • Writing a new Starknet contract from scratch.
  • Modifying storage, events, or interfaces on an existing contract.
  • Composing OpenZeppelin Cairo components (Ownable, ERC20, ERC721, AccessControl, Upgradeable).
  • Implementing the component pattern with embeddable_as.
  • Structuring a multi-contract Scarb project.

When NOT to Use

  • Gas/performance tuning (cairo-optimization).
  • Test strategy design (cairo-testing).
  • Deployment and release operations (cairo-deploy).
  • Security audit of existing code (cairo-auditor).

Quick Start

  1. Classify mode: new, modify, or component.
  2. Load references based on request type — see the table in Orchestration.
  3. Output a plan (interface, storage, components, events, security posture) and wait for confirmation.
  4. Implement following the mandatory security rules, then run scarb build.
  5. Verify every external function's access posture.
  6. Emit a handoff block using ../references/skill-handoff.md (authoring → testing by default, or authoring → auditor for review-first requests), then run the next skill.

Rationalizations to Reject

  • "We can add access control later."
  • "This is an internal function, so it doesn't need validation."
  • "Zero address will never be passed in practice."
  • "We'll add tests after the feature is complete."

Mode Selection

  • new: User wants a new contract from scratch. Full scaffold.
  • modify: User wants to change an existing contract. Read first, then modify.
  • component: User wants to wire or create an OpenZeppelin component.

Orchestration

Turn 1 — Understand. Classify the request:

(a) Determine mode: new, modify, or component.

(b) If modify or component mode, read the existing contract files to understand current structure. Use Glob to find .cairo files, then Read to inspect them.

(c) Identify which references are needed based on the request:

Request involvesLoad reference
Language syntax, types, ownership{skill_dir}/references/language.md
Contract structure, storage, events, interfaces{skill_dir}/references/legacy-full.md
OpenZeppelin components, Ownable, ERC20, upgrades{skill_dir}/references/legacy-full.md (Components section)
Security patterns, auth, timelocks, upgrades{skill_dir}/references/anti-pattern-pairs.md

Where {skill_dir} is the directory containing this SKILL.md. Resolve it from the currently loaded SKILL path (preferred), then use references/... relative paths from that directory.

Turn 2 — Plan. Before writing any code, output a brief plan:

  1. Interface — list the trait functions (name, params, return type, view vs external).
  2. Storage — list storage fields and their types.
  3. Components — list OpenZeppelin components to embed (if any).
  4. Events — list events to emit.
  5. Security posture — for each external function, state: guarded (owner/role) or public (reason).

Keep the plan under 30 lines. Wait for user confirmation before implementing.

Turn 3 — Implement. Write the code following these rules:

Structure rules:

  • Define interfaces outside the contract module with #[starknet::interface].
  • Use @TContractState for view functions, ref self: TContractState for external mutations.
  • Follow the project structure: src/lib.cairo (mod declarations), src/contract.cairo, src/interfaces.cairo.

Security rules (mandatory):

  • Every storage-mutating #[abi(embed_v0)] impl function or #[external(v0)] function MUST have explicit access posture: guarded (assert_only_owner / role check) or intentionally public with a comment stating why.
  • Constructor MUST validate critical addresses are non-zero: assert!(!owner.is_zero(), "owner_zero").
  • Upgrade flows MUST reject zero class hash: for felt252 APIs use assert!(new_class_hash != 0, "class_hash_zero"); for typed ClassHash APIs use assert!(!new_class_hash.is_zero(), "class_hash_zero") before executing upgrade state changes.
  • Timelock checks MUST read time from get_block_timestamp(), never from caller arguments.
  • Use anti-pattern/secure-pattern pairs from references/anti-pattern-pairs.md — never write the anti-pattern.

Component wiring (when using OZ components):

  • Follow the component wiring checklist in references/legacy-full.md (Components section) and workflows/default.md.
  • Keep router output concise: enforce the checklist, but avoid reprinting full wiring scaffolds in this SKILL file.

After writing the code, run scarb build to verify compilation. If it fails, fix the errors and rebuild.

Turn 4 — Verify. After the code compiles:

(a) Re-check every external function against the security rules above. For each one, mentally trace: who can call it? what state does it mutate? is it guarded?

(b) If the user's project has existing tests, run snforge test to check for regressions.

(c) Suggest the next steps:

  • "Run cairo-testing to add unit and fuzz tests."
  • "Run cairo-auditor for a security review before merging."

Security-Critical Rules

These are non-negotiable. Every contract you write must satisfy all of them:

  1. Timelock checks read time from Starknet syscalls (get_block_timestamp), never from caller arguments.
  2. Every storage-mutating external function has explicit access posture: guarded or documented-public.
  3. Upgrade flows reject zero class hash inputs before applying state transitions.
  4. Constructor validates all critical addresses (owner, admin, governor) are non-zero.
  5. Anti-pattern/secure-pattern pairs are enforced — never emit an anti-pattern.

Error Codes

CodeConditionRecovery
AUTH-001scarb build fails due to missing component importsVerify Scarb.toml dependencies and embed the matching OpenZeppelin component impls.
AUTH-002Guard helper missing (assert_only_owner/assert_only_role)Wire OwnableComponent or AccessControlComponent internal impls, then rebuild.
AUTH-003Constructor allows critical zero addressAdd non-zero assertions and write regression tests for zero-address rejection.
AUTH-004Timelock or upgrade path uses unsafe inputsReplace caller-provided time with get_block_timestamp(), reject zero class hash, rerun cairo-auditor.

References

Workflow

Eval Gate

When security rules in this skill or its references change, update at least one case in:

  • evals/cases/contract_skill_benchmark.jsonl
  • evals/cases/contract_skill_generation_eval.jsonl

Файли в пакеті

Модель читає ці файли за потреби, поки навичку завантажено. Вони доступні для читання й ніколи не виконуються.

Поширені запитання

Що робить навичка ШІ Cairo Contract Authoring?

Написання смартконтрактів на Cairo для Starknet. Активується за запитами «написати контракт», «створити контракт», «реалізувати це на Cairo», «додати сховище/події/інтерфейс», «скомпонувати компоненти». Допомагає зі структурою, практиками безпеки та з’єднанням компонентів.

Навіщо використовувати Cairo Contract Authoring у TypingMind?

Тому що ви встановлюєте її один раз і використовуєте з будь-якою моделлю. Cairo Contract Authoring — це звичайний Markdown, а не код для конкретного постачальника, тому та сама навичка працює з GPT-5, Claude, Gemini, Grok або локальною моделлю. Ви можете змінити модель навіть посеред чату, і навичка продовжить працювати. TypingMind використовує ваші власні ключі API, тож ви платите безпосередньо постачальникам замість передплати за кожне місце користувача, а ваші навички й чати залишаються у вашому сховищі.

Як встановити Cairo Contract Authoring у TypingMind?

Відкрийте в TypingMind Плагіни → Навички → Встановити з GitHub і вставте https://github.com/keep-starknet-strange/starknet-agentic/tree/main/skills/cairo-contract-authoring. TypingMind прочитає файл SKILL.md, додасть супровідні файли та встановить навичку, яку можна вмикати окремо для кожного чату.

Які моделі ШІ можуть використовувати Cairo Contract Authoring?

Будь-яка модель, яку ви підключите в TypingMind. Навички ШІ — це звичайні інструкції у форматі Markdown, а не код для конкретного постачальника, тому GPT, Claude, Gemini, Grok і локальні моделі можуть завантажувати цю навичку, коли запит їй відповідає.

Зі скількома моделями ШІ можна використовувати Cairo Contract Authoring?

Зі скількома забажаєте. У TypingMind ви можете використовувати Cairo Contract Authoring із будь-якою моделлю, яка підтримує навички, зокрема з GPT, Claude, Gemini, Grok, DeepSeek, Mistral чи Llama. Для цього ви використовуєте власні ключі API.

Чи безкоштовна навичка ШІ Cairo Contract Authoring?

Так. На GitHub цю навичку публікує keep-starknet-strange за ліцензією Apache-2.0. Ви платите лише своєму постачальнику ШІ за використані токени.

Що таке навички ШІ?

Навичка ШІ — це набір інструкцій для повторного використання, який навчає модель ШІ виконувати одне конкретне завдання. Він відповідає відкритому формату Agent Skills: файл SKILL.md із назвою та описом, а також скрипти, шаблони чи довідкові файли, які можуть знадобитися моделі. Модель читає інструкції лише тоді, коли ваш запит відповідає навичці, тому встановлена навичка нічого не коштує, доки її не використано.

Чим навички ШІ відрізняються від плагінів або серверів MCP?

Плагін або сервер MCP надає моделі нові інструменти, які вона може викликати, — код, який десь виконується й повертає результат. Натомість навичка ШІ дає моделі знання й пояснює порядок дій: як підійти до завдання, яких кроків дотримуватися та яким має бути якісний результат. Навички — це звичайний Markdown, тож їм не потрібні ні сервер, ні ключ API, ні середовище виконання, і вони працюють із будь-якою моделлю.

Усі

Створіть власний робочий простір зі ШІ вже зараз

Підпишіться на нашу розсилку, щоб дізнаватися про нові функції та майбутні розіграші 👇