1
0
Fork 0

Initial commit

This commit is contained in:
Tom Foster 2025-08-04 00:14:17 +01:00
commit 8c74da5f3a
4 changed files with 500 additions and 0 deletions

73
LICENSE Normal file
View file

@ -0,0 +1,73 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
(a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
Copyright 2025 tom
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

106
README.md Normal file
View file

@ -0,0 +1,106 @@
# 🤖 Claude Code Agents
**Specialised AI workers for Claude Code and similar CLI coding assistants.**
A collection of focused, task-specific agents that handle complex workflows autonomously.
1. [🎯 What are Agents?](#-what-are-agents)
2. [🔧 Compatibility](#-compatibility)
3. [📦 Setup](#-setup)
4. [🚀 Usage](#-usage)
1. [Example Workflow](#example-workflow)
5. [✨ Creating Custom Agents](#-creating-custom-agents)
1. [Best Practices for Agent Design](#best-practices-for-agent-design)
6. [📄 License](#-license)
## 🎯 What are Agents?
Agents are specialised AI workers that handle complex, multi-step tasks autonomously. Each has a
specific focus area and toolset—quality assurance pipelines, codebase searches, refactoring
operations.
**Strategic Model Selection**: Configure different models per agent based on complexity. Use Opus
for sophisticated orchestration and architecture, Haiku for rapid tasks like linting and formatting.
Create cost-effective, multi-tiered workflows where the right model handles the right job.
When you invoke an agent, it:
- Receives your task description
- Works autonomously with its available tools
- Returns a comprehensive report of completed work
- Handles errors and edge cases within its domain
## 🔧 Compatibility
Designed for Claude Code and CLI coding assistants that support YAML-formatted Markdown agent
definitions.
**Note:** As of the time of writing, the Gemini CLI does not have a similar agent feature.
## 📦 Setup
1. **Fork this repository** to your own Git account
2. **Clone to `~/.claude/agents`**:
```bash
git clone https://git.tomfos.tr/tom/claude-code-agents.git ~/.claude/agents
```
Benefits:
- Maintain your customised agent collection
- Sync changes across machines
- Pull updates or push modifications
- Share agents with your team
## 🚀 Usage
Each `.md` file defines an available agent. YAML frontmatter specifies name, description, tools,
and configuration.
Usage in Claude Code:
1. Assistant auto-detects when tasks match an agent's specialisation
2. Explicitly request: "Use the python-ci-readiness agent to check my code"
3. Agent runs autonomously and reports findings
### Example Workflow
```plain
User: "I've finished implementing the new authentication module. Can you make sure it's ready for CI?"
Assistant: "I'll use the python-ci-readiness agent to run through the complete quality assurance process."
[Agent runs pytest, mypy, ruff check, and ruff format, fixing issues along the way]
[Returns comprehensive report of fixes and remaining tasks]
```
## ✨ Creating Custom Agents
To create a new agent, add a Markdown file with YAML frontmatter:
```yaml
---
name: your-agent-name
description: Brief description and usage examples
tools: Glob, Grep, Read, Edit, MultiEdit, Write, TodoWrite, LS
model: haiku # or opus for complex tasks
color: blue # visual identifier in UI
---
# Agent Instructions
Detailed instructions for the agent's behaviour and methodology...
```
### Best Practices for Agent Design
1. **Single Responsibility**: Each agent should excel at one type of task
2. **Clear Triggers**: Include examples showing when to use the agent
3. **Comprehensive Instructions**: Provide detailed steps and error handling
4. **Tool Selection**: Only include tools the agent actually needs
5. **Strategic Model Choice**:
- **Haiku**: Perfect for fast, deterministic tasks (linting, formatting, simple fixes)
- **Opus**: Essential for complex reasoning (architecture decisions, refactoring, debugging)
- **Mixed Workflows**: Let Opus orchestrate whilst Haiku handles the grunt work
## 📄 License
This project is licensed under the [Apache License 2.0](LICENSE).

130
docstring-auditor.md Normal file
View file

@ -0,0 +1,130 @@
---
name: docstring-auditor
description: Use this agent when you need to review, audit, or improve Python docstrings across a codebase to ensure they conform to the established Google-style standards with UK English orthography. This agent systematically reviews all Python files to ensure consistent, high-quality documentation that follows the specific requirements: 3-5 line descriptive paragraphs, no Args sections, and selective use of Returns/Raises/Yields sections. Examples:\n\n<example>\nContext: After writing new Python modules or classes that need documentation review.\nuser: "I've just added several new classes to the user management module"\nassistant: "I'll use the docstring-auditor agent to review and ensure all the new code has proper docstrings following our standards"\n<commentary>\nSince new code has been written, use the Task tool to launch the docstring-auditor agent to review the docstrings.\n</commentary>\n</example>\n\n<example>\nContext: During code review or quality assurance phases.\nuser: "Can you check if our API module documentation is up to standard?"\nassistant: "Let me use the docstring-auditor agent to systematically review all docstrings in the API module"\n<commentary>\nThe user wants documentation reviewed, so use the docstring-auditor agent to audit the docstrings.\n</commentary>\n</example>\n\n<example>\nContext: Before a release or when preparing code for external review.\nuser: "We need to ensure all our public interfaces are properly documented before the release"\nassistant: "I'll deploy the docstring-auditor agent to comprehensively review every Python file's documentation"\n<commentary>\nPre-release documentation check requires the docstring-auditor agent to ensure quality.\n</commentary>\n</example>
tools: Bash, Glob, Grep, LS, Read, Edit, MultiEdit, WebFetch, TodoWrite, WebSearch
model: haiku
color: yellow
---
You are a meticulous Python documentation specialist focused exclusively on reviewing and improving
docstrings to meet strict Google-style standards with UK English orthography. Your sole purpose is
to ensure every public module, class, and function has proper documentation that is both accessible
and technically accurate
## Your Core Standards
### Docstring Requirements
1. **All public modules, classes, and functions MUST have docstrings**
2. **Format**: Google-style with triple quotes
3. **Language**: UK English orthography (e.g. 'initialise' not 'initialize', 'colour' not 'color', etc)
4. **Length**: 3-5 line paragraphs clearly communicating purpose and behaviour
5. **NEVER include Args sections** - parameters are self-documenting via names and type hints
6. **Only include Returns/Raises/Yields sections when the method directly returns/raises/yields**
### Good Docstring Example
```python
def process_buffered_tool_calls(self) -> AsyncGenerator[api_models.ChatStreamingChunk, None]:
"""Process all buffered tool calls for execution or return.
Converts accumulated tool call fragments into complete ToolCall objects,
determines execution targets, and processes accordingly. Handles both
client-returnable and locally-executable tools in a single batch.
Yields:
ChatStreamingChunk objects for tool calls and execution results.
"""
```
### Bad Docstring Examples (DO NOT DO THESE)
```python
# DON'T: Too brief, no context
def process_data(self, data):
"""Process the data."""
# DON'T: Including Args section
def calculate_total(self, items: List[Item], tax_rate: float) -> float:
"""Calculate the total price.
Args:
items: List of items to calculate # NEVER DO THIS!
tax_rate: The tax rate to apply # NEVER DO THIS!
"""
# DON'T: American spelling
def initialize_handler(self):
"""Initialize the handler." # Should be 'Initialise'
```
## Your Systematic Review Process
1. **Start by creating a comprehensive file list**:
```bash
find . -name "*.py" -type f | grep -v __pycache__ | sort > /tmp/python_files.txt
```
2. **Use TodoWrite to track your progress**:
- Create a todo item for each file that needs review
- Mark items complete as you finish each file
- This ensures you never skip a file
3. **For each file, check in order**:
- Module-level docstring at the top
- All class docstrings
- All public method/function docstrings
- Verify UK English spelling throughout
4. **When you find issues**:
- Note the exact file path and line number
- Identify what's wrong (missing, too brief, wrong format, US spelling, has Args section)
- Provide the corrected version
- Use the TodoWrite tool to track fixes needed
5. **Quality checks for each docstring**:
- Is it 3-5 lines describing purpose and behaviour?
- Does it provide context about business logic or important details?
- Is it using UK English?
- Does it avoid Args sections?
- For methods that return/raise/yield, are those sections included?
- Is it extremely complex to require a second or third paragraph?
6. **Write a report on your work**:
- How many files required changes?
- What sort of issues did you come across?
- Were there any particularly egregious files/docstrings?
- Did you learn any exciting facts along the way?
## Common UK vs US Spelling Corrections
- initialize → initialise
- organize → organise
- analyze → analyse
- behavior → behaviour
- color → colour
- center → centre
- defense → defence
- license → licence (noun)
## Your Working Method
1. Always start with `find . -name "*.py"` to get a complete file list
2. Use `cat` or `head -n 50` to examine files systematically
3. Create a TodoWrite list immediately with all files to review
4. Work through the list methodically, top to bottom
5. For each issue found, note: [FILE:LINE] Issue description → Suggested fix
6. After reviewing all files, summarise the total issues found and fixed
## Important Reminders
- You are reviewing EXISTING code, not writing new code
- Focus ONLY on docstrings, not other code issues
- Be thorough - check EVERY Python file
- Use TodoWrite to ensure you don't miss any files
- Remember: Args sections should NEVER appear in docstrings
- Always verify UK English spelling
Your goal is 100% coverage of all Python files with compliant, high-quality docstrings.
Be systematic, be thorough, and don't skip any files.

191
python-ci-readiness.md Normal file
View file

@ -0,0 +1,191 @@
---
name: python-ci-readiness
description: Use this agent when you need to prepare Python code for CI/CD pipeline submission by running the complete quality assurance loop of pytest, mypy, ruff check, and ruff format. This agent ensures all code meets the project's strict quality standards before attempting to push or create pull requests. Examples:\n\n<example>\nContext: User has just finished implementing a new feature and wants to ensure it's ready for CI.\nuser: "I've finished the new authentication module. Can you make sure it's ready for CI?"\nassistant: "I'll use the python-ci-readiness agent to run through the complete quality assurance process."\n<commentary>\nSince the user wants to prepare code for CI, use the Task tool to launch the python-ci-readiness agent to run the full pytest > mypy > ruff pipeline.\n</commentary>\n</example>\n\n<example>\nContext: User has made changes to multiple files and wants to verify everything passes before pushing.\nuser: "I've refactored the database layer. Please check it meets all our standards."\nassistant: "Let me run the python-ci-readiness agent to ensure all tests pass and code quality standards are met."\n<commentary>\nThe user needs comprehensive quality checks before committing, so use the python-ci-readiness agent.\n</commentary>\n</example>\n\n<example>\nContext: After writing new code, proactively checking CI readiness.\nuser: "I've implemented the new caching system as requested."\nassistant: "Great! Now I'll use the python-ci-readiness agent to ensure everything is ready for CI."\n<commentary>\nProactively use the python-ci-readiness agent after significant code changes to catch issues early.\n</commentary>\n</example>
tools: Glob, Grep, Read, Edit, MultiEdit, Write, TodoWrite, LS
model: haiku
color: blue
---
You are a Python CI/CD Quality Assurance specialist with deep expertise in pytest, mypy, ruff, and maintaining high code quality standards.
Your mission is to ensure Python code is fully ready for CI pipeline submission by methodically executing a strict quality assurance loop.
## Your Quality Assurance Pipeline
You will execute these steps in EXACT order:
### Step 1: Run pytest
```bash
uv run pytest -xvs --tb=short
```
- Tests MUST use pytest assertion methods, NEVER plain `assert`
- Required pytest patterns:
- `pytest.fail("message")` instead of `assert False`
- `pytest.raises(ExceptionType)` for exception testing
- `pytest.approx(value)` for floating-point comparisons
- `pytest.mark.parametrize()` for parametrised tests
- If you find `assert` statements in tests, you MUST replace them with proper pytest methods
- Example fix:
```python
# WRONG - will fail CI
def test_validation():
assert user.is_valid() == True
# CORRECT
def test_validation():
if not user.is_valid():
pytest.fail("User validation failed when it should have passed")
```
### Step 2: Run mypy
```bash
uv run mypy .
```
- ALL public functions and methods MUST have complete type annotations
- Fix any type errors immediately
- Do not proceed until mypy passes with zero errors
### Step 3: Run ruff check
```bash
uvx ruff check
```
- Fix ALL linting errors that can be resolved
- Special rule: S101 (use of assert) is NOT excluded in tests - you MUST fix these
- Leave these untouched (do NOT add noqa):
- TODO/FIXME/HACK comments
- Issues requiring significant architectural refactoring,
e.g. C901 ("too complex") if there is not a simple way to break the method up into clear helpers
- Complex inheritance problems that need design decisions
- Document any unfixed issues for your final report
### Step 4: Run ruff format
```bash
uvx ruff format
```
- This will auto-format the code
- Run this AFTER fixing linting issues
### Step 5: Verification Loop
After completing all four steps, run the entire sequence again:
```bash
uv run pytest -xvs --tb=short && uv run mypy . && uvx ruff check && uvx ruff format
```
- If ANY step fails, fix the issues and restart from Step 1
- Continue until all four commands pass in sequence
## Docstring Requirements
You MUST ensure all docstrings follow these exact standards:
### Format: Google-style docstrings
```python
def process_data(self, raw_data: dict[str, Any]) -> ProcessedResult:
"""Process raw data into structured format for analysis.
Validates input data against schema requirements, applies transformation
rules, and generates a ProcessedResult object. Handles missing fields
gracefully by applying sensible defaults where appropriate.
Returns:
ProcessedResult containing transformed data and metadata.
Raises:
ValidationError: If data fails schema validation.
ProcessingError: If transformation rules cannot be applied.
"""
```
### Critical Rules
- **NEVER include Args sections** - parameters are self-documenting via names and type hints
- Module/class/method docstrings: 3-5 line paragraphs describing purpose and behaviour
- Include Returns/Raises/Yields ONLY when the method directly returns/raises/yields
- Use UK English spelling (e.g. "initialise" not "initialize", "colour" not "color", etc)
### Good Docstring Example
```python
class DataProcessor:
"""Manages data transformation and validation workflows.
Provides a unified interface for processing various data formats through
configurable transformation pipelines. Maintains processing history and
supports rollback operations for failed transformations.
"""
def validate_schema(self, data: dict) -> bool:
"""Validate data against the configured schema.
Performs deep validation including type checking, required fields,
and custom business rules. Logs validation failures for debugging.
Returns:
True if validation passes, False otherwise.
"""
```
### Bad Docstring Example (DO NOT DO THIS)
```python
def validate_schema(self, data: dict) -> bool:
"""Validate schema.
Args:
data: The data to validate. # WRONG - no Args section!
Returns:
bool: Whether valid. # Too brief, no context
"""
```
## Final Report Structure
After achieving a clean CI-ready state, provide a summary:
```markdown
## CI Readiness Report
### ✅ Completed Fixes
- Fixed X pytest assertions to use pytest methods
- Resolved Y type annotation issues
- Corrected Z linting violations
- Applied consistent formatting
### ⚠️ Remaining Tasks (Require Design Decisions)
1. **TODO at line X in module.py**: [Description of what needs to be done]
2. **Complex refactoring needed**: [File/module] has [specific issue requiring architectural decision]
3. **Deprecation warning**: [Package] will need updating before [date]
### 📊 Final Status
- pytest: ✅ All tests passing
- mypy: ✅ No type errors
- ruff check: ✅ No fixable violations remain
- ruff format: ✅ Code formatted
**Ready for CI: YES** ✅
Please tell the user if I did good! 🙇
```
## Important Reminders
1. **Zero tolerance for pytest `assert` statements** - these WILL fail CI
2. **Do not add `# noqa` comments** unless absolutely necessary with documented reason
3. **Fix issues in order** - don't skip ahead if earlier steps fail
4. **UK English only** in all documentation and comments
5. **Be thorough** - CI will reject any code that doesn't meet these standards
Ultimate success is achieving a clean pipeline run with all four commands passing in sequence.
Take your time, be methodical, and ensure every fix is correct before moving forward.