home / skills / 89jobrien / steve / nathan-standards

nathan-standards skill

/steve/skills/nathan-standards

This skill enforces Nathan development standards across n8n workflows, Python patterns, and project conventions to improve consistency and quality.

npx playbooks add skill 89jobrien/steve --skill nathan-standards

Review the files below or copy the command above to add this skill to your agents.

Files (3)
SKILL.md
4.8 KB
---
name: nathan-standards
description: Development standards for the Nathan n8n-Jira agent automation system.
  Covers n8n workflows, Python patterns, and project conventions.
author: Joseph OBrien
status: unpublished
updated: '2025-12-23'
version: 1.0.1
tag: skill
type: skill
---

# Nathan Development Standards

Standards and patterns for developing within the Nathan project - an n8n-Jira agent automation system.

## When to Use

Invoke this skill when:

- Creating or modifying n8n workflow JSON files
- Writing Python code for the Nathan helpers or templating modules
- Designing webhook command contracts
- Building workflow registry configurations
- Implementing spec-driven features via agent-os

## Project Architecture

Nathan follows a layered architecture:

```text
External Service (Jira) <-- n8n Workflows <-- Python Agent Service
                             (credentials)      (webhook calls)
```

**Core Principle**: n8n owns all external credentials. Python services call n8n webhooks with shared secret authentication.

## n8n Workflow Standards

For detailed workflow patterns, load `references/n8n-workflow-patterns.md`.

### Standard Workflow Structure

Every webhook workflow must follow this pattern:

```text
Webhook --> Validate Secret --> Operation --> Respond to Webhook
               |                   |              |
               v                   v              v
           Unauthorized       Error Response   Success Response
           Response (401)     (500)            (200)
```

### Required Node Pattern

```json
{
  "id": "validate-secret",
  "name": "Validate Secret",
  "type": "n8n-nodes-base.if",
  "typeVersion": 2,
  "parameters": {
    "conditions": {
      "conditions": [{
        "leftValue": "={{ $json.headers['x-n8n-secret'] }}",
        "rightValue": "={{ $env.N8N_WEBHOOK_SECRET }}",
        "operator": { "type": "string", "operation": "equals" }
      }]
    }
  }
}
```

### Response Format

All responses must follow this shape:

```json
{ "success": true, "data": {...}, "status_code": 200, "error": null }
{ "success": false, "data": {}, "status_code": 500, "error": "message" }
```

### JQL Expression Escaping

In n8n expressions within JSON, escape properly:

| Wrong | Correct |
|-------|---------|
| `.map(x => "${x}")` | `.map(x => '"' + x + '"')` |
| `.join('\n')` | `.join('\\n')` |
| `.replaceAll('\n', ' ')` | `.replaceAll('\\n', ' ')` |

## Python Standards

For detailed patterns, load `references/python-patterns.md`.

### Module Structure

```text
nathan/
  helpers/           # Shared utilities (workflow registry, etc.)
  workflows/         # n8n workflow JSON + registry.yaml per category
  templating/        # YAML-to-JSON template engine
  scripts/           # Standalone runnable scripts
```

### Code Style

```python
# Required imports pattern
from __future__ import annotations
from typing import Any
from pathlib import Path
import logging

logger = logging.getLogger(__name__)

# Type hints required, use T | None not Optional[T]
async def trigger_workflow(url: str, params: dict[str, Any]) -> dict[str, Any]:
    ...
```

### Registry Pattern

```yaml
# registry.yaml
version: "1.0.0"
description: "Registry description"

commands:
  command_name:
    endpoint: /webhook/endpoint-path
    method: POST
    required_params:
      - param1
    optional_params:
      - param2
    description: What this command does
    example:
      param1: "value"
```

## Spec-Driven Development

Use agent-os commands for feature development:

1. `/shape-spec` - Initialize and shape specification
2. `/write-spec` - Write detailed spec document
3. `/create-tasks` - Generate task list from spec
4. `/orchestrate-tasks` - Delegate to subagents

Specs live in `agent-os/specs/[spec-name]/` with:

- `spec.md` - Feature specification
- `tasks.md` - Implementation tasks with checkboxes
- `orchestration.yml` - Subagent delegation config

## Quick Reference

### Common Commands

```bash
uv sync                              # Install dependencies
uv run pytest                        # Run tests
uv run pytest path/to/test.py -v     # Single test file
uvx ruff check .                     # Lint
uvx ruff format .                    # Format
docker compose -f docker-compose.n8n.yml up -d  # Start n8n
```

### Environment Variables

| Variable | Purpose |
|----------|---------|
| `N8N_WEBHOOK_SECRET` | Shared secret for webhook auth |
| `N8N_API_KEY` | n8n Public API key |
| `JIRA_DOMAIN` | Jira Cloud domain |
| `JIRA_EMAIL` | Jira account email |
| `JIRA_API_TOKEN` | Jira API token |

### File Naming Conventions

| Type | Convention | Example |
|------|------------|---------|
| Workflow JSON | `kebab-case.json` | `jira-get-ticket.json` |
| Python modules | `snake_case.py` | `n8n_workflow_registry.py` |
| Test files | `test_*.py` | `test_parser.py` |
| Registry | `registry.yaml` | per workflow category |

Overview

This skill documents development standards for the Nathan n8n-Jira agent automation system. It consolidates rules for n8n workflow structure, Python module patterns, registry format, and spec-driven feature development. Use it as the canonical reference when authoring workflows, helper code, or webhook contracts.

How this skill works

The standards describe a layered architecture where n8n workflows hold external credentials and Python services call n8n webhooks using a shared secret. It enforces a single webhook pattern (validate secret → operation → standardized response) and prescribes JSON/YAML registry formats and Python coding conventions. The documentation also defines a spec-driven process (agent-os) for shaping, writing, and implementing features.

When to use it

  • Creating or modifying n8n workflow JSON files and webhook endpoints
  • Writing Python helpers, templating modules, or workflow registry code
  • Designing webhook command contracts and authentication flow
  • Authoring registry.yaml entries that describe endpoints and params
  • Implementing features using the agent-os spec-driven workflow

Best practices

  • Keep n8n responsible for external credentials; Python services must call n8n webhooks with N8N_WEBHOOK_SECRET
  • Follow the required webhook node pattern: Validate Secret → Operation → Respond (401/500/200)
  • Return responses in the standardized shape: {success, data, status_code, error}
  • Use explicit type hints and modern import patterns in Python (from __future__ import annotations)
  • Store workflow JSON in kebab-case and Python modules in snake_case; include registry.yaml per category
  • Use agent-os commands to iterate specs: /shape-spec, /write-spec, /create-tasks, /orchestrate-tasks

Example use cases

  • Add a new Jira command: create workflow JSON, register it in registry.yaml, and implement a minimal Python caller
  • Refactor a webhook to centralize secret validation and standardize error/success responses
  • Write a templating module in nathan/templating to convert YAML registry entries to n8n JSON
  • Build a spec in agent-os, generate tasks, and delegate execution via orchestration.yml
  • Start local n8n for development using the provided docker-compose.n8n.yml and test workflows

FAQ

Where should credentials live?

All external credentials must be managed by n8n. Python services must never store external service credentials and must authenticate to n8n webhooks using N8N_WEBHOOK_SECRET.

What response format should workflows return?

Every webhook response must follow the standardized JSON shape: { "success": bool, "data": {...} or {}, "status_code": number, "error": null or "message" }.