Extension Recipes
Concrete examples for each extension type. For the decision tree and mechanism comparison, see Extensibility Overview.
File Locations
Section titled “File Locations”Directory.github/
Directoryinstructions/ (path-scoped rules)
- python.instructions.md
- typescript.instructions.md
Directoryskills/ (semantic knowledge packages)
Directorypython-patterns/
- SKILL.md
Directoryagents/ (specialized workflows)
- devsquad.implement-python.agent.md
Directoryplugins/devsquad/
Directoryhooks/ (lifecycle scripts)
- my-hook.sh
- hooks.json
Directorydevsquad/
Directorytool-extensions/ (MCP tool injection)
- jira.yml
Recipe 1: Add Project Coding Conventions (Instruction)
Section titled “Recipe 1: Add Project Coding Conventions (Instruction)”Goal: Ensure all Python files follow your team’s conventions.
-
Create the instruction file:
.github/instructions/python.instructions.md ---applyTo: "**/*.py"---# Python - Project Conventions- Type hints required on every public signature- Domain errors inherit from `AppError` (src/core/errors.py)- Async by default for I/O (httpx, asyncpg)- Tests with pytest; shared fixtures in the module's conftest.py- Imports organized: stdlib, third-party, local (isort with black profile) -
The instruction activates automatically whenever an agent edits any
.pyfile.
Adapt for other languages:
| Language | File | applyTo |
|---|---|---|
| TypeScript | typescript.instructions.md | **/*.ts |
| Go | go.instructions.md | **/*.go |
| Terraform | terraform.instructions.md | **/*.tf |
| Bicep | bicep.instructions.md | **/*.bicep |
| REST API contracts | api-contracts.instructions.md | **/contracts/** |
| Dockerfile | docker.instructions.md | **/Dockerfile* |
Recipe 2: Add Reusable Knowledge (Skill)
Section titled “Recipe 2: Add Reusable Knowledge (Skill)”Goal: Share resilience patterns across all agents working with your project.
-
Create the skill directory and file:
.github/skills/resilience-patterns/SKILL.md ---name: resilience-patternsdescription: Retry, circuit breaker, and fallback patterns for the project.Use when implementing external service calls, HTTP clients, databaseconnections, or message queue consumers. Do not use for in-memoryoperations or pure computation.---# Resilience Patterns## Retry- Use exponential backoff with jitter- Maximum 3 retries for transient failures- No retry for 4xx client errors## Circuit Breaker- Failure threshold: 5 consecutive failures- Half-open after 30 seconds- Reset on successful call## Fallback- Cache last known good response (TTL: 5 minutes)- Return degraded response with warning header- Log fallback activation for monitoring -
The skill activates automatically when the conversation involves external calls or resilience.
Key: The description field drives semantic activation. Include keywords, and specify use/don’t-use scenarios:
# Bad: too generic, won't activate reliablydescription: Code patterns
# Good: specific, with domain keywordsdescription: Python implementation patterns for the project. Use when implementing Python code, including error handling patterns with Result type, async with asyncio, tests with pytest and module structure.Recipe 3: Add a Specialized Agent
Section titled “Recipe 3: Add a Specialized Agent”Goal: Create a Python implementation specialist invoked by devsquad.implement.
-
Create the agent file:
.github/agents/devsquad.implement-python.agent.md ---description: Python implementation specialist. Invoked bydevsquad.implement for task execution in Python projects.tools:- edit/editFiles- edit/createFile- execute/runInTerminal- execute/getTerminalOutput- search/codebase--- -
Add the agent body with procedural instructions:
# Python Implementation Specialist## Before Writing Code1. Read the task from tasks.md2. Identify affected modules3. Check existing patterns in the codebase## Implementation Rules- Follow conventions from python.instructions.md- Use Result type for expected errors- Write tests alongside implementation (no separate test tasks)- Run `pytest` after each change## After Writing Code1. Run `ruff check .` for linting2. Run `pytest --cov` for test coverage3. Commit with conventional format -
The agent can be invoked directly with
@devsquad.implement-pythonor delegated as a sub-agent.
Recipe 4: Add a Lifecycle Hook
Section titled “Recipe 4: Add a Lifecycle Hook”Goal: Validate Python imports after every file edit.
-
Create the hook script:
.github/plugins/devsquad/hooks/validate-python-imports.sh #!/bin/bashFILE="$1"if [[ "$FILE" != *.py ]]; thenecho '{"status":"skipped","reason":"not a Python file"}'exit 0fiif command -v ruff &> /dev/null; thenRESULT=$(ruff check "$FILE" --select I 2>&1)if [ $? -eq 0 ]; thenecho '{"status":"pass","message":"imports valid"}'elseecho "{\"status\":\"fail\",\"message\":\"import issues found\",\"details\":\"$RESULT\"}"fielseecho '{"status":"skipped","reason":"ruff not installed"}'fi -
Register in
hooks.json:{"hooks": [{"event": "postToolUse","command": ".github/plugins/devsquad/hooks/validate-python-imports.sh","timeout": 10000}]} -
Make the script executable:
chmod +x .github/plugins/devsquad/hooks/validate-python-imports.sh
Recipe 5: Add an External Tool Integration (Tool Extension)
Section titled “Recipe 5: Add an External Tool Integration (Tool Extension)”Goal: Give existing agents access to Jira tools via MCP.
-
Create the tool extension YAML:
.github/devsquad/tool-extensions/jira.yml name: jiradescription: Jira integration for work item managementmcp:server: "@atlassian/jira-mcp"transport: stdioagents:- devsquad.kickoff- devsquad.decompose- devsquad.implement -
Run the sync script to generate workspace-level agent overrides in
.github/agents/. -
The
sessionStarthook will detect when extensions are stale or unsynced and warn you.
Related
Section titled “Related”- Extensibility Overview: Decision tree and mechanism comparison
- Skills Reference: All 18 built-in skills
- Core Components: Instructions: Built-in instruction reference
- Core Components: Hooks: Built-in hook reference
What to Read Next
Section titled “What to Read Next”- Extensibility Overview for the decision tree
- Skills for the full skill catalog