Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add williamzujkowski/standards --skill advanced-optimizationgit clone --depth 1 https://github.com/williamzujkowski/standardsWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/williamzujkowski/standards/advanced-optimization)<a href="https://agentmods.dev/skills/williamzujkowski/standards/advanced-optimization"><img src="https://agentmods.dev/badge/skills/williamzujkowski/standards/advanced-optimization/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/williamzujkowski/standards/advanced-optimization"><img src="https://agentmods.dev/badge/skills/williamzujkowski/standards/advanced-optimization.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00015 | $0.04105 |
| Opus 5.5 | $0.00006 | $0.01642 |
| Sonnet 5.5 | $0.00003 | $0.00821 |
| Haiku 4.5 | $0.00002 | $0.00411 |
Grade A, and why
database-advanced-optimization scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
This is a copy
94% identical to graphql-api-design — 680 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.
How it starts
The opening of the file, as written. The whole thing — 743 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Database Advanced Optimization
Level 1: Quick Reference (5 minutes)
Database Selection Guide
Use SQL (PostgreSQL) when:
- ACID compliance is critical
- Complex joins and transactions required
- Data has clear relational structure
- Strong consistency needed
- Rich query capabilities required
Use NoSQL (MongoDB) when:
- Flexible schema needed
- Horizontal scaling is priority
- Document-oriented data model fits
- High write throughput required
- Eventual consistency acceptable
Use In-Memory (Redis) when:
- Sub-millisecond latency required
- Caching layer needed
- Real-time features (pub/sub, streams)
- Session management
- Rate limiting or counters
Common Optimization Patterns
-- PostgreSQL: Create covering index
CREATE INDEX idx_orders_user_date ON orders(user_id, created_at)
INCLUDE (status, total_amount);
-- PostgreSQL: Analyze query plan
EXPLAIN (ANALYZE, BUFFERS)
SELECT * FROM orders WHERE user_id = 123;
// MongoDB: Create compound index
db.orders.createIndex({ userId: 1, createdAt: -1 }, { background: true });
// MongoDB: Use aggregation pipeline efficiently
db.orders.aggregate([
{ $match: { status: "pending" } },
{ $sort: { createdAt: -1 } },
{ $limit: 100 }
]);
# Redis: Implement cache-aside pattern
def get_user(user_id):
cache_key = f"user:{user_id}"
user = redis.get(cache_key)
if user is None:
user = db.query("SELECT * FROM users WHERE id = %s", user_id)
redis.setex(cache_key, 3600, json.dumps(user))
return json.loads(user)
Essential Optimization Checklist
PostgreSQL
- Create appropriate indexes (B-tree, GIN, GiST)
- Analyze query plans with EXPLAIN ANALYZE
- Configure autovacuum appropriately
- Set up connection pooling (PgBouncer)
- Monitor with pg_stat_statements
- Optimize shared_buffers and work_mem
- Configure appropriate WAL settings
MongoDB
- Design effective shard keys
- Create compound indexes for common queries
- Enable profiler for slow queries
- Configure replica sets for read scaling
- Optimize aggregation pipelines
- Set appropriate write concerns
- Monitor with MongoDB Compass/Atlas
What ships with it
8 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- yesterday First seen · 743 lines · 15 tokens per session scan A e7429a9a4238
database-advanced-optimization is a skill published in the GitHub repository williamzujkowski/standards (18 stars, last pushed 1mo ago), licensed MIT. It adds 15 tokens to every session and 4,105 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. It is 94% identical to graphql-api-design, differing in 680 lines, and is treated as a copy.
Other skills, from other repositories
database-engineer
!cat skills/shared/protocols/ux-protocol.md 2>/dev/null || true !cat skills/shared/protocols/input-validation.md 2>/dev/null || true !cat skills/shared/protocols/tool-efficiency.md 2>/dev/null || true !cat .production-grade.yaml 2>/dev/null || echo "No config — using defaults" !cat .forgewright/codebase-context.md…
database-management-patterns
Comprehensive guide for database management patterns covering PostgreSQL and MongoDB including schema design, indexing, transactions, replication, and performance tuning.
PostgreSQL Performance Optimization
Production-grade PostgreSQL query optimization, indexing strategies, performance tuning, and modern features including pgvector for AI/ML workloads. Master EXPLAIN plans, query analysis, and database design for high-performance applications.
database-query
Natural language database queries with multi-database support, query optimization, and visual results.
postgresql-expert
Expert-level PostgreSQL database administration, advanced queries, performance tuning, and production operations. Use when the user mentions database, SQL, or performance, or when the task involves Advanced Data Types, Full-Text Search, Advanced Indexes, or Advanced Queries.
database-enumeration
Database service enumeration and quick-win access checks for MSSQL, MySQL, PostgreSQL, Oracle, MongoDB, and Redis. Checks default/empty passwords, unauthenticated access, and command execution capabilities. Use after network-recon identifies database ports.