Skip to content

Best Practices & Patterns

This section describes architectural patterns and best practices for building robust, secure, and high-quality tools within the aifred-tk ecosystem.

Following these patterns ensures that your tools behave consistently across different execution environments (CLI, MCP, etc.) and provide the best possible experience for both users and the LLMs driving them.

Core Patterns

General Principles

  1. Environment Agnostic: Tools should work equally well in a terminal or inside an MCP client.
  2. Security First: Always assume external data (files, URLs, user input) is untrusted.
  3. Lazy Loading: Don't fail the entire toolkit just because one tool is missing a configuration key.
  4. Human-in-the-Loop: High-stakes decisions should always be validated by a human.