Skip to content

Instantly share code, notes, and snippets.

View KiranMantha's full-sized avatar
🎯
Focusing on PlumeJS

Kiran Mantha KiranMantha

🎯
Focusing on PlumeJS
View GitHub Profile
@KiranMantha
KiranMantha / code-execution-priority.md
Last active January 20, 2026 06:16
Javascript code execution priority

JavaScript doesn’t just run code in order — it maintains multiple queues with different priorities:

  • Call Stack: Currently executing code (highest priority)
  • Microtask Queue: Promises, queueMicrotask, MutationObserver
  • Macrotask Queue: setTimeout, setInterval, I/O, UI events
  • Render Queue: requestAnimationFrame, style/layout/paint
console.log('1: Sync');
setTimeout(() => console.log('2: Macro'), 0);

Claude Code TeammateTool - Source Code Analysis

This is not a proposal. This documents existing but hidden functionality found in Claude Code v2.1.19 binary, plus speculation on how it could be used.


Executive Summary

TeammateTool already exists in Claude Code. We extracted this from the compiled binary at ~/.local/share/claude/versions/2.1.19 using strings analysis. The feature is fully implemented but gated behind feature flags (I9() && qFB()).

@KiranMantha
KiranMantha / nextjs-cloudflare-cache.md
Last active April 24, 2026 11:30
Nextjs 14.x page router cloudflare caching

Original Issue Link: vercel/next.js#47516

Fixing Next.js + Cloudflare caching issue for _next/data with x-middleware-prefetch

When using Next.js Pages Router with getServerSideProps behind Cloudflare CDN, I ran into an issue where client-side navigations were repeatedly hitting the origin and, in some cases, rendering blank pages.

This was especially visible for routes backed by AEM Sling Models using a catch-all slug page.


@KiranMantha
KiranMantha / object-vs-map.md
Last active April 29, 2026 14:37
{} vs Map

{} vs Map

For simple use cases, plain objects work fine. However, Maps were specifically designed to be "true" hash tables, fixing several edge cases where objects fail or get messy. Here is what you gain by using a Map over a plain Object:

1. Key Flexibility

  • Object: Keys must be Strings or Symbols. If you try to use a number or an object as a key, it gets forced into a string (e.g., {: 'val'} becomes {"1": 'val'}).
  • Map: Any value can be a key, including functions, objects, or any primitive. This is huge for associating data with DOM elements or complex state.
@KiranMantha
KiranMantha / readme.md
Last active May 8, 2026 06:44
The Roadmap to Mastering Tool Calling in AI Agents

The Roadmap to Mastering Tool Calling in AI Agents

In this article, you will learn how to design, scale, and secure tool calling in AI agents so that the layer connecting model reasoning to real-world action holds up in production.

Topics we will cover include:

  • How the tool calling protocol separates model reasoning from deterministic execution, and why that boundary matters.
  • How to write tool definitions, error handling, and parallelization strategies that stay reliable as your agent scales.
  • How to manage tool catalog size, secure agentic systems, and evaluate tool calls beyond end-to-end task success.

The Roadmap to Mastering Tool Calling in AI Agents

@KiranMantha
KiranMantha / readme.md
Last active May 27, 2026 13:00
Validate creditcard without BE but using Luhn's algorithm and card rules

The Luhn algorithm (or "modulus 10") is a simple checksum formula used to validate identification numbers like credit cards and IMEI codes. It is designed to catch accidental input errors, such as mistyped digits.

Luhn's Algo

Algo Logic:

To calculate or validate using the Luhn formula:

  • Double every second digit starting from the rightmost digit (the check digit) and moving left.
  • Sum the digits if any doubled product is greater than 9 (e.g., if (6 \times 2 = 12), add (1+2=3)).
  • Alternatively, subtract 9.Sum all numbers (both the untouched digits and the newly modified doubled digits).