injective-trading-chain-analysis
Skill6 starsChanged 4 months agoApache-2.0View on GitHub
Analyze Injective chain-level code and protocol specs. Read Go source from injective-core, explain exchange module features (position offsetting, liquidations, margin tiers, funding), and identify spec gaps. Use when discussing chain mechanics, reviewing Injective Go code, or explaining protocol behavior.
In this repository20 other files it gives its agents.
- injective-ai-cost-optimizationSkill
- injective-cliSkill
- injective-core-detect-changesSkill
- injective-docs-styleSkill
- injective-evm-developerSkill
- injective-faucetSkill
- injective-frontend-walletSkill
- injective-fundingSkill
- injective-mcp-serversSkill
- injective-rfq-integrationsSkill
- injective-trading-accountSkill
- injective-trading-autosignSkill
- injective-trading-bridgeSkill
- injective-trading-frontend-uxSkill
- injective-trading-market-dataSkill
- injective-trading-stakingSkill
- injective-trading-tokensSkill
- injective-usdc-integrationSkill
- injective-wallet-opsSkill
- linear-cliSkill
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 2 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 76
Compare to docs: - check if behavior matches published documentation
- Distinctive: line 82
If these skills are not available, selectively run the following commands to install them:
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Injective Trading Chain Analysis, Skill Guide
Analyze Injective chain-level protocol code (Go/Cosmos SDK). Explain exchange module mechanics, review spec completeness, and trace execution paths for derivatives trading features.
When to apply
- Understand how Injective's exchange module works under the hood
Sample prompts: ./references/sample-prompts.md
Important
Exchange module
Key files for the source code of the Injective exchange module may be found in: ./references/injective-core-key-files.md
Cosmos SDK Context
- Injective is built on Cosmos SDK (currently v0.47.x)
- Uses Tendermint BFT consensus
- Exchange module is a custom Cosmos SDK module
- State stored in IAVL tree via keeper pattern
- Messages processed in
DeliverTxphase of ABCI
Activities
Explain Injective's exchange module
The exchange module (x/exchange) handles all trading on Injective.
Key areas:
- Derivative Markets
MsgCreateDerivativeMarketOrder/MsgCreateDerivativeLimitOrder- Position management: open, close, reduce, increase
- Margin: initial margin, maintenance margin, margin ratio checks
- Liquidation: forced closure when margin ratio < maintenance margin
- Position Offsetting (
MsgOffsetPosition)- Allows netting opposing positions between subaccounts
- Reduces total margin requirements
- Chain-level implementation in
derivative_liquidations.go
- Liquidation Engine
- Triggered when position margin < maintenance margin requirement
- Liquidator receives a portion of remaining margin as reward
- Insurance fund covers negative PnL if position is underwater
- Code path:
derivative_liquidations.go→ExecuteLiquidation()
- Funding Rates
- Calculated every hour for perpetual markets
- Formula:
FundingRate = (TWAP_perp - TWAP_oracle) / TWAP_oracle - Capped by
MaxFundingRateparameter per market - Applied to all open positions proportional to quantity
- Market Parameters
InitialMarginRatio,MaintenanceMarginRatioMakerFeeRate,TakerFeeRate(can be negative for rebates)MinPriceTickSize,MinQuantityTickSizeOracleType,OracleScaleFactor
Analyze chain code
- Read the Go source from the user's local clone or fetch from GitHub (
InjectiveLabs/injective-core) - Trace the execution path from message handler → keeper → state changes
- Explain in plain English what the code does, step by step
- Identify spec gaps - what's missing, ambiguous, or could break
- Compare to docs - check if behavior matches published documentation
Related skills
injective-mcp-servers
If these skills are not available, selectively run the following commands to install them:
npx skills add InjectiveLabs/agent-skills --skill injective-mcp-serversPrerequisites
- Injective MCP server must be running
- User prompts should be issued from an AI tool that is configured to talk to the Injective MCP server
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

