Zero Labs
Industry News / AI

Your Cortex Code Desktop Agent Is Generic Until You Teach It Your Stack

Source · Towards AI By Satish Kumar

From the publisher’s feed, collected in the ZeroLabs newsroom.

Article 4 of 8: Plugins, Skills, and Hooks — The Extensibility Layer Most Teams IgnoreOut of the box, Cortex Code Desktop’s agent knows how to write code, run SQL, and navigate a filesystem. What it doesn’t know is that your team deploys via a specific dbt command sequence, that your production tables should never be modified directly by agent sessions, or that your naming conventions follow a pattern that three of your models already violate.That knowledge lives in your team’s heads, in runbooks nobody reads, and in code reviews that catch the same mistakes every sprint.Skills, hooks, and plugins are the mechanism for encoding that knowledge into the agent’s behavior — permanently, shareably, and without relying on everyone remembering to prompt correctly every time.This is the extensibility layer most teams leave unconfigured through their entire Cortex Code Desktop trial. The built-in capabilities are impressive enough that skipping customization doesn’t feel like a mistake immediately. It starts feeling like one when the same agent behavior that worked well in a sandbox starts making contextually wrong decisions in a production codebase — because the agent had no way to know what “production” means to your team.What this doesn’t cover: MCP server integration, which connects Cortex Code Desktop to external tools and services and is covered separately in Article 5.Before You StartPrerequisites for everything in this article:Cortex Code Desktop installed and signed in to your Snowflake accountA workspace (folder) open — skills and hooks are scoped to workspacesFor stage-based sharing: read access on the target Snowflake stage (write access to publish)For GitHub-sourced plugins: network access to the Git hostTL;DRSkills are markdown files that teach the agent reusable workflows and conventions. They’re invoked via slash commands in chat or auto-triggered when a prompt matches the skill’s description.Hooks are shell scripts (or JSON-returning commands) that run automatically at defined points in agent execution. They can block tool calls, inject context, auto-approve safe operations, or integrate with external systems.Plugins are the distribution format — a folder that bundles skills, hooks, MCP servers, and subagents into one installable package, shareable via GitHub or a Snowflake stage.All three are scoped per workspace — a skill or hook in a project folder applies only when that project is open, which is exactly what most teams want.What this doesn’t cover: MCP servers (Article 5) and org-wide distribution patterns for very large organizations.The Three PrimitivesBefore going into each one separately, it helps to understand how they relate to each other.A skill is a markdown file that defines a workflow. It tells the agent: when this kind of task comes up, follow these steps. Skills are invoked explicitly via slash commands or triggered automatically when the agent determines a prompt matches the skill’s description. They’re the closest thing Cortex Code Desktop has to a macro system — reusable, reviewable, version-controllable.A hook is a shell script attached to an event in the agent lifecycle. It can observe what the agent is about to do, modify the inputs, block the operation, or inject additional context into the conversation. Hooks are the enforcement layer — they’re how you encode rules the agent must follow regardless of what’s in the prompt.A plugin is the packaging format. It’s a folder with a manifest file (.cortex-plugin/plugin.json) that can contain any combination of skills, hooks, MCP server configurations, and subagent definitions. Installing a plugin is how you distribute a set of team-specific agent behaviors as a single unit rather than asking everyone to manually copy files around.Skills: Teaching the Agent Your WorkflowThe minimal structure for a skill is a folder containing a SKILL.md file. Everything else — helper scripts, reference documents, supplementary markdown — is optional.The SKILL.md file starts with YAML frontmatter:---name: deploy-dbtdescription: > Use this when the user asks to deploy, run, or refresh the dbt project in any environment. Runs the full dbt deployment sequence — deps, seed, compile, run, and test — in the correct order with the right flags for the active environment.---Below is the plain markdown: the instructions the agent reads and follows when the skill is invoked. These can be as simple or as detailed as the workflow requires — step-by-step commands, conditional logic based on what the agent observes, links to internal documentation, caveats about known edge cases.The description field is the routing mechanism. The agent uses it to decide when to auto-invoke the skill — so write it as a routing hint, not a summary. “Runs the dbt deployment sequence” is a description. “Use this when the user asks to deploy, run, or refresh the dbt project in any environment” is a routing hint. The second version is what makes auto-invocation reliable.Skills live in scoped locations:Project skills go in .cortex/skills/ (or .claude/skills/) inside your workspace — they're committed alongside your code and apply only when that project is open.User skills go in ~/.snowflake/cortex/skills/ and apply globally across all your sessions.Teams share skills either via a plugin (GitHub or Snowflake stage) or by committing them to the project repo directly.Invoking a skill explicitly: type / in the chat input and pick the skill from the picker, or reference it by name ("use the deploy-dbt skill to deploy").A skill the agent uses reliably takes maybe thirty minutes to write. The payoff is that the same thirty minutes compounds across every team member who installs it and every session that would have required re-explaining the workflow.Hooks: Enforcing What the Agent Can DoSkills shape what the agent does. Hooks enforce what it’s allowed to do.Every hook is attached to an event in the agent lifecycle. The most commonly useful events for data engineering teams:PreToolUse fires before any tool is executed and can block the call. This is where you put rules like “never modify files in the production directory” or “always confirm before running a DROP statement.”PermissionRequest fires when a permission dialog is about to appear. A hook here can auto-approve safe read-only operations (so agents don’t stall asking for permission to run git log) and require explicit confirmation for anything destructive.SessionStart fires when a new chat session is created. Use it to inject project-specific context — the tech stack, naming conventions, which warehouse to use, which schemas are production versus dev.The hook execution model: when an event fires, Cortex Code Desktop runs your shell command and pipes the full execution context to stdin as JSON. Your script reads it, makes a decision, and communicates back via exit code AND structured JSON output on stdout.Exit code 0 means proceed normally. Exit code 2 blocks the operation. The JSON-based response gives you finer control:// Block with reason{"decision": "block", "reason": "Cannot modify production files"}// Allow with system message{"decision": "allow", "systemMessage": "Validated by policy hook"}// Allow with modified tool input{ "hookSpecificOutput": { "hookEventName": "PreToolUse", "updatedInput": {"command": "ls -la --color=never"} }}Here’s a minimal PreToolUse hook that blocks write operations against production paths:#!/bin/bashINPUT=$(cat)FILE=$(echo "$INPUT" | jq -r '.tool_input.file_path // empty')if [[ "$FILE" == */production/* ]]; then echo '{"decision": "block", "reason": "Cannot modify files in production directory"}' exit 2fiAnd a SessionStart hook that injects context every time a new session opens:#!/bin/bashcat { "systemMessage": "This project uses dbt Core 1.8, Snowflake as the target warehouse, and follows the medallion architecture (bronze/silver/gold). Never query raw tables directly — always go through the staging layer."}EOFHooks are also available as prompt hooks — natural language instructions evaluated by the LLM rather than shell scripts. Use command hooks for deterministic enforcement; use prompt hooks for softer guidance.Hooks are configured in settings files at either the project scope (.cortex/settings.json) or the user scope (~/.snowflake/cortex/hooks.json). Project hooks fire before user hooks. For production-critical rules, use project scope so they can be version-controlled alongside the code they protect.Configuration format in .cortex/settings.json:{ "hooks": { "PreToolUse": [ { "matcher": "Bash|Write|Edit", "hooks": [ { "type": "command", "command": "bash .cortex/hooks/validate-writes.sh", "timeout": 60 } ] } ] }}Key Lessons / What I’d Do DifferentlyThe surprise: The description field in a skill’s YAML frontmatter has a larger effect on agent behavior than most users expect. A vague description means the agent rarely auto-invokes the skill and requires explicit slash-command calls every time. A precise routing description — one that describes both what the skill does AND the specific situations where it should be used — results in the agent reaching for the skill automatically, which is the experience that makes the investment worth it.The limitation: Hooks fire on a per-tool-call basis, not on the content of what the tool does. A hook can block a write to a production path, but it can’t evaluate whether the SQL the agent is about to run is logically sound. Hooks are enforcement primitives, not semantic validators. Combine them with Plan Mode review for tasks where the logic matters as much as the permissions.The practical recommendation: Start with a single SessionStart hook that injects project context — tech stack, naming conventions, key constraints. The return on thirty minutes of writing is immediate and visible: the agent’s first message in every new session reflects awareness of your environment rather than treating it as a generic codebase. Add skills from there, starting with the workflow your team repeats most often.Plugins: Distributing Team Behaviors as a PackageA plugin is just a folder. The minimum structure is a .cortex-plugin/plugin.json manifest plus whatever skills, hooks, MCP configurations, and subagents you want to bundle:my-team-plugin/├── .cortex-plugin/│ └── plugin.json├── skills/│ ├── deploy-dbt/│ │ └── SKILL.md│ └── validate-schema/│ └── SKILL.md├── agents/│ └── schema-reviewer.md├── .hooks.json└── .mcp.jsonThe manifest declares what’s in the package:{ "name": "my-team-plugin", "version": "1.0.0", "description": "Team conventions and deployment workflows for the analytics platform", "skills": ["skills"], "hooks": {}, "mcpServers": {}}Note: The "skills" field is a path (or array of paths) to directories containing skill subfolders. It defaults to "skills/" if omitted.Installing a plugin is done from the Agent Settings panel > Plugins tab. You can add a local folder (registered by reference — no files copied), or pull from a GitHub repository by providing owner/repo (optionally with a branch and subpath). GitHub-sourced plugins support a sync action that re-clones the latest version and performs an atomic swap of the install directory.Snowflake stage distribution is the option most enterprise teams should consider. Publish skills to a Snowflake stage and teammates install from there:-- Publish a skill to a shared stage-- (done via Cortex Code Desktop UI: select skill > Publish to stage)-- Destination: @SHARED.SKILLS.TEAM_LIBRARY/deploy-dbt/-- Teammates add from the same stage path in their Agent Settings panel-- Add from Snowflake > @SHARED.SKILLS.TEAM_LIBRARY/-- Control access with standard Snowflake grants:GRANT READ ON STAGE SHARED.SKILLS.TEAM_LIBRARY TO ROLE DATA_ENGINEERING;GRANT WRITE ON STAGE SHARED.SKILLS.TEAM_LIBRARY TO ROLE SKILL_MAINTAINERS;Access control becomes a Snowflake RBAC problem, which is already solved in most organizations. Updating the stage updates the skill for everyone who syncs.Plugin storage locations:Bundled: shipped with the app (read-only, opt-in)User: ~/.snowflake/cortex/plugins/ (available across all workspaces)Project: .cortex/plugins/ in your project root (workspace-scoped, shareable via version control)One important caveat: plugins are not cryptographically signed or verified by Snowflake. Treat each plugin source like running code from that author. Review the manifest, the skills it bundles, the hooks it registers, and the MCP servers it declares before installing anything from an external source.Putting It Together: A Team Skill SetThe practical starting point for a data engineering team is three skills and two hooks:Skills:A deployment skill that encodes the full dbt run sequence with correct flags per environment.A schema validation skill that runs a standard set of checks before any structural change.An onboarding walkthrough skill that introduces a new team member to the codebase conventions.Hooks:A PreToolUse hook that blocks writes to production-designated paths.A SessionStart hook that injects the project’s tech stack, naming conventions, and environment-specific notes at the start of every session.Here’s what that looks like as a project directory:my-project/├── .cortex/│ ├── settings.json (hook configuration)│ ├── skills/│ │ ├── deploy-dbt/│ │ │ └── SKILL.md│ │ ├── validate-schema/│ │ │ └── SKILL.md│ │ └── onboarding/│ │ └── SKILL.md│ └── hooks/│ ├── block-production-writes.sh│ └── inject-project-context.sh├── models/├── dbt_project.yml└── ...Commit these to .cortex/ in your project root. From that point, every team member who opens the project in Cortex Code Desktop gets the same agent behaviors — without any manual setup, without any extra prompting, and without relying on anyone remembering to configure their environment correctly.SummarySkills, hooks, and plugins are the mechanism for moving Cortex Code Desktop from a generic coding assistant to a tool that reflects your team’s specific practices, constraints, and knowledge.Skills encode reusable workflows as invocable markdown instructions. Hooks enforce rules at the tool-call level — blocking what shouldn’t happen, injecting context that should always be present. Plugins bundle both (along with subagents and MCP configurations) into a distributable package you can share via GitHub or Snowflake stage.The configuration investment is low; the compounding return across sessions and team members is not.Next Article 5 covers MCP integration — connecting Cortex Code Desktop to external tools like GitHub, Jira, and internal APIs so the agent can act across your full toolchain, not just the local workspace.👏 Found this useful? Give it a clap! 🚀 Share it with your data engineering network ❄️ Follow for more Snowflake tips, releases, and hands-on guidesMedium: @SnowflakeChronicles · LinkedIn: satishkumar-snowflakeSee you in the next one!This article represents the author’s personal views and experience, not those of any employer.Your Cortex Code Desktop Agent Is Generic Until You Teach It Your Stack was originally published in Towards AI on Medium, where people are continuing the conversation by highlighting and responding to this story.