code-agent-patterns
Skill27 starsChanged 3 months agoApache-2.0View on GitHub
Use when building autonomous code editing, bug fixing, or software engineering agents. Keywords: SWE-agent, code agent, bug localization, patch generation, AST, diff, TDD loop, repository indexing.
In this repository163 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- agent-memorySkill
- claukitSkill
- mcp-agent-patternsSkill
- multi-agent-orchestrationSkill
- workflow-state-machinesSkill
- ai-multimodalSkill
- geo-fundamentalsSkill
- media-processingSkill
- screenshotSkill
- seo-fundamentalsSkill
- soraSkill
- aestheticSkill
- figma-implement-designSkill
- figmaSkill
- frontend-designSkill
- mobile-designSkill
- tailwind-patternsSkill
- ui-stylingSkill
- agentic-ragSkill
- api-patternsSkill
- app-builderSkill
- architectureSkill
- ask-mattSkill
- aspnet-coreSkill
- backend-developmentSkill
- better-authSkill
- clean-codeSkill
- codebase-designSkill
- code-review-checklistSkill
- code-reviewSkill
- context-engineeringSkill
- context-optimizationSkill
- database-designSkill
- databasesSkill
- diagnoseSkill
- diagnosing-bugsSkill
- docs-seekerSkill
- domain-modelingSkill
- frontend-dev-guidelinesSkill
- graph-ragSkill
- i18n-localizationSkill
- implementSkill
- improve-codebase-architectureSkill
- lint-and-validateSkill
- llm-evalsSkill
- nextjs-best-practicesSkill
- nodejs-best-practicesSkill
- openai-docsSkill
- performance-profilingSkill
- playwright-interactiveSkill
- playwrightSkill
- prompt-engineeringSkill
- prototypeSkill
- python-patternsSkill
- react-patternsSkill
- render-deploySkill
- repomixSkill
- researchSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
11 rules. About 0 are common, 11 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈11
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 19
Avoid dumping the entire repository into the LLM context.
- Distinctive: line 20
Use dependency graph analysis to identify "impact zones."
- Distinctive: line 32
Prefer "Search-Replace" blocks over entire file rewrites.
- Distinctive: line 34
Use unified diffs as a secondary representation for human review.
- Distinctive: line 38
Reproduce: Write a test case that captures the reported bug (assert failure).
- Distinctive: line 41
Verify: Run the test suite.
- Distinctive: line 42
Rollback: If tests fail after patching, discard changes and restart the process.
- Distinctive: line 51
Every proposed change must survive an automated gauntlet:
- Distinctive: line 52
Syntax Check: Ensure the code is parsable.
- Distinctive: line 56
Security Scan: Check against common patterns like OWASP Top 10.
- Distinctive: line 60
Hard Fixes: Avoid over-complex regex. Use AST-based transformations whenever possible.
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Autonomous Code Agent Patterns
Overview
The code-agent-patterns skill provides a standardized architectural framework for building, maintaining, and scaling autonomous Software Engineering (SWE) agents. It focuses on reliability, precision, and contextual awareness, drawing heavily from industry benchmarks like SWE-Bench and modern LLM-driven development tools.
When To Use
- Implementing autonomous code editing agents.
- Designing specialized agents for bug localization or patch generation.
- Orchestrating multi-agent systems for code review or testing.
- Building tools that need to interface with existing large codebases.
Core Patterns
1. Minimal Context Assembly
Avoid dumping the entire repository into the LLM context. Instead:
- Use dependency graph analysis to identify "impact zones."
- Implement "Breadth-First Context Discovery" (start with high-level symbols, drill down only when necessary).
- Support dynamic file inclusion based on the specific task (e.g., test files, related interfaces).
2. Symbol-Level Repository Indexing
Build a robust index that enables the agent to navigate the codebase as a human developer would:
- Symbol Maps: Index classes, functions, and interfaces along with their file locations.
- Call Graphs: Track function calls and dependencies to understand side effects.
- AST Analysis: Utilize Abstract Syntax Tree (AST) parsing to ensure structural awareness during code modifications.
3. Unified Diff & Search-Replace Patching
To minimize hallucination and merge conflicts:
- Prefer "Search-Replace" blocks over entire file rewrites.
- Validate that the "Search" block matches exact file content before applying the "Replace" content.
- Use unified diffs as a secondary representation for human review.
TDD Fix Loop Workflow
Agents must follow a strict "Red-Green-Refactor" loop for any bug fix:
- Reproduce: Write a test case that captures the reported bug (assert failure).
- Localize: Identify the source using logs, stack traces, or symbol-level search.
- Patch: Apply minimal code changes to satisfy the failing test.
- Verify: Run the test suite.
- Rollback: If tests fail after patching, discard changes and restart the process.
Multi-Agent Coding Triad
To ensure high-quality output, structure teams as:
- Coder: Responsible for reading the codebase and proposing patches.
- Code Reviewer: Audits patches for logic errors, style violations, and architecture alignment.
- Test Engineer: Manages test execution and ensures sufficient coverage for the change.
Patch Validation Pipeline
Every proposed change must survive an automated gauntlet:
- Syntax Check: Ensure the code is parsable.
- Type Check: Validate against TypeScript/Python type definitions.
- Unit Tests: Pass local unit tests.
- Lint: Adhere to project linting standards.
- Security Scan: Check against common patterns like OWASP Top 10.
SWE-Bench Lessons
- Mitigation Strategy: The most common failure mode is "blind editing" without understanding global constraints. Ensure agents have access to
ADR(Architecture Decision Records). - Hard Fixes: Avoid over-complex regex. Use AST-based transformations whenever possible.
- Context Drift: Periodically refresh context maps when making many changes in a single session.
References
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

