# Add Core Functions to Catalyst-Relay

Core changes need consistent files, imports, returns, and exports. This skill guides Catalyst-Relay business logic additions with typed patterns and checklists.

## Install

```bash
npx skillstore add artisan-edge/add-core-function
```

## Metadata

- - Slug: artisan-edge-add-core-function
- - Version: 1.0.0
- - Author: Artisan-Edge
- - GitHub username: Artisan-Edge
- - License: MIT
- - Repository: https://github.com/Artisan-Edge/Catalyst-Relay/tree/main/.claude/skills/add-core-function
- - Ref: main
- - Supported tools: Claude, Codex, Claude Code
- - Risk level: safe
- - Quality score: 80
- - Quality tier: silver
- - Public page: https://skillstore.pages.dev/skills/artisan-edge-add-core-function
- - Manifest: https://skillstore.pages.dev/api/skills/artisan-edge-add-core-function/manifest

## Capabilities

- Defines the one-function-per-file structure under src/core/\{domain\}/\{function\}.ts.
- Shows the required import hierarchy for types, helpers, subfolders, and barrel exports.
- Provides a TypeScript async function pattern using AsyncResult tuples.
- Explains when public core functions should be exported from index.ts.
- Gives a checklist for helper placement, circular dependency avoidance, and type checking.

## Use Cases

- Add an ADT Operation: Create a new discovery, preview, read, or create function that follows Catalyst-Relay core conventions.
- Standardize Public Exports: Place a new core function in the right folder and expose it through the correct barrel export.
- Onboard a Contributor: Teach a contributor how core files, helpers, return types, and import paths should be organized.

## Prompt Templates

### Create a Core Function

```
Use add-core-function to add a pure core function for [domain]. Name it [function] and explain each file change.
```

### Add an ADT Discovery Operation

```
Use add-core-function to design a new ADT discovery operation named [operation]. Include file placement, return type, helper usage, and export guidance.
```

### Review a Core Function Plan

```
Use add-core-function to review this implementation plan: [plan]. Check file location, imports, AsyncResult use, helper placement, and barrel exports.
```

### Refactor Core API Structure

```
Use add-core-function to refactor these proposed core API changes: [changes]. Identify circular dependency risks, public API boundaries, and missing typecheck steps.
```

## Limitations

- It is specific to Catalyst-Relay core layout and naming conventions.
- It does not provide complete business implementations for every function.
- It does not replace tests, project review, or type checking.
- It assumes TypeScript and existing Catalyst-Relay utility patterns.

## Best Practices

- Keep one public core function per file unless the project pattern already differs.
- Use AsyncResult tuples for async functions that can fail.
- Export only public API functions from index.ts and keep internal helpers local.

## Anti Patterns

- Do not place multiple unrelated core functions in one file.
- Do not create circular imports between types, helpers, subfolders, and index files.
- Do not export internal helper functions through the public barrel file.

## Security Audit

- - Safe to publish: true
- - Audited at: 2026-06-28T10:25:56.289\+00:00
- - Summary: The static analyzer flagged Markdown backticks, relative TypeScript import examples, and the word description as security patterns. Manual review found no executable shell commands, no path traversal behavior, no weak cryptography, no network exfiltration, and no prompt injection attempts.

## Stats

- - Views: 245
- - Downloads: 6
- - Favorites: 0
- - Popularity score: 0
