[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6KVWVDG12ZZRW77999X07VG":3,"skill-same:01M6KVWVDG12ZZRW77999X07VG":67},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":39,"linkOnly":40,"markdownContent":41,"markdownBody":42,"frontMatter":43,"refName":44,"commitSha":45,"skillDirectory":46,"forksCount":47,"repositoryHtmlUrl":48,"repositoryHomepageUrl":49,"ownerHtmlUrl":50,"ownerBlogUrl":51,"ownerDescription":6,"updatedAt":52,"install":53,"resources":66},"01M6KVWVDG12ZZRW77999X07VG","claude-sdk-system-prompt",null,"System prompts in the Claude Agent SDK — string vs file vs preset, the claude_code preset and its append field, dynamic prompts via per-turn rebuilding, and how setting_sources composes user\u002Fproject\u002Flocal instructions. Read when designing the agent's voice and operating principles, when migrating an existing prompt into the SDK shape, or when choosing between a static and a dynamic prompt.","Folken2\u002Fnuvel","Folken2","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F175213316?v=4","01M6KVPA04RKNPCC04H2G96FAS","Albert Folch","01M6KVPA43VNTA4PXSEB1TCD81",2,"MIT","https:\u002F\u002Fgithub.com\u002FFolken2\u002Fnuvel\u002Fblob\u002Fmain\u002Fnuvel\u002Fbackends\u002Fclaude_agent_sdk\u002Fskills\u002Fclaude-sdk-system-prompt\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],"claude sdk system prompt","system prompt","system","prompt","sdk","local","static","Existing","sources","agent sdk","STRING","operating","project","claude agent sdk","append","read","how","file","code","preset","2026-11-10 10:12:30",false,"---\nname: claude-sdk-system-prompt\ndescription: System prompts in the Claude Agent SDK — string vs file vs preset, the claude_code preset and its append field, dynamic prompts via per-turn rebuilding, and how setting_sources composes user\u002Fproject\u002Flocal instructions. Read when designing the agent's voice and operating principles, when migrating an existing prompt into the SDK shape, or when choosing between a static and a dynamic prompt.\n---\n\n# System prompts in the Claude Agent SDK\n\nThe SDK accepts the `system_prompt` field in three different shapes. Pick by use case, not by what looks shortest:\n\n| Shape | Use when | Example |\n|-------|----------|---------|\n| **String** | The prompt is short and stable | `system_prompt=\"You are a helpful assistant.\"` |\n| **`{\"type\": \"file\", \"path\": \"...\"}`** | The prompt is long and edited often | `system_prompt={\"type\": \"file\", \"path\": \"prompt.md\"}` |\n| **`{\"type\": \"preset\", \"preset\": \"claude_code\", \"append\": \"...\"}`** | You want Claude Code's tool-using personality plus your domain instructions | (below) |\n\n## File mode — the right default for production\n\nInline string prompts grow until they're unmaintainable. Move to a file as soon as the prompt is more than 5 lines:\n\n```python\nsystem_prompt={\"type\": \"file\", \"path\": \"my_agent\u002Fprompt\u002Fsystem_prompt.md\"}\n```\n\nBenefits:\n- Edit the prompt without touching code\n- `git diff` shows prompt changes clearly\n- Reviewers can read it without scrolling through Python\n- Markdown rendering in editors makes structure visible\n\nThe SDK reads the file every time the option is constructed, so you can edit it and restart the process. Hot-reloading mid-session requires rebuilding `ClaudeAgentOptions` and starting a fresh `ClaudeSDKClient`.\n\n## The `claude_code` preset\n\n```python\nsystem_prompt={\n    \"type\": \"preset\",\n    \"preset\": \"claude_code\",\n    \"append\": \"You're a SQL specialist. Prefer CTEs over subqueries. Always validate schema before writing migrations.\",\n}\n```\n\nThis gives Claude:\n- The `claude_code` system prompt (proactive, tool-using, error-handling personality, autonomy norms)\n- Your `append` text added at the end\n\nUse this when your agent should *act like* Claude Code — multi-step planning, tool use without permission-asking, terse status updates. Don't use it when you want a different personality (a customer-service voice, a teaching voice, a strict review voice). The base personality is opinionated and bleeds through.\n\n## Dynamic prompts — rebuild per turn\n\nThe SDK doesn't support \"dynamic system prompt at runtime\" as a first-class feature (no `InstructionProvider` like ADK). The workaround is to rebuild `ClaudeAgentOptions` and start a fresh client per turn:\n\n```python\nasync def run_turn(prompt: str, user_id: str):\n    options = ClaudeAgentOptions(\n        system_prompt=build_dynamic_prompt(user_id),\n        # ... other options ...\n    )\n    async with ClaudeSDKClient(options=options) as client:\n        await client.query(prompt)\n        async for msg in client.receive_response():\n            yield msg\n```\n\nYou lose session continuity (each turn is a fresh session) — that's the cost of dynamic prompts. For multi-turn dynamic agents, use the SDK's `session_id` + `resume` to thread the conversation across these per-turn rebuilds.\n\nA common middle ground: keep the base system prompt static and inject per-turn context via a `UserPromptSubmit` hook (see `claude-sdk-hooks`). Faster, simpler, no session juggling.\n\n## `setting_sources` and how skills layer in\n\n```python\noptions = ClaudeAgentOptions(\n    system_prompt=...,\n    setting_sources=[\"user\", \"project\", \"local\"],\n)\n```\n\nThis loads `CLAUDE.md` files and `.claude\u002Fskills\u002F` directories from those layers — exactly like Claude Code does. `user` means `~\u002F.claude\u002F`, `project` means the project root's `.claude\u002F`, `local` means the current directory.\n\nThe system prompt you set via `system_prompt` is composed *with* whatever Claude finds in those sources. So you don't have to embed your skills' content in the system prompt — drop SKILL.md files into `.claude\u002Fskills\u002F\u003Cname>\u002F` and they're discovered.\n\nFor nuvel-scaffolded SDK agents, `setting_sources=[\"project\"]` is the sensible default — it picks up the project's `.claude\u002F` without leaking the user's home-directory settings into a server deployment.\n\n## Writing a good system prompt\n\nThree sections, in order:\n\n1. **Identity** — who the agent is, what it's for, who's talking to it.\n2. **Operating principles** — concrete behaviors. \"Use tools to take action, don't ask permission.\" \"Cite tool outputs.\" \"Surface ambiguity in one sentence; don't block.\"\n3. **Guardrails** — things to never do, in declarative form. \"Never delete user data without explicit confirmation.\"\n\nAvoid the three patterns that hurt prompts:\n- **Long lists of \"do this\"** — Claude weights the last item. Pick 3-5 principles, ordered by importance.\n- **Telling Claude its capabilities** (\"you can use tools, you can read files\") — the SDK already tells it. Redundant text dilutes the prompt.\n- **Personality without purpose** (\"you are a friendly assistant who loves to help\") — describes vibes, not actions. Replace with verbs.\n\n## Common mistakes\n\n- **Inlining a 200-line prompt as a Python string.** Use file mode.\n- **Using `claude_code` preset for non-Claude-Code agents.** The personality is too strong; users feel like they're talking to a coding agent.\n- **Dynamic prompts via Python f-strings rebuilt every turn.** Works but breaks session continuity. Use `UserPromptSubmit` hook injection for per-turn context, or `session_id`\u002F`resume` to bridge.\n- **Hardcoding tool names in the prompt.** Claude already sees the tool list; mentioning specific tools in the prompt creates drift when you add\u002Fremove them.\n\n## Quick reference\n\n```python\n# Static, file-based (recommended)\nsystem_prompt={\"type\": \"file\", \"path\": \"prompt\u002Fsystem_prompt.md\"}\n\n# Claude Code personality + your additions\nsystem_prompt={\"type\": \"preset\", \"preset\": \"claude_code\", \"append\": \"...\"}\n\n# With user\u002Fproject\u002Flocal skills auto-discovered\nClaudeAgentOptions(\n    system_prompt={\"type\": \"file\", \"path\": \"...\"},\n    setting_sources=[\"project\"],\n)\n```\n","# System prompts in the Claude Agent SDK\n\nThe SDK accepts the `system_prompt` field in three different shapes. Pick by use case, not by what looks shortest:\n\n| Shape | Use when | Example |\n|-------|----------|---------|\n| **String** | The prompt is short and stable | `system_prompt=\"You are a helpful assistant.\"` |\n| **`{\"type\": \"file\", \"path\": \"...\"}`** | The prompt is long and edited often | `system_prompt={\"type\": \"file\", \"path\": \"prompt.md\"}` |\n| **`{\"type\": \"preset\", \"preset\": \"claude_code\", \"append\": \"...\"}`** | You want Claude Code's tool-using personality plus your domain instructions | (below) |\n\n## File mode — the right default for production\n\nInline string prompts grow until they're unmaintainable. Move to a file as soon as the prompt is more than 5 lines:\n\n```python\nsystem_prompt={\"type\": \"file\", \"path\": \"my_agent\u002Fprompt\u002Fsystem_prompt.md\"}\n```\n\nBenefits:\n- Edit the prompt without touching code\n- `git diff` shows prompt changes clearly\n- Reviewers can read it without scrolling through Python\n- Markdown rendering in editors makes structure visible\n\nThe SDK reads the file every time the option is constructed, so you can edit it and restart the process. Hot-reloading mid-session requires rebuilding `ClaudeAgentOptions` and starting a fresh `ClaudeSDKClient`.\n\n## The `claude_code` preset\n\n```python\nsystem_prompt={\n    \"type\": \"preset\",\n    \"preset\": \"claude_code\",\n    \"append\": \"You're a SQL specialist. Prefer CTEs over subqueries. Always validate schema before writing migrations.\",\n}\n```\n\nThis gives Claude:\n- The `claude_code` system prompt (proactive, tool-using, error-handling personality, autonomy norms)\n- Your `append` text added at the end\n\nUse this when your agent should *act like* Claude Code — multi-step planning, tool use without permission-asking, terse status updates. Don't use it when you want a different personality (a customer-service voice, a teaching voice, a strict review voice). The base personality is opinionated and bleeds through.\n\n## Dynamic prompts — rebuild per turn\n\nThe SDK doesn't support \"dynamic system prompt at runtime\" as a first-class feature (no `InstructionProvider` like ADK). The workaround is to rebuild `ClaudeAgentOptions` and start a fresh client per turn:\n\n```python\nasync def run_turn(prompt: str, user_id: str):\n    options = ClaudeAgentOptions(\n        system_prompt=build_dynamic_prompt(user_id),\n        # ... other options ...\n    )\n    async with ClaudeSDKClient(options=options) as client:\n        await client.query(prompt)\n        async for msg in client.receive_response():\n            yield msg\n```\n\nYou lose session continuity (each turn is a fresh session) — that's the cost of dynamic prompts. For multi-turn dynamic agents, use the SDK's `session_id` + `resume` to thread the conversation across these per-turn rebuilds.\n\nA common middle ground: keep the base system prompt static and inject per-turn context via a `UserPromptSubmit` hook (see `claude-sdk-hooks`). Faster, simpler, no session juggling.\n\n## `setting_sources` and how skills layer in\n\n```python\noptions = ClaudeAgentOptions(\n    system_prompt=...,\n    setting_sources=[\"user\", \"project\", \"local\"],\n)\n```\n\nThis loads `CLAUDE.md` files and `.claude\u002Fskills\u002F` directories from those layers — exactly like Claude Code does. `user` means `~\u002F.claude\u002F`, `project` means the project root's `.claude\u002F`, `local` means the current directory.\n\nThe system prompt you set via `system_prompt` is composed *with* whatever Claude finds in those sources. So you don't have to embed your skills' content in the system prompt — drop SKILL.md files into `.claude\u002Fskills\u002F\u003Cname>\u002F` and they're discovered.\n\nFor nuvel-scaffolded SDK agents, `setting_sources=[\"project\"]` is the sensible default — it picks up the project's `.claude\u002F` without leaking the user's home-directory settings into a server deployment.\n\n## Writing a good system prompt\n\nThree sections, in order:\n\n1. **Identity** — who the agent is, what it's for, who's talking to it.\n2. **Operating principles** — concrete behaviors. \"Use tools to take action, don't ask permission.\" \"Cite tool outputs.\" \"Surface ambiguity in one sentence; don't block.\"\n3. **Guardrails** — things to never do, in declarative form. \"Never delete user data without explicit confirmation.\"\n\nAvoid the three patterns that hurt prompts:\n- **Long lists of \"do this\"** — Claude weights the last item. Pick 3-5 principles, ordered by importance.\n- **Telling Claude its capabilities** (\"you can use tools, you can read files\") — the SDK already tells it. Redundant text dilutes the prompt.\n- **Personality without purpose** (\"you are a friendly assistant who loves to help\") — describes vibes, not actions. Replace with verbs.\n\n## Common mistakes\n\n- **Inlining a 200-line prompt as a Python string.** Use file mode.\n- **Using `claude_code` preset for non-Claude-Code agents.** The personality is too strong; users feel like they're talking to a coding agent.\n- **Dynamic prompts via Python f-strings rebuilt every turn.** Works but breaks session continuity. Use `UserPromptSubmit` hook injection for per-turn context, or `session_id`\u002F`resume` to bridge.\n- **Hardcoding tool names in the prompt.** Claude already sees the tool list; mentioning specific tools in the prompt creates drift when you add\u002Fremove them.\n\n## Quick reference\n\n```python\n# Static, file-based (recommended)\nsystem_prompt={\"type\": \"file\", \"path\": \"prompt\u002Fsystem_prompt.md\"}\n\n# Claude Code personality + your additions\nsystem_prompt={\"type\": \"preset\", \"preset\": \"claude_code\", \"append\": \"...\"}\n\n# With user\u002Fproject\u002Flocal skills auto-discovered\nClaudeAgentOptions(\n    system_prompt={\"type\": \"file\", \"path\": \"...\"},\n    setting_sources=[\"project\"],\n)\n```\n",{"name":5,"description":7},"main","41d246dd855999c6bc4be528bc8d0d1b10ac8c47","nuvel\u002Fbackends\u002Fclaude_agent_sdk\u002Fskills\u002Fclaude-sdk-system-prompt",1,"https:\u002F\u002Fgithub.com\u002FFolken2\u002Fnuvel","https:\u002F\u002Ffolken2.github.io\u002Fnuvel\u002F","https:\u002F\u002Fgithub.com\u002FFolken2","folch.ai","2026-11-05 22:40:38",{"source":8,"skillName":5,"commands":54,"prompt":64,"zipAvailable":65},[55,58,61],{"tool":56,"command":57},"npx","npx skills add Folken2\u002Fnuvel --skill claude-sdk-system-prompt",{"tool":59,"command":60},"bunx","bunx skills add Folken2\u002Fnuvel --skill claude-sdk-system-prompt",{"tool":62,"command":63},"pnpm","pnpm dlx skills add Folken2\u002Fnuvel --skill claude-sdk-system-prompt","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FFolken2\u002Fnuvel\u002Fblob\u002Fmain\u002Fnuvel\u002Fbackends\u002Fclaude_agent_sdk\u002Fskills\u002Fclaude-sdk-system-prompt\u002FSKILL.md",true,[],[68,77,89,109,125,140],{"skillNo":69,"name":70,"nameZh":6,"description":71,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":72,"categories":73,"keywords":74,"publishedAt":39},"01M6KVZNJQ7AVMVBS205404CS7","greet","Greet a user warmly by name.","https:\u002F\u002Fgithub.com\u002FFolken2\u002Fnuvel\u002Fblob\u002Fmain\u002Ftests\u002Ftest_agent_plugins\u002Ffixtures\u002Fvalid-full\u002Fskills\u002Fgreet\u002FSKILL.md",[],[70,75,76],"user","name",{"skillNo":78,"name":79,"nameZh":6,"description":80,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":81,"categories":82,"keywords":83,"publishedAt":39},"01M6KVZHYK2C9S5GRM3PZAFDXG","hello","A simple hello skill that survives a broken mcp.json.","https:\u002F\u002Fgithub.com\u002FFolken2\u002Fnuvel\u002Fblob\u002Fmain\u002Ftests\u002Ftest_agent_plugins\u002Ffixtures\u002Fbad-mcp\u002Fskills\u002Fhello\u002FSKILL.md",[],[79,84,85,86,87,88],"MCP","hello skill","json","broken","simple",{"skillNo":90,"name":91,"nameZh":6,"description":92,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":93,"categories":94,"keywords":95,"publishedAt":39},"01M6KVZC94REQZ852EJ99ZXATK","grok-workflows","Prompt templates and workflows for using xAI GrokBot with Nuvel — code, design, research, and automated pipelines.","https:\u002F\u002Fgithub.com\u002FFolken2\u002Fnuvel\u002Fblob\u002Fmain\u002Fplugins\u002Fgrokbot-plugin\u002Fskills\u002Fgrok-workflows\u002FSKILL.md",[],[96,97,98,99,100,22,101,37,102,103,104,105,106,107,108],"workflows","grok","grok workflows","design","research","prompt templates","templates","xai","grokbot","pipelines","with","for","nuvel",{"skillNo":110,"name":111,"nameZh":6,"description":112,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":113,"categories":114,"keywords":115,"publishedAt":39},"01M6KVZ7BA5MJ1N614MTP2JXCQ","grok-setup","Configure xAI GrokBot with Nuvel API integration and project context for Nuvel-aligned development.","https:\u002F\u002Fgithub.com\u002FFolken2\u002Fnuvel\u002Fblob\u002Fmain\u002Fplugins\u002Fgrokbot-plugin\u002Fskills\u002Fgrok-setup\u002FSKILL.md",[],[97,116,117,107,106,31,108,118,119,120,104,121,122,123,103,124],"grok setup","setup","project context","api integration","configure","development","integration","api","context",{"skillNo":126,"name":127,"nameZh":6,"description":128,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":129,"categories":130,"keywords":131,"publishedAt":39},"01M6KVZ3WYQ6V6XVCRE77WT2WY","cursor-setup","Configure Cursor IDE with Nuvel rules, MCP server integration, and project settings for OrgMemory-aware development.","https:\u002F\u002Fgithub.com\u002FFolken2\u002Fnuvel\u002Fblob\u002Fmain\u002Fplugins\u002Fcursor-plugin\u002Fskills\u002Fcursor-setup\u002FSKILL.md",[],[132,133,117,122,84,134,121,135,136,120,137,138,31,106,107,139,108],"cursor","cursor setup","mcp server","server","ide","Rules","settings","project settings",{"skillNo":141,"name":142,"nameZh":6,"description":143,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":144,"categories":145,"keywords":146,"publishedAt":39},"01M6KVZ0GGSJM4AC8PK7G53H85","cursor-review","Use Cursor IDE with Nuvel OrgMemory to review changes — diff analysis, standards checking, and pre-commit review.","https:\u002F\u002Fgithub.com\u002FFolken2\u002Fnuvel\u002Fblob\u002Fmain\u002Fplugins\u002Fcursor-plugin\u002Fskills\u002Fcursor-review\u002FSKILL.md",[],[147,132,148,149,150,151,152,136,153,154,155,106,156,157,108],"cursor review","review","commit","review changes","pre-commit","analysis","use","diff","standards","changes","diff analysis"]