When should I use shared and cl_init?

Hello. I’m currently making a gamemode.

As for previous experience, I’d like to keep scripts and it’s libraries in order, so I divide functions, managers and core scripts.
But I can’t get it: when should I use shared.lua? Z.B.: setting the player class is shared function, should the manager-script containing it be added to shared.lua? And what about it’s include files?
That’s how it works right now:

init.lua


--AddCSLuaFile("shared.lua") --required if using
AddCSLuaFile("cl_init.lua")

--include("shared.lua") --required if using
include("libraries/core/core.lua")

Core:Init()

cl_init.lua


include("shared.lua")

libraries/core/core.lua:


Core = {}

include("../managers/classmanager.lua")

function Core:Init()
	ClassManager:Init()
end
--not done yet

managers/classmanager.lua


include("../../player/class/exoskeleton.lua")

ClassManager = {}

function PlayersManager:Init()
	print("Module loading: ClassManager")
	concommand.Add("makeexo", PlayersManager.MakeExo)
	print("Module loaded: ClassManager")
end

function PlayersManager:MakeExo(ply)
	player_manager.SetPlayerClass( ply, "player_exoskeleton" )
end

player/class/exoskeleton.lua:


AddCSLuaFile()
DEFINE_BASECLASS( "player_default" )

if ( CLIENT ) then

	--CreateConVar( "cl_playercolor", "0.24 0.34 0.41", { FCVAR_ARCHIVE, FCVAR_USERINFO, FCVAR_DONTRECORD }, "The value is a Vector - so between 0-1 - not between 0-255" )
	--CreateConVar( "cl_weaponcolor", "0.30 1.80 2.10", { FCVAR_ARCHIVE, FCVAR_USERINFO, FCVAR_DONTRECORD }, "The value is a Vector - so between 0-1 - not between 0-255" )
	--CreateConVar( "cl_playerskin", "0", { FCVAR_ARCHIVE, FCVAR_USERINFO, FCVAR_DONTRECORD }, "The skin to use, if the model has any" )
	--CreateConVar( "cl_playerbodygroups", "0", { FCVAR_ARCHIVE, FCVAR_USERINFO, FCVAR_DONTRECORD }, "The bodygroups to use, if the model has any" )

end

local PLAYER = {}


PLAYER.DuckSpeed			= 0.1		-- How fast to go from not ducking, to ducking
PLAYER.UnDuckSpeed			= 0.1		-- How fast to go from ducking, to not ducking

--
-- Creates a Taunt Camera
--
PLAYER.TauntCam = TauntCamera()

--
-- See gamemodes/base/player_class/player_default.lua for all overridable variables
--
PLAYER.WalkSpeed 			= 100
PLAYER.RunSpeed				= 200

--
-- Set up the network table accessors
--
function PLAYER:SetupDataTables()

	BaseClass.SetupDataTables( self )

end


function PLAYER:Loadout()

	self.Player:RemoveAllAmmo()
	
	self.Player:GiveAmmo( 256,	"Pistol", 		true )
		
	self.Player:Give( "weapon_crowbar" )
	self.Player:Give( "weapon_pistol" )

	self.Player:SwitchToDefaultWeapon()

end

function PLAYER:SetModel()

	BaseClass.SetModel( self )
	
	local skin = self.Player:GetInfoNum( "cl_playerskin", 0 )
	self.Player:SetSkin( skin )

	local groups = self.Player:GetInfo( "cl_playerbodygroups" )
	if ( groups == nil ) then groups = "" end
	local groups = string.Explode( " ", groups )
	for k = 0, self.Player:GetNumBodyGroups() - 1 do
		self.Player:SetBodygroup( k, tonumber( groups[ k + 1 ] ) or 0 )
	end

end

--
-- Called when the player spawns
--
function PLAYER:Spawn()

	BaseClass.Spawn( self )

	--local col = self.Player:GetInfo( "cl_playercolor" )
	--self.Player:SetPlayerColor( Vector( col ) )

	--local col = self.Player:GetInfo( "cl_weaponcolor" )
	--self.Player:SetWeaponColor( Vector( col ) )

