[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7BSF3F8SSEKARXPHB6PX4S4":3,"skill-same:01M7BSF3F8SSEKARXPHB6PX4S4":51},{"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":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":6,"ownerHtmlUrl":29,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":30,"install":31,"resources":44},"01M7BSF3F8SSEKARXPHB6PX4S4","dc-power-flow",null,"DC power flow analysis for power systems. Use when computing power flows using DC approximation, building susceptance matrices, calculating line flows and loading percentages, or performing sensitivity analysis on transmission networks.","linyouxue\u002Fskill-repair-benchmark","linyouxue","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F216151464?v=4","01M7BJEVCXKD74KH6FG9CBVSQB","林宥学","01M7BJEVE02NP217V93BKZFC0J",0,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark\u002Fblob\u002Fmain\u002Fevaluation\u002Fresults\u002FHumanAnnotated-Gold31-20260917\u002Ftasks\u002Fenergy-market-pricing\u002Frepaired_skill\u002Fdc-power-flow\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\r\nname: dc-power-flow\r\ndescription: \"DC power flow analysis for power systems. Use when computing power flows using DC approximation, building susceptance matrices, calculating line flows and loading percentages, or performing sensitivity analysis on transmission networks.\"\r\n---\r\n\r\n# DC Power Flow\r\n\r\nDC power flow is a linearized approximation of AC power flow, suitable for economic dispatch and contingency analysis.\r\n\r\n## DC Approximations\r\n\r\n1. **Lossless lines** - Ignore resistance (R ≈ 0)\r\n2. **Flat voltage** - All bus voltages = 1.0 pu\r\n3. **Small angles** - sin(θ) ≈ θ, cos(θ) ≈ 1\r\n\r\nResult: Power flow depends only on bus angles (θ) and line reactances (X).\n\n## Frozen Model Contract\n\nFreeze the DC equations before coding. A file described as “MATPOWER format”\ndefines an input schema; that phrase alone does not select every MATPOWER\ntransformer extension.\n\nUnless the task explicitly writes an extended tap\u002Fphase equation, this Skill's\nrequired model is:\n\n- `b = 1 \u002F X`\n- `flow = b * (theta_from - theta_to) * baseMVA`\n- symmetric B-matrix updates with `+b` on both diagonals and `-b` on both\n  off-diagonals\n- zero phase-offset injection\n\nUse that one contract for the matrix, nodal balance, reported branch flows, and\nthermal constraints. Use one shared model-building function for paired\nbase\u002Fcounterfactual studies and change only the task-designated parameter.\nTransformer tap ratios, phase shifts, line charging, and resistance enter the\nmodel only when the task explicitly specifies their equations.\n\n### Canonical sparse incidence construction\n\nFor a large network, preserve each branch's from\u002Fto pairing with this exact\nlayout:\n\n```python\nedge = np.arange(n_branch)\nA = sp.coo_matrix(\n    (\n        np.r_[np.ones(n_branch), -np.ones(n_branch)],\n        (np.r_[edge, edge], np.r_[f_idx, t_idx]),\n    ),\n    shape=(n_branch, n_bus),\n).tocsr()\n\nb = 1.0 \u002F x\nB = (A.T @ sp.diags(b) @ A).tocsr()\nflow_MW = cp.multiply(b * baseMVA, A @ theta)\n```\n\nBefore solving, require these structural checks:\n\n```python\nones_bus = np.ones(n_bus)\nassert np.all(A.getnnz(axis=1) == 2)\nassert np.allclose(A @ ones_bus, 0.0)\nassert np.allclose((B - B.T).data, 0.0)\nassert np.allclose(B @ ones_bus, 0.0)\n```\n\n### Infeasibility debug order\n\nAn unexpected infeasible result first triggers an implementation audit:\n\n1. verify bus-number mapping and each incidence row's `+1 @ from`,\n   `-1 @ to` pairing;\n2. verify MW versus per-unit conversions;\n3. solve power balance and generator bounds before adding reserve and thermal\n   constraint groups;\n4. add constraint groups back one at a time and identify the first group that\n   changes feasibility.\n\nKeep the frozen equations during this audit. Change the physical formulation\nonly when the task itself explicitly requires a different equation.\n\nBefore export, require all of the following: `b == 1\u002FX`, phase offset is zero,\nB\u002Fflow construction does not consume transformer tap or phase-shift columns,\nboth scenarios use the same builder, and flows, nodal residuals, and total\nobjective have been independently recomputed from the submitted solution.\n\r\n## Bus Number Mapping\r\n\r\nPower system bus numbers may not be contiguous (e.g., case300 has non-sequential bus IDs). Always create a mapping from bus numbers to 0-indexed array positions:\r\n\r\n```python\r\n# Create mapping: bus_number -> 0-indexed position\r\nbus_num_to_idx = {int(buses[i, 0]): i for i in range(n_bus)}\r\n\r\n# Use mapping for branch endpoints\r\nf = bus_num_to_idx[int(br[0])]  # NOT br[0] - 1\r\nt = bus_num_to_idx[int(br[1])]\r\n```\r\n\r\n## Susceptance Matrix (B)\r\n\r\nBuild from branch reactances using bus number mapping:\r\n\r\n```python\r\n# Run: scripts\u002Fbuild_b_matrix.py\r\n# Or inline:\r\nbus_num_to_idx = {int(buses[i, 0]): i for i in range(n_bus)}\r\nB = np.zeros((n_bus, n_bus))\r\n\r\nfor br in branches:\r\n    f = bus_num_to_idx[int(br[0])]  # Map bus number to index\r\n    t = bus_num_to_idx[int(br[1])]\r\n    x = br[3]  # Reactance\r\n    if x != 0:\r\n        b = 1.0 \u002F x\r\n        B[f, f] += b\r\n        B[t, t] += b\r\n        B[f, t] -= b\r\n        B[t, f] -= b\r\n```\r\n\r\n## Power Balance Equation\r\n\r\nAt each bus: `Pg - Pd = B[i, :] @ θ`\r\n\r\nWhere:\r\n- Pg = generation at bus (pu)\r\n- Pd = load at bus (pu)\r\n- θ = vector of bus angles (radians)\r\n\r\n## Slack Bus\r\n\r\nOne bus must have θ = 0 as reference. Find slack bus (type=3):\r\n\r\n```python\r\nslack_idx = None\r\nfor i in range(n_bus):\r\n    if buses[i, 1] == 3:\r\n        slack_idx = i\r\n        break\r\nconstraints.append(theta[slack_idx] == 0)\r\n```\r\n\r\n## Line Flow Calculation\r\n\r\nFlow on branch from bus f to bus t (use bus number mapping):\r\n\r\n```python\r\nf = bus_num_to_idx[int(br[0])]\r\nt = bus_num_to_idx[int(br[1])]\r\nb = 1.0 \u002F br[3]  # Susceptance = 1\u002FX\r\nflow_pu = b * (theta[f] - theta[t])\r\nflow_MW = flow_pu * baseMVA\r\n```\r\n\r\n## Line Loading Percentage\r\n\r\n```python\r\nloading_pct = abs(flow_MW) \u002F rating_MW * 100\r\n```\r\n\r\nWhere `rating_MW = branch[5]` (RATE_A column).\r\n\r\n## Branch Susceptances for Constraints\r\n\r\nStore susceptances when building constraints:\r\n\r\n```python\r\nbranch_susceptances = []\r\nfor br in branches:\r\n    x = br[3]\r\n    b = 1.0 \u002F x if x != 0 else 0\r\n    branch_susceptances.append(b)\r\n```\r\n\r\n## Line Flow Limits (for OPF)\r\n\r\nEnforce thermal limits as linear constraints:\r\n\r\n```python\r\n# |flow| \u003C= rating  →  -rating \u003C= flow \u003C= rating\r\nflow = b * (theta[f] - theta[t]) * baseMVA\r\nconstraints.append(flow \u003C= rate)\r\nconstraints.append(flow >= -rate)\r\n```\r\n","# DC Power Flow\r\n\r\nDC power flow is a linearized approximation of AC power flow, suitable for economic dispatch and contingency analysis.\r\n\r\n## DC Approximations\r\n\r\n1. **Lossless lines** - Ignore resistance (R ≈ 0)\r\n2. **Flat voltage** - All bus voltages = 1.0 pu\r\n3. **Small angles** - sin(θ) ≈ θ, cos(θ) ≈ 1\r\n\r\nResult: Power flow depends only on bus angles (θ) and line reactances (X).\n\n## Frozen Model Contract\n\nFreeze the DC equations before coding. A file described as “MATPOWER format”\ndefines an input schema; that phrase alone does not select every MATPOWER\ntransformer extension.\n\nUnless the task explicitly writes an extended tap\u002Fphase equation, this Skill's\nrequired model is:\n\n- `b = 1 \u002F X`\n- `flow = b * (theta_from - theta_to) * baseMVA`\n- symmetric B-matrix updates with `+b` on both diagonals and `-b` on both\n  off-diagonals\n- zero phase-offset injection\n\nUse that one contract for the matrix, nodal balance, reported branch flows, and\nthermal constraints. Use one shared model-building function for paired\nbase\u002Fcounterfactual studies and change only the task-designated parameter.\nTransformer tap ratios, phase shifts, line charging, and resistance enter the\nmodel only when the task explicitly specifies their equations.\n\n### Canonical sparse incidence construction\n\nFor a large network, preserve each branch's from\u002Fto pairing with this exact\nlayout:\n\n```python\nedge = np.arange(n_branch)\nA = sp.coo_matrix(\n    (\n        np.r_[np.ones(n_branch), -np.ones(n_branch)],\n        (np.r_[edge, edge], np.r_[f_idx, t_idx]),\n    ),\n    shape=(n_branch, n_bus),\n).tocsr()\n\nb = 1.0 \u002F x\nB = (A.T @ sp.diags(b) @ A).tocsr()\nflow_MW = cp.multiply(b * baseMVA, A @ theta)\n```\n\nBefore solving, require these structural checks:\n\n```python\nones_bus = np.ones(n_bus)\nassert np.all(A.getnnz(axis=1) == 2)\nassert np.allclose(A @ ones_bus, 0.0)\nassert np.allclose((B - B.T).data, 0.0)\nassert np.allclose(B @ ones_bus, 0.0)\n```\n\n### Infeasibility debug order\n\nAn unexpected infeasible result first triggers an implementation audit:\n\n1. verify bus-number mapping and each incidence row's `+1 @ from`,\n   `-1 @ to` pairing;\n2. verify MW versus per-unit conversions;\n3. solve power balance and generator bounds before adding reserve and thermal\n   constraint groups;\n4. add constraint groups back one at a time and identify the first group that\n   changes feasibility.\n\nKeep the frozen equations during this audit. Change the physical formulation\nonly when the task itself explicitly requires a different equation.\n\nBefore export, require all of the following: `b == 1\u002FX`, phase offset is zero,\nB\u002Fflow construction does not consume transformer tap or phase-shift columns,\nboth scenarios use the same builder, and flows, nodal residuals, and total\nobjective have been independently recomputed from the submitted solution.\n\r\n## Bus Number Mapping\r\n\r\nPower system bus numbers may not be contiguous (e.g., case300 has non-sequential bus IDs). Always create a mapping from bus numbers to 0-indexed array positions:\r\n\r\n```python\r\n# Create mapping: bus_number -> 0-indexed position\r\nbus_num_to_idx = {int(buses[i, 0]): i for i in range(n_bus)}\r\n\r\n# Use mapping for branch endpoints\r\nf = bus_num_to_idx[int(br[0])]  # NOT br[0] - 1\r\nt = bus_num_to_idx[int(br[1])]\r\n```\r\n\r\n## Susceptance Matrix (B)\r\n\r\nBuild from branch reactances using bus number mapping:\r\n\r\n```python\r\n# Run: scripts\u002Fbuild_b_matrix.py\r\n# Or inline:\r\nbus_num_to_idx = {int(buses[i, 0]): i for i in range(n_bus)}\r\nB = np.zeros((n_bus, n_bus))\r\n\r\nfor br in branches:\r\n    f = bus_num_to_idx[int(br[0])]  # Map bus number to index\r\n    t = bus_num_to_idx[int(br[1])]\r\n    x = br[3]  # Reactance\r\n    if x != 0:\r\n        b = 1.0 \u002F x\r\n        B[f, f] += b\r\n        B[t, t] += b\r\n        B[f, t] -= b\r\n        B[t, f] -= b\r\n```\r\n\r\n## Power Balance Equation\r\n\r\nAt each bus: `Pg - Pd = B[i, :] @ θ`\r\n\r\nWhere:\r\n- Pg = generation at bus (pu)\r\n- Pd = load at bus (pu)\r\n- θ = vector of bus angles (radians)\r\n\r\n## Slack Bus\r\n\r\nOne bus must have θ = 0 as reference. Find slack bus (type=3):\r\n\r\n```python\r\nslack_idx = None\r\nfor i in range(n_bus):\r\n    if buses[i, 1] == 3:\r\n        slack_idx = i\r\n        break\r\nconstraints.append(theta[slack_idx] == 0)\r\n```\r\n\r\n## Line Flow Calculation\r\n\r\nFlow on branch from bus f to bus t (use bus number mapping):\r\n\r\n```python\r\nf = bus_num_to_idx[int(br[0])]\r\nt = bus_num_to_idx[int(br[1])]\r\nb = 1.0 \u002F br[3]  # Susceptance = 1\u002FX\r\nflow_pu = b * (theta[f] - theta[t])\r\nflow_MW = flow_pu * baseMVA\r\n```\r\n\r\n## Line Loading Percentage\r\n\r\n```python\r\nloading_pct = abs(flow_MW) \u002F rating_MW * 100\r\n```\r\n\r\nWhere `rating_MW = branch[5]` (RATE_A column).\r\n\r\n## Branch Susceptances for Constraints\r\n\r\nStore susceptances when building constraints:\r\n\r\n```python\r\nbranch_susceptances = []\r\nfor br in branches:\r\n    x = br[3]\r\n    b = 1.0 \u002F x if x != 0 else 0\r\n    branch_susceptances.append(b)\r\n```\r\n\r\n## Line Flow Limits (for OPF)\r\n\r\nEnforce thermal limits as linear constraints:\r\n\r\n```python\r\n# |flow| \u003C= rating  →  -rating \u003C= flow \u003C= rating\r\nflow = b * (theta[f] - theta[t]) * baseMVA\r\nconstraints.append(flow \u003C= rate)\r\nconstraints.append(flow >= -rate)\r\n```\r\n",{"name":5,"description":7},"main","cdcb6d230f3b15c3c33f8a2bdd16439f43602cbe","evaluation\u002Fresults\u002FHumanAnnotated-Gold31-20260917\u002Ftasks\u002Fenergy-market-pricing\u002Frepaired_skill\u002Fdc-power-flow",1,"https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark","https:\u002F\u002Fgithub.com\u002Flinyouxue","2026-11-14 20:28:35",{"source":8,"skillName":5,"commands":32,"prompt":42,"zipAvailable":43},[33,36,39],{"tool":34,"command":35},"npx","npx skills add linyouxue\u002Fskill-repair-benchmark --skill dc-power-flow",{"tool":37,"command":38},"bunx","bunx skills add linyouxue\u002Fskill-repair-benchmark --skill dc-power-flow",{"tool":40,"command":41},"pnpm","pnpm dlx skills add linyouxue\u002Fskill-repair-benchmark --skill dc-power-flow","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark\u002Fblob\u002Fmain\u002Fevaluation\u002Fresults\u002FHumanAnnotated-Gold31-20260917\u002Ftasks\u002Fenergy-market-pricing\u002Frepaired_skill\u002Fdc-power-flow\u002FSKILL.md",true,[45],{"path":46,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":49,"sourceHtmlUrl":50},"scripts\u002Fbuild_b_matrix.py","SCRIPT","脚本",3269,"https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark\u002Fblob\u002Fmain\u002Fevaluation\u002Fresults\u002FHumanAnnotated-Gold31-20260917\u002Ftasks\u002Fenergy-market-pricing\u002Frepaired_skill\u002Fdc-power-flow\u002Fscripts\u002Fbuild_b_matrix.py",[52,59,66,73,78,83],{"skillNo":53,"name":54,"nameZh":6,"description":55,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":56,"categories":57,"keywords":58,"publishedAt":19},"01M7E1HGVRY73NBJ022CJG13X6","video-frame-extraction","Extract frames from video files and save them as images using OpenCV","https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark\u002Fblob\u002Fmain\u002Fjpg-ocr-stat\u002Fresult\u002Fskilltta-claude4.7\u002Fgroup_03\u002Frun_03\u002Finputs\u002Fskills\u002Fvideo-frame-extraction\u002FSKILL.md",[],[],{"skillNo":60,"name":61,"nameZh":6,"description":62,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":63,"categories":64,"keywords":65,"publishedAt":19},"01M7E1HAG5R7CJ9C8NYJS771MB","openai-vision","Analyze images and multi-frame sequences using OpenAI GPT vision models","https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark\u002Fblob\u002Fmain\u002Fjpg-ocr-stat\u002Fresult\u002Fskilltta-claude4.7\u002Fgroup_03\u002Frun_03\u002Finputs\u002Fskills\u002Fopenai-vision\u002FSKILL.md",[],[],{"skillNo":67,"name":68,"nameZh":6,"description":69,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":70,"categories":71,"keywords":72,"publishedAt":19},"01M7E1H7DADKB6QBWKC2KQ63SZ","image-ocr","Extract text content from images using Tesseract OCR via Python, including structured field extraction from receipts and forms","https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark\u002Fblob\u002Fmain\u002Fjpg-ocr-stat\u002Fresult\u002Fskilltta-claude4.7\u002Fgroup_03\u002Frun_03\u002Finputs\u002Fskills\u002Fimage-ocr\u002FSKILL.md",[],[],{"skillNo":74,"name":54,"nameZh":6,"description":55,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":75,"categories":76,"keywords":77,"publishedAt":19},"01M7E1H0WBNT43TENGQY7AVZHD","https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark\u002Fblob\u002Fmain\u002Fjpg-ocr-stat\u002Fresult\u002Fskilltta-claude4.7\u002Fgroup_03\u002Frun_02\u002Finputs\u002Fskills\u002Fvideo-frame-extraction\u002FSKILL.md",[],[],{"skillNo":79,"name":61,"nameZh":6,"description":62,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":80,"categories":81,"keywords":82,"publishedAt":19},"01M7E1GTC7D4N4Q2EF03875J9E","https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark\u002Fblob\u002Fmain\u002Fjpg-ocr-stat\u002Fresult\u002Fskilltta-claude4.7\u002Fgroup_03\u002Frun_02\u002Finputs\u002Fskills\u002Fopenai-vision\u002FSKILL.md",[],[],{"skillNo":84,"name":68,"nameZh":6,"description":69,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":85,"categories":86,"keywords":87,"publishedAt":19},"01M7E1GQ92CWFMGH53KSSE4WER","https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark\u002Fblob\u002Fmain\u002Fjpg-ocr-stat\u002Fresult\u002Fskilltta-claude4.7\u002Fgroup_03\u002Frun_02\u002Finputs\u002Fskills\u002Fimage-ocr\u002FSKILL.md",[],[]]