Initial commit
This commit is contained in:
@@ -0,0 +1,75 @@
|
||||
{pkgs}: let
|
||||
formatterBins = {
|
||||
alejandra = "${pkgs.alejandra}/bin/alejandra";
|
||||
biome = "${pkgs.biome}/bin/biome";
|
||||
oxfmt = "${pkgs.oxfmt}/bin/oxfmt";
|
||||
shfmt = "${pkgs.shfmt}/bin/shfmt";
|
||||
};
|
||||
|
||||
lspBins = {
|
||||
astro-ls = "${pkgs.astro-language-server}/bin/astro-ls";
|
||||
biome = "${pkgs.biome}/bin/biome";
|
||||
marksman = "${pkgs.marksman}/bin/marksman";
|
||||
nil = "${pkgs.nil}/bin/nil";
|
||||
tailwindcss = "${pkgs.tailwindcss-language-server}/bin/tailwindcss-language-server";
|
||||
volar = "${pkgs.vue-language-server}/bin/vue-language-server";
|
||||
};
|
||||
in {
|
||||
packages = with pkgs; [
|
||||
astro-language-server
|
||||
biome
|
||||
marksman
|
||||
nil
|
||||
tailwindcss-language-server
|
||||
vue-language-server
|
||||
alejandra
|
||||
oxfmt
|
||||
shfmt
|
||||
];
|
||||
|
||||
formatter = {
|
||||
shfmt = {
|
||||
command = [formatterBins.shfmt "-i" "2"];
|
||||
extensions = ["sh" "bash"];
|
||||
};
|
||||
oxfmt = {
|
||||
command = [formatterBins.oxfmt];
|
||||
extensions = ["yaml" "js" "json" "jsx" "md" "ts" "tsx" "css" "html" "vue"];
|
||||
};
|
||||
biome = {
|
||||
command = [formatterBins.biome "format" "--stdin-file-path"];
|
||||
extensions = ["astro"];
|
||||
};
|
||||
alejandra = {
|
||||
command = [formatterBins.alejandra "-q"];
|
||||
extensions = ["nix"];
|
||||
};
|
||||
};
|
||||
|
||||
lsp = {
|
||||
astro-ls = {
|
||||
command = [lspBins.astro-ls "--stdio"];
|
||||
extensions = ["astro"];
|
||||
};
|
||||
biome = {
|
||||
command = [lspBins.biome "lsp-proxy"];
|
||||
extensions = ["js" "ts" "json" "jsx" "tsx"];
|
||||
};
|
||||
nil = {
|
||||
command = [lspBins.nil];
|
||||
extensions = ["nix"];
|
||||
};
|
||||
marksman = {
|
||||
command = [lspBins.marksman];
|
||||
extensions = ["md"];
|
||||
};
|
||||
tailwindcss = {
|
||||
command = [lspBins.tailwindcss "--stdio"];
|
||||
extensions = ["css" "html"];
|
||||
};
|
||||
volar = {
|
||||
command = [lspBins.volar "--stdio"];
|
||||
extensions = ["vue"];
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,141 @@
|
||||
{
|
||||
config = {
|
||||
google = {
|
||||
npm = "@ai-sdk/google";
|
||||
models = {
|
||||
antigravity-gemini-3-pro = {
|
||||
name = "Gemini 3 Pro (Antigravity)";
|
||||
limit = {
|
||||
context = 1048576;
|
||||
output = 65535;
|
||||
};
|
||||
modalities = {
|
||||
input = ["text" "image" "pdf"];
|
||||
output = ["text"];
|
||||
};
|
||||
variants = {
|
||||
low = {thinkingLevel = "low";};
|
||||
high = {thinkingLevel = "high";};
|
||||
};
|
||||
};
|
||||
antigravity-gemini-3-flash = {
|
||||
name = "Gemini 3 Flash (Antigravity)";
|
||||
limit = {
|
||||
context = 1048576;
|
||||
output = 65536;
|
||||
};
|
||||
modalities = {
|
||||
input = ["text" "image" "pdf"];
|
||||
output = ["text"];
|
||||
};
|
||||
variants = {
|
||||
minimal = {thinkingLevel = "minimal";};
|
||||
low = {thinkingLevel = "low";};
|
||||
medium = {thinkingLevel = "medium";};
|
||||
high = {thinkingLevel = "high";};
|
||||
};
|
||||
};
|
||||
antigravity-claude-sonnet-4-5 = {
|
||||
name = "Claude Sonnet 4.5 (Antigravity)";
|
||||
limit = {
|
||||
context = 200000;
|
||||
output = 64000;
|
||||
};
|
||||
modalities = {
|
||||
input = ["text" "image" "pdf"];
|
||||
output = ["text"];
|
||||
};
|
||||
};
|
||||
antigravity-claude-sonnet-4-5-thinking = {
|
||||
name = "Claude Sonnet 4.5 Thinking (Antigravity)";
|
||||
limit = {
|
||||
context = 200000;
|
||||
output = 64000;
|
||||
};
|
||||
modalities = {
|
||||
input = ["text" "image" "pdf"];
|
||||
output = ["text"];
|
||||
};
|
||||
variants = {
|
||||
low = {thinkingConfig = {thinkingBudget = 8192;};};
|
||||
max = {thinkingConfig = {thinkingBudget = 32768;};};
|
||||
};
|
||||
};
|
||||
antigravity-claude-opus-4-5-thinking = {
|
||||
name = "Claude Opus 4.5 Thinking (Antigravity)";
|
||||
limit = {
|
||||
context = 200000;
|
||||
output = 64000;
|
||||
};
|
||||
modalities = {
|
||||
input = ["text" "image" "pdf"];
|
||||
output = ["text"];
|
||||
};
|
||||
variants = {
|
||||
low = {thinkingConfig = {thinkingBudget = 8192;};};
|
||||
max = {thinkingConfig = {thinkingBudget = 32768;};};
|
||||
};
|
||||
};
|
||||
antigravity-claude-opus-4-6-thinking = {
|
||||
name = "Claude Opus 4.6 Thinking (Antigravity)";
|
||||
limit = {
|
||||
context = 200000;
|
||||
output = 64000;
|
||||
};
|
||||
modalities = {
|
||||
input = ["text" "image" "pdf"];
|
||||
output = ["text"];
|
||||
};
|
||||
variants = {
|
||||
low = {thinkingConfig = {thinkingBudget = 8192;};};
|
||||
max = {thinkingConfig = {thinkingBudget = 32768;};};
|
||||
};
|
||||
};
|
||||
gemini-2-5-flash = {
|
||||
name = "Gemini 2.5 Flash (Gemini CLI)";
|
||||
limit = {
|
||||
context = 1048576;
|
||||
output = 65536;
|
||||
};
|
||||
modalities = {
|
||||
input = ["text" "image" "pdf"];
|
||||
output = ["text"];
|
||||
};
|
||||
};
|
||||
gemini-2-5-pro = {
|
||||
name = "Gemini 2.5 Pro (Gemini CLI)";
|
||||
limit = {
|
||||
context = 1048576;
|
||||
output = 65536;
|
||||
};
|
||||
modalities = {
|
||||
input = ["text" "image" "pdf"];
|
||||
output = ["text"];
|
||||
};
|
||||
};
|
||||
gemini-3-flash-preview = {
|
||||
name = "Gemini 3 Flash Preview (Gemini CLI)";
|
||||
limit = {
|
||||
context = 1048576;
|
||||
output = 65536;
|
||||
};
|
||||
modalities = {
|
||||
input = ["text" "image" "pdf"];
|
||||
output = ["text"];
|
||||
};
|
||||
};
|
||||
gemini-3-pro-preview = {
|
||||
name = "Gemini 3 Pro Preview (Gemini CLI)";
|
||||
limit = {
|
||||
context = 1048576;
|
||||
output = 65535;
|
||||
};
|
||||
modalities = {
|
||||
input = ["text" "image" "pdf"];
|
||||
output = ["text"];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
{pkgs}: let
|
||||
fetchSkill = {
|
||||
name,
|
||||
owner,
|
||||
repo,
|
||||
rev,
|
||||
path,
|
||||
hash,
|
||||
}:
|
||||
pkgs.stdenv.mkDerivation {
|
||||
name = "opencode-skill-${name}";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
inherit owner repo rev hash;
|
||||
};
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out
|
||||
cp ${path} $out/SKILL.md
|
||||
'';
|
||||
};
|
||||
|
||||
fetchSkillDir = {
|
||||
name,
|
||||
owner,
|
||||
repo,
|
||||
rev,
|
||||
basePath,
|
||||
hash,
|
||||
}:
|
||||
pkgs.stdenv.mkDerivation {
|
||||
name = "opencode-skill-${name}";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
inherit owner repo rev hash;
|
||||
};
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out
|
||||
cp -r ${basePath}/* $out/
|
||||
'';
|
||||
};
|
||||
|
||||
localSkill = {
|
||||
name,
|
||||
path,
|
||||
}:
|
||||
pkgs.stdenv.mkDerivation {
|
||||
name = "opencode-skill-${name}";
|
||||
src = path;
|
||||
installPhase = ''
|
||||
mkdir -p $out
|
||||
cp SKILL.md $out/SKILL.md
|
||||
'';
|
||||
};
|
||||
|
||||
skills = {
|
||||
technical-writing = fetchSkill {
|
||||
name = "technical-writing";
|
||||
owner = "proffesor-for-testing";
|
||||
repo = "agentic-qe";
|
||||
rev = "990aee4a6a747f2db0ef77a2f67d58462f61e608";
|
||||
path = ".claude/skills/technical-writing/SKILL.md";
|
||||
hash = "sha256-PdIVhLp5/quigz325ZeG4NaWUgPsD3PgykSD61FFjLo=";
|
||||
};
|
||||
|
||||
blog-post-writer = fetchSkillDir {
|
||||
name = "blog-post-writer";
|
||||
owner = "nicknisi";
|
||||
repo = "dotfiles";
|
||||
rev = "f1be3f2b669c8e3401b589141f9a56651e45a1a7";
|
||||
basePath = "home/.claude/skills/blog-post-writer";
|
||||
hash = "sha256-U1GqtQMgzimGbbDJpqIGrBnu5HiSTZDETAKFhijMU9s=";
|
||||
};
|
||||
|
||||
frontend-design = fetchSkill {
|
||||
name = "frontend-design";
|
||||
owner = "anthropics";
|
||||
repo = "claude-code";
|
||||
rev = "d213a74fc8e3b6efded52729196e0c2d4c3abb3e";
|
||||
path = "plugins/frontend-design/skills/frontend-design/SKILL.md";
|
||||
hash = "sha256-SleLxTUjM7HNHc78YklikuFwix2DPaTDIACUnsSQCrA=";
|
||||
};
|
||||
|
||||
flutter-development = fetchSkill {
|
||||
name = "flutter-development";
|
||||
owner = "aj-geddes";
|
||||
repo = "useful-ai-prompts";
|
||||
rev = "ce8c39c22df0e0e64c853817a7f8d79f0ea331e2";
|
||||
path = "skills/flutter-development/SKILL.md";
|
||||
hash = "sha256-BCvO+P2URoTiUOSV8PTq62ckyxXLEHtIml0EkZGRbK8=";
|
||||
};
|
||||
|
||||
writing-documentation = fetchSkillDir {
|
||||
name = "writing-documentation";
|
||||
owner = "dhruvbaldawa";
|
||||
repo = "ccconfigs";
|
||||
rev = "451b604718d39fcc2c008d22e550bdf60c7115da";
|
||||
basePath = "essentials/skills/writing-documentation";
|
||||
hash = "sha256-7V1xG2FmzqWdnWmVV6WWKBAvY6QHWo+UKzh0Uu/Xg/w=";
|
||||
};
|
||||
|
||||
changelog-generator = fetchSkill {
|
||||
name = "changelog-generator";
|
||||
owner = "composioHQ";
|
||||
repo = "awesome-claude-skills";
|
||||
rev = "362d35428562ad05d1faa1767abaf39d6e3a8e7a";
|
||||
path = "changelog-generator/SKILL.md";
|
||||
hash = "sha256-tSEO0h9J3lPVePFoy7A7c1K6umNNE/21/2RbaJD4Abc=";
|
||||
};
|
||||
|
||||
readme-generator = fetchSkill {
|
||||
name = "readme-generator";
|
||||
owner = "Shpigford";
|
||||
repo = "skills";
|
||||
rev = "bdd6f84e38e460246079dd44755c587522ddf60e";
|
||||
path = "readme/SKILL.md";
|
||||
hash = "sha256-M6ZSxwrq9tGkxJi6BVoSRh6+fPlQPUmZVg595wldsNI=";
|
||||
};
|
||||
|
||||
memory-aware-architect = localSkill {
|
||||
name = "memory-aware-architect";
|
||||
path = ./skills/memory-aware-architect;
|
||||
};
|
||||
};
|
||||
|
||||
allSkills = pkgs.runCommand "opencode-skills" {} ''
|
||||
mkdir -p $out/skill
|
||||
|
||||
${pkgs.lib.concatStringsSep "\n" (pkgs.lib.mapAttrsToList (name: skill: ''
|
||||
mkdir -p $out/skill/${name}
|
||||
cp -r ${skill}/* $out/skill/${name}/
|
||||
'')
|
||||
skills)}
|
||||
'';
|
||||
in {
|
||||
packages = [];
|
||||
skillsSource = allSkills;
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
{pkgs, ...}: let
|
||||
languages = import ./_languages.nix {inherit pkgs;};
|
||||
providers = import ./_providers.nix;
|
||||
skills = import ./_skills.nix {inherit pkgs;};
|
||||
|
||||
inherit (pkgs) opencode;
|
||||
|
||||
opencodeEnv = pkgs.buildEnv {
|
||||
name = "opencode-env";
|
||||
paths =
|
||||
languages.packages
|
||||
++ skills.packages;
|
||||
};
|
||||
opencodeInitScript = pkgs.writeShellScript "opencode-init" ''
|
||||
mkdir -p "$HOME/.local/cache/opencode/node_modules/@opencode-ai"
|
||||
mkdir -p "$HOME/.config/opencode/node_modules/@opencode-ai"
|
||||
if [ -d "$HOME/.config/opencode/node_modules/@opencode-ai/plugin" ]; then
|
||||
if [ ! -L "$HOME/.local/cache/opencode/node_modules/@opencode-ai/plugin" ]; then
|
||||
ln -sf "$HOME/.config/opencode/node_modules/@opencode-ai/plugin" \
|
||||
"$HOME/.local/cache/opencode/node_modules/@opencode-ai/plugin"
|
||||
fi
|
||||
fi
|
||||
exec ${opencode}/bin/opencode "$@"
|
||||
'';
|
||||
opencodeWrapped =
|
||||
pkgs.runCommand "opencode-wrapped" {
|
||||
buildInputs = [pkgs.makeWrapper];
|
||||
} ''
|
||||
mkdir -p $out/bin
|
||||
makeWrapper ${opencodeInitScript} $out/bin/opencode \
|
||||
--prefix PATH : ${opencodeEnv}/bin \
|
||||
--prefix LD_LIBRARY_PATH : "${pkgs.lib.makeLibraryPath [pkgs.stdenv.cc.cc.lib]}"
|
||||
'';
|
||||
configFile = "opencode/config.json";
|
||||
tuiFile = "opencode/tui.json";
|
||||
in {
|
||||
users.users.someone.packages = [
|
||||
opencodeWrapped
|
||||
];
|
||||
xdg.configFile = {
|
||||
"${configFile}".text = builtins.toJSON {
|
||||
"$schema" = "https://opencode.ai/config.json";
|
||||
plugin = [
|
||||
"opencode-antigravity-auth@latest"
|
||||
"@tarquinen/opencode-dcp@latest"
|
||||
"oh-my-openagent@latest"
|
||||
];
|
||||
small_model = "google/gemma-3n-e4b-it:free";
|
||||
autoupdate = false;
|
||||
share = "disabled";
|
||||
disabled_providers = [
|
||||
"amazon-bedrock"
|
||||
"anthropic"
|
||||
"azure-openai"
|
||||
"azure-cognitive-services"
|
||||
"baseten"
|
||||
"cerebras"
|
||||
"cloudflare-ai-gateway"
|
||||
"cortecs"
|
||||
"deep-infra"
|
||||
"fireworks-ai"
|
||||
"google-vertex-ai"
|
||||
"groq"
|
||||
"hugging-face"
|
||||
"helicone"
|
||||
"llama.cpp"
|
||||
"io-net"
|
||||
"lmstudio"
|
||||
"moonshot-ai"
|
||||
"nebius-token-factory"
|
||||
"ollama"
|
||||
"ollama-cloud"
|
||||
"openai"
|
||||
"sap-ai-core"
|
||||
"ovhcloud-ai-endpoints"
|
||||
"together-ai"
|
||||
"venice-ai"
|
||||
"xai"
|
||||
"zai"
|
||||
"zenmux"
|
||||
];
|
||||
enabled_providers = ["opencode" "google" "openrouter"];
|
||||
mcp = {
|
||||
gh_grep = {
|
||||
type = "remote";
|
||||
url = "https://mcp.grep.app/";
|
||||
enabled = true;
|
||||
timeout = 10000;
|
||||
};
|
||||
deepwiki = {
|
||||
type = "remote";
|
||||
url = "https://mcp.deepwiki.com/mcp";
|
||||
enabled = true;
|
||||
timeout = 10000;
|
||||
};
|
||||
context7 = {
|
||||
type = "remote";
|
||||
url = "https://mcp.context7.com/mcp";
|
||||
enabled = true;
|
||||
timeout = 10000;
|
||||
};
|
||||
};
|
||||
inherit (languages) formatter lsp;
|
||||
provider = providers.config;
|
||||
};
|
||||
"${tuiFile}".text = builtins.toJSON {
|
||||
"$schema" = "https://opencode.ai/tui.json";
|
||||
theme = "gruvbox";
|
||||
};
|
||||
"opencode/skill".source = skills.skillsSource + "/skill";
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,190 @@
|
||||
---
|
||||
name: memory-aware-architect
|
||||
description: Mandatory persistent memory integration for project development. Use when working on any codebase that uses opencode-mem for context persistence. Always searches memory before planning, coding, refactoring, or debugging. Suggests adding new facts after completing significant tasks. Works with any programming language, framework, or architecture style.
|
||||
license: MIT
|
||||
---
|
||||
|
||||
# Memory-Aware Architect
|
||||
|
||||
## Core Workflow (Mandatory)
|
||||
|
||||
### 1. Search Memory First (Required at Task Start)
|
||||
|
||||
Before responding to any architecture, refactoring, feature implementation, debugging, or project-related query, execute one or more semantic searches in persistent memory using the `memory` tool.
|
||||
|
||||
Craft specific, descriptive queries based on the user's task and the project context:
|
||||
|
||||
```javascript
|
||||
// Architecture & design patterns
|
||||
memory({ mode: "search", query: "architecture pattern layers components structure" })
|
||||
|
||||
// Technology stack & frameworks
|
||||
memory({ mode: "search", query: "framework library dependencies tech stack" })
|
||||
|
||||
// Error handling & logging
|
||||
memory({ mode: "search", query: "error handling logging monitoring patterns" })
|
||||
|
||||
// Testing strategy
|
||||
memory({ mode: "search", query: "testing unit integration e2e test patterns" })
|
||||
|
||||
// Specific features or modules
|
||||
memory({ mode: "search", query: "authentication user management JWT session" })
|
||||
memory({ mode: "search", query: "database schema models relationships ORM" })
|
||||
memory({ mode: "search", query: "API endpoints routes controllers handlers" })
|
||||
```
|
||||
|
||||
**Key principles for effective searches:**
|
||||
- Include relevant technical terms from the user's request
|
||||
- Search for both broad patterns and specific implementations
|
||||
- When user mentions modules/components/features, include those exact terms
|
||||
- Run multiple searches if the task involves different aspects (e.g., frontend + backend + database)
|
||||
|
||||
### 2. Integrate Retrieved Facts
|
||||
|
||||
- Use retrieved memories to inform all planning, reasoning, and code generation
|
||||
- Never re-explain concepts, patterns, or decisions already stored in memory
|
||||
- Trust the existing memory over assumptions—the project has its own conventions
|
||||
- If critical context is missing, ask for clarification—but prioritize existing memory content
|
||||
- If no relevant memories found, mention: "No prior context found in memory for [topic]"
|
||||
|
||||
### 3. Add New Knowledge (After Significant Work)
|
||||
|
||||
After completing important tasks (refactors, new features, architectural decisions, significant fixes), identify valuable new knowledge and suggest adding it to memory:
|
||||
|
||||
```javascript
|
||||
memory({ mode: "add", content: "[concise, precise description of new decision/implementation]" })
|
||||
```
|
||||
|
||||
**What makes good memory content:**
|
||||
- Architectural decisions and their rationale
|
||||
- Established patterns and conventions
|
||||
- Technology choices and configuration details
|
||||
- Non-obvious implementation details
|
||||
- Gotchas, edge cases, or lessons learned
|
||||
- Integration patterns between components
|
||||
- Performance optimizations applied
|
||||
|
||||
**Examples across different project types:**
|
||||
|
||||
```javascript
|
||||
// Frontend project
|
||||
memory({ mode: "add", content: "Use React.memo() for all list item components to prevent unnecessary re-renders; measured 40% performance improvement" })
|
||||
|
||||
// Backend API
|
||||
memory({ mode: "add", content: "All API endpoints use middleware chain: auth → rate-limit → validation → controller; defined in src/middleware/index.js" })
|
||||
|
||||
// Database
|
||||
memory({ mode: "add", content: "User sessions table uses UUID v4 for session_id with 24-hour TTL; cleanup cron runs daily at 3 AM UTC" })
|
||||
|
||||
// DevOps
|
||||
memory({ mode: "add", content: "Deploy staging with 'npm run deploy:staging'; auto-runs migrations and health checks before traffic switch" })
|
||||
|
||||
// Architecture decision
|
||||
memory({ mode: "add", content: "Switched from REST to GraphQL for mobile API to reduce over-fetching; web still uses REST for caching benefits" })
|
||||
```
|
||||
|
||||
## Universal Best Practices
|
||||
|
||||
These guidelines apply regardless of project type, but always defer to project-specific patterns stored in memory:
|
||||
|
||||
### Memory-First Mindset
|
||||
- **Always search before assuming** - The project may have established conventions
|
||||
- **Consistency over cleverness** - Follow existing patterns even if you'd do it differently
|
||||
- **Document decisions, not just code** - Future you (or Claude) needs to understand *why*
|
||||
|
||||
### What to Search For
|
||||
- Project structure and organization
|
||||
- Naming conventions (files, functions, variables, classes)
|
||||
- Error handling and logging patterns
|
||||
- Testing approaches and tools
|
||||
- Code style preferences (formatting, comments, documentation)
|
||||
- Dependency management and versions
|
||||
- Build and deployment processes
|
||||
- Third-party integrations and API patterns
|
||||
|
||||
### What to Add to Memory
|
||||
- Deviations from framework defaults
|
||||
- Performance optimizations
|
||||
- Security considerations
|
||||
- Cross-cutting concerns (auth, logging, caching, etc.)
|
||||
- Module/component responsibilities
|
||||
- Data flow and state management
|
||||
- Configuration and environment setup
|
||||
- Team conventions and preferences
|
||||
|
||||
## Example Usage Patterns
|
||||
|
||||
### User: "Add user authentication to the app"
|
||||
|
||||
**Correct Response Flow:**
|
||||
1. Search memory: "authentication", "user management", "security patterns", "session handling"
|
||||
2. Check what auth approach is already established (JWT? Sessions? OAuth?)
|
||||
3. Apply existing security patterns from memory
|
||||
4. Implement following project conventions
|
||||
5. Suggest adding: "Implemented JWT authentication with refresh tokens; access token TTL 15min, refresh TTL 7 days; stored in httpOnly cookies"
|
||||
|
||||
### User: "Fix the bug where the dashboard loads slowly"
|
||||
|
||||
**Correct Response Flow:**
|
||||
1. Search memory: "dashboard", "performance", "loading", "caching", "data fetching"
|
||||
2. Identify existing performance patterns or known issues from memory
|
||||
3. Debug using project-specific context
|
||||
4. If you find and fix a non-obvious issue, suggest adding: "Dashboard slow load caused by N+1 query in user stats endpoint; fixed with single JOIN query and added Redis cache (5min TTL)"
|
||||
|
||||
### User: "Refactor the payment module to be more testable"
|
||||
|
||||
**Correct Response Flow:**
|
||||
1. Search memory: "payment", "testing patterns", "dependency injection", "mocking"
|
||||
2. Apply project's established testing and architecture patterns
|
||||
3. Refactor maintaining consistency with existing code structure
|
||||
4. Suggest adding: "Refactored PaymentService to use dependency injection; accepts payment gateway as constructor param for easier mocking in tests"
|
||||
|
||||
## Anti-Patterns to Avoid
|
||||
|
||||
- ❌ Skipping the initial memory search (breaks continuity)
|
||||
- ❌ Re-explaining concepts already in memory (wastes tokens)
|
||||
- ❌ Ignoring retrieved patterns when generating code (creates inconsistency)
|
||||
- ❌ Forgetting to suggest memory additions after significant work (loses knowledge)
|
||||
- ❌ Assuming standard conventions without checking memory first (may conflict with project)
|
||||
- ❌ Adding trivial or obvious information to memory (noise)
|
||||
- ❌ Writing vague memory content like "implemented feature X" (not useful later)
|
||||
|
||||
## Quick Reference
|
||||
|
||||
**When to Search Memory:**
|
||||
- Start of any development task
|
||||
- Before making architectural decisions
|
||||
- When encountering unfamiliar parts of codebase
|
||||
- Before refactoring existing code
|
||||
- When debugging issues
|
||||
- When adding new features or modules
|
||||
|
||||
**When to Add to Memory:**
|
||||
- After implementing significant features
|
||||
- When making architectural decisions
|
||||
- After fixing non-trivial bugs
|
||||
- When establishing new patterns or conventions
|
||||
- After performance optimizations
|
||||
- When integrating external services
|
||||
- After learning project-specific gotchas
|
||||
|
||||
**Default Response Flow:**
|
||||
```
|
||||
1. memory search (1+ queries based on task)
|
||||
↓
|
||||
2. analyze retrieved facts and patterns
|
||||
↓
|
||||
3. generate solution consistent with project
|
||||
↓
|
||||
4. suggest memory add for new knowledge (if applicable)
|
||||
```
|
||||
|
||||
**Search Query Formula:**
|
||||
```
|
||||
[feature/module name] + [technical aspect] + [related patterns]
|
||||
|
||||
Examples:
|
||||
- "user profile component React state management"
|
||||
- "payment processing error handling retry logic"
|
||||
- "database migration rollback strategy"
|
||||
```
|
||||
Reference in New Issue
Block a user