Works with the AI Agents you already use
Local LLM Code Architect & Token Optimizer
by Tushar
Supercharge local LLMs (Qwen 2.5, DeepSeek, Llama 3) for large codebases. Enforces strict context budgeting, AST-guided diffing, and zero-hallucination planning.
$5
/moSubscription · cancel anytime
Secure checkout via Stripe
- Always the latest version
- Delivered live to your agent via MCP
- Cancel anytime, access ends at period end
Local LLM Code Architect & Token Optimizer
Example session with this skill installed
Refactor 'src/auth/session.ts' to add a Redis cache layer for user lookups before hitting Prisma. Keep it token-efficient for my local Qwen 2.5-Coder 14B model without rewriting the entire 450-line file.
- Read your context and instructions
- Compiled the local llm code
Summary
Compressed architectural context for src/auth/session.ts from 1,840 tokens down to 185 tokens (-89.9% reduction) and applied surgical Redis session caching without touching untouched methods.
| Metric | Full File Prompting | Context-Budgeted AST Approach |
|---|---|---|
| Prompt Token Consumption | 1,840 tokens | 185 tokens (-89.9%) |
| Response Latency (Local 14B) | 14.8 seconds | 2.9 seconds |
Risk of Truncation (// ... rest) | High (Common on 7B/14B) | 0% (Enforced Surgical Diff) |
| Files Modified | Full destructive overwrite | Surgical 18-line diff block |
1. Token-Budgeted AST Context Skeleton
// src/auth/session.ts (Compressed Skeleton)
export interface UserSessionPayload { userId: string; role: 'admin' | 'member'; }
export class AuthenticationMiddleware {
public verifySession = async (req: AuthenticatedRequest, res: Response, next: NextFunction): Promise<void>;
}
2. Surgical Search-and-Replace Block (src/auth/session.ts)
<<<<<<< SEARCH
const userExists = await db.user.findUnique({
where: { id: decoded.userId },
select: { id: true, active: true, role: true }
});
=======
// 1. Check Redis fast memory cache first
let userExists: any = null;
try {
const cached = await redisClient.get(`user:session:${decoded.userId}`);
if (cached) userExists = JSON.parse(cached);
} catch (cacheErr) {
logger.warn('Redis cache lookup failed, falling back to DB', { error: cacheErr });
}
// 2. Fallback to PostgreSQL via Prisma if cache miss
if (!userExists) {
userExists = await db.user.findUnique({
where: { id: decoded.userId },
select: { id: true, active: true, role: true }
});
if (userExists) {
await redisClient.setEx(`user:session:${decoded.userId}`, 300, JSON.stringify(userExists)).catch(() => {});
}
}
>>>>>>>
3. Dependency Verification Check
- Confirmed
ioredis/redispackage is installed inpackage.json. - Confirmed
redisClientinstance is exported fromsrc/utils/redis.ts.
Next steps
- Review and apply the surgical diff block above.
- Run
npm test -- test/auth/session.test.tsto verify the Redis fallback and cache-hit behavior.
Subscription · always the latest version
- Secure checkout via Stripe
- Cancel anytime
- Delivered live via MCP
About this skill
Turn Local Open-Weight Coding LLMs Into 10x Senior Software Engineers
Running local models like Qwen 2.5-Coder 7B/14B/32B, DeepSeek-Coder, or Llama 3 Code on your own hardware gives you total privacy and zero API bills. But on real production codebases, local models often fall flat:
- They choke on large 500+ line files, blowing through their effective attention window.
- They emit lazy shortcuts like
// ... rest of code stays the same ...that wipe out your source code. - They rewrite entire multi-hundred line files just to update one variable, introducing syntax bugs.
- They hallucinate fake npm/pip packages that don't exist.
Local LLM Code Architect solves these systemic problems with structured AST context extraction, strict context window budgeting, and precision surgical search-and-replace protocols.
Key Capabilities
- 70%–90% Context Reduction: Bundled
context_budgeter.pyextracts public class/type interfaces and function signatures, keeping local models well within their high-attention token budget. - Eliminates Truncation Bugs: Enforces strict bans on placeholder comments (
// ... rest unchanged) and mandates verifiable surgical diffs. - Zero Phantom Packages: Enforces pre-flight dependency checking against
package.jsonandpyproject.tomlbefore writing code. - Universal Compatibility: Works seamlessly with Ollama, LM Studio, vLLM, Cursor with local endpoints, Claude Code, and Copilot.
- Includes AST CLI: Run
python scripts/context_budgeter.py ./src --budget 3000to prepare token-efficient context prompts automatically.
Requires Python for the context_budgeter.py script. Cannot automatically install missing system-level binaries.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Free to use
No account required to browse
Trust & safety
Security scan
Security scan passed 13 days ago
- Software
Python 3.9+
Zero cloud dependencies. Runs entirely on your local machine with full data privacy. Compatible with any local LLM runner (Ollama, LM Studio, vLLM).
Permissions
File Scopes
What's inside
Frequently Asked Questions
New in LLM Ops
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for LLM Ops.