[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7CS686402QYSEMW7K73MKAM":3,"skill-same:01M7CS686402QYSEMW7K73MKAM":48},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":26,"commitSha":27,"skillDirectory":28,"forksCount":14,"repositoryHtmlUrl":29,"repositoryHomepageUrl":6,"ownerHtmlUrl":30,"ownerBlogUrl":31,"ownerDescription":32,"updatedAt":33,"install":34,"resources":47},"01M7CS686402QYSEMW7K73MKAM","iterative-retrieval",null,"Pattern for progressively refining context retrieval to solve the subagent context problem","Henrique1601\u002FSkiilsToIAs","Henrique1601","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F92006691?v=4","01M7CRXVT0GVXVK80JT1GR687S","Henrique Bezerra Dos Santos","01M7CRXVTN5Y8TMWJ1MDSKCQ1T",0,"MIT","https:\u002F\u002Fgithub.com\u002FHenrique1601\u002FSkiilsToIAs\u002Fblob\u002Fmain\u002Fai-agents\u002Fiterative-retrieval\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: iterative-retrieval\ndescription: Pattern for progressively refining context retrieval to solve the subagent context problem\nmetadata:\n  origin: ECC\n---\n\n# Iterative Retrieval Pattern\n\nSolves the \"context problem\" in multi-agent workflows where subagents don't know what context they need until they start working.\n\n## When to Activate\n\n- Spawning subagents that need codebase context they cannot predict upfront\n- Building multi-agent workflows where context is progressively refined\n- Encountering \"context too large\" or \"missing context\" failures in agent tasks\n- Designing RAG-like retrieval pipelines for code exploration\n- Optimizing token usage in agent orchestration\n\n## The Problem\n\nSubagents are spawned with limited context. They don't know:\n- Which files contain relevant code\n- What patterns exist in the codebase\n- What terminology the project uses\n\nStandard approaches fail:\n- **Send everything**: Exceeds context limits\n- **Send nothing**: Agent lacks critical information\n- **Guess what's needed**: Often wrong\n\n## The Solution: Iterative Retrieval\n\nA 4-phase loop that progressively refines context:\n\n```\n┌─────────────────────────────────────────────┐\n│                                             │\n│   ┌──────────┐      ┌──────────┐            │\n│   │ DISPATCH │─────│ EVALUATE │            │\n│   └──────────┘      └──────────┘            │\n│        ▲                  │                 │\n│        │                  ▼                 │\n│   ┌──────────┐      ┌──────────┐            │\n│   │   LOOP   │─────│  REFINE  │            │\n│   └──────────┘      └──────────┘            │\n│                                             │\n│        Max 3 cycles, then proceed           │\n└─────────────────────────────────────────────┘\n```\n\n### Phase 1: DISPATCH\n\nInitial broad query to gather candidate files:\n\n```javascript\n\u002F\u002F Start with high-level intent\nconst initialQuery = {\n  patterns: ['src\u002F**\u002F*.ts', 'lib\u002F**\u002F*.ts'],\n  keywords: ['authentication', 'user', 'session'],\n  excludes: ['*.test.ts', '*.spec.ts']\n};\n\n\u002F\u002F Dispatch to retrieval agent\nconst candidates = await retrieveFiles(initialQuery);\n```\n\n### Phase 2: EVALUATE\n\nAssess retrieved content for relevance:\n\n```javascript\nfunction evaluateRelevance(files, task) {\n  return files.map(file => ({\n    path: file.path,\n    relevance: scoreRelevance(file.content, task),\n    reason: explainRelevance(file.content, task),\n    missingContext: identifyGaps(file.content, task)\n  }));\n}\n```\n\nScoring criteria:\n- **High (0.8-1.0)**: Directly implements target functionality\n- **Medium (0.5-0.7)**: Contains related patterns or types\n- **Low (0.2-0.4)**: Tangentially related\n- **None (0-0.2)**: Not relevant, exclude\n\n### Phase 3: REFINE\n\nUpdate search criteria based on evaluation:\n\n```javascript\nfunction refineQuery(evaluation, previousQuery) {\n  return {\n    \u002F\u002F Add new patterns discovered in high-relevance files\n    patterns: [...previousQuery.patterns, ...extractPatterns(evaluation)],\n\n    \u002F\u002F Add terminology found in codebase\n    keywords: [...previousQuery.keywords, ...extractKeywords(evaluation)],\n\n    \u002F\u002F Exclude confirmed irrelevant paths\n    excludes: [...previousQuery.excludes, ...evaluation\n      .filter(e => e.relevance \u003C 0.2)\n      .map(e => e.path)\n    ],\n\n    \u002F\u002F Target specific gaps\n    focusAreas: evaluation\n      .flatMap(e => e.missingContext)\n      .filter(unique)\n  };\n}\n```\n\n### Phase 4: LOOP\n\nRepeat with refined criteria (max 3 cycles):\n\n```javascript\nasync function iterativeRetrieve(task, maxCycles = 3) {\n  let query = createInitialQuery(task);\n  let bestContext = [];\n\n  for (let cycle = 0; cycle \u003C maxCycles; cycle++) {\n    const candidates = await retrieveFiles(query);\n    const evaluation = evaluateRelevance(candidates, task);\n\n    \u002F\u002F Check if we have sufficient context\n    const highRelevance = evaluation.filter(e => e.relevance >= 0.7);\n    if (highRelevance.length >= 3 && !hasCriticalGaps(evaluation)) {\n      return highRelevance;\n    }\n\n    \u002F\u002F Refine and continue\n    query = refineQuery(evaluation, query);\n    bestContext = mergeContext(bestContext, highRelevance);\n  }\n\n  return bestContext;\n}\n```\n\n## Practical Examples\n\n### Example 1: Bug Fix Context\n\n```\nTask: \"Fix the authentication token expiry bug\"\n\nCycle 1:\n  DISPATCH: Search for \"token\", \"auth\", \"expiry\" in src\u002F**\n  EVALUATE: Found auth.ts (0.9), tokens.ts (0.8), user.ts (0.3)\n  REFINE: Add \"refresh\", \"jwt\" keywords; exclude user.ts\n\nCycle 2:\n  DISPATCH: Search refined terms\n  EVALUATE: Found session-manager.ts (0.95), jwt-utils.ts (0.85)\n  REFINE: Sufficient context (2 high-relevance files)\n\nResult: auth.ts, tokens.ts, session-manager.ts, jwt-utils.ts\n```\n\n### Example 2: Feature Implementation\n\n```\nTask: \"Add rate limiting to API endpoints\"\n\nCycle 1:\n  DISPATCH: Search \"rate\", \"limit\", \"api\" in routes\u002F**\n  EVALUATE: No matches - codebase uses \"throttle\" terminology\n  REFINE: Add \"throttle\", \"middleware\" keywords\n\nCycle 2:\n  DISPATCH: Search refined terms\n  EVALUATE: Found throttle.ts (0.9), middleware\u002Findex.ts (0.7)\n  REFINE: Need router patterns\n\nCycle 3:\n  DISPATCH: Search \"router\", \"express\" patterns\n  EVALUATE: Found router-setup.ts (0.8)\n  REFINE: Sufficient context\n\nResult: throttle.ts, middleware\u002Findex.ts, router-setup.ts\n```\n\n## Integration with Agents\n\nUse in agent prompts:\n\n```markdown\nWhen retrieving context for this task:\n1. Start with broad keyword search\n2. Evaluate each file's relevance (0-1 scale)\n3. Identify what context is still missing\n4. Refine search criteria and repeat (max 3 cycles)\n5. Return files with relevance >= 0.7\n```\n\n## Best Practices\n\n1. **Start broad, narrow progressively** - Don't over-specify initial queries\n2. **Learn codebase terminology** - First cycle often reveals naming conventions\n3. **Track what's missing** - Explicit gap identification drives refinement\n4. **Stop at \"good enough\"** - 3 high-relevance files beats 10 mediocre ones\n5. **Exclude confidently** - Low-relevance files won't become relevant\n\n## Related\n\n- [The Longform Guide](https:\u002F\u002Fx.com\u002Faffaanmustafa\u002Fstatus\u002F2014040193557471352) - Subagent orchestration section\n- `continuous-learning` skill - For patterns that improve over time\n- Agent definitions bundled with ECC (manual install path: `agents\u002F`)\n","# Iterative Retrieval Pattern\n\nSolves the \"context problem\" in multi-agent workflows where subagents don't know what context they need until they start working.\n\n## When to Activate\n\n- Spawning subagents that need codebase context they cannot predict upfront\n- Building multi-agent workflows where context is progressively refined\n- Encountering \"context too large\" or \"missing context\" failures in agent tasks\n- Designing RAG-like retrieval pipelines for code exploration\n- Optimizing token usage in agent orchestration\n\n## The Problem\n\nSubagents are spawned with limited context. They don't know:\n- Which files contain relevant code\n- What patterns exist in the codebase\n- What terminology the project uses\n\nStandard approaches fail:\n- **Send everything**: Exceeds context limits\n- **Send nothing**: Agent lacks critical information\n- **Guess what's needed**: Often wrong\n\n## The Solution: Iterative Retrieval\n\nA 4-phase loop that progressively refines context:\n\n```\n┌─────────────────────────────────────────────┐\n│                                             │\n│   ┌──────────┐      ┌──────────┐            │\n│   │ DISPATCH │─────│ EVALUATE │            │\n│   └──────────┘      └──────────┘            │\n│        ▲                  │                 │\n│        │                  ▼                 │\n│   ┌──────────┐      ┌──────────┐            │\n│   │   LOOP   │─────│  REFINE  │            │\n│   └──────────┘      └──────────┘            │\n│                                             │\n│        Max 3 cycles, then proceed           │\n└─────────────────────────────────────────────┘\n```\n\n### Phase 1: DISPATCH\n\nInitial broad query to gather candidate files:\n\n```javascript\n\u002F\u002F Start with high-level intent\nconst initialQuery = {\n  patterns: ['src\u002F**\u002F*.ts', 'lib\u002F**\u002F*.ts'],\n  keywords: ['authentication', 'user', 'session'],\n  excludes: ['*.test.ts', '*.spec.ts']\n};\n\n\u002F\u002F Dispatch to retrieval agent\nconst candidates = await retrieveFiles(initialQuery);\n```\n\n### Phase 2: EVALUATE\n\nAssess retrieved content for relevance:\n\n```javascript\nfunction evaluateRelevance(files, task) {\n  return files.map(file => ({\n    path: file.path,\n    relevance: scoreRelevance(file.content, task),\n    reason: explainRelevance(file.content, task),\n    missingContext: identifyGaps(file.content, task)\n  }));\n}\n```\n\nScoring criteria:\n- **High (0.8-1.0)**: Directly implements target functionality\n- **Medium (0.5-0.7)**: Contains related patterns or types\n- **Low (0.2-0.4)**: Tangentially related\n- **None (0-0.2)**: Not relevant, exclude\n\n### Phase 3: REFINE\n\nUpdate search criteria based on evaluation:\n\n```javascript\nfunction refineQuery(evaluation, previousQuery) {\n  return {\n    \u002F\u002F Add new patterns discovered in high-relevance files\n    patterns: [...previousQuery.patterns, ...extractPatterns(evaluation)],\n\n    \u002F\u002F Add terminology found in codebase\n    keywords: [...previousQuery.keywords, ...extractKeywords(evaluation)],\n\n    \u002F\u002F Exclude confirmed irrelevant paths\n    excludes: [...previousQuery.excludes, ...evaluation\n      .filter(e => e.relevance \u003C 0.2)\n      .map(e => e.path)\n    ],\n\n    \u002F\u002F Target specific gaps\n    focusAreas: evaluation\n      .flatMap(e => e.missingContext)\n      .filter(unique)\n  };\n}\n```\n\n### Phase 4: LOOP\n\nRepeat with refined criteria (max 3 cycles):\n\n```javascript\nasync function iterativeRetrieve(task, maxCycles = 3) {\n  let query = createInitialQuery(task);\n  let bestContext = [];\n\n  for (let cycle = 0; cycle \u003C maxCycles; cycle++) {\n    const candidates = await retrieveFiles(query);\n    const evaluation = evaluateRelevance(candidates, task);\n\n    \u002F\u002F Check if we have sufficient context\n    const highRelevance = evaluation.filter(e => e.relevance >= 0.7);\n    if (highRelevance.length >= 3 && !hasCriticalGaps(evaluation)) {\n      return highRelevance;\n    }\n\n    \u002F\u002F Refine and continue\n    query = refineQuery(evaluation, query);\n    bestContext = mergeContext(bestContext, highRelevance);\n  }\n\n  return bestContext;\n}\n```\n\n## Practical Examples\n\n### Example 1: Bug Fix Context\n\n```\nTask: \"Fix the authentication token expiry bug\"\n\nCycle 1:\n  DISPATCH: Search for \"token\", \"auth\", \"expiry\" in src\u002F**\n  EVALUATE: Found auth.ts (0.9), tokens.ts (0.8), user.ts (0.3)\n  REFINE: Add \"refresh\", \"jwt\" keywords; exclude user.ts\n\nCycle 2:\n  DISPATCH: Search refined terms\n  EVALUATE: Found session-manager.ts (0.95), jwt-utils.ts (0.85)\n  REFINE: Sufficient context (2 high-relevance files)\n\nResult: auth.ts, tokens.ts, session-manager.ts, jwt-utils.ts\n```\n\n### Example 2: Feature Implementation\n\n```\nTask: \"Add rate limiting to API endpoints\"\n\nCycle 1:\n  DISPATCH: Search \"rate\", \"limit\", \"api\" in routes\u002F**\n  EVALUATE: No matches - codebase uses \"throttle\" terminology\n  REFINE: Add \"throttle\", \"middleware\" keywords\n\nCycle 2:\n  DISPATCH: Search refined terms\n  EVALUATE: Found throttle.ts (0.9), middleware\u002Findex.ts (0.7)\n  REFINE: Need router patterns\n\nCycle 3:\n  DISPATCH: Search \"router\", \"express\" patterns\n  EVALUATE: Found router-setup.ts (0.8)\n  REFINE: Sufficient context\n\nResult: throttle.ts, middleware\u002Findex.ts, router-setup.ts\n```\n\n## Integration with Agents\n\nUse in agent prompts:\n\n```markdown\nWhen retrieving context for this task:\n1. Start with broad keyword search\n2. Evaluate each file's relevance (0-1 scale)\n3. Identify what context is still missing\n4. Refine search criteria and repeat (max 3 cycles)\n5. Return files with relevance >= 0.7\n```\n\n## Best Practices\n\n1. **Start broad, narrow progressively** - Don't over-specify initial queries\n2. **Learn codebase terminology** - First cycle often reveals naming conventions\n3. **Track what's missing** - Explicit gap identification drives refinement\n4. **Stop at \"good enough\"** - 3 high-relevance files beats 10 mediocre ones\n5. **Exclude confidently** - Low-relevance files won't become relevant\n\n## Related\n\n- [The Longform Guide](https:\u002F\u002Fx.com\u002Faffaanmustafa\u002Fstatus\u002F2014040193557471352) - Subagent orchestration section\n- `continuous-learning` skill - For patterns that improve over time\n- Agent definitions bundled with ECC (manual install path: `agents\u002F`)\n",{"name":5,"metadata":24,"description":7},{"origin":25},"ECC","main","a73152352c0612252131e5cf84e91312a6cf17dc","ai-agents\u002Fiterative-retrieval","https:\u002F\u002Fgithub.com\u002FHenrique1601\u002FSkiilsToIAs","https:\u002F\u002Fgithub.com\u002FHenrique1601","https:\u002F\u002Fbezerraportifolio.netlify.app\u002F","Full Stack Developer | React, Next.js, TypeScript, Node.js & IA | Construindo produtos digitais e soluções SaaS","2026-11-15 02:56:04",{"source":8,"skillName":5,"commands":35,"prompt":45,"zipAvailable":46},[36,39,42],{"tool":37,"command":38},"npx","npx skills add Henrique1601\u002FSkiilsToIAs --skill iterative-retrieval",{"tool":40,"command":41},"bunx","bunx skills add Henrique1601\u002FSkiilsToIAs --skill iterative-retrieval",{"tool":43,"command":44},"pnpm","pnpm dlx skills add Henrique1601\u002FSkiilsToIAs --skill iterative-retrieval","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FHenrique1601\u002FSkiilsToIAs\u002Fblob\u002Fmain\u002Fai-agents\u002Fiterative-retrieval\u002FSKILL.md",true,[],[49,56,63,71,78,85],{"skillNo":50,"name":51,"nameZh":6,"description":52,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":53,"categories":54,"keywords":55,"publishedAt":19},"01M7E2ANBW9V6AVX5JXNCEAWF8","rag-architect-agent","Agente Arquiteto de RAG, Embeddings & Busca Vetorial. Especialista em design e implementação de pipelines de Retrieval-Augmented Generation de alta fidelidade: chunking semântico, modelagem pgvector no PostgreSQL (Neon\u002FSupabase), busca híbrida (cosseno + BM25), reranking, validação via TypeSafe AI e filosofia Ponytail (anti-overengineering).","https:\u002F\u002Fgithub.com\u002FHenrique1601\u002FSkiilsToIAs\u002Fblob\u002Fmain\u002Fcustom-agents\u002Frag-architect-agent\u002FSKILL.md",[],[],{"skillNo":57,"name":58,"nameZh":6,"description":59,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":60,"categories":61,"keywords":62,"publishedAt":19},"01M7E29KKF8R02ZRGYE2MJM67G","rag-architecture-patterns","Padrões arquiteturais e implementação de pipelines RAG (Retrieval-Augmented Generation) de alta fidelidade para qualquer projeto ou sistema. Cobre chunking semântico, embeddings, busca híbrida (pgvector + BM25), reranking, validação via TypeSafe AI e filosofia Ponytail (anti-overengineering).","https:\u002F\u002Fgithub.com\u002FHenrique1601\u002FSkiilsToIAs\u002Fblob\u002Fmain\u002Fai-agents\u002Frag-architecture-patterns\u002FSKILL.md",[],[],{"skillNo":64,"name":65,"nameZh":6,"description":66,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":67,"licenseFileUrl":6,"sourceHtmlUrl":68,"categories":69,"keywords":70,"publishedAt":19},"01M7CWRA8E3BJ7CPY8N8EG28J1","skill-repair","Use this to fix and re-install agent skills that have failed installation.\nThis skill provides the necessary context and permissions to surgically update\nthe `manifest.json` after a fix has been applied.","Apache-2.0","https:\u002F\u002Fgithub.com\u002FHenrique1601\u002FSkiilsToIAs\u002Fblob\u002Fmain\u002Futilities\u002Fskill-repair\u002FSKILL.md",[],[],{"skillNo":72,"name":73,"nameZh":6,"description":74,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":75,"categories":76,"keywords":77,"publishedAt":19},"01M7CWR66FZP8FA47WVZ4Z2EXC","security-scan","Scan your Claude Code configuration (.claude\u002F directory) for security vulnerabilities, misconfigurations, and injection risks using AgentShield. Checks CLAUDE.md, settings.json, MCP servers, hooks, and agent definitions.","https:\u002F\u002Fgithub.com\u002FHenrique1601\u002FSkiilsToIAs\u002Fblob\u002Fmain\u002Futilities\u002Fsecurity-scan\u002FSKILL.md",[],[],{"skillNo":79,"name":80,"nameZh":6,"description":81,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":82,"categories":83,"keywords":84,"publishedAt":19},"01M7CWR0QPY58QPTR1P759TFNG","security-review","Use this skill when adding authentication, handling user input, working with secrets, creating API endpoints, or implementing payment\u002Fsensitive features. Provides comprehensive security checklist and patterns.","https:\u002F\u002Fgithub.com\u002FHenrique1601\u002FSkiilsToIAs\u002Fblob\u002Fmain\u002Futilities\u002Fsecurity-review\u002FSKILL.md",[],[],{"skillNo":86,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":19},"01M7CWQXCE40XWT4FZ3VWZFGDP","security-bounty-hunter","Hunt for exploitable, bounty-worthy security issues in repositories. Focuses on remotely reachable vulnerabilities that qualify for real reports instead of noisy local-only findings.","https:\u002F\u002Fgithub.com\u002FHenrique1601\u002FSkiilsToIAs\u002Fblob\u002Fmain\u002Futilities\u002Fsecurity-bounty-hunter\u002FSKILL.md",[],[]]