end

--
-- Return true to draw local (thirdperson) camera - false to prevent - nothing to use default behaviour
--
function PLAYER:ShouldDrawLocal() 

	if ( self.TauntCam:ShouldDrawLocalPlayer( self.Player, self.Player:IsPlayingTaunt() ) ) then return true end

end

--
-- Allow player class to create move
--
function PLAYER:CreateMove( cmd )

	if ( self.TauntCam:CreateMove( cmd, self.Player, self.Player:IsPlayingTaunt() ) ) then return true end

end

--
-- Allow changing the player's view
--
function PLAYER:CalcView( view )

	if ( self.TauntCam:CalcView( view, self.Player, self.Player:IsPlayingTaunt() ) ) then return true end

	-- Your stuff here

end

function PLAYER:GetHandsModel()

	-- return { model = "models/weapons/c_arms_cstrike.mdl", skin = 1, body = "0100000" }

	local cl_playermodel = self.Player:GetInfo( "cl_playermodel" )
	return player_manager.TranslatePlayerHands( cl_playermodel )

end

--
-- Reproduces the jump boost from HL2 singleplayer
--
local JUMPING

function PLAYER:StartMove( move )
	
	-- Only apply the jump boost in FinishMove if the player has jumped during this frame
	-- Using a global variable is safe here because nothing else happens between SetupMove and FinishMove
	if bit.band( move:GetButtons(), IN_JUMP ) ~= 0 and bit.band( move:GetOldButtons(), IN_JUMP ) == 0 and self.Player:OnGround() then
		JUMPING = true
	end
	
end

function PLAYER:FinishMove( move )
	
	-- If the player has jumped this frame
	if JUMPING then
		-- Get their orientation
		local forward = self.Player:EyeAngles()
		forward.p = 0
		forward = forward:Forward()
		
		-- Compute the speed boost
		
		-- HL2 normally provides a much weaker jump boost when sprinting
		-- For some reason this never applied to GMod, so we won't perform
		-- this check here to preserve the "authentic" feeling
		local speedBoostPerc = ( ( not self.Player:Crouching() ) and 0.5 ) or 0.1
		
		local speedAddition = math.abs( move:GetForwardSpeed() * speedBoostPerc )
		local maxSpeed = move:GetMaxSpeed() * ( 1 + speedBoostPerc )
		local newSpeed = speedAddition + move:GetVelocity():Length2D()
		
		-- Clamp it to make sure they can't bunnyhop to ludicrous speed
		if newSpeed > maxSpeed then
			speedAddition = speedAddition - (newSpeed - maxSpeed)
		end
		
		-- Reverse it if the player is running backwards
		if move:GetForwardSpeed() < 0 then
			speedAddition = -speedAddition
		end
		
		-- Apply the speed boost
		move:SetVelocity(forward * speedAddition + move:GetVelocity())
	end
	
	JUMPING = nil
	
end

player_manager.RegisterClass( "player_exoskeleton", PLAYER, "player_default" )

--gamemodes/sandbox's player_sandbox

So, whenever I call command, I get these errors:


[ERROR] lua/includes/modules/player_manager.lua:337: attempt to index local 'ply' (a nil value)
  1. SetPlayerClass - lua/includes/modules/player_manager.lua:337
   2. MakeExo - gamemodes/test/gamemode/libraries/core/../managers/classmanager.lua:12
    3. unknown - gamemodes/test/gamemode/libraries/core/../managers/classmanager.lua:8
     4. unknown - lua/includes/modules/concommand.lua:69


[ERROR] lua/includes/modules/player_manager.lua:337: attempt to index local 'ply' (a nil value)
  1. SetPlayerClass - lua/includes/modules/player_manager.lua:337
   2. MakeExo - gamemodes/test/gamemode/libraries/core/../managers/classmanager.lua:12
    3. unknown - gamemodes/test/gamemode/libraries/core/../managersclassmanager.lua:8
     4. unknown - lua/includes/modules/concommand.lua:69

Why does it get nil value? Should I be including shared function managers files to shared.lua?
Or I missed something? How are shared functions used then?

Thanks.