[{"data":1,"prerenderedAt":799},["ShallowReactive",2],{"blog-post:\u002Fcalculate":3},{"id":4,"title":5,"body":6,"date":784,"description":785,"extension":786,"image":787,"meta":788,"navigation":63,"order":789,"path":790,"seo":791,"stem":792,"tags":793,"__hash__":798},"esPosts\u002F014.calculate.md","Skill: Calculate para IA",{"type":7,"value":8,"toc":779},"minimark",[9,13,18,29,33,39,43,739,746,775],[10,11,12],"p",{},"Los LLMs no son fiables con operaciones numéricas. Una skill puede indicarle al agente cuándo y cómo calcular con precisión en lugar de adivinar resultados.",[14,15,17],"h2",{"id":16},"título","Título",[19,20,25],"pre",{"className":21,"code":23,"language":24},[22],"language-text","calculate\n","text",[26,27,23],"code",{"__ignoreMap":28},"",[14,30,32],{"id":31},"descripción","Descripción",[19,34,37],{"className":35,"code":36,"language":24},[22],"Performs exact arithmetic and advanced numeric operations by executing Python. Use when the agent needs sums, subtractions, multiplications, divisions, percentages, exponents, statistics, financial math, or any numeric result where rounding errors matter — never do mental math even in simple operations.\n",[26,38,36],{"__ignoreMap":28},[14,40,42],{"id":41},"skill","Skill",[19,44,48],{"className":45,"code":46,"language":47,"meta":28,"style":28},"language-markdown shiki shiki-themes slack-ochin one-dark-pro","# Calculate\n\n## Core rule\n\n**Never compute numbers mentally or approximate.** Always run Python and use only the value printed to stdout.\n\n## When to use\n\nApply this skill whenever a response depends on a numeric result:\n\n- Basic arithmetic: `+`, `-`, `*`, `\u002F`, `%`, powers\n- Percentages, ratios, averages, running totals\n- Multi-step expressions with parentheses\n- Advanced math: roots, logarithms, trigonometry, factorials\n- Statistics: mean, median, standard deviation\n- Financial precision: currency, tax, interest\n- Any calculation where a rounding error would mislead the user\n\n## Workflow\n\n1. Identify the expression or algorithm needed\n2. Run it with `python3 -c '...'` (single line) or a heredoc (multiple lines)\n3. Use **only** the value printed to stdout as the result\n4. If execution fails, fix the script and retry — do not estimate\n\n## Execution patterns\n\n### Single expression\n\n```bash\npython3 -c \"print(1234 * 56.78)\"\n```\n\n### Multiple lines \u002F variables\n\n```bash\npython3 \u003C\u003C'PY'\nprincipal = 10000\nrate = 0.05\nyears = 3\nprint(principal * (1 + rate) ** years)\nPY\n```\n\n### Decimal precision (money)\n\n```bash\npython3 -c \"from decimal import Decimal as D; print(D('19.99') * D('3'))\"\n```\n\n### Statistics\n\n```bash\npython3 -c \"import statistics as s; print(s.mean([10, 20, 30]))\"\n```\n\n### Rounding (only at the end, in Python)\n\n```bash\npython3 -c \"print(round(100 \u002F 3, 2))\"\n```\n\n## Allowed libraries\n\nUse Python stdlib only — no pip dependencies:\n\n| Module | Use for |\n|--------|---------|\n| `math` | sqrt, log, trig, factorial, ceil, floor |\n| `decimal` | Fixed-precision decimal arithmetic |\n| `fractions` | Exact rational numbers |\n| `statistics` | mean, median, stdev, variance |\n| `cmath` | Complex numbers |\n\n## Multi-step calculations\n\nPrint intermediate steps when the user needs to follow the logic:\n\n```bash\npython3 \u003C\u003C'PY'\nitems = [19.99, 4.50, 12.00]\nsubtotal = sum(items)\ntax = subtotal * 0.08\ntotal = subtotal + tax\nprint(f\"subtotal={subtotal}\")\nprint(f\"tax={tax}\")\nprint(f\"total={total}\")\nPY\n```\n\n## Presenting results\n\nIn your response:\n\n1. State the problem in plain language\n2. Show the verified result from Python\n3. Include intermediate steps only when they add clarity\n4. Never round in prose without having rounded in Python first\n\n**Example response:**\n\n> The invoice total is $19.99 + $4.50 + $12.00 = $36.49. With 8% tax ($2.92), the final total is **$39.41**.\n\n## Examples\n\n| Scenario | Command | Result |\n|----------|---------|--------|\n| Invoice sum | `python3 -c \"print(19.99 + 4.50 + 12.00)\"` | 36.49 |\n| 15% of 2500 | `python3 -c \"print(2500 * 0.15)\"` | 375.0 |\n| Average | `python3 -c \"import statistics; print(statistics.mean([12, 18, 24]))\"` | 18 |\n| Compound interest | heredoc with `principal`, `rate`, `years` | computed |\n\n## Anti-patterns\n\n- Do not do arithmetic in your head or \"work it out\" without Python\n- Do not use `bc`, `node -e`, or other tools unless `python3` is unavailable\n- Do not round manually in text without explicit `round()` in the script\n- Do not guess when a script fails — fix and re-run\n\n## Fallback\n\nIf `python3` is not available, tell the user and ask before using another method.\n","markdown",[26,49,50,58,65,71,76,82,87,93,98,104,109,115,121,127,133,139,145,151,156,162,167,173,179,185,191,196,202,207,213,218,224,230,236,241,247,252,257,263,269,275,281,287,293,298,303,309,314,319,325,330,335,341,346,351,357,362,367,373,378,383,389,394,399,405,410,416,421,427,433,439,445,451,457,463,468,474,479,485,490,495,500,506,512,518,524,530,536,542,547,552,557,563,568,574,579,585,591,597,603,608,614,619,625,630,636,641,647,653,659,665,671,677,682,688,693,699,705,711,717,722,728,733],{"__ignoreMap":28},[51,52,55],"span",{"class":53,"line":54},"line",1,[51,56,57],{},"# Calculate\n",[51,59,61],{"class":53,"line":60},2,[51,62,64],{"emptyLinePlaceholder":63},true,"\n",[51,66,68],{"class":53,"line":67},3,[51,69,70],{},"## Core rule\n",[51,72,74],{"class":53,"line":73},4,[51,75,64],{"emptyLinePlaceholder":63},[51,77,79],{"class":53,"line":78},5,[51,80,81],{},"**Never compute numbers mentally or approximate.** Always run Python and use only the value printed to stdout.\n",[51,83,85],{"class":53,"line":84},6,[51,86,64],{"emptyLinePlaceholder":63},[51,88,90],{"class":53,"line":89},7,[51,91,92],{},"## When to use\n",[51,94,96],{"class":53,"line":95},8,[51,97,64],{"emptyLinePlaceholder":63},[51,99,101],{"class":53,"line":100},9,[51,102,103],{},"Apply this skill whenever a response depends on a numeric result:\n",[51,105,107],{"class":53,"line":106},10,[51,108,64],{"emptyLinePlaceholder":63},[51,110,112],{"class":53,"line":111},11,[51,113,114],{},"- Basic arithmetic: `+`, `-`, `*`, `\u002F`, `%`, powers\n",[51,116,118],{"class":53,"line":117},12,[51,119,120],{},"- Percentages, ratios, averages, running totals\n",[51,122,124],{"class":53,"line":123},13,[51,125,126],{},"- Multi-step expressions with parentheses\n",[51,128,130],{"class":53,"line":129},14,[51,131,132],{},"- Advanced math: roots, logarithms, trigonometry, factorials\n",[51,134,136],{"class":53,"line":135},15,[51,137,138],{},"- Statistics: mean, median, standard deviation\n",[51,140,142],{"class":53,"line":141},16,[51,143,144],{},"- Financial precision: currency, tax, interest\n",[51,146,148],{"class":53,"line":147},17,[51,149,150],{},"- Any calculation where a rounding error would mislead the user\n",[51,152,154],{"class":53,"line":153},18,[51,155,64],{"emptyLinePlaceholder":63},[51,157,159],{"class":53,"line":158},19,[51,160,161],{},"## Workflow\n",[51,163,165],{"class":53,"line":164},20,[51,166,64],{"emptyLinePlaceholder":63},[51,168,170],{"class":53,"line":169},21,[51,171,172],{},"1. Identify the expression or algorithm needed\n",[51,174,176],{"class":53,"line":175},22,[51,177,178],{},"2. Run it with `python3 -c '...'` (single line) or a heredoc (multiple lines)\n",[51,180,182],{"class":53,"line":181},23,[51,183,184],{},"3. Use **only** the value printed to stdout as the result\n",[51,186,188],{"class":53,"line":187},24,[51,189,190],{},"4. If execution fails, fix the script and retry — do not estimate\n",[51,192,194],{"class":53,"line":193},25,[51,195,64],{"emptyLinePlaceholder":63},[51,197,199],{"class":53,"line":198},26,[51,200,201],{},"## Execution patterns\n",[51,203,205],{"class":53,"line":204},27,[51,206,64],{"emptyLinePlaceholder":63},[51,208,210],{"class":53,"line":209},28,[51,211,212],{},"### Single expression\n",[51,214,216],{"class":53,"line":215},29,[51,217,64],{"emptyLinePlaceholder":63},[51,219,221],{"class":53,"line":220},30,[51,222,223],{},"```bash\n",[51,225,227],{"class":53,"line":226},31,[51,228,229],{},"python3 -c \"print(1234 * 56.78)\"\n",[51,231,233],{"class":53,"line":232},32,[51,234,235],{},"```\n",[51,237,239],{"class":53,"line":238},33,[51,240,64],{"emptyLinePlaceholder":63},[51,242,244],{"class":53,"line":243},34,[51,245,246],{},"### Multiple lines \u002F variables\n",[51,248,250],{"class":53,"line":249},35,[51,251,64],{"emptyLinePlaceholder":63},[51,253,255],{"class":53,"line":254},36,[51,256,223],{},[51,258,260],{"class":53,"line":259},37,[51,261,262],{},"python3 \u003C\u003C'PY'\n",[51,264,266],{"class":53,"line":265},38,[51,267,268],{},"principal = 10000\n",[51,270,272],{"class":53,"line":271},39,[51,273,274],{},"rate = 0.05\n",[51,276,278],{"class":53,"line":277},40,[51,279,280],{},"years = 3\n",[51,282,284],{"class":53,"line":283},41,[51,285,286],{},"print(principal * (1 + rate) ** years)\n",[51,288,290],{"class":53,"line":289},42,[51,291,292],{},"PY\n",[51,294,296],{"class":53,"line":295},43,[51,297,235],{},[51,299,301],{"class":53,"line":300},44,[51,302,64],{"emptyLinePlaceholder":63},[51,304,306],{"class":53,"line":305},45,[51,307,308],{},"### Decimal precision (money)\n",[51,310,312],{"class":53,"line":311},46,[51,313,64],{"emptyLinePlaceholder":63},[51,315,317],{"class":53,"line":316},47,[51,318,223],{},[51,320,322],{"class":53,"line":321},48,[51,323,324],{},"python3 -c \"from decimal import Decimal as D; print(D('19.99') * D('3'))\"\n",[51,326,328],{"class":53,"line":327},49,[51,329,235],{},[51,331,333],{"class":53,"line":332},50,[51,334,64],{"emptyLinePlaceholder":63},[51,336,338],{"class":53,"line":337},51,[51,339,340],{},"### Statistics\n",[51,342,344],{"class":53,"line":343},52,[51,345,64],{"emptyLinePlaceholder":63},[51,347,349],{"class":53,"line":348},53,[51,350,223],{},[51,352,354],{"class":53,"line":353},54,[51,355,356],{},"python3 -c \"import statistics as s; print(s.mean([10, 20, 30]))\"\n",[51,358,360],{"class":53,"line":359},55,[51,361,235],{},[51,363,365],{"class":53,"line":364},56,[51,366,64],{"emptyLinePlaceholder":63},[51,368,370],{"class":53,"line":369},57,[51,371,372],{},"### Rounding (only at the end, in Python)\n",[51,374,376],{"class":53,"line":375},58,[51,377,64],{"emptyLinePlaceholder":63},[51,379,381],{"class":53,"line":380},59,[51,382,223],{},[51,384,386],{"class":53,"line":385},60,[51,387,388],{},"python3 -c \"print(round(100 \u002F 3, 2))\"\n",[51,390,392],{"class":53,"line":391},61,[51,393,235],{},[51,395,397],{"class":53,"line":396},62,[51,398,64],{"emptyLinePlaceholder":63},[51,400,402],{"class":53,"line":401},63,[51,403,404],{},"## Allowed libraries\n",[51,406,408],{"class":53,"line":407},64,[51,409,64],{"emptyLinePlaceholder":63},[51,411,413],{"class":53,"line":412},65,[51,414,415],{},"Use Python stdlib only — no pip dependencies:\n",[51,417,419],{"class":53,"line":418},66,[51,420,64],{"emptyLinePlaceholder":63},[51,422,424],{"class":53,"line":423},67,[51,425,426],{},"| Module | Use for |\n",[51,428,430],{"class":53,"line":429},68,[51,431,432],{},"|--------|---------|\n",[51,434,436],{"class":53,"line":435},69,[51,437,438],{},"| `math` | sqrt, log, trig, factorial, ceil, floor |\n",[51,440,442],{"class":53,"line":441},70,[51,443,444],{},"| `decimal` | Fixed-precision decimal arithmetic |\n",[51,446,448],{"class":53,"line":447},71,[51,449,450],{},"| `fractions` | Exact rational numbers |\n",[51,452,454],{"class":53,"line":453},72,[51,455,456],{},"| `statistics` | mean, median, stdev, variance |\n",[51,458,460],{"class":53,"line":459},73,[51,461,462],{},"| `cmath` | Complex numbers |\n",[51,464,466],{"class":53,"line":465},74,[51,467,64],{"emptyLinePlaceholder":63},[51,469,471],{"class":53,"line":470},75,[51,472,473],{},"## Multi-step calculations\n",[51,475,477],{"class":53,"line":476},76,[51,478,64],{"emptyLinePlaceholder":63},[51,480,482],{"class":53,"line":481},77,[51,483,484],{},"Print intermediate steps when the user needs to follow the logic:\n",[51,486,488],{"class":53,"line":487},78,[51,489,64],{"emptyLinePlaceholder":63},[51,491,493],{"class":53,"line":492},79,[51,494,223],{},[51,496,498],{"class":53,"line":497},80,[51,499,262],{},[51,501,503],{"class":53,"line":502},81,[51,504,505],{},"items = [19.99, 4.50, 12.00]\n",[51,507,509],{"class":53,"line":508},82,[51,510,511],{},"subtotal = sum(items)\n",[51,513,515],{"class":53,"line":514},83,[51,516,517],{},"tax = subtotal * 0.08\n",[51,519,521],{"class":53,"line":520},84,[51,522,523],{},"total = subtotal + tax\n",[51,525,527],{"class":53,"line":526},85,[51,528,529],{},"print(f\"subtotal={subtotal}\")\n",[51,531,533],{"class":53,"line":532},86,[51,534,535],{},"print(f\"tax={tax}\")\n",[51,537,539],{"class":53,"line":538},87,[51,540,541],{},"print(f\"total={total}\")\n",[51,543,545],{"class":53,"line":544},88,[51,546,292],{},[51,548,550],{"class":53,"line":549},89,[51,551,235],{},[51,553,555],{"class":53,"line":554},90,[51,556,64],{"emptyLinePlaceholder":63},[51,558,560],{"class":53,"line":559},91,[51,561,562],{},"## Presenting results\n",[51,564,566],{"class":53,"line":565},92,[51,567,64],{"emptyLinePlaceholder":63},[51,569,571],{"class":53,"line":570},93,[51,572,573],{},"In your response:\n",[51,575,577],{"class":53,"line":576},94,[51,578,64],{"emptyLinePlaceholder":63},[51,580,582],{"class":53,"line":581},95,[51,583,584],{},"1. State the problem in plain language\n",[51,586,588],{"class":53,"line":587},96,[51,589,590],{},"2. Show the verified result from Python\n",[51,592,594],{"class":53,"line":593},97,[51,595,596],{},"3. Include intermediate steps only when they add clarity\n",[51,598,600],{"class":53,"line":599},98,[51,601,602],{},"4. Never round in prose without having rounded in Python first\n",[51,604,606],{"class":53,"line":605},99,[51,607,64],{"emptyLinePlaceholder":63},[51,609,611],{"class":53,"line":610},100,[51,612,613],{},"**Example response:**\n",[51,615,617],{"class":53,"line":616},101,[51,618,64],{"emptyLinePlaceholder":63},[51,620,622],{"class":53,"line":621},102,[51,623,624],{},"> The invoice total is $19.99 + $4.50 + $12.00 = $36.49. With 8% tax ($2.92), the final total is **$39.41**.\n",[51,626,628],{"class":53,"line":627},103,[51,629,64],{"emptyLinePlaceholder":63},[51,631,633],{"class":53,"line":632},104,[51,634,635],{},"## Examples\n",[51,637,639],{"class":53,"line":638},105,[51,640,64],{"emptyLinePlaceholder":63},[51,642,644],{"class":53,"line":643},106,[51,645,646],{},"| Scenario | Command | Result |\n",[51,648,650],{"class":53,"line":649},107,[51,651,652],{},"|----------|---------|--------|\n",[51,654,656],{"class":53,"line":655},108,[51,657,658],{},"| Invoice sum | `python3 -c \"print(19.99 + 4.50 + 12.00)\"` | 36.49 |\n",[51,660,662],{"class":53,"line":661},109,[51,663,664],{},"| 15% of 2500 | `python3 -c \"print(2500 * 0.15)\"` | 375.0 |\n",[51,666,668],{"class":53,"line":667},110,[51,669,670],{},"| Average | `python3 -c \"import statistics; print(statistics.mean([12, 18, 24]))\"` | 18 |\n",[51,672,674],{"class":53,"line":673},111,[51,675,676],{},"| Compound interest | heredoc with `principal`, `rate`, `years` | computed |\n",[51,678,680],{"class":53,"line":679},112,[51,681,64],{"emptyLinePlaceholder":63},[51,683,685],{"class":53,"line":684},113,[51,686,687],{},"## Anti-patterns\n",[51,689,691],{"class":53,"line":690},114,[51,692,64],{"emptyLinePlaceholder":63},[51,694,696],{"class":53,"line":695},115,[51,697,698],{},"- Do not do arithmetic in your head or \"work it out\" without Python\n",[51,700,702],{"class":53,"line":701},116,[51,703,704],{},"- Do not use `bc`, `node -e`, or other tools unless `python3` is unavailable\n",[51,706,708],{"class":53,"line":707},117,[51,709,710],{},"- Do not round manually in text without explicit `round()` in the script\n",[51,712,714],{"class":53,"line":713},118,[51,715,716],{},"- Do not guess when a script fails — fix and re-run\n",[51,718,720],{"class":53,"line":719},119,[51,721,64],{"emptyLinePlaceholder":63},[51,723,725],{"class":53,"line":724},120,[51,726,727],{},"## Fallback\n",[51,729,731],{"class":53,"line":730},121,[51,732,64],{"emptyLinePlaceholder":63},[51,734,736],{"class":53,"line":735},122,[51,737,738],{},"If `python3` is not available, tell the user and ask before using another method.\n",[10,740,741,742,745],{},"Si eres desarrollador puedes agregar fácilmente esta skill mediante ",[26,743,744],{},"npx",":",[19,747,751],{"className":748,"code":749,"language":750,"meta":28,"style":28},"language-bash shiki shiki-themes slack-ochin one-dark-pro","npx skills add andreslqr\u002Fagents --skill calculate\n","bash",[26,752,753],{"__ignoreMap":28},[51,754,755,758,762,765,768,772],{"class":53,"line":54},[51,756,744],{"class":757},"s7MfV",[51,759,761],{"class":760},"s6Mrx"," skills",[51,763,764],{"class":760}," add",[51,766,767],{"class":760}," andreslqr\u002Fagents",[51,769,771],{"class":770},"sDWox"," --skill",[51,773,774],{"class":760}," calculate\n",[776,777,778],"style",{},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .s7MfV, html code.shiki .s7MfV{--shiki-default:#7EB233;--shiki-dark:#61AFEF}html pre.shiki code .s6Mrx, html code.shiki .s6Mrx{--shiki-default:#A44185;--shiki-dark:#98C379}html pre.shiki code .sDWox, html code.shiki .sDWox{--shiki-default:#174781;--shiki-dark:#D19A66}",{"title":28,"searchDepth":60,"depth":60,"links":780},[781,782,783],{"id":16,"depth":60,"text":17},{"id":31,"depth":60,"text":32},{"id":41,"depth":60,"text":42},"2026-07-10","Plantilla de skill para que tu agente calcule operaciones numéricas con precisión","md","\u002Fimages\u002Fcontent\u002Fposts\u002Fcalculate.png",{},null,"\u002Fcalculate",{"title":5,"description":785},"014.calculate",[794,795,796,797],"IA","Cursor","Skills","Claude","CcII-aUpWlIWODwEtHuD80SUwtkOzIBsCKVWqYK163U",1784575165764]