Skip to content
Skills Library
AI & agents · Building & coding

code-agent-patterns

/code-agent-patterns

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.

Licence
Apache-2.0
Last repository change
24.10.2026

Assessment and security

90/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content25 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
3
Deprecation

No signals detected. Repository changed on 24.10.2026, without references to retired models or APIs.

Licence

Apache-2.0, otwarta: można używać i zmieniać, z zachowaniem licencji i informacji o zmianach.

What it does and when to use it

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.

Original author description

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.

How it works

  1. Overview
  2. When To Use
  3. Core Patterns
  4. TDD Fix Loop Workflow
  5. Multi-Agent Coding Triad
  6. Patch Validation Pipeline
  7. SWE-Bench Lessons
  8. References
Original SKILL.md headings · 62 lines, 487 words
SKILL.md preview
---
name: "code-agent-patterns"
description: >-
  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.
---
# 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:
1. **Reproduce**: Write a test case that captures the reported bug (assert failure).
2. **Localize**: Identify the source using logs, stack traces, or symbol-level search.
3. **Patch**: Apply minimal code changes to satisfy the failing test.
4. **Verify**: Run the test suite.
5. **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:
1. **Syntax Check**: Ensure the code is parsable.
2. **Type Check**: Validate against TypeScript/Python type definitions.
3. **Unit Tests**: Pass local unit tests.
4. **Lint**: Adhere to project linting standards.
5. **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
- [SWE-Bench](https://www.swebench.com/)
- [KILO-KIT Documentation](https://github.com/vodailoc/KILO-KIT)
- [Aider: AI Pair Programming](https://aider.chat/)

Versions

The database has no other skills named code-agent-patterns.

Database snapshot: 13.11.2026 · package version f61a4e8d33bd (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100create-task
    Use when creating an octomux task to dispatch autonomous Claude Code agents for building features, fixing bugs, or any code changes
  • 100mukhon-codex-guide
    Comprehensive reference, prompt patterns, and architectural guide for OpenAI Codex and coding agents (including GitHub Copilot CLI, OpenAI Canvas, and custom Agent SDK runners). Covers repository-level instructions, structured tool-calling schemas, AST-guided editing, multi-file…
  • 100mini-swe-evolution-guide
    Mini-SWE-agent harness evolution reference. Use when evolving the permitted prompt, agent control flow, model utilities, or registered E2B-backed tools. Covers candidate wiring, the fixed provider boundary, and required validation.
  • 100agent-engineering
    Battle-tested engineering principles for AI coding agents. Covers plan-first workflow, subagent delegation, self-improvement loops, verification gates, elegant solutions, autonomous bug fixing, and structured task management. Use when configuring agent behavior, writing…
  • 84agent-design
    Design AI agents using the 3P pattern (Perceive/Plan/Perform). Use when building autonomous AI agents or workflows.
  • 100ai-agents-architect
    Expert in designing and building autonomous AI agents. Masters tool use, memory systems, planning strategies, and multi-agent orchestration. Use when: build agent, AI agent, autonomous agent, tool use, function calling.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.