/fortigate-toolkit:fortigate-developmentfrom fortigate-toolkit
TDD workflow for FortiGate toolkit - guides test-first development with proper API mocking patterns
Ships in fortigate-toolkit. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Use this skill when adding features or fixing bugs in the FortiGate toolkit.
FortiGate API returns interfaces as lists of dicts, not strings:
# CORRECT - what FortiGate actually returns
{"srcintf": [{"name": "port1"}], "dstintf": [{"name": "vlan100"}]}
# WRONG - common assumption
{"srcintf": ["port1"], "dstintf": ["vlan100"]}
Before implementing, create a test in tests/test_fortigate_client.py:
def test_your_new_feature(self, mock_client):
"""Describe what this tests."""
# Arrange - mock the API response with CORRECT structure
mock_client._session.request.return_value = Mock(
status_code=200,
ok=True,
text='{}',
json=lambda: {"results": [{"name": "test", "type": "vlan"}]},
)
# Act
result = mock_client.your_new_method()
# Assert
assert result == expected_value
pytest tests/test_fortigate_client.py::TestYourClass::test_your_new_feature -v
The test MUST fail before implementation.
Add only enough code to make the test pass. No extras.
pytest -v
All tests must pass, including existing ones.
Clean up while keeping tests green.
mock_client._session.request.return_value = Mock(
status_code=200,
ok=True,
text='{"results": []}',
json=lambda: {"results": []},
)
mock_client._session.request.return_value = Mock(
status_code=404,
ok=False,
text='{"error": "not found"}',
json=lambda: {"error": "not found"},
url="https://test.local/api/v2/test",
)
mock_client._session.request.side_effect = [
requests.ConnectionError("fail"), # First attempt
requests.ConnectionError("fail"), # Second attempt
Mock(status_code=200, ...), # Third succeeds
]
| Exception | HTTP Code | Retried? |
|---|---|---|
FortiGateAuthError | 401, 403 | No |
FortiGateNotFoundError | 404 | No |
FortiGateRateLimitError | 429 | Yes (3x) |
FortiGateConnectionError | N/A | Yes (3x) |
FortiGateError | 500+ | No |
Before claiming done:
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
Claude Code refuses to install this plugin
.claude-plugin/plugin.json: skills: Invalid input
Checked against Claude Code 2.1.332's install rules. The listing below is what the repository ships; Claude Code cannot install it as published.