{"record":{"id":"929d451967bc24ba","repo":"zed-industries/zed","slug":"shared-skill-exceeds-the-maximum-size-of-max-skil","errorCode":null,"errorMessage":"shared skill exceeds the maximum size of {MAX_SKILL_FILE_SIZE} bytes","messagePattern":"shared skill exceeds the maximum size of (.+?) bytes","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/agent_skills/agent_skills.rs","lineNumber":846,"sourceCode":"}\n\n/// Recover the `SKILL.md` contents embedded in a `zed://skill?data=…` link\n/// produced by [`encode_skill_share_link`].\npub fn decode_skill_share_link(link: &str) -> Result<String> {\n    use base64::Engine as _;\n    let url = Url::parse(link).context(\"skill share link is not a valid URL\")?;\n    anyhow::ensure!(\n        url.scheme() == SKILL_SHARE_LINK_SCHEME && url.host_str() == Some(SKILL_SHARE_LINK_HOST),\n        \"not a skill share link\"\n    );\n    let data = url\n        .query_pairs()\n        .find_map(|(key, value)| (key == SKILL_SHARE_LINK_DATA_PARAM).then_some(value))\n        .context(\"skill share link is missing the `data` parameter\")?;\n    let bytes = base64::engine::general_purpose::URL_SAFE_NO_PAD\n        .decode(data.as_bytes())\n        .context(\"skill share link `data` is not valid base64\")?;\n    anyhow::ensure!(\n        bytes.len() <= MAX_SKILL_FILE_SIZE,\n        \"shared skill exceeds the maximum size of {MAX_SKILL_FILE_SIZE} bytes\"\n    );\n    let content = String::from_utf8(bytes).context(\"skill share link `data` is not valid UTF-8\")?;\n    Ok(content)\n}\n\n#[cfg(test)]\nmod tests {\n    use super::*;\n    use fs::FakeFs;\n    use gpui::TestAppContext;\n\n    #[test]\n    fn test_skill_source_precedence_is_total_and_ordered() {\n        // Pin the hierarchy: project-local > global > built-in. Every\n        // override and conflict-resolution site routes through this,\n        // so the rest of the codebase relies on it being correct.","sourceCodeStart":828,"sourceCodeEnd":864,"githubUrl":"https://github.com/zed-industries/zed/blob/bc538def4545534201bbfcac4e95ac34ea6501b6/crates/agent_skills/agent_skills.rs#L828-L864","documentation":"Error \"shared skill exceeds the maximum size of {MAX_SKILL_FILE_SIZE} bytes\" thrown in zed-industries/zed.","triggerScenarios":"Thrown at crates/agent_skills/agent_skills.rs:846 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"bc538def4545534201bbfcac4e95ac34ea6501b6","analyzedAt":"2026-08-16T07:30:46.435Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}