Skip to content
Back to skills

Portfolio

ASecurity

Portfolio system knowledge base. Covers position queries, routing strategies, {PRIMARY_PROVIDER} integration, cache design.

  • 191 stars
  • 0 votes
  • 0 copies
  • 4 views
  • Added February 7, 2026
developmentbashapidocumentation

Works with

  • cli
  • api

Security analysis

A100/100

Pro scans all 3 files and shows the line behind each finding

Scanned February 12, 2026

npx -y skills add sd0xdev/sd0x-dev-flow --skill portfolio --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Portfolio?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Portfolio
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/sd0xdev-portfolio/badge)](https://www.skillsdirectory.com/skills/sd0xdev-portfolio)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: portfolio
description: Portfolio system knowledge base. Covers position queries, routing strategies, {PRIMARY_PROVIDER} integration, cache design.
allowed-tools: Read, Grep, Glob
context: fork
agent: Explore
---

# Portfolio Skill

## Trigger

- Keywords: Portfolio, portfolio, position, {PRIMARY_PROVIDER}, protocol, lending, staking, liquidity

## When NOT to Use

- General token queries (not Portfolio positions)
- Transaction building (use corresponding provider)
- Non-portfolio related API issues

## Core Files

| Type       | File                                               | Purpose                 |
| ---------- | -------------------------------------------------- | ----------------------- |
| Controller | `src/entity/portfolio/portfolio.controller.ts`     | REST API                |
| Router     | `src/service/portfolio/source-router/*.service.ts` | Routing orchestration   |
| Client     | `src/service/portfolio/providers/{provider}/*.ts`  | {PRIMARY_PROVIDER} integration |
| Aggregator | `src/service/portfolio/aggregation/*.service.ts`   | Aggregation computation |
| DTO        | `src/dto/portfolio/position.types.ts`              | Position model          |

## API Overview

**Base**: `/onchain/v1/portfolio`

| Endpoint     | Method | Purpose               |
| ------------ | ------ | --------------------- |
| `/positions` | POST   | Get portfolio positions |
| `/chains`    | GET    | Supported chains list |
| `/protocols` | GET    | Supported protocols list |

## Verification

- Position data correctly normalized
- Cache hit/miss working properly
- Aggregation calculations accurate

## Development Guide

### Add Protocol Support

1. Check if {PRIMARY_PROVIDER} supports it
2. If custom build needed: implement `PortfolioPositionExtractor` + register + configure routing

### Add Data Source

1. Implement `ProviderClient` + `Adapter`
2. Register with `SourceRouter`
3. Configure routing strategy

### Debug

```bash
redis-cli keys "portfolio:{provider}:*"
redis-cli get "portfolio:{provider}:positions:0x...:v2:..."
curl -X POST /positions -d '{"isForceRefresh": true, ...}'
```

## References

- `references/architecture.md` - System architecture + cache strategy
- `references/api.md` - API reference + data models
- @docs/features/portfolio/ - Detailed documentation

## Tests

| Type        | Location                       |
| ----------- | ------------------------------ |
| Unit        | `test/unit/service/portfolio/` |
| Integration | `test/integration/portfolio/`  |

## Examples

```
Input: How to query portfolio positions?
Action: Explain POST /positions API + routing strategy
```

```
Input: How does {PRIMARY_PROVIDER} integration work?
Action: Explain {PRIMARY_PROVIDER}Client + {PRIMARY_PROVIDER}Adapter flow
```

Files in this skill

  • SKILL.md2.7 KB
  • references/api.md2.8 KB
  • references/architecture.md4.7 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.