[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M75SVPAMK09RRZ56SPVRPJ2K":3,"skill-same:01M75SVPAMK09RRZ56SPVRPJ2K":44},{"skillNo":4,"name":5,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":20,"frontMatter":21,"refName":22,"commitSha":23,"skillDirectory":24,"forksCount":25,"repositoryHtmlUrl":26,"repositoryHomepageUrl":27,"ownerHtmlUrl":28,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":29,"install":30,"resources":43},"01M75SVPAMK09RRZ56SPVRPJ2K","patch",null,"ZyntroAI\u002Ffastapi-python-boilerplate","ZyntroAI","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F312382677?v=4","01M75SQSYX5NMYH6AGGAS67D2B","Zyntro​ Media","01M75SQSZHW30DBXDX3TAYJ92F",1,"MIT","https:\u002F\u002Fgithub.com\u002FZyntroAI\u002Ffastapi-python-boilerplate\u002Fblob\u002Fmain\u002Fskills\u002Fpatch\u002FSKILL.md",[],[],"2026-11-12 13:55:43",false,"# 🛠️ Patch Skill — Controlled Change Management Layer\n**Path:** `skills\u002Fpatch\u002F` — Minimal, auditable, reversible code changes\n\n---\n\n## 📁 Final Structure\n```\nskills\u002Fpatch\u002F\n├── SKILL.md               # Documentation & API\n├── __init__.py            # Export core API\n├── analyze\u002F               # Impact & context analysis\n│   ├── __init__.py\n│   ├── diff.py            # Parse\u002Fcompare changes\n│   ├── context.py         # Git\u002Frepo state\n│   └── impact.py          # Risk\u002Fscope analysis\n├── generate\u002F              # Create minimal diffs\n│   ├── __init__.py\n│   ├── unified_diff.py    # Standard patch format\n│   ├── file_patch.py      # Single-file changes\n│   └── migration.py       # Multi-file\u002Fstructure\n├── validate\u002F              # Safety & compliance\n│   ├── __init__.py\n│   ├── syntax.py          # Language syntax check\n│   ├── conflict.py        # Detect merge conflicts\n│   ├── tests.py           # Run existing tests\n│   └── security.py        # Scan secrets\u002Frisk\n├── apply\u002F                 # Execution & rollback\n│   ├── __init__.py\n│   ├── apply.py           # Apply patch\n│   ├── dry_run.py         # Preview without change\n│   └── rollback.py        # Revert safely\n└── tests\u002F                 # Skill self-tests\n    └── test_patch.py\n```\n\n---\n\n## 🧠 Core API (`__init__.py`)\n```python\n\"\"\"\n🛠️ Patch Skill — Controlled Change Management\nPurpose: Minimal, validatable, reversible code changes\n\"\"\"\nfrom typing import Dict, List, Optional\nfrom .analyze.diff import analyze_diff\nfrom .analyze.impact import assess_impact\nfrom .generate.unified_diff import create_diff\nfrom .validate.syntax import check_syntax\nfrom .validate.conflict import detect_conflicts\nfrom .validate.tests import run_test_suite\nfrom .validate.security import scan_security\nfrom .apply.dry_run import preview_changes\nfrom .apply.apply import execute_patch\nfrom .apply.rollback import safe_rollback\n\nclass PatchSkill:\n    \"\"\"\n    Mutation layer — Agents decide *what* → Patch controls *how*\n    \"\"\"\n    def __init__(self):\n        self.policy = PatchPolicy()\n        self.history: List[Dict] = []\n\n    def create(self,\n               files: List[Dict],\n               reason: str,\n               issue: Optional[str] = None,\n               target_branch: str = \"main\") -> Dict:\n        \"\"\"Build patch object — minimal diff + metadata\"\"\"\n        return {\n            \"id\": f\"patch_{len(self.history):03d}\",\n            \"type\": \"bugfix\",\n            \"status\": \"proposed\",\n            \"target\": target_branch,\n            \"files\": files,\n            \"reason\": reason,\n            \"issue\": issue,\n            \"risk\": {\"level\": \"unknown\"},\n            \"validation\": {},\n            \"rollback\": {\"available\": False}\n        }\n\n    def generate(self, base: str, modified: str) -> str:\n        \"\"\"Generate unified diff\"\"\"\n        return create_diff(base, modified)\n\n    def analyze(self, patch: Dict) -> Dict:\n        \"\"\"Analyze risk, scope, context\"\"\"\n        impact = assess_impact(patch)\n        patch[\"risk\"] = impact\n        return patch\n\n    def validate(self, patch: Dict) -> Dict:\n        \"\"\"Syntax + conflict + tests + security\"\"\"\n        patch[\"validation\"] = {\n            \"syntax\": check_syntax(patch),\n            \"conflict\": detect_conflicts(patch),\n            \"tests\": run_test_suite(patch),\n            \"security\": scan_security(patch)\n        }\n        return patch\n\n    def preview(self, patch: Dict) -> Dict:\n        \"\"\"Dry run — no changes\"\"\"\n        return preview_changes(patch)\n\n    def confidence(self, patch: Dict) -> float:\n        \"\"\"Score: 0.0–1.0\"\"\"\n        rc = patch.get(\"risk\", {}).get(\"root_cause_confidence\", 0.0)\n        pc = 0.95 if all(v == \"pass\" for v in patch[\"validation\"].values()) else 0.0\n        return round((rc + pc) \u002F 2, 2)\n\n    def apply(self, patch: Dict, auto_commit: bool = True) -> Dict:\n        \"\"\"Apply only if policy allows\"\"\"\n        conf = self.confidence(patch)\n        if self.policy.allow(patch, conf):\n            result = execute_patch(patch, auto_commit)\n            patch[\"status\"] = \"applied\"\n            patch[\"rollback\"][\"available\"] = True\n            self.history.append(patch)\n            return result\n        patch[\"status\"] = \"blocked\"\n        return {\"status\": \"blocked\", \"reason\": \"policy_check_failed\"}\n\n    def rollback(self, patch_id: str) -> Dict:\n        \"\"\"Revert safely\"\"\"\n        return safe_rollback(patch_id)\n\n    def status(self, patch_id: str) -> Optional[Dict]:\n        \"\"\"Get patch state\"\"\"\n        return next((p for p in self.history if p[\"id\"] == patch_id), None)\n\n    def artifactize(self, patch: Dict) -> Dict:\n        \"\"\"Convert verified patch → Knowledge Artifact\"\"\"\n        return {\n            \"type\": \"code-pattern\",\n            \"problem\": patch[\"reason\"],\n            \"patch\": patch[\"files\"],\n            \"verification\": patch[\"validation\"],\n            \"confidence\": self.confidence(patch),\n            \"repository\": patch.get(\"target\"),\n            \"source\": \"patch-skill\"\n        }\n\n\nclass PatchPolicy:\n    \"\"\"Guardrails — never bypass branch protection\"\"\"\n    def __init__(self):\n        self.rules = {\n            \"require_clean_worktree\": True,\n            \"require_diff_review\": True,\n            \"require_tests\": True,\n            \"require_security_scan\": True,\n            \"confidence_min\": 0.90,\n            \"forbidden\": [\n                \"force_push\", \"bypass_branch_protection\",\n                \"disable_ci\", \"modify_secrets\", \"delete_unrelated_files\"\n            ]\n        }\n\n    def allow(self, patch: Dict, confidence: float) -> bool:\n        val = patch.get(\"validation\", {})\n        return (confidence >= self.rules[\"confidence_min\"] and\n                val.get(\"syntax\") == \"pass\" and\n                val.get(\"conflict\") == \"pass\" and\n                val.get(\"tests\") == \"pass\" and\n                val.get(\"security\") == \"pass\")\n\n\n# Global instance\npatch = PatchSkill()\n```\n\n---\n\n## 📄 SKILL.md — Documentation\n```markdown\n# 🛠️ Patch Skill — Controlled Change Management\n**Purpose:** Minimal, auditable, reversible code changes  \n**Principle:** Smallest safe change — never rewrite entire project\n\n## 🧩 Core API\n- `patch.create()` → Build patch object\n- `patch.generate()` → Unified diff\n- `patch.analyze()` → Risk\u002Fscope\n- `patch.validate()` → Syntax\u002Fconflict\u002Ftests\u002Fsecurity\n- `patch.preview()` → Dry run\n- `patch.confidence()` → Score 0–1\n- `patch.apply()` → Auto\u002FManual\n- `patch.rollback()` → Revert\n- `patch.artifactize()` → → Knowledge\n\n## 📋 Lifecycle\nRequest → Analyze → Generate → Preview → Validate → Policy Check → Apply → Test → Knowledge\n\n## 🛡️ Policy Guardrails\n- ✅ No force push\n- ✅ No bypass branch protection\n- ✅ No secret modification\n- ✅ Tests\u002FSecurity required\n- ✅ Confidence ≥ 0.90\n\n## 🔗 Integrations\n- debug-error → root cause → patch\n- claude → suggest → validate → apply\n- github-coding → PR\u002FCI\u002FReview\n- create-knowledge-artifact → save verified patterns\n```\n\n---\n\n## 📄 Example Patch Object\n```json\n{\n  \"id\": \"patch_001\",\n  \"type\": \"bugfix\",\n  \"status\": \"proposed\",\n  \"target\": \"main\",\n  \"issue\": \"#123\",\n  \"files\": [{\"path\": \"app\u002Fapi.py\", \"lines\": \"42-51\"}],\n  \"reason\": \"500 error on dependency init\",\n  \"risk\": {\"level\": \"low\", \"root_cause_confidence\": 0.96},\n  \"validation\": {\n    \"syntax\": \"pass\", \"conflict\": \"pass\",\n    \"tests\": \"pass\", \"security\": \"pass\"\n  },\n  \"confidence\": 0.94,\n  \"rollback\": {\"available\": true}\n}\n```\n\n---\n\n## 🔗 Ecosystem Integration\n```\nAI Orchestrator\n    ├── debug-error → root cause → patch.generate()\n    ├── claude → propose → patch.validate()\n    └── github-coding → PR → CI → patch.apply()\npatch\n    ├── analyze → risk\n    ├── validate → syntax\u002Ftests\u002Fsecurity\n    ├── apply → policy check\n    └── artifactize → Knowledge Artifact\n```\n\n---\n\n## 🚀 Usage Example\n```python\nfrom skills.patch import patch\n\n# 1. Create\np = patch.create(\n    files=[{\"path\": \"app\u002Fapi.py\", \"content\": \"fixed code\"}],\n    reason=\"Fix 500 on init\",\n    issue=\"#123\",\n    target_branch=\"main\"\n)\n\n# 2. Analyze & Validate\np = patch.analyze(p)\np = patch.validate(p)\n\n# 3. Preview\nprint(patch.preview(p))\n\n# 4. Apply if confident\nif patch.confidence(p) >= 0.9:\n    result = patch.apply(p)\n    # → Auto-saved as Knowledge Artifact\n```\n\n---\n\n## 🧪 Policy Logic\n```\nConfidence ≥ 0.90\n+ Syntax OK\n+ No Conflicts\n+ Tests Pass\n+ Security OK\n+ Worktree Clean\n→ ✅ AUTO APPLY\n\nELSE\n→ ⏳ REVIEW REQUIRED\n```\n\n---\n\n## 📥 Ready to Add\n```bash\nmkdir -p skills\u002Fpatch\u002F{analyze,generate,validate,apply,tests}\n# Copy all files above\ngit add skills\u002Fpatch\u002F\ngit commit -m \"feat: add Patch Skill — controlled change management layer\"\n```\n\n---\n\n## ✅ Key Advantage\n**Patch ≠ Coding Agent**  \nAgents decide *what* → Patch controls *how* → Safe, auditable, reversible\n\nWould you like me to write **full implementation files** for each submodule (`diff.py`, `apply.py`, etc.)? 🧩✅\n",{},"main","c68ea5db21e36ef3f01986f87cf40276e64c2e9b","skills\u002Fpatch",0,"https:\u002F\u002Fgithub.com\u002FZyntroAI\u002Ffastapi-python-boilerplate","https:\u002F\u002Fzyntroai.github.io\u002Ffastapi-python-boilerplate\u002F","https:\u002F\u002Fgithub.com\u002FZyntroAI","2026-11-02 02:14:54",{"source":7,"skillName":5,"commands":31,"prompt":41,"zipAvailable":42},[32,35,38],{"tool":33,"command":34},"npx","npx skills add ZyntroAI\u002Ffastapi-python-boilerplate --skill patch",{"tool":36,"command":37},"bunx","bunx skills add ZyntroAI\u002Ffastapi-python-boilerplate --skill patch",{"tool":39,"command":40},"pnpm","pnpm dlx skills add ZyntroAI\u002Ffastapi-python-boilerplate --skill patch","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FZyntroAI\u002Ffastapi-python-boilerplate\u002Fblob\u002Fmain\u002Fskills\u002Fpatch\u002FSKILL.md",true,[],[45,51,58,64,70,77],{"skillNo":46,"name":47,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":48,"categories":49,"keywords":50,"publishedAt":18},"01M75SVXD72XFZWSX20BSWW622","workflow_dispatch","https:\u002F\u002Fgithub.com\u002FZyntroAI\u002Ffastapi-python-boilerplate\u002Fblob\u002Fmain\u002Fskills\u002Fworkflow_dispatch\u002FSkill.md",[],[],{"skillNo":52,"name":53,"nameZh":6,"description":54,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":55,"categories":56,"keywords":57,"publishedAt":18},"01M75SVVF3FBTNHKFWAF8H6ZD2","research","Multi-source research & knowledge synthesis with cross-validation, provenance graph, confidence score","https:\u002F\u002Fgithub.com\u002FZyntroAI\u002Ffastapi-python-boilerplate\u002Fblob\u002Fmain\u002Fskills\u002Fresearch\u002FSKILL.md",[],[],{"skillNo":59,"name":60,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":61,"categories":62,"keywords":63,"publishedAt":18},"01M75SVR5BQFH3MM78FWR8V10V","pr-triage-automove","https:\u002F\u002Fgithub.com\u002FZyntroAI\u002Ffastapi-python-boilerplate\u002Fblob\u002Fmain\u002Fskills\u002Fpr-triage-automove\u002FSKILL.md",[],[],{"skillNo":65,"name":66,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":67,"categories":68,"keywords":69,"publishedAt":18},"01M75SVKCB0EMDSY2Q76BGNNH5","git-patch-merge","https:\u002F\u002Fgithub.com\u002FZyntroAI\u002Ffastapi-python-boilerplate\u002Fblob\u002Fmain\u002Fskills\u002Fgit-patch-merge\u002FSKILL.md",[],[],{"skillNo":71,"name":72,"nameZh":6,"description":73,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":74,"categories":75,"keywords":76,"publishedAt":18},"01M75SVH67JHCKQ632D6HE5ZHZ","fetching","Low-level async HTTP\u002FGraphQL fetch — SSRF-safe, retry, cache, provenance","https:\u002F\u002Fgithub.com\u002FZyntroAI\u002Ffastapi-python-boilerplate\u002Fblob\u002Fmain\u002Fskills\u002Ffetching\u002FSKILL.md",[],[],{"skillNo":78,"name":79,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":80,"categories":81,"keywords":82,"publishedAt":18},"01M75SVERZKVWCJG2Q00MJ1GFN","Central Credential Management","https:\u002F\u002Fgithub.com\u002FZyntroAI\u002Ffastapi-python-boilerplate\u002Fblob\u002Fmain\u002Fskills\u002Fcredential-management\u002FSKILL.md",[],[]]